63 #define DEBUG_MEM_STEPPING 
   64 #define DEBUG_MEM_DETAILED_STEPPING 
   77 #define RED  "\033[0;31m" 
   78 #define LIGHT_RED  "\33[1;31m" 
   79 #define GREEN "\033[32;40m" 
   80 #define GREEN_ON_BLUE "\033[1;32;44m" 
   81 #define RESET_COLOR "\033[0m" 
   86 #define GREEN_ON_BLUE "" 
   87 #define RESET_COLOR "" 
   97     return std::numeric_limits<T>::has_infinity
 
   98         && value == std::numeric_limits<T>::infinity();
 
  104   if(fgScheduler == 0) fgScheduler = 
new G4Scheduler();
 
  115       G4cout << 
"G4Scheduler received G4State_Quit" << 
G4endl;
 
  325           << 
"You are asking to use user defined steps but you did not give any.";
 
  326       G4Exception(
"G4Scheduler::FindUserPreDefinedTimeStep",
 
  329                   exceptionDescription);
 
  383     G4cout << 
"*** G4Scheduler starts processing " << 
G4endl;
 
  385     G4cout << 
"___________________________________________" 
  386     "___________________________" << 
G4endl;
 
  411   G4bool trackFound = 
false;
 
  435       G4cout << 
"G4Scheduler: process time= "<< localtimer << 
G4endl;
 
  459       G4cout << 
"*** G4Scheduler ends at time : " 
  461       G4cout << 
"___________________________________" << 
G4endl;
 
  465       G4cout << 
"*** G4Scheduler did not start because no " 
  466       "track was found to be processed"<< 
G4endl;
 
  467       G4cout << 
"___________________________________" << 
G4endl;
 
  523   double nextWatchedTime = -1;
 
  539     if(nextWatchedTime > 
fEndTime && carryOn)
 
  562     G4cout << 
"G4Scheduler has reached a stage: it might be" 
  563            " a transition or the end" 
  566     G4bool normalStop = 
false;
 
  570       G4cout << 
"== G4Scheduler: I stop because I reached the stop time : " 
  576       G4cout << 
"G4Scheduler: I stop because the current main list of tracks " 
  583       G4cout << 
"G4Scheduler: I stop because I reached the maximum allowed " 
  590       G4cout << 
"G4Scheduler: It might be that I stop because " 
  591       "I have been told so. You may check " 
  592       "member fContinue and usage of the method G4Scheduler::Stop()." 
  606 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING) 
  607   MemStat mem_first, mem_second, mem_diff;
 
  610 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING) 
  624 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING) 
  626     mem_diff = mem_second-mem_first;
 
  627     G4cout << 
"\t || MEM || After step " << 
fNbSteps << 
", diff is : " 
  634 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING) 
  636   mem_diff = mem_second-mem_first;
 
  637   G4cout << 
"\t || MEM || After stepping, diff is : " << mem_diff << 
G4endl;
 
  642     G4cout << 
"*** G4Scheduler has finished processing a track list at time : " 
  677 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  678   MemStat mem_first, mem_second, mem_diff;
 
  681 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  696              << 
" the chosen user time step is : " 
  716 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  718   mem_diff = mem_second-mem_first;
 
  719   G4cout << 
"|| MEM || After computing TS, diff is : " << mem_diff << 
G4endl;
 
  736 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  750 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  752   mem_diff = mem_second-mem_first;
 
  753   G4cout << 
"|| MEM || After IL, diff is : " << mem_diff << 
G4endl;
 
  762     G4cout << 
"*** The minimum time returned by the processes is : " 
  770 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  808       exceptionDescription << 
"Too many zero time steps were detected. ";
 
  809       exceptionDescription << 
"The simulation is probably stuck. ";
 
  811           << 
"The maximum number of zero time steps is currently : " 
  813       exceptionDescription << 
".";
 
  816                   "SchedulerNullTimeSteps",
 
  818                   exceptionDescription);
 
  834 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  836   mem_diff = mem_second-mem_first;
 
  837   G4cout << 
"|| MEM || After LeadingTracks and UserPreTimeStepAction: " 
  841 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  864 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  866   mem_diff = mem_second-mem_first;
 
  867   G4cout << 
"|| MEM || After DoIT, diff is : " << mem_diff << 
G4endl;
 
  870 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  892 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING) 
  894   mem_diff = mem_second-mem_first;
 
  895   G4cout << 
"|| MEM || After computing reactions + UserPostTimeStepAction, " 
  896   "diff is : " << mem_diff << 
G4endl;
 
  910       std::stringstream finalOutput;
 
  912       finalOutput << 
"*** End of step N°" << 
fNbSteps 
  916              << 
"\t " << interactionType
 
  923           finalOutput << 
"It has also reached the user time limit" << 
G4endl;
 
  925         finalOutput << 
"_______________________________________________________________" 
  929       G4cout << finalOutput.str();
 
  946   map<double, double>::const_iterator it_fpUserTimeSteps_i = 
fpUserTimeSteps 
  948   map<double, double>::const_iterator it_fpUserTimeSteps_low = 
fpUserTimeSteps 
  964     it_fpUserTimeSteps_i--;
 
  972     it_fpUserTimeSteps_i = it_fpUserTimeSteps_low;
 
  973     map<double, double>::const_iterator tmp_it = it_fpUserTimeSteps_low;
 
  984   else if (it_fpUserTimeSteps_i == it_fpUserTimeSteps_low)
 
  993     if(it_fpUserTimeSteps_i != 
fpUserTimeSteps->begin()) it_fpUserTimeSteps_i--;
 
  998     it_fpUserTimeSteps_i = it_fpUserTimeSteps_low;
 
 1001   return it_fpUserTimeSteps_i->second;
 
 1012     exceptionDescription
 
 1013         << 
