46 fCurrentTrack ( nullptr ),
47 fPreviousStepSize (-1.0), fCurrentMinimumStep( -1.0 ), fProposedSafety ( -1.0),
48 fOccurenceBiasingOperation( nullptr ), fFinalStateBiasingOperation( nullptr ), fNonPhysicsBiasingOperation( nullptr ),
49 fPreviousOccurenceBiasingOperation( nullptr ), fPreviousFinalStateBiasingOperation( nullptr ), fPreviousNonPhysicsBiasingOperation( nullptr ),
50 fResetWrappedProcessInteractionLength( true ),
51 fWrappedProcess ( nullptr ),
52 fIsPhysicsBasedBiasing ( false ),
53 fWrappedProcessIsAtRest ( false ),
54 fWrappedProcessIsAlong ( false ),
55 fWrappedProcessIsPost ( false ),
56 fWrappedProcessPostStepGPIL ( -1.0 ),
57 fBiasingPostStepGPIL ( -1.0 ),
58 fWrappedProcessInteractionLength ( -1.0 ),
59 fWrappedProcessForceCondition (
NotForced ),
61 fWrappedProcessAlongStepGPIL ( -1.0 ),
62 fBiasingAlongStepGPIL ( -1.0 ),
65 fBiasingInteractionLaw ( nullptr ),
66 fPreviousBiasingInteractionLaw ( nullptr ),
67 fPhysicalInteractionLaw ( nullptr ),
68 fOccurenceBiasingParticleChange ( nullptr ),
69 fIamFirstGPIL ( false ),
70 fProcessManager ( nullptr ),
71 fSharedData ( nullptr )
84 :
G4VProcess( useThisName !=
"" ? useThisName :
"biasWrapper("+wrappedProcess->GetProcessName()+
")",
85 wrappedProcess->GetProcessType()),
86 fCurrentTrack ( nullptr ),
87 fPreviousStepSize (-1.0), fCurrentMinimumStep( -1.0 ), fProposedSafety ( -1.0),
88 fOccurenceBiasingOperation( nullptr ), fFinalStateBiasingOperation( nullptr ), fNonPhysicsBiasingOperation( nullptr ),
89 fPreviousOccurenceBiasingOperation( nullptr ), fPreviousFinalStateBiasingOperation( nullptr ), fPreviousNonPhysicsBiasingOperation( nullptr ),
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 )
146 return (*itr).second;
227 if ( firstStepInVolume )
286 G4double usedPreviousStepSize = previousStepSize;
306 usedPreviousStepSize = 0.0;
399 return particleChange;
422 G4bool forceBiasedFinalState =
false;
438 return finalStateParticleChange;
442 if ( forceBiasedFinalState )
445 return finalStateParticleChange;
450 G4double weightForInteraction = 1.0;
460 ed <<
"Internal inconsistency in cross-section handling. Please report !" <<
G4endl;
461 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
471 if ( weightForInteraction <= 0. )
474 ed <<
" Negative interaction weight : w_I = "
475 << weightForInteraction <<
481 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
609 G4double weightForNonInteraction (1.0);
612 weightForNonInteraction =
618 if ( weightForNonInteraction <= 0. )
621 ed <<
" Negative non interaction weight : w_NI = " << weightForNonInteraction <<
626 G4Exception(
" G4BiasingProcessInterface::AlongStepDoIt(...)",
749 fSharedData-> fBiasingProcessInterfaces.push_back(
this );
750 fSharedData-> fPublicBiasingProcessInterfaces.push_back(
this );
753 fSharedData-> fPhysicsBiasingProcessInterfaces.push_back(
this );
754 fSharedData-> fPublicPhysicsBiasingProcessInterfaces.push_back(
this );
758 fSharedData-> fNonPhysicsBiasingProcessInterfaces.push_back(
this );
759 fSharedData-> fPublicNonPhysicsBiasingProcessInterfaces.push_back(
this );
825 G4int iPhys = ( physOnly ) ? 1 : 0;
832 G4int iPhys = ( physOnly ) ? 1 : 0;
839 G4int iPhys = ( physOnly ) ? 1 : 0;
846 G4int iPhys = ( physOnly ) ? 1 : 0;
856 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
863 if ( thisIdx > thatIdx )
879 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
886 if ( thisIdx < thatIdx )
902 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
909 if ( thisIdx > thatIdx )
925 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
932 if ( thisIdx < thatIdx )
945 for (
G4int iPhys = 0; iPhys < 2; iPhys++ )
947 G4bool physOnly = ( iPhys == 1 );
972 G4double usedPreviousStepSize = previousStepSize;
984 usedPreviousStepSize = 0.0;
998 (
fSharedData -> fBiasingProcessInterfaces ) . clear();
999 (
fSharedData -> fPhysicsBiasingProcessInterfaces ) . clear();
1000 (
fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . clear();
1001 (
fSharedData -> fPublicBiasingProcessInterfaces ) . clear();
1002 (
fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . clear();
1003 (
fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . clear();
1008 for (
size_t j = 0; j < tmpProcess.size(); j++ )
1010 if ( (*pv)(i) == tmpProcess[j] )
1012 (
fSharedData -> fBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1013 (
fSharedData -> fPublicBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1016 (
fSharedData -> fPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1017 (
fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1021 (
fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1022 (
fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
virtual void SetMasterProcess(G4VProcess *masterP)
virtual void Initialize(const G4Track &track)
G4double condition(const G4ErrorSymMatrix &m)
static G4MapCache< const G4ProcessManager *, G4BiasingProcessSharedData * > fSharedDataMap
const G4VProcess * GetMasterProcess() const
virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition &pd)
G4VBiasingOperation * fPreviousFinalStateBiasingOperation
G4bool IsLastPostStepGPILInterface(G4bool physOnly=true) const
G4bool fResetWrappedProcessInteractionLength
virtual void PreparePhysicsTable(const G4ParticleDefinition &pd)
virtual G4VParticleChange * AtRestDoIt(const G4Track &, const G4Step &)
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &track, G4ForceCondition *condition)=0
virtual void SetProcessManager(const G4ProcessManager *)
G4VBiasingOperation * fFinalStateBiasingOperation
void SetWrappedParticleChange(G4VParticleChange *wpc)
static G4Cache< G4bool > fCommonEnd
G4VBiasingOperation * fNonPhysicsBiasingOperation
G4double fBiasingAlongStepGPIL
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *pd, const G4String &s, G4bool f)
G4GPILSelection fWrappedProcessGPILSelection
std::ostringstream G4ExceptionDescription
static G4Cache< G4bool > fResetInteractionLaws
G4ParticleChange * fParticleChange
G4double GetStepLength() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &pd)
virtual G4VParticleChange * ApplyFinalStateBiasing(const G4BiasingProcessInterface *, const G4Track *, const G4Step *, G4bool &)=0
G4double fBiasingPostStepGPIL
virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition &pd)
static G4Cache< G4bool > fDoCommonConfigure
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &step)
G4StepStatus GetStepStatus() const
G4ParticleChangeForNothing * fDummyParticleChange
void InvokeWrappedProcessPostStepGPIL(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4TrackStatus GetTrackStatus() const
void ResetForUnbiasedTracking()
std::vector< G4BiasingProcessInterface * > fBiasingProcessInterfaces
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)
G4double fWrappedProcessPostStepGPIL
const G4bool fIsPhysicsBasedBiasing
G4double fPreviousStepSize
virtual void SetProcessManager(const G4ProcessManager *)
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const =0
virtual void ResetNumberOfInteractionLengthLeft()
G4ForceCondition fBiasingForceCondition
G4VBiasingOperation * fPreviousOccurenceBiasingOperation
const G4ProcessManager * fProcessManager
void SetOccurenceWeightForNonInteraction(G4double w)
const G4Step * GetStep() const
const G4VBiasingInteractionLaw * fPreviousBiasingInteractionLaw
virtual G4double ProposeAlongStepLimit(const G4BiasingProcessInterface *)
G4VProcess * GetWrappedProcess() const
void SetUpFirstLastFlags()
virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition &part)
G4bool GetIsFirstPostStepGPILInterface(G4bool physOnly=true) const
G4StepPoint * GetPreStepPoint() const
virtual void StartTracking(G4Track *)
void SetSecondaryWeightByProcess(G4bool)
static G4Cache< G4bool > fCommonStart
std::vector< G4BiasingProcessInterface * > fPhysicsBiasingProcessInterfaces
G4int GetCurrentStepNumber() const
G4bool GetIsLastPostStepDoItInterface(G4bool physOnly=true) const
const G4VBiasingInteractionLaw * fBiasingInteractionLaw
G4bool GetIsLastPostStepGPILInterface(G4bool physOnly=true) const
virtual void PreparePhysicsTable(const G4ParticleDefinition &)
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const
G4bool GetIsFirstPostStepDoItInterface(G4bool physOnly=true) const
G4VBiasingOperation * fPreviousNonPhysicsBiasingOperation
G4double GetCurrentInteractionLength() const
void SetProcessSubType(G4int)
void SetPhysicalCrossSection(G4double crossSection)
void SetOccurenceWeightForInteraction(G4double w)
G4VProcess * fWrappedProcess
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &, G4bool)
const G4String & GetProcessName() const
G4ForceCondition fWrappedProcessForceCondition
const G4bool fWrappedProcessIsAlong
virtual G4VParticleChange * GenerateBiasingFinalState(const G4Track *, const G4Step *)=0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4bool IsApplicable(const G4ParticleDefinition &pd)
virtual const G4ProcessManager * GetProcessManager()
G4bool fLeavingPreviousOperator
static G4VBiasingOperator * GetBiasingOperator(const G4LogicalVolume *)
virtual G4bool IsSingular() const
virtual const G4ProcessManager * GetProcessManager()
iterator Find(const key_type &k)
G4LogicalVolume * GetLogicalVolume() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
G4VBiasingOperation * fOccurenceBiasingOperation
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)=0
G4ParticleChangeForOccurenceBiasing * fOccurenceBiasingParticleChange
G4bool IsFirstPostStepGPILInterface(G4bool physOnly=true) const
G4bool fFirstLastFlags[8]
virtual void SetMasterProcess(G4VProcess *masterP)
G4BiasingProcessInterface(G4String name="biasWrapper(0)")
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *pd, const G4String &s, G4bool f)
virtual G4GPILSelection ProposeGPILSelection(const G4GPILSelection wrappedProcessSelection)
G4VPhysicalVolume * GetVolume() const
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)=0
G4double GetSampledInteractionLength() const
static const std::vector< G4VBiasingOperator * > & GetBiasingOperators()
G4double fWrappedProcessInteractionLength
const G4String & GetName() const
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &, G4bool)
virtual G4bool IsEffectiveCrossSectionInfinite() const
G4TrackStatus GetTrackStatus() const
G4bool IsFirstPostStepDoItInterface(G4bool physOnly=true) const
virtual const G4VBiasingInteractionLaw * ProvideOccurenceBiasingInteractionLaw(const G4BiasingProcessInterface *, G4ForceCondition &)=0
virtual void AlongMoveBy(const G4BiasingProcessInterface *, const G4Step *, G4double)
G4InteractionLawPhysical * fPhysicalInteractionLaw
virtual void ResetNumberOfInteractionLengthLeft()
G4BiasingProcessSharedData * fSharedData
virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition &)
void ProposeTrackStatus(G4TrackStatus status)
virtual void EndTracking()
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)=0
G4double fWrappedProcessAlongStepGPIL
G4double fCurrentMinimumStep
G4bool IsLastPostStepDoItInterface(G4bool physOnly=true) const
G4int IdxFirstLast(G4int firstLast, G4int GPILDoIt, G4int physAll) const
void ReorderBiasingVectorAsGPIL()
G4VBiasingOperator * fPreviousBiasingOperator
void Put(const value_type &val) const
G4int GetProcessSubType() const
G4GPILSelection fBiasingGPILSelection
void StartTracking(G4Track *track)
virtual G4double DistanceToApplyOperation(const G4Track *, G4double, G4ForceCondition *)=0
virtual G4bool IsApplicable(const G4ParticleDefinition &)
G4VBiasingOperator * fCurrentBiasingOperator
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *)
~G4BiasingProcessInterface()
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData)=0
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
const G4BiasingProcessSharedData * GetSharedData() const