Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ITTrackHolder Class Reference

#include <G4ITTrackHolder.hh>

Inheritance diagram for G4ITTrackHolder:
Collaboration diagram for G4ITTrackHolder:

Public Types

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

Public Member Functions

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

Static Public Member Functions

static G4ITTrackHolderInstance ()
 
static G4ITTrackHolderMasterInstance ()
 
static void PushToMaster (G4Track *)
 
- Static Public Member Functions inherited from G4VITTrackHolder
static G4VITTrackHolderInstance ()
 

Protected Member Functions

void AddTrackID (G4Track *track)
 
void _PushTrack (G4Track *track)
 
void PushTo (G4Track *, PriorityList::Type)
 
void PushDelayed (G4Track *track)
 
- Protected Member Functions inherited from G4VITTrackHolder
 G4VITTrackHolder ()
 
virtual ~G4VITTrackHolder ()
 

Protected Attributes

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

Friends

class G4Scheduler
 
class G4ITStepProcessor
 
class G4ITModelProcessor
 

Additional Inherited Members

- Static Protected Attributes inherited from G4VITTrackHolder
static G4ThreadLocal
G4VITTrackHolder
fInstance
 

Detailed Description

Definition at line 121 of file G4ITTrackHolder.hh.

Member Typedef Documentation

Definition at line 138 of file G4ITTrackHolder.hh.

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

Definition at line 140 of file G4ITTrackHolder.hh.

Definition at line 139 of file G4ITTrackHolder.hh.

Constructor & Destructor Documentation

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

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists
G4TrackManyList fAllMainList
MapOfDelayedLists fDelayedList
G4TrackManyList fAllSecondariesList

Here is the call graph for this function:

Member Function Documentation

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 }
double GetTimeTolerance() const
Definition: G4Scheduler.hh:398
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void AddTrackID(G4Track *track)
void PushDelayed(G4Track *track)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
virtual const G4String & GetName() const =0
static G4Scheduler * Instance()
Definition: G4Scheduler.cc:102
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49
G4GLOB_DLL std::ostream G4cout
void PushTo(G4Track *, PriorityList::Type)
G4int GetTrackID() const
bool IsRunning()
Definition: G4Scheduler.hh:108
G4double GetGlobalTime() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4double GetGlobalTime() const
Definition: G4Scheduler.hh:356
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

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)

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists
void AddWatcher(Watcher *watcher)
Definition: G4FastList.hh:340

Here is the call graph for this function:

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

Definition at line 801 of file G4ITTrackHolder.cc.

802 {
803  watcher->Watch(&fToBeKilledList);
804 }
G4TrackList fToBeKilledList
void G4ITTrackHolder::AddWatcherForMainList ( G4TrackList::Watcher *  watcher)

Definition at line 796 of file G4ITTrackHolder.cc.

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

Here is the call graph for this function:

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 }

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists
G4TrackManyList fAllMainList
MapOfDelayedLists fDelayedList
G4TrackManyList fAllSecondariesList

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
MapOfDelayedLists fDelayedList

Here is the caller graph for this function:

MapOfDelayedLists& G4ITTrackHolder::GetDelayedLists ( )
inline

Definition at line 206 of file G4ITTrackHolder.hh.

207  {
208  return fDelayedList;
209  }
MapOfDelayedLists fDelayedList
G4TrackList* G4ITTrackHolder::GetKillList ( )
inline

Definition at line 235 of file G4ITTrackHolder.hh.

236  {
237  return &fToBeKilledList;
238  }
G4TrackList fToBeKilledList
MapOfPriorityLists& G4ITTrackHolder::GetLists ( )
inline

Definition at line 192 of file G4ITTrackHolder.hh.

193  { return fLists;}
std::map< Key, PriorityList * > fLists
G4TrackList * G4ITTrackHolder::GetMainList ( Key  i)

Definition at line 773 of file G4ITTrackHolder.cc.

774 {
775  PriorityList* priorityList = GetPriorityList(i);
776  if (priorityList)
777  {
778  return priorityList->GetMainList();
779  }
780  return 0;
781 }
G4TrackList * GetMainList()
PriorityList * GetPriorityList(Key)

Here is the call graph for this function:

Here is the caller graph for this function:

G4TrackManyList* G4ITTrackHolder::GetMainList ( )
inline

Definition at line 196 of file G4ITTrackHolder.hh.

197  {
198  return &fAllMainList;
199  }
G4TrackManyList fAllMainList
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  }
MapOfDelayedLists fDelayedList
#define DBL_MAX
Definition: templates.hh:83

Here is the caller graph for this function:

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
G4TrackManyList fAllMainList
MapOfDelayedLists fDelayedList
G4TrackManyList fAllSecondariesList

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists

Here is the caller graph for this function:

G4TrackManyList* G4ITTrackHolder::GetSecondariesList ( )
inline