"You are asking to use user defined steps but you did not give any.";
 
 1014     G4Exception(
"G4Scheduler::FindUserPreDefinedTimeStep",
 
 1017                 exceptionDescription);
 
 1020   map<double, double>::iterator fpUserTimeSteps_i =
 
 1037     fpUserTimeSteps_i--;
 
 1044     fpUserTimeSteps_i = fpUserTimeSteps_low;
 
 1046   else if(fpUserTimeSteps_i == fpUserTimeSteps_low)
 
 1049     fpUserTimeSteps_i--;
 
 1053     fpUserTimeSteps_i = fpUserTimeSteps_low;
 
 1066     exceptionDescription
 
 1067         << 
"End tracking is called while G4Scheduler is still running." 
 1073                 exceptionDescription);
 
 1083     for (; it != end; ++it)
 
 1095     for (; it != end; ++it)
 
 1151       interactionType = 
"eInteractionWithMedium";
 
 1154       interactionType = 
"eCollisionBetweenTracks";
 
 1157       interactionType = 
"eCollisionBetweenTracks";
 
G4ITModelHandler holds for two IT types the corresponding model manager. 
 
void RegisterModel(G4VITStepModel *aModel, const G4double globalTime)
 
G4bool fUseDefaultTimeSteps
 
std::map< double, double > * fpUserTimeSteps
 
G4ITReactionSet * fReactionSet
 
Its role is the same as G4StepManager : 
 
virtual void DefineTracks()
 
void MergeSecondariesWithMainList()
 
virtual size_t GetNTracks()
 
void PrepareLeadingTracks()
 
void FindUserPreDefinedTimeStep()
 
The G4ITModelProcessor will call the two processes defined in G4VITModel. 
 
virtual G4bool Notify(G4ApplicationState requestedState)
 
G4TrackManyList * GetSecondariesList()
 
std::ostringstream G4ExceptionDescription
 
virtual void Initialize()
 
void SetTrackingManager(G4ITTrackingManager *trackingManager)
 
void SetTrackingManager(G4ITTrackingManager *trackMan)
 
bool fReachedUserTimeLimit
 
Define what to do before stepping and after stepping. 
 
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1 
 
G4ITStepStatus fITStepStatus
 
int fMaxNZeroTimeStepsAllowed
 
static G4Scheduler * Instance()
 
G4double CalculateMinTimeStep(G4double currentGlobalTime, G4double definedMinTimeStep)
 
static G4ITTypeManager * Instance()
 
static G4ThreadLocal G4Scheduler * fgScheduler
 
static G4ITReactionSet * Instance()
 
static const double microsecond
 
bool fUsePreDefinedTimeSteps
 
virtual void UserPostTimeStepAction()
 
void EndTrackingWOKill(G4Track *)
 
G4GLOB_DLL std::ostream G4cout
 
double fUserUpperTimeLimit
 
static void DeleteInstance()
 
virtual void UserPreTimeStepAction()
In this method, the user can use : G4Scheduler::Instance()->GetGlobalTime(), to know the current simu...
 
void DoIt(double timeStep)
 
G4ITStepManager enables to synchronize in time the step of tracks. 
 
G4ITTrackingManager * fpTrackingManager
 
double GetLimitingTimeStep() const 
 
void ForceReinitialization()
 
bool MergeNextTimeToMainList(double &time)
 
G4ITModelProcessor * fpModelProcessor
 
G4SchedulerMessenger * fpMessenger
 
bool SecondaryListsNOTEmpty()
 
static void DeleteInstance()
DeleteInstance should be used instead of the destructor. 
 
G4ITModelHandler * fpModelHandler
 
virtual size_t GetNTracks()
 
G4ITStepProcessor * fpStepProcessor
 
double GetNextWatchedTime() const 
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
bool DelayListsNOTEmpty()
 
virtual void Initialize()
 
G4double ComputeInteractionLength(double previousTimeStep)
 
G4ITTrackingInteractivity * fpTrackingInteractivity
 
G4UserTimeStepAction * fpUserTimeStepAction
 
std::set< double > fWatchedTimes
 
double fDefinedMinTimeStep
 
void ComputeTrackReaction(G4ITStepStatus fITStepStatus, G4double fGlobalTime, G4double currentTimeStep, G4double previousTimeStep, G4bool reachedUserTimeLimit, G4double fTimeTolerance, G4UserTimeStepAction *fpUserTimeStepAction, G4int fVerbose)
 
T min(const T t1, const T t2)
brief Return the smallest of the two arguments 
 
G4Scheduler & operator=(const G4Scheduler &)
 
virtual void RegisterModel(G4VITStepModel *, double)
 
double fDefaultMinTimeStep
 
virtual void EndProcessing()
 
void SetModelHandler(G4ITModelHandler *)
 
static const double picosecond
 
G4TrackList * GetMainList(Key)
 
void SetInteractivity(G4ITTrackingInteractivity *)
 
void GetCollisionType(G4String &interactionType)
 
void ResetLeadingTracks()
 
G4ITTrackHolder & fTrackContainer
 
bool GetComputeTimeStep()
 
void SetInteractivity(G4ITTrackingInteractivity *)
 
virtual void StartProcessing()