40 fOperators.Push_back(
this);
42 if ( fStateNotifier.Get() ==
nullptr )
48 auto it = fLogicalToSetupMap.Find(logical);
49 if ( it == fLogicalToSetupMap.End() )
51 fLogicalToSetupMap[logical] =
this;
53 else if ( (*it).second !=
this )
56 ed <<
"Biasing operator `" <<
GetName()
57 <<
"' can not be attached to Logical volume `"
58 << logical->
GetName() <<
"' which is already used by another operator !"
65const std::vector < G4VBiasingOperator* >&
68 return fOperators.Get();
73 auto it = fLogicalToSetupMap.Find(logical);
74 if ( it == fLogicalToSetupMap.End() ) {
return nullptr; }
75 else {
return (*it).second; }
81 return fOccurenceBiasingOperation;
87 return fFinalStateBiasingOperation;
93 return fNonPhysicsBiasingOperation;
102 fPreviousBiasingAppliedCase = biasingCase;
103 fPreviousAppliedOccurenceBiasingOperation =
nullptr;
104 fPreviousAppliedFinalStateBiasingOperation =
nullptr;
105 fPreviousAppliedNonPhysicsBiasingOperation =
nullptr;
106 switch ( biasingCase )
111 fPreviousAppliedNonPhysicsBiasingOperation = operationApplied ;
114 fPreviousAppliedFinalStateBiasingOperation = operationApplied;
117 G4Exception(
"G4VBiasingOperator::ReportOperationApplied(...)",
119 "Internal logic error, please report !");
122 G4Exception(
"G4VBiasingOperator::ReportOperationApplied(...)",
124 "Internal logic error, please report !");
126 OperationApplied( callingProcess, biasingCase, operationApplied, particleChangeProduced );
133 G4double weightForOccurenceInteraction,
137 fPreviousBiasingAppliedCase = biasingCase;
138 fPreviousAppliedOccurenceBiasingOperation = occurenceOperationApplied;
139 fPreviousAppliedFinalStateBiasingOperation = finalStateOperationApplied;
140 OperationApplied( callingProcess, biasingCase, occurenceOperationApplied, weightForOccurenceInteraction, finalStateOperationApplied, particleChangeProduced );
149 fOccurenceBiasingOperation = nullptr ;
150 fFinalStateBiasingOperation = nullptr ;
151 fNonPhysicsBiasingOperation = nullptr ;
152 fPreviousProposedOccurenceBiasingOperation = nullptr ;
153 fPreviousProposedFinalStateBiasingOperation = nullptr ;
154 fPreviousProposedNonPhysicsBiasingOperation = nullptr ;
155 fPreviousAppliedOccurenceBiasingOperation = nullptr ;
156 fPreviousAppliedFinalStateBiasingOperation = nullptr ;
157 fPreviousAppliedNonPhysicsBiasingOperation = nullptr ;
158 fPreviousBiasingAppliedCase =
BAC_None ;
195 for (
auto i = 0; i < (
G4int)G4VBiasingOperator::fOperators.Size(); ++i )
197 G4VBiasingOperator::fOperators[i]->StartRun();
200 fPreviousState = requestedState;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4BiasingOperatorStateNotifier()
G4bool Notify(G4ApplicationState requestedState)
const G4String & GetName() const
virtual void ExitBiasing(const G4Track *track, const G4BiasingProcessInterface *callingProcess)
const G4String & GetName() const
friend class G4BiasingOperatorStateNotifier
G4VBiasingOperation * GetProposedOccurenceBiasingOperation(const G4Track *track, const G4BiasingProcessInterface *callingProcess)
virtual void OperationApplied(const G4BiasingProcessInterface *callingProcess, G4BiasingAppliedCase biasingCase, G4VBiasingOperation *operationApplied, const G4VParticleChange *particleChangeProduced)
virtual G4VBiasingOperation * ProposeFinalStateBiasingOperation(const G4Track *track, const G4BiasingProcessInterface *callingProcess)=0
virtual G4VBiasingOperation * ProposeNonPhysicsBiasingOperation(const G4Track *track, const G4BiasingProcessInterface *callingProcess)=0
void AttachTo(const G4LogicalVolume *)
static const std::vector< G4VBiasingOperator * > & GetBiasingOperators()
G4VBiasingOperation * GetProposedNonPhysicsBiasingOperation(const G4Track *track, const G4BiasingProcessInterface *callingProcess)
static G4VBiasingOperator * GetBiasingOperator(const G4LogicalVolume *)
void ExitingBiasing(const G4Track *track, const G4BiasingProcessInterface *callingProcess)
G4VBiasingOperator(const G4String &name)
virtual G4VBiasingOperation * ProposeOccurenceBiasingOperation(const G4Track *track, const G4BiasingProcessInterface *callingProcess)=0
void ReportOperationApplied(const G4BiasingProcessInterface *callingProcess, G4BiasingAppliedCase biasingCase, G4VBiasingOperation *operationApplied, const G4VParticleChange *particleChangeProduced)
G4VBiasingOperation * GetProposedFinalStateBiasingOperation(const G4Track *track, const G4BiasingProcessInterface *callingProcess)
G4VStateDependent(G4bool bottom=false)