Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Static Private Attributes | Friends
G4ITTrackHolder Class Reference

#include <G4ITTrackHolder.hh>

Inheritance diagram for G4ITTrackHolder:
G4VITTrackHolder

Public Types

typedef int Key
 
typedef std::map< double, std::map< Key, G4TrackList * > > MapOfDelayedLists
 
typedef std::map< Key, PriorityList * > MapOfPriorityLists
 

Public Member Functions

bool AddWatcher (int, G4TrackList::Watcher *, PriorityList::Type=PriorityList::MainList)
 
void AddWatcherForKillList (G4TrackList::Watcher *)
 
void AddWatcherForMainList (G4TrackList::Watcher *)
 
bool CheckMapIsNOTEmpty (MapOfPriorityLists &mapOfLists, PriorityList::Type type)
 
void Clear ()
 
bool DelayListsNOTEmpty ()
 
 G4ITTrackHolder ()
 
MapOfDelayedListsGetDelayedLists ()
 
G4TrackListGetKillList ()
 
MapOfPriorityListsGetLists ()
 
G4TrackManyListGetMainList ()
 
G4TrackListGetMainList (Key)
 
double GetNextTime ()
 
virtual size_t GetNTracks ()
 
PriorityListGetPriorityList (Key)
 
G4TrackManyListGetSecondariesList ()
 
void KillTracks ()
 
bool MainListsNOTEmpty ()
 
bool MergeNextTimeToMainList (double &time)
 
void MergeSecondariesWithMainList ()
 
void MoveMainToWaitingList ()
 
virtual void Push (G4Track *)
 
void PushToKill (G4Track *track)
 
bool SecondaryListsNOTEmpty ()
 
void SetVerbose (int verbose)
 
virtual ~G4ITTrackHolder ()
 

Static Public Member Functions

static G4ITTrackHolderInstance ()
 
static G4ITTrackHolderMasterInstance ()
 
static void PushToMaster (G4Track *)
 

Protected Member Functions

void _PushTrack (G4Track *track)
 
void AddTrackID (G4Track *track)
 
void PushDelayed (G4Track *track)
 
void PushTo (G4Track *, PriorityList::Type)
 

Protected Attributes

G4TrackManyList fAllMainList
 
G4TrackManyList fAllSecondariesList
 
MapOfDelayedLists fDelayedList
 
std::map< Key, PriorityList * > fLists
 
bool fMainListHaveBeenSet
 
int fNbTracks
 
double fPostActivityGlobalTime
 
G4TrackList fToBeKilledList
 
int fVerbose
 

Static Protected Attributes

static G4ThreadLocal G4VITTrackHolderfInstance
 

Static Private Attributes

static G4ThreadLocal G4ITTrackHolderfgInstance
 
static G4ITTrackHolderfgMasterInstance
 

Friends

class G4ITModelProcessor
 
class G4ITStepProcessor
 
class G4Scheduler
 

Detailed Description

Definition at line 121 of file G4ITTrackHolder.hh.

Member Typedef Documentation

◆ Key

typedef int G4ITTrackHolder::Key

Definition at line 138 of file G4ITTrackHolder.hh.

◆ MapOfDelayedLists

typedef std::map<double, std::map<Key, G4TrackList*> > G4ITTrackHolder::MapOfDelayedLists

Definition at line 140 of file G4ITTrackHolder.hh.

◆ MapOfPriorityLists

Definition at line 139 of file G4ITTrackHolder.hh.

Constructor & Destructor Documentation

◆ G4ITTrackHolder()

G4ITTrackHolder::G4ITTrackHolder ( )

Definition at line 223 of file G4ITTrackHolder.cc.

223 :
225{
226 fNbTracks = -1;
227 fMainListHaveBeenSet = false;
228 fVerbose = 0;
229
231// fPreActivityGlobalTime = -1;
232}
double fPostActivityGlobalTime

References fMainListHaveBeenSet, fNbTracks, fPostActivityGlobalTime, and fVerbose.

Referenced by Instance(), and MasterInstance().

◆ ~G4ITTrackHolder()

G4ITTrackHolder::~G4ITTrackHolder ( )
virtual

Definition at line 234 of file G4ITTrackHolder.cc.

