MCPcopy Create free account
hub / github.com/Geant4/geant4 / PrepareNewEvent

Method PrepareNewEvent

source/event/src/G4StackManager.cc:241–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241G4int G4StackManager::PrepareNewEvent(G4Event* currentEvent)
242{
243 if(userStackingAction != nullptr)
244 {
245 userStackingAction->PrepareNewEvent();
246 }
247
248 // Set the urgentStack in a defined state. Not doing it would
249 // affect reproducibility
250 //
251 urgentStack->clearAndDestroy();
252
253 G4int n_passedFromPrevious = 0;
254
255 if( GetNPostponedTrack() > 0 )
256 {
257#ifdef G4VERBOSE
258 if( verboseLevel > 1 )
259 {
260 G4cout << GetNPostponedTrack()
261 << " postponed tracked are now shifted to the stack." << G4endl;
262 }
263#endif
264
265 G4StackedTrack aStackedTrack;
266 G4TrackStack tmpStack;
267
268 postponeStack->TransferTo(&tmpStack);
269
270 while( tmpStack.GetNTrack() > 0 )
271 {
272 aStackedTrack=tmpStack.PopFromStack();
273 G4Track* aTrack = aStackedTrack.GetTrack();
274 DefineDefaultClassification( aTrack );
275 G4ClassificationOfNewTrack classification = fDefaultClassification;
276 if(userStackingAction!=nullptr)
277 {
278 classification = userStackingAction->ClassifyNewTrack( aTrack );
279 if(classification != fDefaultClassification)
280 {
281 if(fExceptionSeverity!=G4ExceptionSeverity::IgnoreTheIssue)
282 {
283 G4ExceptionDescription ed;
284 ed << "UserStackingAction has changed the track classification from "
285 << fDefaultClassification << " to " << classification << ". ";
286 G4Exception("G4StackManager::PushOneTrack","Event10052",
287 fExceptionSeverity,ed);
288 }
289 }
290 }
291 if(classification!=fKill)
292 {
293 aTrack->SetParentID(-1);
294 aTrack->SetTrackID(-(++n_passedFromPrevious));
295 }
296 else if(aTrack->GetTrackStatus() == fSuspendAndWait && classification > 0)
297 // to avoid this track sent to Waiting stack again
298 { aTrack->SetTrackStatus( fSuspend ); }

Callers 5

RunInitializationMethod · 0.45
RunInitializationMethod · 0.45
RunInitializationMethod · 0.45
RunInitializationMethod · 0.45
DoProcessingMethod · 0.45

Calls 10

G4ExceptionFunction · 0.85
GetTrackStatusMethod · 0.80
clearAndDestroyMethod · 0.45
TransferToMethod · 0.45
GetNTrackMethod · 0.45
PopFromStackMethod · 0.45
GetTrackMethod · 0.45
ClassifyNewTrackMethod · 0.45
SetParentIDMethod · 0.45
SetTrackIDMethod · 0.45

Tested by

no test coverage detected