44 fCurrentTrack ( nullptr ),
45 fPreviousStepSize (-1.0), fCurrentMinimumStep( -1.0 ), fProposedSafety ( -1.0),
46 fOccurenceBiasingOperation( nullptr ), fFinalStateBiasingOperation( nullptr ), fNonPhysicsBiasingOperation( nullptr ),
47 fPreviousOccurenceBiasingOperation( nullptr ), fPreviousFinalStateBiasingOperation( nullptr ), fPreviousNonPhysicsBiasingOperation( nullptr ),
48 fResetWrappedProcessInteractionLength( true ),
49 fWrappedProcess ( nullptr ),
50 fIsPhysicsBasedBiasing ( false ),
51 fWrappedProcessIsAtRest ( false ),
52 fWrappedProcessIsAlong ( false ),
53 fWrappedProcessIsPost ( false ),
54 fWrappedProcessPostStepGPIL ( -1.0 ),
55 fBiasingPostStepGPIL ( -1.0 ),
56 fWrappedProcessInteractionLength ( -1.0 ),
57 fWrappedProcessForceCondition (
NotForced ),
59 fWrappedProcessAlongStepGPIL ( -1.0 ),
60 fBiasingAlongStepGPIL ( -1.0 ),
63 fBiasingInteractionLaw ( nullptr ),
64 fPreviousBiasingInteractionLaw ( nullptr ),
65 fPhysicalInteractionLaw ( nullptr ),
66 fOccurenceBiasingParticleChange ( nullptr ),
67 fDummyParticleChange ( nullptr ),
68 fIamFirstGPIL ( false ),
69 fProcessManager ( nullptr ),
70 fSharedData ( nullptr )
83 :
G4VProcess( useThisName !=
"" ? useThisName :
"biasWrapper("+wrappedProcess->GetProcessName()+
")",
84 wrappedProcess->GetProcessType()),
85 fCurrentTrack ( nullptr ),
86 fPreviousStepSize (-1.0), fCurrentMinimumStep( -1.0 ), fProposedSafety ( -1.0),
87 fOccurenceBiasingOperation( nullptr ), fFinalStateBiasingOperation( nullptr ), fNonPhysicsBiasingOperation( nullptr ),
88 fPreviousOccurenceBiasingOperation( nullptr ), fPreviousFinalStateBiasingOperation( nullptr ), fPreviousNonPhysicsBiasingOperation( nullptr ),
89 fResetWrappedProcessInteractionLength ( false ),
90 fWrappedProcess ( wrappedProcess ),
91 fIsPhysicsBasedBiasing ( true ),
92 fWrappedProcessIsAtRest ( wrappedIsAtRest ),
93 fWrappedProcessIsAlong ( wrappedIsAlongStep ),
94 fWrappedProcessIsPost ( wrappedIsPostStep ),
95 fWrappedProcessPostStepGPIL ( -1.0 ),
96 fBiasingPostStepGPIL ( -1.0 ),
97 fWrappedProcessInteractionLength ( -1.0 ),
98 fWrappedProcessForceCondition (
NotForced ),
100 fWrappedProcessAlongStepGPIL ( -1.0 ),
101 fBiasingAlongStepGPIL ( -1.0 ),
104 fBiasingInteractionLaw ( nullptr ),
105 fPreviousBiasingInteractionLaw ( nullptr ),
106 fPhysicalInteractionLaw ( nullptr ),
107 fOccurenceBiasingParticleChange ( nullptr ),
108 fIamFirstGPIL ( false ),
109 fProcessManager ( nullptr ),
110 fSharedData ( nullptr )
144 return (*itr).second;
228 G4bool firstStepInParallelVolume =
false;
233 size_t iParallel = 0;
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;
269 if ( firstStepInVolume )
276 ed <<
" Biasing operators are defined at the same place in mass and parallel geometries ! Found:\n";
278 ed <<
" - `" << newOperator->
GetName() <<
"' in mass geometry.\n";
280 G4Exception(
" G4BiasingProcessInterface::PostStepGetPhysicalInteractionLength(...)",
288 if ( firstStepInVolume || firstStepInParallelVolume )
351 G4double usedPreviousStepSize = previousStepSize;
371 usedPreviousStepSize = 0.0;
462 return particleChange;
485 G4bool forceBiasedFinalState =
false;
501 return finalStateParticleChange;
505 if ( forceBiasedFinalState )
508 return finalStateParticleChange;
513 G4double weightForInteraction = 1.0;
523 ed <<
"Internal inconsistency in cross-section handling. Please report !" <<
G4endl;
524 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
534 if ( weightForInteraction <= 0. )
537 ed <<
" Negative interaction weight : w_I = "
538 << weightForInteraction <<
544 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
674 G4double weightForNonInteraction (1.0);
677 weightForNonInteraction =
683 if ( weightForNonInteraction <= 0. )
686 ed <<
" Negative non interaction weight : w_NI = " << weightForNonInteraction <<
691 G4Exception(
" G4BiasingProcessInterface::AlongStepDoIt(...)",
814 fSharedData-> fBiasingProcessInterfaces.push_back(
this );
815 fSharedData-> fPublicBiasingProcessInterfaces.push_back(
this );
818 fSharedData-> fPhysicsBiasingProcessInterfaces.push_back(
this );
819 fSharedData-> fPublicPhysicsBiasingProcessInterfaces.push_back(
this );
823 fSharedData-> fNonPhysicsBiasingProcessInterfaces.push_back(
this );
824 fSharedData-> fPublicNonPhysicsBiasingProcessInterfaces.push_back(
this );
890 G4int iPhys = ( physOnly ) ? 1 : 0;
897 G4int iPhys = ( physOnly ) ? 1 : 0;
904 G4int iPhys = ( physOnly ) ? 1 : 0;
911 G4int iPhys = ( physOnly ) ? 1 : 0;
921 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
922 if ( thisIdx < 0 )
return false;
931 if ( thisIdx > thatIdx )
948 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
949 if ( thisIdx < 0 )
return false;
958 if ( thisIdx < thatIdx )
975 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
976 if ( thisIdx < 0 )
return false;
985 if ( thisIdx > thatIdx )
1002 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
1003 if ( thisIdx < 0 )
return false;
1012 if ( thisIdx < thatIdx )
1026 for (
G4int iPhys = 0; iPhys < 2; iPhys++ )
1028 G4bool physOnly = ( iPhys == 1 );
1053 G4double usedPreviousStepSize = previousStepSize;
1065 usedPreviousStepSize = 0.0;
1089 for (
size_t j = 0; j < tmpProcess.size(); j++ )
1091 if ( (*pv)(i) == tmpProcess[j] )
1093 (
fSharedData -> fBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1094 (
fSharedData -> fPublicBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1097 (
fSharedData -> fPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1098 (
fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1102 (
fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1103 (
fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
G4BiasingProcessSharedData * fSharedData
virtual const G4ProcessManager * GetProcessManager()
G4bool fResetWrappedProcessInteractionLength
const G4String GetName() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
G4VProcess * fWrappedProcess
std::ostringstream G4ExceptionDescription
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &track, G4ForceCondition *condition)=0
static G4Cache< G4bool > fResetInteractionLaws
G4LogicalVolume * GetLogicalVolume() const
virtual void ResetNumberOfInteractionLengthLeft()
void StartTracking(G4Track *track)
G4VBiasingOperator * fMassGeometryOperator
G4VBiasingOperator * fPreviousBiasingOperator
G4ForceCondition fBiasingForceCondition
G4StepPoint * GetPreStepPoint() const
void SetOccurenceWeightForInteraction(G4double w)
G4VBiasingOperation * fPreviousFinalStateBiasingOperation
G4ParticleChangeForOccurenceBiasing * fOccurenceBiasingParticleChange
const G4VProcess * GetMasterProcess() const
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const
G4bool IsFirstPostStepGPILInterface(G4bool physOnly=true) const
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
virtual G4bool IsApplicable(const G4ParticleDefinition &pd)
G4VBiasingOperator * fParallelGeometryOperator
G4double fPreviousStepSize
const G4bool fIsPhysicsBasedBiasing
virtual void BuildPhysicsTable(const G4ParticleDefinition &pd)
virtual G4bool IsApplicable(const G4ParticleDefinition &)
G4BiasingProcessInterface(G4String name="biasWrapper(0)")
void SetSecondaryWeightByProcess(G4bool)
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *pd, const G4String &s, G4bool f)
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const =0
G4bool GetIsLastPostStepGPILInterface(G4bool physOnly=true) const
virtual G4GPILSelection ProposeGPILSelection(const G4GPILSelection wrappedProcessSelection)
virtual void PreparePhysicsTable(const G4ParticleDefinition &)
G4int GetCurrentStepNumber() const
G4double condition(const G4ErrorSymMatrix &m)
G4double GetCurrentInteractionLength() const
G4VBiasingOperation * fFinalStateBiasingOperation
G4bool IsFirstPostStepDoItInterface(G4bool physOnly=true) const
G4double GetSampledInteractionLength() const
virtual const G4VBiasingInteractionLaw * ProvideOccurenceBiasingInteractionLaw(const G4BiasingProcessInterface *, G4ForceCondition &)=0
const G4String & GetName() const
static const std::vector< G4VBiasingOperator * > & GetBiasingOperators()
virtual const G4ProcessManager * GetProcessManager()
static G4Cache< G4bool > fDoCommonConfigure
virtual G4bool IsEffectiveCrossSectionInfinite() const
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
G4GPILSelection fBiasingGPILSelection
virtual void EndTracking()
G4double fBiasingPostStepGPIL
std::vector< G4BiasingProcessInterface * > fPhysicsBiasingProcessInterfaces
static G4Cache< G4bool > fCommonStart
virtual void StartTracking(G4Track *)
G4GPILSelection fWrappedProcessGPILSelection
G4StepStatus GetStepStatus() const
G4bool IsLastPostStepDoItInterface(G4bool physOnly=true) const
G4VBiasingOperation * fPreviousNonPhysicsBiasingOperation
virtual void Initialize(const G4Track &track)
void ReorderBiasingVectorAsGPIL()
~G4BiasingProcessInterface()
G4int IdxFirstLast(G4int firstLast, G4int GPILDoIt, G4int physAll) const
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &, G4bool)
G4bool IsLastPostStepGPILInterface(G4bool physOnly=true) const
void SetUpFirstLastFlags()
void SetPhysicalCrossSection(G4double crossSection)
const G4VBiasingInteractionLaw * fBiasingInteractionLaw
virtual void SetProcessManager(const G4ProcessManager *)
G4double GetStepLength() const
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *)
virtual G4VParticleChange * GenerateBiasingFinalState(const G4Track *, const G4Step *)=0
const std::vector< const G4VPhysicalVolume * > & GetCurrentVolumes() const
G4VBiasingOperation * fNonPhysicsBiasingOperation
virtual G4double DistanceToApplyOperation(const G4Track *, G4double, G4ForceCondition *)=0
G4VBiasingOperation * fPreviousOccurenceBiasingOperation
void InvokeWrappedProcessPostStepGPIL(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4VProcess * GetWrappedProcess() const
G4double fWrappedProcessPostStepGPIL
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)=0
const G4String & GetProcessName() const
virtual void AlongMoveBy(const G4BiasingProcessInterface *, const G4Step *, G4double)
virtual G4bool IsSingular() const
G4bool fFirstLastFlags[8]
const std::vector< G4bool > & GetWasLimiting() const
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData)=0
G4bool GetIsFirstPostStepGPILInterface(G4bool physOnly=true) const
const G4Step * GetStep() const
virtual void PreparePhysicsTable(const G4ParticleDefinition &pd)
void Put(const value_type &val) const
const G4ProcessManager * fProcessManager
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition &pd)
virtual void ResetNumberOfInteractionLengthLeft()
void ResetForUnbiasedTracking()
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)=0
virtual G4double ProposeAlongStepLimit(const G4BiasingProcessInterface *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
iterator Find(const key_type &k)
G4ParallelGeometriesLimiterProcess * fParallelGeometriesLimiterProcess
G4double fWrappedProcessInteractionLength
G4ParticleChangeForNothing * fDummyParticleChange
static G4Cache< G4bool > fCommonEnd
G4double fCurrentMinimumStep
virtual G4VParticleChange * AtRestDoIt(const G4Track &, const G4Step &)
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *pd, const G4String &s, G4bool f)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
virtual G4VParticleChange * ApplyFinalStateBiasing(const G4BiasingProcessInterface *, const G4Track *, const G4Step *, G4bool &)=0
static G4MapCache< const G4ProcessManager *, G4BiasingProcessSharedData * > fSharedDataMap
G4TrackStatus GetTrackStatus() const
G4bool fLeavingPreviousOperator
void SetProcessSubType(G4int)
void SetWrappedParticleChange(G4VParticleChange *wpc)
G4bool GetIsLastPostStepDoItInterface(G4bool physOnly=true) const
virtual void SetMasterProcess(G4VProcess *masterP)
G4bool GetIsFirstPostStepDoItInterface(G4bool physOnly=true) const
static G4VBiasingOperator * GetBiasingOperator(const G4LogicalVolume *)
G4VBiasingOperator * fCurrentBiasingOperator
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &, G4bool)
virtual void SetProcessManager(const G4ProcessManager *)
G4ForceCondition fWrappedProcessForceCondition
G4double fWrappedProcessAlongStepGPIL
void SetOccurenceWeightForNonInteraction(G4double w)
G4TrackStatus GetTrackStatus() const
virtual void SetMasterProcess(G4VProcess *masterP)
const G4BiasingProcessSharedData * GetSharedData() const
void ProposeTrackStatus(G4TrackStatus status)
virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition &)
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)=0
virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition &pd)
const G4bool fWrappedProcessIsAlong
virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition &part)
const G4VBiasingInteractionLaw * fPreviousBiasingInteractionLaw
G4VPhysicalVolume * GetVolume() const
std::vector< G4BiasingProcessInterface * > fBiasingProcessInterfaces
G4InteractionLawPhysical * fPhysicalInteractionLaw
G4double fBiasingAlongStepGPIL
G4VBiasingOperation * fOccurenceBiasingOperation
G4int GetProcessSubType() const
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &step)