235{
236 std::map<Key, PriorityList*>::iterator end = fLists.end();
237
238 for (std::map<Key, PriorityList*>::iterator it = fLists.begin(); it != end;
239 it++)
240 {
241 delete it->second;
242 it->second = 0;
243 }
244
245 if (!fDelayedList.empty())
246 {
247 MapOfDelayedLists::iterator fDelayedList_i = fDelayedList.begin();
248 MapOfDelayedLists::iterator fDelayedList_end = fDelayedList.end();
249
250 for (; fDelayedList_i != fDelayedList_end; fDelayedList_i++)
251 {
252 std::map<Key, G4TrackList*>::iterator it = fDelayedList_i->second.begin();
253 std::map<Key, G4TrackList*>::iterator __end =
254 fDelayedList_i->second.end();
255
256 for (; it != __end; it++)
257 {
258 if (it->second) delete (it->second);
259 it->second = 0;
260 }
261 }
262 fDelayedList.clear();
263 }
264
267 fNbTracks = -1;
268}
G4TrackManyList fAllMainList
MapOfDelayedLists fDelayedList
std::map< Key, PriorityList * > fLists
G4TrackManyList fAllSecondariesList

References fAllMainList, fAllSecondariesList, fDelayedList, fLists, fNbTracks, and G4ManyFastLists< OBJECT >::RemoveLists().

Member Function Documentation

◆ _PushTrack()

void G4ITTrackHolder::_PushTrack ( G4Track track)
protected

Definition at line 447 of file G4ITTrackHolder.cc.

448{
449 if (track == 0)
450 {
451 G4ExceptionDescription exceptionDescription;
452 exceptionDescription
453 << "You are trying to push a non-existing track (track pointer is null)"
454 << G4endl;
455
456 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager014",
457 FatalErrorInArgument, exceptionDescription);
458 }
459
460 G4double globalTime = track->GetGlobalTime();
461
462 if (track->GetTrackID() == 0)
463 {
464 // Set track ID
465 AddTrackID(track);
466 }
467
468 double currentGlobalTime = G4Scheduler::Instance()->GetGlobalTime();
469
470#ifdef G4VERBOSE
471 if (fVerbose)
472 {
473 G4cout << G4endl;
474 G4cout << "\t"<< ">> Pushing a track --> ";
475 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
476 << " -- ";
477 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
478 << "\t";
479 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
480 << G4endl;
481 }
482#endif
483
484 if (G4Scheduler::Instance()->IsRunning() == false)
485 {
486 if (globalTime < currentGlobalTime)
487 {
488 G4ExceptionDescription exceptionDescription;
489 exceptionDescription
490 << "You are trying to push a track with a global time"
491 << " inferior to the current simulation time." << G4endl<< "The time is going back : " << G4endl
492 << "The time in the step manager : "
493 << G4BestUnit(currentGlobalTime,"Time")
494 << G4endl
495 << "The time of the track : "
496 << G4BestUnit(globalTime,"Time")
497 << G4endl
498 << "(ITStepManager is not yet running)"
499 << G4endl;
500
501 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager014",
502 FatalErrorInArgument, exceptionDescription);
503 }
504
505 // Push the track to the rigth track list :
506 // If the track time is the same as the main track list,
507 // it will be push to the main track list
508 // otherwise, it will be pushed to the delayed track list.
509 if (fMainListHaveBeenSet == false)
510 {
511 PushDelayed(track);
512 }
513 else
514 {
515 if (globalTime == currentGlobalTime)
516 {
517 #ifdef G4VERBOSE
518 if (fVerbose)
519 {
520 G4cout << G4endl;
521 G4cout << "\t"<< ">> Pushing to *main* list --> ";
522 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
523 << " -- ";
524 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
525 << "\t";
526 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
527 << G4endl;
528 }
529 #endif
531 }
532 else
533 {
534 // if(currentGlobalTime > 1*CLHEP::picosecond) abort();
535 #ifdef G4VERBOSE
536 if (fVerbose)
537 {
538 G4cout << G4endl;
539 G4cout << "\t"<< ">> Pushing to *delayed* list --> ";
540 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
541 << " -- ";
542 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
543 << "\t";
544 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
545 << G4endl;
546 }
547 #endif
548 PushDelayed(track);
549 }
550 }
551 }
552 else // Is running
553 {
554 double timeDifference = globalTime - currentGlobalTime;
555 double timeTolerance = G4Scheduler::Instance()->GetTimeTolerance();
556
557 if (timeDifference < -1 * timeTolerance)
558 {
559 G4ExceptionDescription exceptionDescription;
560 exceptionDescription
561 << "You are trying to push a track with a global time"
562 << " inferior to the current simulation time." << G4endl<< "The time is going back : "
563 << G4endl
564 << "The time in the step manager : "
565 << G4BestUnit(timeDifference,"Time")
566 << G4endl
567 << "The time of the track : " << G4BestUnit(globalTime,"Time")
568 << G4endl
569 << "(ITStepManager is running)"
570 << G4endl;
571
572 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager015",
573 FatalErrorInArgument, exceptionDescription);
574 }
575
576 // Push the track to the rigth track list :
577 // If the track time is the same as the main track list,
578 // it will be push to the secondary list
579 // otherwise, it will be pushed to the delayed track list.
580 if (fabs(timeDifference) < timeTolerance)
581 {
582// G4cout << "Is pushing " << GetIT(track)->GetName() << G4endl;
583
584 #ifdef G4VERBOSE
585 if (fVerbose)
586 {
587 G4cout << G4endl;
588 G4cout << "\t"<< ">> Pushing to *secondary* list --> ";
589 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
590 << " -- ";
591 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
592 << "\t";
593 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
594 << G4endl;
595 }
596 #endif
598 }
599 else // globalTime < fGlobalTime already taken into account above
600 {
601 G4ExceptionDescription exceptionDescription;
602 exceptionDescription
603 << "While running you cannot push a track"
604 << " with a bigger global time than the current global time" << G4endl<< "The time in the step manager : "
605 << G4BestUnit(currentGlobalTime,"Time")
606 << G4endl
607 << "The time of the track : " << G4BestUnit(globalTime,"Time")
608 << G4endl
609 << "(ITStepManager is running)"
610 << G4endl;
611
612 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager016",
613 FatalErrorInArgument, exceptionDescription);
614 // PushDelayed(track, globalTime);
615 }
616 }
617}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:48
#define G4BestUnit(a, b)
double G4double
Definition: G4Types.hh:83
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void PushTo(G4Track *, PriorityList::Type)
void AddTrackID(G4Track *track)
void PushDelayed(G4Track *track)
virtual const G4String & GetName() const =0
static G4Scheduler * Instance()
Definition: G4Scheduler.cc:101
G4double GetGlobalTime() const
Definition: G4Scheduler.hh:364
G4double GetTimeTolerance() const
Definition: G4Scheduler.hh:406
G4int GetTrackID() const
G4double GetGlobalTime() const

