45 fpMainList(nullptr), fpWaitingList(nullptr)
50 fpMainList(nullptr), fpWaitingList(nullptr)
57 fpMainList(right.fpMainList),
58 fpWaitingList(right.fpWaitingList)
64 if (fpMainList !=
nullptr)
69 if (fpWaitingList !=
nullptr)
72 fpWaitingList =
nullptr;
78 if (__list == fpMainList)
83 else if (__list == fpWaitingList)
86 fpWaitingList =
nullptr;
94 allMainList.
Add(__list);
108 if (fpMainList ==
nullptr)
118 if (fpMainList !=
nullptr)
136 listOfAllSecondaries.
Add(&fSecondaries);
143 if (fpWaitingList ==
nullptr)
157 if (fpMainList ==
nullptr) fpMainList =
new G4TrackList();
163 if (fpMainList ==
nullptr) fpMainList =
new G4TrackList();
171 if (fpMainList !=
nullptr)
173 nTracks += fpMainList->
size();
176 if (fpWaitingList !=
nullptr)
178 nTracks += fpWaitingList->
size();
181 nTracks += fSecondaries.
size();
198 if (fgInstance ==
nullptr)
205 fgMasterInstance = fgInstance;
215 if (fgMasterInstance ==
nullptr)
220 return fgMasterInstance;
237 for (
auto it =
fLists.begin(); it != end;
249 for (; fDelayedList_i != fDelayedList_end; fDelayedList_i++)
251 auto it = fDelayedList_i->second.begin();
253 fDelayedList_i->second.end();
255 for (; it != __end; it++)
302 if (it == end)
return false;
305 for (; it != end; it++)
309 auto it_listUnion =
fLists.find(
311 if (it_listUnion ==
fLists.end())
317 if (it_listUnion->second == 0)
321 right_listUnion = it_listUnion->second;
324 if (it->second == 0)
continue;
363 for (; it != end; it++)
365 if (it->second->GetMainList() ==
nullptr)
370 it->second->TransferSecondariesToMainList();
404 auto it =
fLists.find(moleculeID);
411 fLists[moleculeID] = priorityList;
415 priorityList = it->second;
448 if (track ==
nullptr)
452 <<
"You are trying to push a non-existing track (track pointer is null)"
455 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager014",
473 G4cout <<
"\t"<<
">> Pushing a track --> ";
485 if (globalTime < currentGlobalTime)
489 <<
"You are trying to push a track with a global time"
490 <<
" inferior to the current simulation time." <<
G4endl<<
"The time is going back : " <<
G4endl
491 <<
"The time in the step manager : "
494 <<
"The time of the track : "
497 <<
"(ITStepManager is not yet running)"
500 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager014",
514 if (globalTime == currentGlobalTime)
520 G4cout <<
"\t"<<
">> Pushing to *main* list --> ";
538 G4cout <<
"\t"<<
">> Pushing to *delayed* list --> ";
553 double timeDifference = globalTime - currentGlobalTime;
556 if (timeDifference < -1 * timeTolerance)
560 <<
"You are trying to push a track with a global time"
561 <<
" inferior to the current simulation time." <<
G4endl<<
"The time is going back : "
563 <<
"The time in the step manager : "
566 <<
"The time of the track : " <<
G4BestUnit(globalTime,
"Time")
568 <<
"(ITStepManager is running)"
571 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager015",
579 if (fabs(timeDifference) < timeTolerance)
587 G4cout <<
"\t"<<
">> Pushing to *secondary* list --> ";
602 <<
"While running you cannot push a track"
603 <<
" with a bigger global time than the current global time" <<
G4endl<<
"The time in the step manager : "
606 <<
"The time of the track : " <<
G4BestUnit(globalTime,
"Time")
608 <<
"(ITStepManager is running)"
611 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager016",
625 G4cout <<
"\t" <<
">> Pushing a delayed track" <<
G4endl;
645 it_delayed->second.find(moleculeID);
647 if (it_trackList == it_delayed->second.end())
649 (it_delayed->second[moleculeID] =
new G4TrackList())->push_back(track);
653 if (it_trackList->second != 0)
655 it_trackList->second->push_back(track);
701 G4cout <<
"*** G4ITTrackHolder::KillTracks , step #"
705 G4cout << setw(25) << left <<
"#Name"
706 << setw(25) <<
"track ID"<<
G4endl;
734 for (; it !=
fLists.end(); it++)
745 auto it2 = it1->second.begin();
747 for (; it2 != it1->second.end(); it2++)
768 if (it ==
fLists.end())
return nullptr;
775 if (priorityList !=
nullptr)
783 G4TrackList::Watcher* watcher,
786 auto it =
fLists.find(
id);
787 if (it ==
fLists.end())
return false;
790 if (trackList ==
nullptr)
return false;
825 for (; delayedmap_it != delayedmap_end; delayedmap_it++)
827 auto it = delayedmap_it->second.begin();
828 auto end = delayedmap_it->second.end();
830 for (; it != end; it++)
832 if (it->second !=
nullptr) nTracks += it->second->size();
845 for (; it != end; it++)
849 lists->SetWaitingList(lists->GetMainList());
860 for (; __it != __end; __it++)
862 std::map<Key, G4TrackList*>& mapOfLists = __it->second;
863 if (!mapOfLists.empty())
865 auto it = mapOfLists.begin();
866 auto end = mapOfLists.end();
867 for (; it != end; it++)
871 if (!(mainList->empty()))
return true;
882 auto it = mapOfLists.begin();
883 auto end = mapOfLists.end();
884 for (; it != end; it++)
890 if (!(trackList->empty()))
return true;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4Mutex pushToTheMasterInstance
G4Mutex creationOfTheMasterInstance
G4IT * GetIT(const G4Track *track)
G4FastList< G4Track > G4TrackList
G4GLOB_DLL std::ostream G4cout
void Watch(G4FastList< G4Track > *fastList)
void transferTo(G4FastList< OBJECT > *)
G4FastListNode< G4FastList< OBJECT > > * GetListNode()
void AddWatcher(Watcher *watcher)
void push_back(OBJECT *__track)
size_t GetNTracks() override
static G4ITTrackHolder * MasterInstance()
void Push(G4Track *) override
G4TrackManyList fAllMainList
void _PushTrack(G4Track *track)
~G4ITTrackHolder() override
MapOfDelayedLists fDelayedList
std::map< Key, PriorityList * > MapOfPriorityLists
bool fMainListHaveBeenSet
G4TrackManyList * GetMainList()
void PushTo(G4Track *, PriorityList::Type)
G4TrackList fToBeKilledList
PriorityList * GetPriorityList(Key)
bool CheckMapIsNOTEmpty(MapOfPriorityLists &mapOfLists, PriorityList::Type type)
void AddTrackID(G4Track *track)
void MergeSecondariesWithMainList()
std::map< Key, PriorityList * > fLists
void AddWatcherForKillList(G4TrackList::Watcher *)
G4TrackManyList fAllSecondariesList
static G4ITTrackHolder * Instance()
bool MergeNextTimeToMainList(double &time)
void PushDelayed(G4Track *track)
bool AddWatcher(int, G4TrackList::Watcher *, PriorityList::Type=PriorityList::MainList)
double fPostActivityGlobalTime
static void PushToMaster(G4Track *)
void AddWatcherForMainList(G4TrackList::Watcher *)
void MoveMainToWaitingList()
bool DelayListsNOTEmpty()
virtual G4ITType GetITSubType() const
virtual const G4String & GetName() const =0
void AddGlobalWatcher(typename G4FastList< OBJECT >::Watcher *watcher)
void Add(G4FastList< OBJECT > *__list)
G4double GetTimeTolerance() const override
static G4Scheduler * Instance()
G4double GetGlobalTime() const override
G4double GetGlobalTime() const
void SetTrackID(const G4int aValue)
static G4VScheduler * Instance()
virtual G4int GetNbSteps() const
void TransferSecondariesToMainList()
void MergeWithMainList(G4TrackList *trackList)
void NewMainList(G4TrackList *__list, G4TrackManyList &allMainList)
G4TrackList * GetMainList()
void PushToListOfSecondaries(G4Track *__track, G4TrackManyList &listOfAllSecondaries)
void TransferToMainList(G4TrackList *&__list, G4TrackManyList &allMainList)
virtual void NotifyDeletingList(G4TrackList *__list)
void PushToMainList(G4Track *__track, G4TrackManyList &allMainList)
void PushToWaitingList(G4Track *__track)
G4bool IsMultithreadedApplication()