File indexing completed on 2025-01-18 09:57:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 #ifndef G4BiasingProcessInterface_h
0055 #define G4BiasingProcessInterface_h
0056
0057 #include "globals.hh"
0058 #include "G4VProcess.hh"
0059 #include "G4Cache.hh"
0060 #include "G4BiasingProcessSharedData.hh"
0061
0062 class G4VBiasingInteractionLaw;
0063 class G4InteractionLawPhysical;
0064 class G4VBiasingOperator;
0065 class G4VBiasingOperation;
0066 class G4ParticleChangeForOccurenceBiasing;
0067 class G4ParticleChangeForNothing;
0068
0069 class G4BiasingProcessInterface : public G4VProcess {
0070 public:
0071
0072
0073
0074 G4BiasingProcessInterface( G4String name = "biasWrapper(0)" );
0075
0076
0077
0078
0079 G4BiasingProcessInterface(G4VProcess* wrappedProcess,
0080 G4bool wrappedIsAtRest, G4bool wrappedIsAlongStep, G4bool wrappedIsPostStep,
0081 G4String useThisName = "");
0082 ~G4BiasingProcessInterface();
0083
0084 G4VProcess* GetWrappedProcess() const {return fWrappedProcess;}
0085
0086
0087
0088
0089
0090
0091
0092 G4VBiasingOperator* GetCurrentBiasingOperator() const {return fSharedData-> fCurrentBiasingOperator; }
0093 G4VBiasingOperator* GetPreviousBiasingOperator() const {return fSharedData->fPreviousBiasingOperator; }
0094
0095 G4VBiasingOperation* GetCurrentNonPhysicsBiasingOperation() const { return fNonPhysicsBiasingOperation; }
0096 G4VBiasingOperation* GetPreviousNonPhysicsBiasingOperation() const { return fPreviousNonPhysicsBiasingOperation; }
0097 G4VBiasingOperation* GetCurrentOccurenceBiasingOperation() const { return fOccurenceBiasingOperation; }
0098 G4VBiasingOperation* GetPreviousOccurenceBiasingOperation() const { return fPreviousOccurenceBiasingOperation; }
0099 G4VBiasingOperation* GetCurrentFinalStateBiasingOperation() const { return fFinalStateBiasingOperation; }
0100 G4VBiasingOperation* GetPreviousFinalStateBiasingOperation() const { return fPreviousFinalStateBiasingOperation; }
0101
0102
0103
0104
0105
0106 const std::vector< const G4BiasingProcessInterface* >& GetBiasingProcessInterfaces() const
0107 {return fSharedData-> fPublicBiasingProcessInterfaces;}
0108 const std::vector< const G4BiasingProcessInterface* >& GetPhysicsBiasingProcessInterfaces() const
0109 {return fSharedData-> fPublicPhysicsBiasingProcessInterfaces;}
0110 const std::vector< const G4BiasingProcessInterface* >& GetNonPhysicsBiasingProcessInterfaces() const
0111 {return fSharedData->fPublicNonPhysicsBiasingProcessInterfaces;}
0112
0113
0114 const G4BiasingProcessSharedData* GetSharedData() const { return fSharedData; }
0115
0116 static const G4BiasingProcessSharedData* GetSharedData( const G4ProcessManager* );
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 G4bool GetIsFirstPostStepGPILInterface(G4bool physOnly = true) const;
0132 G4bool GetIsLastPostStepGPILInterface(G4bool physOnly = true) const;
0133 G4bool GetIsFirstPostStepDoItInterface(G4bool physOnly = true) const;
0134 G4bool GetIsLastPostStepDoItInterface(G4bool physOnly = true) const;
0135
0136 G4bool IsFirstPostStepGPILInterface(G4bool physOnly = true) const;
0137 G4bool IsLastPostStepGPILInterface(G4bool physOnly = true) const;
0138 G4bool IsFirstPostStepDoItInterface(G4bool physOnly = true) const;
0139 G4bool IsLastPostStepDoItInterface(G4bool physOnly = true) const;
0140
0141 G4bool GetWrappedProcessIsAtRest() const { return fWrappedProcessIsAtRest; }
0142 G4bool GetWrappedProcessIsAlong() const { return fWrappedProcessIsAlong; }
0143 G4bool GetWrappedProcessIsPost() const { return fWrappedProcessIsPost; }
0144
0145
0146
0147 G4double GetPreviousStepSize() const { return fPreviousStepSize;}
0148 G4double GetCurrentMinimumStep() const { return fCurrentMinimumStep;}
0149 G4double GetProposedSafety() const { return fProposedSafety;}
0150 void SetProposedSafety(G4double sft) { fProposedSafety = sft;}
0151
0152 G4double GetPostStepGPIL() const { return fBiasingPostStepGPIL; }
0153 G4double GetAlongStepGPIL() const { return fWrappedProcessAlongStepGPIL; }
0154
0155
0156
0157
0158
0159 public:
0160
0161 void StartTracking(G4Track* track);
0162 void EndTracking();
0163
0164
0165 virtual G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
0166 G4double previousStepSize,
0167 G4ForceCondition* condition);
0168 virtual G4VParticleChange* PostStepDoIt(const G4Track& track,
0169 const G4Step& step);
0170
0171 virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
0172 G4double previousStepSize,
0173 G4double currentMinimumStep,
0174 G4double& proposedSafety,
0175 G4GPILSelection* selection);
0176 virtual G4VParticleChange* AlongStepDoIt(const G4Track& track,
0177 const G4Step& step);
0178
0179 virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&,
0180 G4ForceCondition*);
0181 virtual G4VParticleChange* AtRestDoIt(const G4Track&,
0182 const G4Step&);
0183
0184 virtual G4bool IsApplicable(const G4ParticleDefinition& pd);
0185 virtual void BuildPhysicsTable(const G4ParticleDefinition& pd);
0186 virtual void PreparePhysicsTable(const G4ParticleDefinition& pd);
0187 virtual G4bool StorePhysicsTable(const G4ParticleDefinition* pd,
0188 const G4String& s, G4bool f);
0189 virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition* pd,
0190 const G4String& s, G4bool f);
0191
0192 virtual void SetProcessManager(const G4ProcessManager*);
0193 virtual const G4ProcessManager* GetProcessManager();
0194
0195 virtual void ResetNumberOfInteractionLengthLeft();
0196
0197
0198
0199
0200 virtual void SetMasterProcess(G4VProcess* masterP);
0201 virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition& pd);
0202 virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition& pd);
0203
0204
0205 private:
0206
0207 void SetUpFirstLastFlags();
0208 void ResetForUnbiasedTracking();
0209 void ReorderBiasingVectorAsGPIL();
0210
0211 G4Track* fCurrentTrack;
0212 G4double fPreviousStepSize;
0213 G4double fCurrentMinimumStep;
0214 G4double fProposedSafety;
0215
0216 G4VBiasingOperation* fOccurenceBiasingOperation;
0217 G4VBiasingOperation* fFinalStateBiasingOperation;
0218 G4VBiasingOperation* fNonPhysicsBiasingOperation;
0219 G4VBiasingOperation* fPreviousOccurenceBiasingOperation;
0220 G4VBiasingOperation* fPreviousFinalStateBiasingOperation;
0221 G4VBiasingOperation* fPreviousNonPhysicsBiasingOperation;
0222
0223 G4bool fResetWrappedProcessInteractionLength;
0224
0225 G4VProcess* fWrappedProcess;
0226 const G4bool fIsPhysicsBasedBiasing;
0227 const G4bool fWrappedProcessIsAtRest;
0228 const G4bool fWrappedProcessIsAlong;
0229 const G4bool fWrappedProcessIsPost;
0230
0231
0232 G4double fWrappedProcessPostStepGPIL;
0233 G4double fBiasingPostStepGPIL;
0234 G4double fWrappedProcessInteractionLength;
0235 G4ForceCondition fWrappedProcessForceCondition;
0236 G4ForceCondition fBiasingForceCondition;
0237 G4double fWrappedProcessAlongStepGPIL;
0238 G4double fBiasingAlongStepGPIL;
0239 G4GPILSelection fWrappedProcessGPILSelection;
0240 G4GPILSelection fBiasingGPILSelection;
0241
0242 const G4VBiasingInteractionLaw* fBiasingInteractionLaw;
0243 const G4VBiasingInteractionLaw* fPreviousBiasingInteractionLaw;
0244 G4InteractionLawPhysical* fPhysicalInteractionLaw;
0245 G4ParticleChangeForOccurenceBiasing* fOccurenceBiasingParticleChange;
0246 G4ParticleChangeForNothing* fDummyParticleChange;
0247 G4bool fFirstLastFlags[8];
0248 G4int IdxFirstLast(G4int firstLast, G4int GPILDoIt, G4int physAll) const
0249 {
0250
0251
0252 return 4*firstLast + 2*GPILDoIt + physAll;
0253 }
0254
0255
0256
0257 void InvokeWrappedProcessPostStepGPIL( const G4Track& track,
0258 G4double previousStepSize,
0259 G4ForceCondition* condition );
0260
0261 G4bool fIamFirstGPIL;
0262
0263
0264
0265 static G4Cache<G4bool> fResetInteractionLaws;
0266 static G4Cache<G4bool> fCommonStart;
0267 static G4Cache<G4bool> fCommonEnd;
0268 static G4Cache<G4bool> fDoCommonConfigure;
0269
0270 const G4ProcessManager* fProcessManager;
0271
0272
0273
0274 G4BiasingProcessSharedData* fSharedData;
0275
0276 };
0277
0278 #endif