References AddTrackID(), FatalErrorInArgument, fMainListHaveBeenSet, fVerbose, G4BestUnit, G4cout, G4endl, G4Exception(), G4Scheduler::GetGlobalTime(), G4Track::GetGlobalTime(), GetIT(), G4IT::GetName(), G4Scheduler::GetTimeTolerance(), G4Track::GetTrackID(), G4Scheduler::Instance(), PriorityList::MainList, PushDelayed(), PushTo(), and PriorityList::SecondariesList.

Referenced by Push(), and G4ITStepProcessor::PushSecondaries().

◆ AddTrackID()

void G4ITTrackHolder::AddTrackID ( G4Track track)
protected

Definition at line 377 of file G4ITTrackHolder.cc.

378{
379 //if(fNbTracks == 0) fNbTracks = -1;
380 track->SetTrackID(fNbTracks);
381 fNbTracks--;
382}
void SetTrackID(const G4int aValue)

References fNbTracks, and G4Track::SetTrackID().

Referenced by _PushTrack().

◆ AddWatcher()

bool G4ITTrackHolder::AddWatcher ( int  id,
G4TrackList::Watcher *  watcher,
PriorityList::Type  type = PriorityList::MainList 
)

Definition at line 783 of file G4ITTrackHolder.cc.

786{
787 std::map<Key, PriorityList*>::iterator it = fLists.find(id);
788 if (it == fLists.end()) return false;
789
790 G4TrackList* trackList = it->second->Get(type);
791 if (trackList == 0) return false;
792 trackList->AddWatcher(watcher);
793 return true;
794}
void AddWatcher(Watcher *watcher)
Definition: G4FastList.hh:338

References G4FastList< OBJECT >::AddWatcher(), and fLists.

◆ AddWatcherForKillList()

void G4ITTrackHolder::AddWatcherForKillList ( G4TrackList::Watcher *  watcher)

Definition at line 801 of file G4ITTrackHolder.cc.

802{
803 watcher->Watch(&fToBeKilledList);
804}
G4TrackList fToBeKilledList

References fToBeKilledList.

◆ AddWatcherForMainList()

void G4ITTrackHolder::AddWatcherForMainList ( G4TrackList::Watcher *  watcher)

Definition at line 796 of file G4ITTrackHolder.cc.

797{
799}
void AddGlobalWatcher(typename G4FastList< OBJECT >::Watcher *watcher)

References G4ManyFastLists< OBJECT >::AddGlobalWatcher(), and fAllMainList.

◆ CheckMapIsNOTEmpty()

bool G4ITTrackHolder::CheckMapIsNOTEmpty ( MapOfPriorityLists mapOfLists,
PriorityList::Type  type 
)