Definition at line 201 of file G4ITTrackHolder.hh.

202  {
203  return &fAllSecondariesList;
204  }
G4TrackManyList fAllSecondariesList

Here is the caller graph for this function:

G4ITTrackHolder * G4ITTrackHolder::Instance ( )
static

Definition at line 196 of file G4ITTrackHolder.cc.

197 {
198  if (fgInstance == 0)
199  {
200  fgInstance = new G4ITTrackHolder();
203  )
204  {
205  fgMasterInstance = fgInstance;
206  }
207 
208  }
209  return fgInstance;
210 }
G4bool IsMultithreadedApplication()
Definition: G4Threading.cc:152
G4bool IsMasterThread()
Definition: G4Threading.cc:146

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
G4TrackList fToBeKilledList
iterator end()
static G4VScheduler * Instance()
Definition: G4VScheduler.cc:48
virtual G4int GetNbSteps() const
Definition: G4VScheduler.hh:85
virtual const G4String & GetName() const =0
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49
G4GLOB_DLL std::ostream G4cout
G4int GetTrackID() const
iterator erase(OBJECT *)
#define G4endl
Definition: G4ios.hh:61
G4int size() const
Definition: G4FastList.hh:359
iterator begin()

Here is the call graph for this function:

Here is the caller graph for this function:

bool G4ITTrackHolder::MainListsNOTEmpty ( )
inline

Definition at line 215 of file G4ITTrackHolder.hh.

216  {
218  }
bool CheckMapIsNOTEmpty(MapOfPriorityLists &mapOfLists, PriorityList::Type type)
std::map< Key, PriorityList * > fLists

Here is the call graph for this function:

Here is the caller graph for this function:

G4ITTrackHolder * G4ITTrackHolder::MasterInstance ( )
static

Definition at line 212 of file G4ITTrackHolder.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists
G4TrackManyList fAllMainList
MapOfDelayedLists fDelayedList

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists
G4TrackManyList fAllMainList

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists
G4TrackManyList fAllMainList

Here is the call graph for this function:

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)

Here is the call graph for this function:

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 }
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49
G4GLOB_DLL std::ostream G4cout
G4FastList< G4Track > G4TrackList
Definition: G4TrackList.hh:57
G4double GetGlobalTime() const
virtual G4ITType GetITSubType() const
Definition: G4IT.hh:160
MapOfDelayedLists fDelayedList
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
std::map< Key, PriorityList * > fLists
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49
G4TrackManyList fAllMainList
virtual G4ITType GetITSubType() const
Definition: G4IT.hh:160
G4TrackManyList fAllSecondariesList

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ITTrackHolder::PushToKill ( G4Track track)
inline

Definition at line 164 of file G4ITTrackHolder.hh.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
void PushDelayed(G4Track *track)
G4Mutex pushToTheMasterInstance
static G4ITTrackHolder * MasterInstance()

Here is the call graph for this function:

bool G4ITTrackHolder::SecondaryListsNOTEmpty ( )
inline

Definition at line 220 of file G4ITTrackHolder.hh.

221  {
223  }
bool CheckMapIsNOTEmpty(MapOfPriorityLists &mapOfLists, PriorityList::Type type)
std::map< Key, PriorityList * > fLists

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ITTrackHolder::SetVerbose ( int  verbose)
inline

Definition at line 230 of file G4ITTrackHolder.hh.

231  {
232  fVerbose = verbose;
233  }

Friends And Related Function Documentation

friend class G4ITModelProcessor
friend

Definition at line 134 of file G4ITTrackHolder.hh.

friend class G4ITStepProcessor
friend

Definition at line 133 of file G4ITTrackHolder.hh.

friend class G4Scheduler
friend

Definition at line 132 of file G4ITTrackHolder.hh.

Member Data Documentation

G4TrackManyList G4ITTrackHolder::fAllMainList
protected

Definition at line 257 of file G4ITTrackHolder.hh.

G4TrackManyList G4ITTrackHolder::fAllSecondariesList
protected

Definition at line 258 of file G4ITTrackHolder.hh.

MapOfDelayedLists G4ITTrackHolder::fDelayedList
protected

Definition at line 248 of file G4ITTrackHolder.hh.

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

Definition at line 247 of file G4ITTrackHolder.hh.

bool G4ITTrackHolder::fMainListHaveBeenSet
protected

Definition at line 250 of file G4ITTrackHolder.hh.

int G4ITTrackHolder::fNbTracks
protected

Definition at line 252 of file G4ITTrackHolder.hh.

double G4ITTrackHolder::fPostActivityGlobalTime
protected

Definition at line 254 of file G4ITTrackHolder.hh.

G4TrackList G4ITTrackHolder::fToBeKilledList
protected

Definition at line 249 of file G4ITTrackHolder.hh.

int G4ITTrackHolder::fVerbose
protected

Definition at line 251 of file G4ITTrackHolder.hh.


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