99#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
100 MemStat mem_first, mem_second, mem_diff;
101 mem_first = MemoryUsage();
109#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
110 mem_second = MemoryUsage();
111 mem_diff = mem_second-mem_first;
112 G4cout <<
"\t || MEM || G4Scheduler::CalculateMinTimeStep || After "
113 "computing fpModelProcessor -> InitializeStepper, diff is : "
121 pStepModel->GetTimeStepper()->CalculateMinTimeStep(
131 fTSTimeStep = fReactionSetInTime.begin()->get()->GetTime() - currentGlobalTime;
135#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
136 mem_second = MemoryUsage();
137 mem_diff = mem_second-mem_first;
138 G4cout <<
"\t || MEM || G4Scheduler::CalculateMinTimeStep || "
139 "After looping on tracks, diff is : " << mem_diff <<
G4endl;
151#if defined (DEBUG_MEM)
152 MemStat mem_first, mem_second, mem_diff;
153 mem_first = MemoryUsage();
160 pModel->PrepareNewTimeStep();
163#if defined (DEBUG_MEM)
164 mem_second = MemoryUsage();
165 mem_diff = mem_second-mem_first;
166 G4cout <<
"\t || MEM || G4ITModelProcessor::InitializeStepper || After computing stepper -> Prepare(), diff is : " << mem_diff <<
G4endl;
177 G4bool reachedUserTimeLimit,
197 reachedUserTimeLimit);
205 auto pTrackA =
const_cast<G4Track*
>(pChanges->GetTrackA());
206 auto pTrackB =
const_cast<G4Track*
>(pChanges->GetTrackB());
208 if (pTrackA ==
nullptr
209 || pTrackB ==
nullptr
216 G4int nbSecondaries = pChanges->GetNumberOfSecondaries();
217 const std::vector<G4Track*>* productsVector = pChanges->GetfSecondary();
219 if (fpUserTimeStepAction !=
nullptr)
231 << pTrackA->GetTrackID() <<
") + " <<
GetIT(pTrackB)->
GetName() <<
" ("
232 << pTrackB->GetTrackID() <<
") -> ";
236 if (nbSecondaries > 0)
238 for (
int i = 0; i < nbSecondaries; ++i)
241 if ((fVerbose != 0) && i != 0)
247 G4Track* secondary = (*productsVector)[i];
250 pTrackB->GetTrackID());
252 if (secondary->
GetGlobalTime() - fGlobalTime > fTimeTolerance)
255 exceptionDescription <<
"The time of the secondary should not be bigger than the"
256 " current global time."
257 <<
" This may cause synchronization problem. If the process you"
258 " are using required "
259 <<
"such feature please contact the developers." <<
G4endl
260 <<
"The global time in the step manager : "
263 <<
"The global time of the track : "
267 G4Exception(
"G4Scheduler::ComputeInteractionBetweenTracks",
270 exceptionDescription);
297 if (pTrackA->GetTrackID() == 0 || pTrackB->GetTrackID() == 0)
300 if (pTrackA->GetTrackID() == 0)
311 <<
"The problem was found for the reaction between tracks :"
313 << pTrackA->GetTrackID() <<
") & "
314 << pTrackB->GetParticleDefinition()->GetParticleName() <<
" ("
315 << pTrackB->GetTrackID() <<
"). \n";
317 if (pTrack->
GetStep() ==
nullptr)
319 exceptionDescription <<
"Also no step was found"
320 <<
" ie track->GetStep() == 0 \n";
323 exceptionDescription <<
"Parent ID of trackA : "
324 << pTrackA->GetParentID() <<
"\n";
325 exceptionDescription <<
"Parent ID of trackB : "
326 << pTrackB->GetParentID() <<
"\n";
329 <<
"The ID of one of the reaction track was not setup.";
330 G4Exception(
"G4Scheduler::ComputeInteractionBetweenTracks",
333 exceptionDescription);
336 if (pChanges->WereParentsKilled())
345 pChanges.reset(
nullptr);
368 <<
"You are trying to set a new model while the model processor has alreaday be initialized";
369 G4Exception(
"G4ITModelProcessor::SetModelHandler",
"ITModelProcessor001",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
@ eCollisionBetweenTracks
G4IT * GetIT(const G4Track *track)
G4GLOB_DLL std::ostream G4cout
bool GetTimeStepComputerFlag()
void RegisterModel(G4VITStepModel *pModel, G4double globalTime)
std::vector< G4VITStepModel * > GetActiveModels(G4double globalTime) const
bool GetReactionProcessFlag()
void SetModelHandler(G4ITModelHandler *)
G4ITTrackHolder * fpTrackContainer
G4ITReactionSet * fReactionSet
void InitializeStepper(G4double currentGlobalTime, G4double userMinTime)
void SetTrackingManager(G4ITTrackingManager *trackingManager)
G4VITStepModel * fpActiveModelWithMinTimeStep
const G4Track * GetTrack() const
std::vector< G4VITStepModel * > fActiveModels
void RegisterModel(double time, G4VITStepModel *)
std::vector< std::unique_ptr< G4ITReactionChange > > fReactionInfo
void SetTrack(const G4Track *)
G4ITTrackingManager * fpTrackingManager
G4double CalculateMinTimeStep(G4double currentGlobalTime, G4double definedMinTimeStep)
void ComputeTrackReaction(G4ITStepStatus fITStepStatus, G4double fGlobalTime, G4double currentTimeStep, G4double previousTimeStep, G4bool reachedUserTimeLimit, G4double fTimeTolerance, G4UserTimeStepAction *fpUserTimeStepAction, G4int fVerbose)
G4ITModelHandler * fpModelHandler
virtual ~G4ITModelProcessor()
bool GetComputeTimeStep() const
G4double fUserMinTimeStep
static G4ITReactionSet * Instance()
G4ITReactionPerTime & GetReactionsPerTime()
void MergeSecondariesWithMainList()
static G4ITTrackHolder * Instance()
void EndTracking(G4Track *)
void SetParentID(int, int)
virtual const G4String & GetName() const =0
const G4String & GetParticleName() const
const G4ParticleDefinition * GetParticleDefinition() const
G4double GetGlobalTime() const
const G4Step * GetStep() const
virtual void UserReactionAction(const G4Track &, const G4Track &, const std::vector< G4Track * > *)
virtual void Initialize()
virtual std::vector< std::unique_ptr< G4ITReactionChange > > FindReaction(G4ITReactionSet *, const double, const double, const bool)=0
G4VITReactionProcess * GetReactionProcess()
static void SetTimes(const G4double &, const G4double &)