Definition at line 880 of file G4ITTrackHolder.cc.

882{
883 MapOfPriorityLists::iterator it = mapOfLists.begin();
884 MapOfPriorityLists::iterator end = mapOfLists.end();
885 for (; it != end; it++)
886 {
887 if (PriorityList* lists = it->second)
888 {
889 if (G4TrackList* trackList = lists->Get(type))
890 {
891 if (!(trackList->empty())) return true;
892 }
893 }
894 }
895 return false;
896}

Referenced by MainListsNOTEmpty(), and SecondaryListsNOTEmpty().

◆ Clear()

void G4ITTrackHolder::Clear ( )

Definition at line 726 of file G4ITTrackHolder.cc.

727{
730// fAllMainList.RemoveLists();
731// fAllSecondariesList.RemoveLists();
732
733 std::map<Key, PriorityList*>::iterator it = fLists.begin();
734
735 for (; it != fLists.end(); it++)
736 {
737 if (it->second) delete it->second;
738 it->second = 0;
739 }
740 fLists.clear();
741
742 MapOfDelayedLists::iterator it1 = fDelayedList.begin();
743
744 for (; it1 != fDelayedList.end(); it1++)
745 {
746 std::map<Key, G4TrackList*>::iterator it2 = it1->second.begin();
747
748 for (; it2 != it1->second.end(); it2++)
749 {
750 if (it2->second) delete it2->second;
751 it2->second = 0;
752 }
753 }
754
755 fDelayedList.clear();
756
757// fAllMainList.ClearLists();
758// fAllSecondariesList.ClearLists();
761 KillTracks();
762
763 fNbTracks = -1;
764}

References G4ManyFastLists< OBJECT >::ClearLists(), fAllMainList, fAllSecondariesList, fDelayedList, fLists, fNbTracks, KillTracks(), and G4ManyFastLists< OBJECT >::RemoveLists().

Referenced by G4Scheduler::ClearList().

◆ DelayListsNOTEmpty()

bool G4ITTrackHolder::DelayListsNOTEmpty ( )

Definition at line 857 of file G4ITTrackHolder.cc.

858{
859 MapOfDelayedLists::iterator __it = fDelayedList.begin();
860 MapOfDelayedLists::iterator __end = fDelayedList.end();
861 for (; __it != __end; __it++)
862 {
863 std::map<Key, G4TrackList*>& mapOfLists = __it->second;
864 if (mapOfLists.empty() == false)
865 {
866 std::map<Key, G4TrackList*>::iterator it = mapOfLists.begin();
867 std::map<Key, G4TrackList*>::iterator end = mapOfLists.end();
868 for (; it != end; it++)
869 {
870 if (G4TrackList* mainList = it->second)
871 {
872 if (!(mainList->empty())) return true;
873 }
874 }
875 }
876 }
877 return false;
878}

References fDelayedList.

Referenced by G4Scheduler::Process().

◆ GetDelayedLists()

MapOfDelayedLists & G4ITTrackHolder::GetDelayedLists ( )
inline

Definition at line 206 of file G4ITTrackHolder.hh.

207 {
208 return fDelayedList;
209 }

References fDelayedList.

◆ GetKillList()

G4TrackList * G4ITTrackHolder::GetKillList ( )
inline

Definition at line 235 of file G4ITTrackHolder.hh.

236 {
237 return &fToBeKilledList;
238 }

References fToBeKilledList.

◆ GetLists()

MapOfPriorityLists & G4ITTrackHolder::GetLists ( )
inline

Definition at line 192 of file G4ITTrackHolder.hh.

193 { return fLists;}

References fLists.

◆ GetMainList() [1/2]

G4TrackManyList * G4ITTrackHolder::GetMainList ( )
inline

Definition at line 196 of file G4ITTrackHolder.hh.

197 {
198 return &fAllMainList;
199 }

References fAllMainList.

◆ GetMainList() [2/2]

G4TrackList * G4ITTrackHolder::GetMainList ( Key  i)

◆ GetNextTime()

double G4ITTrackHolder::GetNextTime ( )
inline

Definition at line 152 of file G4ITTrackHolder.hh.

153 {
154 if (fDelayedList.empty()) return DBL_MAX;
155 return fDelayedList.begin()->first;
156 }
#define DBL_MAX
Definition: templates.hh:62

References DBL_MAX, and fDelayedList.

Referenced by G4Scheduler::Process(), and G4Scheduler::SynchronizeTracks().

◆ GetNTracks()

size_t G4ITTrackHolder::GetNTracks ( )
virtual

