97#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
98 MemStat mem_first, mem_second, mem_diff;
99 mem_first = MemoryUsage();
107#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
108 mem_second = MemoryUsage();
109 mem_diff = mem_second-mem_first;
110 G4cout <<
"\t || MEM || G4Scheduler::CalculateMinTimeStep || After "
111 "computing fpModelProcessor -> InitializeStepper, diff is : "
119 pStepModel->GetTimeStepper()->CalculateMinTimeStep(
129 fTSTimeStep = fReactionSetInTime.begin()->get()->GetTime() - currentGlobalTime;
133#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
134 mem_second = MemoryUsage();
135 mem_diff = mem_second-mem_first;
136 G4cout <<
"\t || MEM || G4Scheduler::CalculateMinTimeStep || "
137 "After looping on tracks, diff is : " << mem_diff <<
G4endl;
149#if defined (DEBUG_MEM)
150 MemStat mem_first, mem_second, mem_diff;
151 mem_first = MemoryUsage();
158 pModel->PrepareNewTimeStep();
161#if defined (DEBUG_MEM)
162 mem_second = MemoryUsage();
163 mem_diff = mem_second-mem_first;
164 G4cout <<
"\t || MEM || G4ITModelProcessor::InitializeStepper || After computing stepper -> Prepare(), diff is : " << mem_diff <<
G4endl;
175 G4bool reachedUserTimeLimit,
195 reachedUserTimeLimit);
203 auto pTrackA =
const_cast<G4Track*
>(pChanges->GetTrackA());
204 auto pTrackB =
const_cast<G4Track*
>(pChanges->GetTrackB());
206 if (pTrackA ==
nullptr
207 || pTrackB ==
nullptr
214 G4int nbSecondaries = pChanges->GetNumberOfSecondaries();
215 const std::vector<G4Track*>* productsVector = pChanges->GetfSecondary();
217 if (fpUserTimeStepAction)
229 << pTrackA->GetTrackID() <<
") + " <<
GetIT(pTrackB)->
GetName() <<
" ("
230 << pTrackB->GetTrackID() <<
") -> ";
234 if (nbSecondaries > 0)
236 for (
int i = 0; i < nbSecondaries; ++i)
239 if (fVerbose && i != 0)
245 G4Track* secondary = (*productsVector)[i];
248 pTrackB->GetTrackID());
250 if (secondary->
GetGlobalTime() - fGlobalTime > fTimeTolerance)
253 exceptionDescription <<
"The time of the secondary should not be bigger than the"
254 " current global time."
255 <<
" This may cause synchronization problem. If the process you"
256 " are using required "
257 <<
"such feature please contact the developers." <<
G4endl
258 <<
"The global time in the step manager : "
261 <<
"The global time of the track : "
265 G4Exception(
"G4Scheduler::ComputeInteractionBetweenTracks",
268 exceptionDescription);
295 if (pTrackA->GetTrackID() == 0 || pTrackB->GetTrackID() == 0)
298 if (pTrackA->GetTrackID() == 0)
309 <<
"The problem was found for the reaction between tracks :"
311 << pTrackA->GetTrackID() <<
") & "
312 << pTrackB->GetParticleDefinition()->GetParticleName() <<
" ("
313 << pTrackB->GetTrackID() <<
"). \n";
315 if (pTrack->
GetStep() ==
nullptr)
317 exceptionDescription <<
"Also no step was found"
318 <<
" ie track->GetStep() == 0 \n";
321 exceptionDescription <<
"Parent ID of trackA : "
322 << pTrackA->GetParentID() <<
"\n";
323 exceptionDescription <<
"Parent ID of trackB : "
324 << pTrackB->GetParentID() <<
"\n";
327 <<
"The ID of one of the reaction track was not setup.";
328 G4Exception(
"G4Scheduler::ComputeInteractionBetweenTracks",
331 exceptionDescription);
334 if (pChanges->WereParentsKilled())
343 pChanges.reset(
nullptr);
366 <<
"You are trying to set a new model while the model processor has alreaday be initialized";
367 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 &)