71   if(fpInstance) fpInstance->Initialize();
 
   78   while ((mol_iterator)())
 
   82     fCounterMap[*(mol_iterator.
value())]; 
 
   93   if (fpLastSearch.get() == 0)
 
   95     fpLastSearch.reset(
new Search());
 
   99     if (fpLastSearch->fLowerBoundSet && fpLastSearch->fLastMoleculeSearched
 
  101                                         == molecule) 
return true;
 
  104   CounterMapType::iterator mol_it = fCounterMap.find(molecule);
 
  105   fpLastSearch->fLastMoleculeSearched = mol_it;
 
  107   if (mol_it != fCounterMap.end()) 
 
  109     fpLastSearch->fLowerBoundTime = fpLastSearch->fLastMoleculeSearched->second
 
  111     fpLastSearch->fLowerBoundSet = 
true;
 
  115     fpLastSearch->fLowerBoundSet = 
false;
 
  122                                             bool sameTypeOfMolecule)
 
  124   CounterMapType::iterator mol_it = fpLastSearch->fLastMoleculeSearched;
 
  125   if (mol_it == fCounterMap.end()) 
return 0; 
 
  128   if (timeMap.empty()) 
return 0;
 
  130   NbMoleculeAgainstTime::iterator end_time = timeMap.end();
 
  132   if (sameTypeOfMolecule == 
true)
 
  135     if (fpLastSearch->fLowerBoundSet && fpLastSearch->fLowerBoundTime
 
  140       if (fpLastSearch->fLowerBoundTime->first < time)
 
  142         NbMoleculeAgainstTime::iterator upperToLast = fpLastSearch
 
  146         if (upperToLast == end_time)
 
  148           return fpLastSearch->fLowerBoundTime->second;
 
  151         if (upperToLast->first > time)
 
  153           return fpLastSearch->fLowerBoundTime->second;
 
  168   NbMoleculeAgainstTime::iterator up_time_it = timeMap.upper_bound(time);
 
  170   if (up_time_it == end_time)
 
  172     NbMoleculeAgainstTime::reverse_iterator last_time = timeMap.rbegin();
 
  174     if (last_time->first <= time)
 
  177       return last_time->second;
 
  183   if (up_time_it == timeMap.begin())
 
  195   fpLastSearch->fLowerBoundTime = up_time_it;
 
  196   fpLastSearch->fLowerBoundSet = 
true;
 
  200   return fpLastSearch->fLowerBoundTime->second;
 
  206   G4bool sameTypeOfMolecule = SearchTimeMap(molecule);
 
  207   return SearchUpperBoundTime(time, sameTypeOfMolecule);
 
  218     G4cout << 
"G4MoleculeCounter::AddAMoleculeAtTime : " << molecule.
GetName()
 
  222   CounterMapType::iterator counterMap_i = fCounterMap.find(molecule);
 
  224   if (counterMap_i == fCounterMap.end())
 
  228     fCounterMap[molecule][time] = 1;
 
  230   else if (counterMap_i->second.empty())
 
  234     counterMap_i->second[time] = 1;
 
  238     NbMoleculeAgainstTime::iterator end = counterMap_i->second.end();
 
  245     if (end->first <= time)
 
  247       counterMap_i->second[time] = end->second + 1;
 
  251       NbMoleculeAgainstTime::iterator it = counterMap_i->second.lower_bound(
 
  254       while (it->first > time && it != counterMap_i->second.begin())
 
  262       if (it == counterMap_i->second.begin() && it->first > time)
 
  276       counterMap_i->second[time] = it->second + 1;
 
  292     G4cout << 
"G4MoleculeCounter::RemoveAMoleculeAtTime : " 
  299   if (nbMolPerTime.empty())
 
  303         "You are trying to remove molecule " + molecule.
GetName()
 
  304         + 
" from the counter while this kind of molecules has not been registered yet";
 
  305     G4Exception(
"G4MoleculeCounter::RemoveAMoleculeAtTime", 
"",
 
  312     NbMoleculeAgainstTime::iterator it;
 
  314     if (nbMolPerTime.size() == 1)
 
  316       it = nbMolPerTime.begin();
 
  323       it = nbMolPerTime.lower_bound(time);
 
  326     if (it == nbMolPerTime.end())
 
  333       if (time < it->first)
 
  336                           + 
" record at the time or even before the time asked";
 
  337         G4Exception(
"G4MoleculeCounter::RemoveAMoleculeAtTime", 
"",
 
  354     if (nbMolPerTime.value_comp()(*it, *nbMolPerTime.begin()))
 
  360       if (time < it->first)
 
  363                           + 
" record at the time or even before the time asked";
 
  364         G4Exception(
"G4MoleculeCounter::RemoveAMoleculeAtTime", 
"",
 
  370         && it != nbMolPerTime.begin())
 
  381     if (it == nbMolPerTime.begin() && it->first > time)
 
  395     nbMolPerTime[time] = it->second - 1;
 
  409     G4cout << 
"Entering in G4MoleculeCounter::RecordMolecules" << 
G4endl;
 
  412   CounterMapType::iterator it;
 
  415   for(it = fCounterMap.begin(); it != fCounterMap.end(); it++)
 
  417     output->push_back(it->first);
 
  428   CounterMapType::iterator it;
 
  429   CounterMapType::const_iterator ite;
 
  431   NbMoleculeAgainstTime::iterator it2;
 
  432   NbMoleculeAgainstTime::const_iterator ite2;
 
  435   for (it = fCounterMap.begin(), ite = fCounterMap.end(); it != ite; ++it)
 
  438     for (it2 = (it->second).begin(), ite2 = (it->second).end(); it2 != ite2;
 
  442       output->insert(it2->first);
 
int SearchUpperBoundTime(double time, bool sameTypeOfMolecule)
 
virtual void AddAMoleculeAtTime(const G4Molecule &, G4double)
 
G4MoleculeModelIterator GetModelIterator()
 
static G4MoleculeCounter * GetMoleculeCounter()
 
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1 
 
G4bool SearchTimeMap(const G4Molecule &molecule)
 
int GetNMoleculesAtTime(const G4Molecule &molecule, double time)
 
const G4String & GetName() const 
Returns the name of the molecule. 
 
RecordedMolecules GetRecordedMolecules()
 
G4GLOB_DLL std::ostream G4cout
 
static G4MoleculeCounter * Instance()
 
static G4MoleculeTable * Instance()
 
stdunique_ptr< std::set< G4double > > RecordedTimes
 
const G4MoleculeDefinition * GetDefinition() const 
Get molecule definition. 
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
static G4ThreadLocal double fPrecision
 
void PrintState() const 
Show the electronic state of the molecule. 
 
static G4ThreadLocal G4MoleculeCounter * fpInstance
 
stdunique_ptr< std::vector< G4Molecule > > RecordedMolecules
 
std::map< G4double, G4int, compDoubleWithPrecision > NbMoleculeAgainstTime
 
static void InitializeInstance()
 
RecordedTimes GetRecordedTimes()
 
Class Description The dynamic molecule holds all the data that change for a molecule It has a pointer...
 
virtual void RemoveAMoleculeAtTime(const G4Molecule &, G4double)
 
void SetTimeSlice(double)
 
static void DeleteInstance()