Reimplemented from G4VITTrackHolder.

Definition at line 815 of file G4ITTrackHolder.cc.

816{
817 size_t nTracks(0);
818 nTracks += fAllMainList.size();
819 nTracks += fAllSecondariesList.size();
820
821 // G4cout << "nTracks = " << nTracks << G4endl;
822
823 MapOfDelayedLists::iterator delayedmap_it = fDelayedList.begin();
824 MapOfDelayedLists::iterator delayedmap_end = fDelayedList.end();
825
826 for (; delayedmap_it != delayedmap_end; delayedmap_it++)
827 {
828 std::map<Key, G4TrackList*>::iterator it = delayedmap_it->second.begin();
829 std::map<Key, G4TrackList*>::iterator end = delayedmap_it->second.end();
830
831 for (; it != end; it++)
832 {
833 if (it->second) nTracks += it->second->size();
834 }
835 }
836
837 // G4cout << "nTracks = " << nTracks << G4endl;
838
839 return nTracks;
840}
size_t size() const

References fAllMainList, fAllSecondariesList, fDelayedList, and G4ManyFastLists< OBJECT >::size().

Referenced by G4Scheduler::GetNTracks().

◆ GetPriorityList()

PriorityList * G4ITTrackHolder::GetPriorityList ( Key  i)

Definition at line 766 of file G4ITTrackHolder.cc.

767{
768 std::map<Key, PriorityList*>::iterator it = fLists.find(i);
769 if (it == fLists.end()) return 0;
770 return it->second;
771}

References fLists.

Referenced by GetMainList().

◆ GetSecondariesList()

G4TrackManyList * G4ITTrackHolder::GetSecondariesList ( )
inline

Definition at line 201 of file G4ITTrackHolder.hh.

202 {
203 return &fAllSecondariesList;
204 }

References fAllSecondariesList.

Referenced by G4Scheduler::EndTracking().

◆ Instance()

G4ITTrackHolder * G4ITTrackHolder::Instance ( )
static

◆ KillTracks()

void G4ITTrackHolder::KillTracks ( )

Definition at line 696 of file G4ITTrackHolder.cc.

697{
698 if (fToBeKilledList.size() == 0) return;
699#ifdef G4VERBOSE
700 if (fVerbose > 1)
701 {
702 G4cout << "*** G4ITTrackHolder::KillTracks , step #"
704 << " ***" << G4endl;
705 G4cout << "Nb of tracks to kill "<< fToBeKilledList.size() << G4endl;
706 G4cout << setw(25) << left << "#Name"
707 << setw(25) << "track ID"<< G4endl;
708
710 for(; it != fToBeKilledList.end();)
711 {
712 G4Track* toBeErased = *it;
713
714 G4cout << setw(25) << GetIT(toBeErased)->GetName()
715 << setw(25) << toBeErased->GetTrackID()
716 << G4endl;
717
718 it = fToBeKilledList.erase(toBeErased);
719 }
720 }
721 else
722#endif
724}
G4int size() const
Definition: G4FastList.hh:357
iterator begin()
iterator end()
iterator erase(OBJECT *)
static G4VScheduler * Instance()
Definition: G4VScheduler.cc:48
virtual G4int GetNbSteps() const
Definition: G4VScheduler.hh:85

References G4FastList< OBJECT >::begin(), G4FastList< OBJECT >::end(), G4FastList< OBJECT >::erase(), fToBeKilledList, fVerbose, G4cout, G4endl, GetIT(), G4IT::GetName(), G4VScheduler::GetNbSteps(), G4Track::GetTrackID(), G4VScheduler::Instance(), and G4FastList< OBJECT >::size().

Referenced by Clear(), G4ITModelProcessor::ComputeTrackReaction(), and G4ITStepProcessor::DoIt().

◆ MainListsNOTEmpty()

bool G4ITTrackHolder::MainListsNOTEmpty ( )
inline

Definition at line 215 of file G4ITTrackHolder.hh.

216 {
218 }
bool CheckMapIsNOTEmpty(MapOfPriorityLists &mapOfLists, PriorityList::Type type)

References CheckMapIsNOTEmpty(), fLists, and PriorityList::MainList.

Referenced by G4Scheduler::DoProcess(), G4Scheduler::EndTracking(), and G4Scheduler::PrintWhyDoYouStop().

◆ MasterInstance()

G4ITTrackHolder * G4ITTrackHolder::MasterInstance ( )
static

Definition at line 212 of file G4ITTrackHolder.cc.

213{
215 if (fgMasterInstance == 0)
216 {
218 }
219 lock.unlock();
220 return fgMasterInstance;
221}
G4Mutex creationOfTheMasterInstance

