Skip to content

Commit aa20241

Browse files
committed
* fix a bug in DefinePhysicalInteractionLength that sometimes would
trigger premature in-flight decays when a particle crosses a boundary in the geometry. [rtj]
1 parent d32b459 commit aa20241

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

src/G4.10.01.p02fixes/G4SteppingManager2.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ void G4SteppingManager::GetProcessNumber()
260260
}
261261

262262
// Transportation is assumed to be the last process in the vector
263-
if(kp == MAXofAlongStepLoops-1)
263+
// This is a bad assumption, should actually check! -rtj-
264+
//if(kp == MAXofAlongStepLoops-1)
265+
// fStepStatus = fGeomBoundary;
266+
G4ProcessType ptype = fCurrentProcess->GetProcessType();
267+
if (ptype == fTransportation || ptype == fParallel)
264268
fStepStatus = fGeomBoundary;
265269
}
266270

@@ -341,6 +345,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
341345
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
342346

343347
// Set the current process as a process which defined this Step length
348+
// Do not select a ParallelWorld process as the defining AtRestProc
344349
if (fCurrentProcess->GetProcessType() != fParallel)
345350
fStep->GetPostStepPoint()
346351
->SetProcessDefinedStep(fCurrentProcess);

src/G4.10.02.p02fixes/G4SteppingManager2.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ void G4SteppingManager::GetProcessNumber()
260260
}
261261

262262
// Transportation is assumed to be the last process in the vector
263-
if(kp == MAXofAlongStepLoops-1)
263+
// This is a bad assumption, should actually check! -rtj-
264+
//if(kp == MAXofAlongStepLoops-1)
265+
// fStepStatus = fGeomBoundary;
266+
G4ProcessType ptype = fCurrentProcess->GetProcessType();
267+
if (ptype == fTransportation || ptype == fParallel)
264268
fStepStatus = fGeomBoundary;
265269
}
266270

@@ -341,6 +345,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
341345
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
342346

343347
// Set the current process as a process which defined this Step length
348+
// Do not select a ParallelWorld process as the defining AtRestProc
344349
if (fCurrentProcess->GetProcessType() != fParallel)
345350
fStep->GetPostStepPoint()
346351
->SetProcessDefinedStep(fCurrentProcess);

src/G4.10.03.p01fixes/G4SteppingManager2.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ void G4SteppingManager::GetProcessNumber()
260260
}
261261

262262
// Transportation is assumed to be the last process in the vector
263-
if(kp == MAXofAlongStepLoops-1)
263+
// This is a bad assumption, should actually check! -rtj-
264+
//if(kp == MAXofAlongStepLoops-1)
265+
// fStepStatus = fGeomBoundary;
266+
G4ProcessType ptype = fCurrentProcess->GetProcessType();
267+
if (ptype == fTransportation || ptype == fParallel)
264268
fStepStatus = fGeomBoundary;
265269
}
266270

@@ -341,6 +345,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
341345
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
342346

343347
// Set the current process as a process which defined this Step length
348+
// Do not select a ParallelWorld process as the defining AtRestProc
344349
if (fCurrentProcess->GetProcessType() != fParallel)
345350
fStep->GetPostStepPoint()
346351
->SetProcessDefinedStep(fCurrentProcess);

src/G4.10.04.p02fixes/G4SteppingManager2.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,12 @@ void G4SteppingManager::GetProcessNumber()
260260
}
261261

262262
// Transportation is assumed to be the last process in the vector
263-
if(kp == MAXofAlongStepLoops-1)
264-
fStepStatus = fGeomBoundary;
263+
// This is a bad assumption, should actually check! -rtj-
264+
//if(kp == MAXofAlongStepLoops-1)
265+
// fStepStatus = fGeomBoundary;
266+
G4ProcessType ptype = fCurrentProcess->GetProcessType();
267+
if (ptype == fTransportation || ptype == fParallel)
268+
fStepStatus = fGeomBoundary;
265269
}
266270

267271
// Make sure to check the safety, even if Step is not limited
@@ -341,6 +345,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
341345
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
342346

343347
// Set the current process as a process which defined this Step length
348+
// Do not select a ParallelWorld process as the defining AtRestProc
344349
if (fCurrentProcess->GetProcessType() != fParallel)
345350
fStep->GetPostStepPoint()
346351
->SetProcessDefinedStep(fCurrentProcess);

src/G4.10.06.p01fixes/G4SteppingManager2.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,12 @@ void G4SteppingManager::GetProcessNumber()
259259
}
260260

261261
// Transportation is assumed to be the last process in the vector
262-
if(kp == MAXofAlongStepLoops-1)
263-
fStepStatus = fGeomBoundary;
262+
// This is a bad assumption, should actually check! -rtj-
263+
//if(kp == MAXofAlongStepLoops-1)
264+
// fStepStatus = fGeomBoundary;
265+
G4ProcessType ptype = fCurrentProcess->GetProcessType();
266+
if (ptype == fTransportation || ptype == fParallel)
267+
fStepStatus = fGeomBoundary;
264268
}
265269

266270
// Make sure to check the safety, even if Step is not limited
@@ -340,6 +344,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
340344
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
341345

342346
// Set the current process as a process which defined this Step length
347+
// Do not select a ParallelWorld process as the defining AtRestProc
343348
if (fCurrentProcess->GetProcessType() != fParallel)
344349
fStep->GetPostStepPoint()
345350
->SetProcessDefinedStep(fCurrentProcess);

0 commit comments

Comments
 (0)