222 fSharedData->fPreviousBiasingOperator = fSharedData->fCurrentBiasingOperator;
223 fSharedData->fIsNewOperator =
false;
224 fSharedData->fLeavingPreviousOperator =
false;
228 G4bool firstStepInParallelVolume =
false;
229 if ( fSharedData->fParallelGeometriesLimiterProcess )
233 size_t iParallel = 0;
234 for (
auto wasLimiting : fSharedData->fParallelGeometriesLimiterProcess->
GetWasLimiting() )
236 if ( firstStep || wasLimiting )
238 firstStepInParallelVolume =
true;
241 ->GetLogicalVolume() );
242 if ( newParallelOperator )
244 if ( tmpParallelOperator )
247 ed <<
" Several biasing operators are defined at the same place in parallel geometries ! Found:\n";
248 ed <<
" - `" << newParallelOperator->
GetName() <<
"' and \n";
249 ed <<
" - `" << tmpParallelOperator->GetName() <<
"'.\n";
250 ed <<
" Keeping `" << newParallelOperator->GetName() <<
"'. Behavior not guaranteed ! Please consider having only one operator at a place. " <<
G4endl;
251 G4Exception(
" G4BiasingProcessInterface::PostStepGetPhysicalInteractionLength(...)",
257 else newParallelOperator = tmpParallelOperator;
261 fSharedData->fParallelGeometryOperator = newParallelOperator;
269 if ( firstStepInVolume )
272 fSharedData->fMassGeometryOperator = newOperator;
273 if ( ( newOperator !=
nullptr ) && ( fSharedData->fParallelGeometryOperator != nullptr ) )
276 ed <<
" Biasing operators are defined at the same place in mass and parallel geometries ! Found:\n";
277 ed <<
" - `" << fSharedData->fParallelGeometryOperator->
GetName() <<
"' in parallel geometry and \n";
278 ed <<
" - `" << newOperator->
GetName() <<
"' in mass geometry.\n";
279 ed <<
" Keeping `" << fSharedData->fParallelGeometryOperator->
GetName() <<
"'. Behavior not guaranteed ! Please consider having only one operator at a place. " <<
G4endl;
280 G4Exception(
" G4BiasingProcessInterface::PostStepGetPhysicalInteractionLength(...)",
288 if ( firstStepInVolume || firstStepInParallelVolume )
291 if ( newOperator ==
nullptr ) newOperator = fSharedData->fMassGeometryOperator;
293 fSharedData->fCurrentBiasingOperator = newOperator ;
295 if ( newOperator != fSharedData->fPreviousBiasingOperator )
297 fSharedData->fLeavingPreviousOperator = ( fSharedData->fPreviousBiasingOperator != nullptr ) ;
298 fSharedData->fIsNewOperator = ( newOperator != nullptr );
310 if ( fSharedData->fCurrentBiasingOperator !=
nullptr )
312 for (
size_t i = 0 ; i < (fSharedData->fPhysicsBiasingProcessInterfaces).size(); i++ )
313 (fSharedData->fPhysicsBiasingProcessInterfaces)[i]->InvokeWrappedProcessPostStepGPIL( track, previousStepSize,
condition );
322 if ( ( fSharedData->fPreviousBiasingOperator != 0 ) ||
323 ( fSharedData->fCurrentBiasingOperator != 0 ) )
325 fPreviousOccurenceBiasingOperation = fOccurenceBiasingOperation;
326 fPreviousFinalStateBiasingOperation = fFinalStateBiasingOperation;
327 fPreviousNonPhysicsBiasingOperation = fNonPhysicsBiasingOperation;
328 fPreviousBiasingInteractionLaw = fBiasingInteractionLaw;
330 fOccurenceBiasingOperation = 0;
331 fFinalStateBiasingOperation = 0;
332 fNonPhysicsBiasingOperation = 0;
333 fBiasingInteractionLaw = 0;
336 fBiasingPostStepGPIL =
DBL_MAX;
340 fWrappedProcessAlongStepGPIL =
DBL_MAX;
341 fBiasingAlongStepGPIL =
DBL_MAX;
345 fPreviousStepSize = previousStepSize;
351 G4double usedPreviousStepSize = previousStepSize;
356 if ( fSharedData->fLeavingPreviousOperator )
358 (fSharedData->fPreviousBiasingOperator)->ExitingBiasing( &track,
this );
360 if ( fSharedData->fCurrentBiasingOperator == 0 )
362 ResetForUnbiasedTracking();
363 if ( fIsPhysicsBasedBiasing )
366 if ( fResetWrappedProcessInteractionLength )
368 fResetWrappedProcessInteractionLength =
false;
371 usedPreviousStepSize = 0.0;
381 if ( fSharedData->fCurrentBiasingOperator == 0 )
401 if ( !fIsPhysicsBasedBiasing )
403 fNonPhysicsBiasingOperation = (fSharedData->fCurrentBiasingOperator)->GetProposedNonPhysicsBiasingOperation( &track,
this );
404 if ( fNonPhysicsBiasingOperation == 0 )
416 fOccurenceBiasingOperation = (fSharedData->fCurrentBiasingOperator)->GetProposedOccurenceBiasingOperation( &track,
this );
420 if ( fOccurenceBiasingOperation == 0 )
422 *
condition = fWrappedProcessForceCondition;
423 return fWrappedProcessPostStepGPIL;
428 fResetWrappedProcessInteractionLength =
true;
436 fBiasingForceCondition = fWrappedProcessForceCondition;
443 return fBiasingPostStepGPIL;
G4double condition(const G4ErrorSymMatrix &m)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
std::ostringstream G4ExceptionDescription
G4StepStatus GetStepStatus() const
const std::vector< const G4VPhysicalVolume * > & GetCurrentVolumes() const
virtual void ResetNumberOfInteractionLengthLeft()
const G4Step * GetStep() const
G4StepPoint * GetPreStepPoint() const
G4int GetCurrentStepNumber() const
void SetPhysicalCrossSection(G4double crossSection)
const std::vector< G4bool > & GetWasLimiting() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4VBiasingOperator * GetBiasingOperator(const G4LogicalVolume *)
G4LogicalVolume * GetLogicalVolume() const
G4VPhysicalVolume * GetVolume() const
G4double GetSampledInteractionLength() const
virtual const G4VBiasingInteractionLaw * ProvideOccurenceBiasingInteractionLaw(const G4BiasingProcessInterface *, G4ForceCondition &)=0
virtual G4double DistanceToApplyOperation(const G4Track *, G4double, G4ForceCondition *)=0
const G4String GetName() const