References creationOfTheMasterInstance, fgMasterInstance, G4ITTrackHolder(), and G4TemplateAutoLock< _Mutex_t >::unlock().

Referenced by PushToMaster().

◆ MergeNextTimeToMainList()

bool G4ITTrackHolder::MergeNextTimeToMainList ( double &  time)

Definition at line 289 of file G4ITTrackHolder.cc.

290{
291// G4cout << "G4ITTrackHolder::MergeNextTimeToMainList" << G4endl;
292 if (fDelayedList.empty())
293 {
294 return false;
295 }
296
297// G4cout << "fDelayedList.size = " << fDelayedList.size() <<G4endl;
298
299 std::map<Key, G4TrackList*>::iterator it =
300 fDelayedList.begin()->second.begin();
301 std::map<Key, G4TrackList*>::iterator end =
302 fDelayedList.begin()->second.end();
303 if (it == end) return false;
304
305 bool output = false;
306 for (; it != end; it++)
307 {
308 PriorityList* right_listUnion(0);
309
310 std::map<Key, PriorityList*>::iterator it_listUnion = fLists.find(
311 it->first);
312 if (it_listUnion == fLists.end())
313 {
314 right_listUnion = (fLists[it->first] = new PriorityList());
315 }
316 else
317 {
318 if (it_listUnion->second == 0)
319 {
320 it_listUnion->second = new PriorityList();
321 }
322 right_listUnion = it_listUnion->second;
323 }
324
325 if (it->second == 0) continue;
326
327 /*
328 if (right_listUnion->GetMainList() == 0)
329 {
330 // right_listUnion->fpMainList = new G4TrackList();
331 // if(it->second)
332 // {
333 right_listUnion->NewMainList(it->second, fAllMainList);
334 // }
335 }
336 else
337 {
338 right_listUnion->TransferToMainList(it->second);
339 delete it->second;
340 }*/
341
342 right_listUnion->TransferToMainList(it->second, fAllMainList);
343
344 if (output == false)
345 {
346 if (right_listUnion->GetMainList()->size())
347 {
348 output = true;
349 }
350 }
351 it->second = 0;
352 }
353
354 if (output) time = fDelayedList.begin()->first;
355 fDelayedList.erase(fDelayedList.begin());
356 return output;
357}

References fAllMainList, fDelayedList, fLists, PriorityList::GetMainList(), G4FastList< OBJECT >::size(), and PriorityList::TransferToMainList().

Referenced by G4Scheduler::SynchronizeTracks().

◆ MergeSecondariesWithMainList()

void G4ITTrackHolder::MergeSecondariesWithMainList ( )

Definition at line 359 of file G4ITTrackHolder.cc.

360{
361 std::map<Key, PriorityList*>::iterator it = fLists.begin();
362 std::map<Key, PriorityList*>::iterator end = fLists.end();
363
364 for (; it != end; it++)
365 {
366 if (it->second->GetMainList() == 0)
367 {
368 it->second->NewMainList(fAllMainList);
369 }
370
371 it->second->TransferSecondariesToMainList();
372 }
373}

References fAllMainList, and fLists.

Referenced by G4ITModelProcessor::ComputeTrackReaction(), G4ITStepProcessor::DoIt(), G4Scheduler::EndTracking(), G4DNAIRT::MakeReaction(), and G4DNAIRT_geometries::MakeReaction().

◆ MoveMainToWaitingList()

void G4ITTrackHolder::MoveMainToWaitingList ( )

Definition at line 842 of file G4ITTrackHolder.cc.

843{
844 MapOfPriorityLists::iterator it = fLists.begin();
845 MapOfPriorityLists::iterator end = fLists.end();
846 for (; it != end; it++)
847 {
848 if (PriorityList* lists = it->second)
849 {
850 lists->SetWaitingList(lists->GetMainList());
851 //TODO
852 }
853 }
855}

References fAllMainList, fLists, and G4ManyFastLists< OBJECT >::RemoveLists().

◆ Push()

void G4ITTrackHolder::Push ( G4Track track)
virtual

Reimplemented from G4VITTrackHolder.

Definition at line 386 of file G4ITTrackHolder.cc.

387{
388// if (G4VScheduler::Instance()->IsRunning())
389// {
390// G4ExceptionDescription exceptionDescription;
391// exceptionDescription
392// << "G4ITTrackHolder::PushTrack : You are trying to push tracks while the "
393// "ITStepManager is running";
394// G4Exception("G4ITTrackHolder::PushTrack", "ITStepManager012",
395// FatalErrorInArgument, exceptionDescription);
396// }
397 _PushTrack(track);
398
399// G4MIConstituent::NotifyEntityAdded(track);
400}
void _PushTrack(G4Track *track)

