47 fWrappedProcess ( 0 ),
48 fIsPhysicsBasedBiasing ( false ),
49 fWrappedProcessIsAtRest ( false ),
50 fWrappedProcessIsAlong ( false ),
51 fWrappedProcessIsPost ( false ),
52 fWrappedProcessInteractionLength( -1.0 ),
53 fBiasingInteractionLaw ( 0 ),
54 fPhysicalInteractionLaw ( 0 ),
55 fOccurenceBiasingParticleChange ( 0 ),
56 fIamFirstGPIL ( false ),
70 :
G4VProcess( useThisName !=
"" ? useThisName :
"biasWrapper("+wrappedProcess->GetProcessName()+
")",
71 wrappedProcess->GetProcessType()),
72 fWrappedProcess ( wrappedProcess ),
73 fIsPhysicsBasedBiasing ( true ),
74 fWrappedProcessIsAtRest ( wrappedIsAtRest ),
75 fWrappedProcessIsAlong ( wrappedIsAlongStep ),
76 fWrappedProcessIsPost ( wrappedIsPostStep ),
77 fWrappedProcessInteractionLength( -1.0 ),
78 fBiasingInteractionLaw ( 0 ),
79 fPhysicalInteractionLaw ( 0 ),
80 fOccurenceBiasingParticleChange ( 0 ),
81 fIamFirstGPIL ( false ),
117 return (*itr).second;
180 if ( biasingData )
delete biasingData;
184 for (
size_t i2nd = 0 ; i2nd < secondaries->size() ; i2nd++ )
187 if ( biasingData )
delete biasingData;
216 if ( firstStepInVolume )
275 G4double usedPreviousStepSize = previousStepSize;
295 usedPreviousStepSize = 0.0;
388 return particleChange;
411 G4bool forceBiasedFinalState =
false;
427 return finalStateParticleChange;
431 if ( forceBiasedFinalState )
434 return finalStateParticleChange;
438 G4double weightForInteraction = 1.0;
448 ed <<
"Internal inconsistency in cross-section handling. Please report !" <<
G4endl;
449 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
459 if ( weightForInteraction <= 0. )
462 ed <<
" Negative interaction weight : w_I = "
463 << weightForInteraction <<
469 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
596 G4double weightForNonInteraction (1.0);
599 weightForNonInteraction =
605 if ( weightForNonInteraction <= 0. )
608 ed <<
" Negative non interaction weight : w_NI = " << weightForNonInteraction <<
613 G4Exception(
" G4BiasingProcessInterface::AlongStepDoIt(...)",
718 fSharedData-> fBiasingProcessInterfaces.push_back(
this );
719 fSharedData-> fPublicBiasingProcessInterfaces.push_back(
this );
722 fSharedData-> fPhysicsBiasingProcessInterfaces.push_back(
this );
723 fSharedData-> fPublicPhysicsBiasingProcessInterfaces.push_back(
this );
727 fSharedData-> fNonPhysicsBiasingProcessInterfaces.push_back(
this );
728 fSharedData-> fPublicNonPhysicsBiasingProcessInterfaces.push_back(
this );
778 G4int iPhys = ( physOnly ) ? 1 : 0;
785 G4int iPhys = ( physOnly ) ? 1 : 0;
792 G4int iPhys = ( physOnly ) ? 1 : 0;
799 G4int iPhys = ( physOnly ) ? 1 : 0;
809 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
819 if ( thisIdx > thatIdx )
835 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
845 if ( thisIdx < thatIdx )
861 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
871 if ( thisIdx > thatIdx )
887 for (
G4int i = 0; i < pv->
size(); i++ )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
897 if ( thisIdx < thatIdx )
910 for (
G4int iPhys = 0; iPhys < 2; iPhys++ )
912 G4bool physOnly = ( iPhys == 1 );
937 G4double usedPreviousStepSize = previousStepSize;
949 usedPreviousStepSize = 0.0;
963 (
fSharedData -> fBiasingProcessInterfaces ) . clear();
964 (
fSharedData -> fPhysicsBiasingProcessInterfaces ) . clear();
965 (
fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . clear();
966 (
fSharedData -> fPublicBiasingProcessInterfaces ) . clear();
967 (
fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . clear();
968 (
fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . clear();
973 for (
size_t j = 0; j < tmpProcess.size(); j++ )
975 if ( (*pv)(i) == tmpProcess[j] )
977 (
fSharedData -> fBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
978 (
fSharedData -> fPublicBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
981 (
fSharedData -> fPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
982 (
fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
986 (
fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
987 (
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
static G4BiasingTrackDataStore * GetInstance()
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)
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
G4BiasingTrackData * GetBiasingTrackData(const G4Track *track)
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
std::vector< G4Track * > G4TrackVector
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
const G4TrackVector * GetSecondary() const
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