45 G4TrackList::Watcher(), fpMainList(0), fpWaitingList(0)
51 fpMainList(right.fpMainList),
52 fpWaitingList(right.fpWaitingList)
88 allMainList.
Add(__list);
230 std::map<Key, PriorityList*>::iterator end =
fLists.end();
232 for (std::map<Key, PriorityList*>::iterator it =
fLists.begin(); it != end;
241 MapOfDelayedLists::iterator fDelayedList_i =
fDelayedList.begin();
242 MapOfDelayedLists::iterator fDelayedList_end =
fDelayedList.end();
244 for (; fDelayedList_i != fDelayedList_end; fDelayedList_i++)
246 std::map<Key, G4TrackList*>::iterator it = fDelayedList_i->second.begin();
247 std::map<Key, G4TrackList*>::iterator __end =
248 fDelayedList_i->second.end();
250 for (; it != __end; it++)
252 if (it->second)
delete (it->second);
293 std::map<Key, G4TrackList*>::iterator it =
295 std::map<Key, G4TrackList*>::iterator end =
297 if (it == end)
return false;
300 for (; it != end; it++)
304 std::map<Key, PriorityList*>::iterator it_listUnion =
fLists.find(
306 if (it_listUnion ==
fLists.end())
312 if (it_listUnion->second == 0)
316 right_listUnion = it_listUnion->second;
319 if (it->second == 0)
continue;
355 std::map<Key, PriorityList*>::iterator it =
fLists.begin();
356 std::map<Key, PriorityList*>::iterator end =
fLists.end();
358 for (; it != end; it++)
360 if (it->second->GetMainList() == 0)
365 it->second->TransferSecondariesToMainList();
386 <<
"G4ITTrackHolder::PushTrack : You are trying to push tracks while the "
387 "ITStepManager is running";
388 G4Exception(
"G4ITTrackHolder::PushTrack",
"ITStepManager012",
399 std::map<Key, PriorityList*>::iterator it =
fLists.find(moleculeID);
406 fLists[moleculeID] = priorityList;
410 priorityList = it->second;
447 <<
"You are trying to push a non-existing track (track pointer is null)"
450 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager014",
468 G4cout <<
"\t"<<
">> Pushing a track --> ";
480 if (globalTime < currentGlobalTime)
484 <<
"You are trying to push a track with a global time"
485 <<
" inferior to the current simulation time." <<
G4endl<<
"The time is going back : " <<
G4endl
486 <<
"The time in the step manager : "
489 <<
"The time of the track : "
492 <<
"(ITStepManager is not yet running)"
495 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager014",
509 if (globalTime == currentGlobalTime)
521 double timeDifference = globalTime - currentGlobalTime;
524 if (timeDifference < -1 * timeTolerance)
528 <<
"You are trying to push a track with a global time"
529 <<
" inferior to the current simulation time." <<
G4endl<<
"The time is going back : "
531 <<
"The time in the step manager : "
534 <<
"The time of the track : " <<
G4BestUnit(globalTime,
"Time")
536 <<
"(ITStepManager is running)"
539 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager015",
547 if (fabs(timeDifference) < timeTolerance)
557 <<
"While running you cannot push a track"
558 <<
" with a bigger global time than the current global time" <<
G4endl<<
"The time in the step manager : "
561 <<
"The time of the track : " <<
G4BestUnit(globalTime,
"Time")
563 <<
"(ITStepManager is running)"
566 G4Exception(
"G4ITTrackHolder::_PushTrack",
"ITStepManager016",
580 G4cout <<
"\t" <<
">> Pushing a delayed track" <<
G4endl;
589 std::map<double, std::map<Key, G4TrackList*> >::iterator it_delayed =
599 std::map<Key, G4TrackList*>::iterator it_trackList =
600 it_delayed->second.find(moleculeID);
602 if (it_trackList == it_delayed->second.end())
604 (it_delayed->second[moleculeID] =
new G4TrackList())->push_back(track);
608 if (it_trackList->second != 0)
610 it_trackList->second->push_back(track);
656 G4cout <<
"*** G4ITTrackHolder::KillTracks , step #"
661 << setw(25) <<
"track ID"<<
G4endl;
687 std::map<Key, PriorityList*>::iterator it =
fLists.begin();
689 for (; it !=
fLists.end(); it++)
691 if (it->second)
delete it->second;
700 std::map<Key, G4TrackList*>::iterator it2 = it1->second.begin();
702 for (; it2 != it1->second.end(); it2++)
704 if (it2->second)
delete it2->second;
722 std::map<Key, PriorityList*>::iterator it =
fLists.find(i);
723 if (it ==
fLists.end())
return 0;
738 G4TrackList::Watcher* watcher,
741 std::map<Key, PriorityList*>::iterator it =
fLists.find(
id);
742 if (it ==
fLists.end())
return false;
745 if (trackList == 0)
return false;
767 MapOfDelayedLists::iterator delayedmap_it =
fDelayedList.begin();
768 MapOfDelayedLists::iterator delayedmap_end =
fDelayedList.end();
770 for (; delayedmap_it != delayedmap_end; delayedmap_it++)
772 std::map<Key, G4TrackList*>::iterator it = delayedmap_it->second.begin();
773 std::map<Key, G4TrackList*>::iterator end = delayedmap_it->second.end();
775 for (; it != end; it++)
777 if (it->second) nTracks += it->second->size();
788 MapOfPriorityLists::iterator it =
fLists.begin();
789 MapOfPriorityLists::iterator end =
fLists.end();
790 for (; it != end; it++)
794 lists->SetWaitingList(lists->GetMainList());
803 MapOfDelayedLists::iterator __it =
fDelayedList.begin();
805 for (; __it != __end; __it++)
807 std::map<Key, G4TrackList*>& mapOfLists = __it->second;
808 if (mapOfLists.empty() ==
false)
810 std::map<Key, G4TrackList*>::iterator it = mapOfLists.begin();
811 std::map<Key, G4TrackList*>::iterator end = mapOfLists.end();
812 for (; it != end; it++)
816 if (!(mainList->empty()))
return true;
827 MapOfPriorityLists::iterator it = mapOfLists.begin();
828 MapOfPriorityLists::iterator end = mapOfLists.end();
829 for (; it != end; it++)
835 if (!(trackList->empty()))
return true;
G4TrackList fToBeKilledList
void AddWatcher(Watcher *watcher)
G4TrackManyList * GetMainList()
virtual void Push(G4Track *)
void MergeSecondariesWithMainList()
G4FastList_iterator enables to go through the tracks contained by a list.
bool CheckMapIsNOTEmpty(MapOfPriorityLists &mapOfLists, PriorityList::Type type)
double GetTimeTolerance() const
std::ostringstream G4ExceptionDescription
void AddTrackID(G4Track *track)
std::map< Key, PriorityList * > fLists
double fPostActivityGlobalTime
static G4VScheduler * Instance()
G4TrackList * fpWaitingList
void PushDelayed(G4Track *track)
G4ITTrackHolder is an empty interface that permits to push tracks to the IT system without actually d...
virtual G4int GetNbSteps() const
void MoveMainToWaitingList()
G4Mutex pushToTheMasterInstance
virtual void NotifyDeletingList(G4TrackList *__list)
static G4ITTrackHolder * fgMasterInstance
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
virtual const G4String & GetName() const =0
G4TrackList * GetMainList()
static G4Scheduler * Instance()
void PushToMainList(G4Track *__track, G4TrackManyList &allMainList)
void PushToWaitingList(G4Track *__track)
void Add(G4FastList< OBJECT > *__list)
void MergeWithMainList(G4TrackList *trackList)
G4Mutex creationOfTheMasterInstance
G4IT * GetIT(const G4Track *track)
G4GLOB_DLL std::ostream G4cout
void _PushTrack(G4Track *track)
static G4ThreadLocal G4ITTrackHolder * fgInstance
G4FastList< G4Track > G4TrackList
void PushTo(G4Track *, PriorityList::Type)
bool MergeNextTimeToMainList(double &time)
G4double GetGlobalTime() const
G4TrackManyList fAllMainList
G4bool IsMultithreadedApplication()
virtual size_t GetNTracks()
void TransferToMainList(G4TrackList *&__list, G4TrackManyList &allMainList)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
bool DelayListsNOTEmpty()
static G4ITTrackHolder * MasterInstance()
void push_back(OBJECT *__track)
PriorityList * GetPriorityList(Key)
G4FastListNode< G4FastList< OBJECT > > * GetListNode()
virtual G4ITType GetITSubType() const
MapOfDelayedLists fDelayedList
bool fMainListHaveBeenSet
std::map< Key, PriorityList * > MapOfPriorityLists
static void PushToMaster(G4Track *)
void PushToListOfSecondaries(G4Track *__track, G4TrackManyList &listOfAllSecondaries)
void transferTo(G4FastList< OBJECT > *)
static G4ITTrackHolder * Instance()
virtual ~G4ITTrackHolder()
G4double GetGlobalTime() const
void NewMainList(G4TrackList *__list, G4TrackManyList &allMainList)
void TransferSecondariesToMainList()
G4TrackManyList fAllSecondariesList
void SetTrackID(const G4int aValue)
bool AddWatcher(int, G4TrackList::Watcher *, PriorityList::Type=PriorityList::MainList)