References _PushTrack().

Referenced by G4DNAIRT::MakeReaction(), G4DNAIRT_geometries::MakeReaction(), G4DNAMakeReaction::MakeReaction(), G4DNAMolecularReaction::MakeReaction(), G4DNAScavengerProcess::PostStepDoIt(), G4DNAChemistryManager::PushTrack(), G4DNAIRT::Sampling(), and G4DNAIRT_geometries::Sampling().

◆ PushDelayed()

void G4ITTrackHolder::PushDelayed ( G4Track track)
protected

Definition at line 621 of file G4ITTrackHolder.cc.

622{
623#ifdef G4VERBOSE
624 if (fVerbose)
625 {
626 G4cout << "\t" << ">> Pushing a delayed track" << G4endl;
627 }
628#endif
629
630 int moleculeID = GetIT(track)->GetITSubType();
631 // std::map<int, PriorityList>::iterator it = fLists.find(moleculeID);
632
633 G4double globalTime = track->GetGlobalTime();
634
635 std::map<double, std::map<Key, G4TrackList*> >::iterator it_delayed =
636 fDelayedList.find(globalTime);
637
638 if (it_delayed == fDelayedList.end())
639 {
640 (fDelayedList[globalTime][moleculeID] = new G4TrackList())->push_back(
641 track);
642 }
643 else
644 {
645 std::map<Key, G4TrackList*>::iterator it_trackList =
646 it_delayed->second.find(moleculeID);
647
648 if (it_trackList == it_delayed->second.end())
649 {
650 (it_delayed->second[moleculeID] = new G4TrackList())->push_back(track);
651 }
652 else
653 {
654 if (it_trackList->second != 0)
655 {
656 it_trackList->second->push_back(track);
657 }
658 }
659 }
660
661 // fDelayedList[globalTime][moleculeID]
662
663 /*
664 std::map<double,std::map<int, G4TrackList* > >::iterator it_delayed =
665 fDelayedList.begin();
666
667 std::map<double,std::map<int, G4TrackList* > >::iterator end_delayed =
668 fDelayedList.end();
669
670 for(it_delayed != end_delayed ; it_delayed++)
671 {
672 std::map<int, G4TrackList*> & trackListMap = it->second;
673
674
675 }
676 */
677 /*
678 std::map<double,G4TrackList* > :: iterator
679 fDelayedList_i = fDelayedList.find(globalTime) ;
680
681 if(fDelayedList_i == fDelayedList.end())
682 {
683
684 G4TrackList* newList = new G4TrackList ;
685 newList -> push_back(track);
686 fDelayedList[globalTime] = newList ;
687 }
688 else
689 {
690 fDelayedList_i->second-> push_back(track);
691 }
692 */
693}
G4FastList< G4Track > G4TrackList
Definition: G4TrackList.hh:56
virtual G4ITType GetITSubType() const
Definition: G4IT.hh:159

References fDelayedList, fVerbose, G4cout, G4endl, G4Track::GetGlobalTime(), GetIT(), and G4IT::GetITSubType().

Referenced by _PushTrack(), and PushToMaster().

◆ PushTo()

void G4ITTrackHolder::PushTo ( G4Track track,
PriorityList::Type  type 
)
protected

Definition at line 402 of file G4ITTrackHolder.cc.

403{
404 int moleculeID = GetIT(track)->GetITSubType();
405 std::map<Key, PriorityList*>::iterator it = fLists.find(moleculeID);
406
407 PriorityList* priorityList(0);
408
409 if (it == fLists.end())
410 {
411 priorityList = new PriorityList(fAllMainList);
412 fLists[moleculeID] = priorityList;
413 }
414 else
415 {
416 priorityList = it->second;
417 }
418
419 switch (type)
420 {
422 {
423 priorityList->PushToMainList(track, fAllMainList);
424 break;
425 }
427 {
428 priorityList->PushToListOfSecondaries(track, fAllSecondariesList);
429 break;
430 }
432 {
433 priorityList->PushToWaitingList(track);
434 return;
435 break;
436 }
437
438 default:
439 {
440 return;
441 break;
442 }
443 }
444}

References fAllMainList, fAllSecondariesList, fLists, GetIT(), G4IT::GetITSubType(), PriorityList::MainList, PriorityList::PushToListOfSecondaries(), PriorityList::PushToMainList(), PriorityList::PushToWaitingList(), PriorityList::SecondariesList, and PriorityList::WaitingList.

