47 , fpChemistryInfo(pChemistryInfo)
48 , fIsInitialized(false)
49 , fCounterAgainstTime(false)
66 G4cout <<
"G4DNAScavengerMaterial existed but empty" <<
G4endl;
79 exceptionDescription <<
"matConf : "<<matConf->
GetName();
80 G4Exception(
"G4DNAScavengerMaterial::GetNumberMoleculePerVolumeUnitForMaterialConf",
"G4DNAScavengerMaterial001",
95 return (floor)(iter->second);
165 G4cout <<
"**************************************************************"
169 auto containedConf = iter->first;
173 G4cout <<
"Scavenger:" << containedConf->GetName() <<
" : "
174 << concentration / 1.0e-6 <<
" (M) with : "
176 <<
"in: " << pConfinedBox->Volume() / (
um *
um *
um) <<
" (um3)"
180 G4cout <<
"!!!!!!!!!!!!! this molecule has less one molecule for "
190 G4cout <<
"**************************************************************"
214 auto containedConf = iter->first;
215 auto concentration = iter->second;
217 floor(
Avogadro * concentration * pConfinedBox->Volume());
219 floor(
Avogadro * concentration * pConfinedBox->Volume());
232 G4cout <<
"G4DNAScavengerMaterial::AddAMoleculeAtTime : "
243 else if(counterMap_i->second.empty())
245 counterMap_i->second[time] = number;
249 auto end = counterMap_i->second.rbegin();
251 if(
end->first <= time || fabs(
end->first - time) <=
255 counterMap_i->second[time] = newValue;
293 auto it_ = nbMolPerTime.rbegin();
294 G4cout <<
"G4DNAScavengerMaterial::RemoveAMoleculeAtTime : "
297 <<
" form : " << it_->second <<
G4endl;
300 if(nbMolPerTime.empty())
303 G4String errMsg =
"You are trying to remove molecule " +
305 " from the counter while this kind of molecules has not "
306 "been registered yet";
307 G4Exception(
"G4DNAScavengerMaterial::RemoveAMoleculeAtTime",
"",
314 auto it = nbMolPerTime.rbegin();
316 if(it == nbMolPerTime.rend())
321 " recorded at the time or even before the time asked";
322 G4Exception(
"G4DNAScavengerMaterial::RemoveAMoleculeAtTime",
"",
326 G4double finalN = it->second - number;
331 G4cout <<
"fScavengerTable : " << pMolecule->
GetName() <<
" : "
335 errMsg <<
"After removal of " << number <<
" species of "
336 <<
" " << it->second <<
" " << pMolecule->
GetName()
337 <<
" the final number at time " <<
G4BestUnit(time,
"Time")
338 <<
" is less than zero and so not valid." <<
G4endl;
339 G4cout <<
" Global time is "
341 <<
". Previous selected time is " <<
G4BestUnit(it->first,
"Time")
343 G4Exception(
"G4DNAScavengerMaterial::RemoveAMoleculeAtTime",
"N_INF_0",
346 nbMolPerTime[time] = finalN;
358 auto V = pConfinedBox->
Volume();
361 auto pReactant = it.first;
363 G4cout <<
" --- > For " << pReactant->GetName() <<
G4endl;
365 for(
auto it2 : it.second)
420 G4bool sameTypeOfMolecule)
434 if(sameTypeOfMolecule)
444 if(upperToLast == timeMap.end())
449 if(upperToLast->first > time)
457 auto up_time_it = timeMap.upper_bound(time);
459 if(up_time_it == timeMap.end())
461 auto last_time = timeMap.rbegin();
462 return last_time->second;
464 if(up_time_it == timeMap.begin())
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::map< G4double, G4int, G4::MoleculeCounter::TimePrecision > NbMoleculeAgainstTime
static constexpr double picosecond
static constexpr double um
G4GLOB_DLL std::ostream G4cout
G4double GetNumberMoleculePerVolumeUnitForMaterialConf(MolType) const
MaterialMap::iterator end()
G4int SearchUpperBoundTime(G4double time, G4bool sameTypeOfMolecule)
G4bool fCounterAgainstTime
void ReduceNumberMoleculePerVolumeUnitForMaterialConf(MolType, G4double)
void AddAMoleculeAtTime(MolType, G4double time, const G4ThreeVector *position=nullptr, G4int number=1)
std::map< MolType, G4double > fScavengerTable
G4bool find(MolType type)
void AddNumberMoleculePerVolumeUnitForMaterialConf(MolType, G4double)
G4DNAScavengerMaterial()=default
CounterMapType fCounterMap
G4bool SearchTimeMap(MolType molecule)
G4VChemistryWorld * fpChemistryInfo
std::unique_ptr< Search > fpLastSearch
G4int GetNMoleculesAtTime(MolType molecule, G4double time)
void RemoveAMoleculeAtTime(MolType, G4double time, const G4ThreeVector *position=nullptr, G4int number=1)
const G4String & GetName() const
static G4MoleculeTable * Instance()
static G4Scheduler * Instance()
std::map< MolType, double >::iterator begin()
G4DNABoundingBox * GetChemistryBoundary() const
std::map< MolType, double >::iterator end()
static G4ThreadLocal double fPrecision