Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 ////////////////////////////////////////////// 27 // Class: G4VEMAdjointModel 28 // Author: L. Desorgher 29 // Organisation: SpaceIT GmbH 30 // 31 // Base class for Adjoint EM model. It is bas 32 // G4VEmModel. 33 ////////////////////////////////////////////// 34 35 #ifndef G4VEmAdjointModel_h 36 #define G4VEmAdjointModel_h 1 37 38 #include "globals.hh" 39 #include "G4ParticleDefinition.hh" 40 #include "G4VEmModel.hh" 41 42 class G4AdjointCSMatrix; 43 class G4AdjointCSManager; 44 class G4Material; 45 class G4MaterialCutsCouple; 46 class G4ParticleChange; 47 class G4Region; 48 class G4Track; 49 50 class G4VEmAdjointModel 51 { 52 public: 53 explicit G4VEmAdjointModel(const G4String& n 54 55 virtual ~G4VEmAdjointModel(); 56 57 //------------------------------------------ 58 // Virtual methods to be implemented for the 59 //------------------------------------------ 60 61 virtual void SampleSecondaries(const G4Track 62 G4ParticleCha 63 64 //------------------------------------------ 65 // Methods for adjoint processes 66 //------------------------------------------ 67 68 virtual G4double AdjointCrossSection(const G 69 G4doubl 70 G4bool 71 72 // The implementation of the DiffCrossSectio 73 // energy loss process. For the photoelectri 74 // the method should be redefined 75 virtual G4double DiffCrossSectionPerAtomPrim 76 G4double kinEnergyProj, // kin energy of 77 G4double kinEnergyProd, // kinetic energy 78 G4double Z, G4double A = 0.); 79 80 virtual G4double DiffCrossSectionPerAtomPrim 81 G4double kinEnergyProj, // kin energy 82 G4double kinEnergyScatProj, // kin energy 83 G4double Z, G4double A = 0.); 84 85 virtual G4double DiffCrossSectionPerVolumePr 86 const G4Material* aMaterial, 87 G4double kinEnergyProj, // kin energy of 88 G4double kinEnergyProd // kinetic energy 89 ); 90 91 virtual G4double DiffCrossSectionPerVolumePr 92 const G4Material* aMaterial, 93 G4double kinEnergyProj, // kin energy 94 G4double kinEnergyScatProj // kinetic ene 95 ); 96 97 // Energy limits of adjoint secondary 98 //------------------ 99 100 virtual G4double GetSecondAdjEnergyMaxForSca 101 G4double primAdjEnergy); 102 103 virtual G4double GetSecondAdjEnergyMinForSca 104 G4double primAdjEnergy, G4double tcut = 0. 105 106 virtual G4double GetSecondAdjEnergyMaxForPro 107 108 virtual G4double GetSecondAdjEnergyMinForPro 109 110 // Other Methods 111 //--------------- 112 113 void DefineCurrentMaterial(const G4MaterialC 114 115 std::vector<std::vector<double>*> 116 ComputeAdjointCrossSectionVectorPerAtomForSe 117 118 119 120 std::vector<std::vector<double>*> 121 ComputeAdjointCrossSectionVectorPerAtomForSc 122 G4double kinEnergyProd, G4double Z, G4doub 123 G4int nbin_pro_decade = 10); 124 125 std::vector<std::vector<double>*> 126 ComputeAdjointCrossSectionVectorPerVolumeFor 127 G4Material* aMaterial, G4double kinEnergyP 128 129 std::vector<std::vector<double>*> 130 ComputeAdjointCrossSectionVectorPerVolumeFor 131 G4Material* aMaterial, G4double kinEnergyP 132 133 inline void SetCSMatrices(std::vector<G4Adjo 134 std::vector<G4Adjo 135 { 136 fCSMatrixProdToProjBackScat = Vec1CSMatrix 137 fCSMatrixProjToProjBackScat = Vec2CSMatrix 138 }; 139 140 inline G4ParticleDefinition* 141 GetAdjointEquivalentOfDirectPrimaryParticleD 142 { 143 return fAdjEquivDirectPrimPart; 144 } 145 146 inline G4ParticleDefinition* 147 GetAdjointEquivalentOfDirectSecondaryParticl 148 { 149 return fAdjEquivDirectSecondPart; 150 } 151 152 inline G4double GetHighEnergyLimit() const { 153 154 inline G4double GetLowEnergyLimit() const { 155 156 void SetHighEnergyLimit(G4double aVal); 157 158 void SetLowEnergyLimit(G4double aVal); 159 160 inline void DefineDirectEMModel(G4VEmModel* 161 162 void SetAdjointEquivalentOfDirectPrimaryPart 163 G4ParticleDefinition* aPart); 164 165 inline void SetAdjointEquivalentOfDirectSeco 166 G4ParticleDefinition* aPart) 167 { 168 fAdjEquivDirectSecondPart = aPart; 169 } 170 171 inline void SetSecondPartOfSameType(G4bool a 172 { 173 fSecondPartSameType = aBool; 174 } 175 176 inline G4bool GetSecondPartOfSameType() cons 177 178 inline void SetUseMatrix(G4bool aBool) { fUs 179 180 inline void SetUseMatrixPerElement(G4bool aB 181 { 182 fUseMatrixPerElement = aBool; 183 } 184 185 inline void SetUseOnlyOneMatrixForAllElement 186 { 187 fOneMatrixForAllElements = aBool; 188 } 189 190 inline void SetApplyCutInRange(G4bool aBool) 191 192 inline G4bool GetUseMatrix() const { return 193 194 inline G4bool GetUseMatrixPerElement() const 195 196 inline G4bool GetUseOnlyOneMatrixForAllEleme 197 { 198 return fOneMatrixForAllElements; 199 } 200 201 inline G4bool GetApplyCutInRange() const { r 202 203 inline const G4String& GetName() const { ret 204 205 inline virtual void SetCSBiasingFactor(G4dou 206 { 207 fCsBiasingFactor = aVal; 208 } 209 210 inline void SetCorrectWeightForPostStepInMod 211 { 212 fInModelWeightCorr = aBool; 213 } 214 215 inline void SetAdditionalWeightCorrectionFac 216 G4double factor) 217 { 218 fOutsideWeightFactor = factor; 219 } 220 221 G4VEmAdjointModel(G4VEmAdjointModel&) = dele 222 G4VEmAdjointModel& operator=(const G4VEmAdjo 223 224 protected: 225 G4double DiffCrossSectionFunction1(G4double 226 227 G4double DiffCrossSectionFunction2(G4double 228 229 // General methods to sample secondary energ 230 G4double SampleAdjSecEnergyFromCSMatrix(std: 231 G4do 232 G4bo 233 234 G4double SampleAdjSecEnergyFromCSMatrix(G4do 235 G4bo 236 237 void SelectCSMatrix(G4bool isScatProjToProj) 238 239 virtual G4double SampleAdjSecEnergyFromDiffC 240 G4double prim_energy, G4bool isScatProjToP 241 242 // Post Step weight correction 243 virtual void CorrectPostStepWeight(G4Particl 244 G4double 245 G4double 246 G4double 247 G4bool is 248 249 G4AdjointCSManager* fCSManager; 250 G4VEmModel* fDirectModel = nullptr; 251 252 const G4String fName; 253 254 G4Material* fSelectedMaterial = nullp 255 G4Material* fCurrentMaterial = nullp 256 G4MaterialCutsCouple* fCurrentCouple = nullp 257 258 // particle definition 259 G4ParticleDefinition* fAdjEquivDirectPrimPar 260 G4ParticleDefinition* fAdjEquivDirectSecondP 261 G4ParticleDefinition* fDirectPrimaryPart 262 263 // adjoint CS matrix for each element or mat 264 std::vector<G4AdjointCSMatrix*>* fCSMatrixPr 265 std::vector<G4AdjointCSMatrix*>* fCSMatrixPr 266 267 std::vector<G4double> fElementCSScatProjToPr 268 std::vector<G4double> fElementCSProdToProj; 269 270 G4double fKinEnergyProdForIntegration = 271 G4double fKinEnergyScatProjForIntegration = 272 273 G4double fLastCS = 0 274 G4double fLastAdjointCSForScatProjToProj = 0 275 G4double fLastAdjointCSForProdToProj = 0 276 277 G4double fPreStepEnergy = 0.; 278 279 G4double fTcutPrim = 0.; 280 G4double fTcutSecond = 0.; 281 282 // Energy limits 283 G4double fHighEnergyLimit = 0.; 284 G4double fLowEnergyLimit = 0.; 285 286 // Cross Section biasing factor 287 G4double fCsBiasingFactor = 1.; 288 289 // [1] This is needed for the forced interac 290 // correction is given outside the model whi 291 // the model. The weight should be fixed bef 292 G4double fOutsideWeightFactor = 1.; 293 294 // Needed for CS integration at the initiali 295 G4int fASelectedNucleus = 0; 296 G4int fZSelectedNucleus = 0; 297 298 std::size_t fCSMatrixUsed = 0; // Index of 299 300 G4bool fSecondPartSameType = false; 301 G4bool fInModelWeightCorr = 302 false; // correct_weight_for_post_step_in 303 304 G4bool fApplyCutInRange = true; 305 306 // Type of Model with Matrix or not 307 G4bool fUseMatrix = false; 308 G4bool fUseMatrixPerElement = false; // 309 G4bool fOneMatrixForAllElements = false; 310 }; 311 312 #endif 313