Referenced by _PushTrack().

◆ PushToKill()

void G4ITTrackHolder::PushToKill ( G4Track track)
inline

Definition at line 164 of file G4ITTrackHolder.hh.

165 {
166 G4TrackList::Pop(track);
168
171 }
172 }
@ fKillTrackAndSecondaries
@ fStopAndKill
static void Pop(G4Track *)
void push_back(OBJECT *__track)
G4TrackStatus GetTrackStatus() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)

References fKillTrackAndSecondaries, fStopAndKill, fToBeKilledList, G4Track::GetTrackStatus(), G4FastList< G4Track >::Pop(), G4FastList< OBJECT >::push_back(), and G4Track::SetTrackStatus().

Referenced by G4ITTrackingManager::EndTracking().

◆ PushToMaster()

void G4ITTrackHolder::PushToMaster ( G4Track track)
static

Definition at line 806 of file G4ITTrackHolder.cc.

807{
808 G4ITTrackHolder* trackHolder = MasterInstance();
809
811 trackHolder->PushDelayed(track);
812 lock.unlock();
813}
G4Mutex pushToTheMasterInstance
static G4ITTrackHolder * MasterInstance()

References MasterInstance(), PushDelayed(), pushToTheMasterInstance, and G4TemplateAutoLock< _Mutex_t >::unlock().

◆ SecondaryListsNOTEmpty()

bool G4ITTrackHolder::SecondaryListsNOTEmpty ( )
inline

◆ SetVerbose()

void G4ITTrackHolder::SetVerbose ( int  verbose)
inline

Definition at line 230 of file G4ITTrackHolder.hh.

231 {
232 fVerbose = verbose;
233 }

References fVerbose.

Friends And Related Function Documentation

◆ G4ITModelProcessor

friend class G4ITModelProcessor
friend

Definition at line 134 of file G4ITTrackHolder.hh.

◆ G4ITStepProcessor

friend class G4ITStepProcessor
friend

Definition at line 133 of file G4ITTrackHolder.hh.

◆ G4Scheduler

friend class G4Scheduler
friend

Definition at line 132 of file G4ITTrackHolder.hh.

Field Documentation

◆ fAllMainList

G4TrackManyList G4ITTrackHolder::fAllMainList
protected

◆ fAllSecondariesList

G4TrackManyList G4ITTrackHolder::fAllSecondariesList
protected

Definition at line 258 of file G4ITTrackHolder.hh.

Referenced by Clear(), GetNTracks(), GetSecondariesList(), PushTo(), and ~G4ITTrackHolder().

◆ fDelayedList

MapOfDelayedLists G4ITTrackHolder::fDelayedList
protected

◆ fgInstance

G4ThreadLocal G4ITTrackHolder * G4ITTrackHolder::fgInstance
staticprivate

Definition at line 130 of file G4ITTrackHolder.hh.

Referenced by Instance().

◆ fgMasterInstance

G4ITTrackHolder * G4ITTrackHolder::fgMasterInstance
staticprivate

Definition at line 131 of file G4ITTrackHolder.hh.

Referenced by Instance(), and MasterInstance().

◆ fInstance

G4ThreadLocal G4VITTrackHolder * G4VITTrackHolder::fInstance
staticprotectedinherited

◆ fLists

std::map<Key, PriorityList*> G4ITTrackHolder::fLists
protected

◆ fMainListHaveBeenSet

bool G4ITTrackHolder::fMainListHaveBeenSet
protected

Definition at line 250 of file G4ITTrackHolder.hh.

Referenced by _PushTrack(), and G4ITTrackHolder().

◆ fNbTracks

int G4ITTrackHolder::fNbTracks
protected

Definition at line 252 of file G4ITTrackHolder.hh.

Referenced by AddTrackID(), Clear(), G4ITTrackHolder(), and ~G4ITTrackHolder().

◆ fPostActivityGlobalTime

double G4ITTrackHolder::fPostActivityGlobalTime
protected

Definition at line 254 of file G4ITTrackHolder.hh.

Referenced by G4ITTrackHolder().

◆ fToBeKilledList

G4TrackList G4ITTrackHolder::fToBeKilledList
protected

Definition at line 249 of file G4ITTrackHolder.hh.

Referenced by AddWatcherForKillList(), GetKillList(), KillTracks(), and PushToKill().

◆ fVerbose

int G4ITTrackHolder::fVerbose
protected

Definition at line 251 of file G4ITTrackHolder.hh.

Referenced by _PushTrack(), G4ITTrackHolder(), KillTracks(), PushDelayed(), and SetVerbose().


The documentation for this class was generated from the following files: