Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: G4PAIModel.hh 105869 2017-08-24 13:37:59Z gcosmo $ 26 // 27 // 27 // ------------------------------------------- 28 // ------------------------------------------------------------------- 28 // 29 // 29 // GEANT4 Class header file 30 // GEANT4 Class header file 30 // 31 // 31 // 32 // 32 // File name: G4PAIModel 33 // File name: G4PAIModel 33 // 34 // 34 // Author: V. Grichine based on Vladimi 35 // Author: V. Grichine based on Vladimir Ivanchenko code 35 // 36 // 36 // Creation date: 05.10.2003 37 // Creation date: 05.10.2003 37 // 38 // 38 // Modifications: 39 // Modifications: 39 // 08-04-05 Major optimisation of internal int 40 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko) 40 // 26-09-07 Fixed tmax computation (V.Ivantche 41 // 26-09-07 Fixed tmax computation (V.Ivantchenko) 41 // 19.08.13 V.Ivanchenko extract data handling 42 // 19.08.13 V.Ivanchenko extract data handling to G4PAIModelData class 42 // added sharing of internal data bet 43 // added sharing of internal data between threads (MT migration) 43 // 44 // 44 // 45 // 45 // Class Description: 46 // Class Description: 46 // 47 // 47 // Implementation of PAI model of energy loss 48 // Implementation of PAI model of energy loss and 48 // delta-electron production by heavy charged 49 // delta-electron production by heavy charged particles 49 50 50 // ------------------------------------------- 51 // ------------------------------------------------------------------- 51 // 52 // 52 53 53 #ifndef G4PAIModel_h 54 #ifndef G4PAIModel_h 54 #define G4PAIModel_h 1 55 #define G4PAIModel_h 1 55 56 56 #include <CLHEP/Units/PhysicalConstants.h> 57 #include <CLHEP/Units/PhysicalConstants.h> 57 58 58 #include "G4VEmModel.hh" 59 #include "G4VEmModel.hh" 59 #include "G4VEmFluctuationModel.hh" 60 #include "G4VEmFluctuationModel.hh" 60 #include "globals.hh" 61 #include "globals.hh" 61 #include <vector> 62 #include <vector> 62 63 63 class G4Region; 64 class G4Region; 64 class G4MaterialCutsCouple; 65 class G4MaterialCutsCouple; 65 class G4ParticleChangeForLoss; 66 class G4ParticleChangeForLoss; 66 class G4PAIModelData; 67 class G4PAIModelData; 67 68 68 class G4PAIModel final : public G4VEmModel, pu << 69 class G4PAIModel : public G4VEmModel, public G4VEmFluctuationModel 69 { 70 { 70 71 71 public: 72 public: 72 73 73 explicit G4PAIModel(const G4ParticleDefiniti 74 explicit G4PAIModel(const G4ParticleDefinition* p = nullptr, 74 const G4String& nam = "PAI"); 75 const G4String& nam = "PAI"); 75 76 76 ~G4PAIModel() final; 77 ~G4PAIModel() final; 77 78 78 void Initialise(const G4ParticleDefinition*, 79 void Initialise(const G4ParticleDefinition*, const G4DataVector&) final; 79 80 80 void InitialiseLocal(const G4ParticleDefinit 81 void InitialiseLocal(const G4ParticleDefinition*, 81 G4VEmModel* masterModel 82 G4VEmModel* masterModel) final; 82 83 83 G4double MinEnergyCut(const G4ParticleDefini 84 G4double MinEnergyCut(const G4ParticleDefinition*, 84 const G4MaterialCutsCo 85 const G4MaterialCutsCouple* couple) final; 85 86 86 G4double ComputeDEDXPerVolume(const G4Materi 87 G4double ComputeDEDXPerVolume(const G4Material*, 87 const G4ParticleDefinition*, 88 const G4ParticleDefinition*, 88 G4double kineticEnergy, 89 G4double kineticEnergy, 89 G4double cutEnergy) final; 90 G4double cutEnergy) final; 90 91 91 G4double CrossSectionPerVolume(const G4Mater 92 G4double CrossSectionPerVolume(const G4Material*, 92 const G4ParticleDefinition*, 93 const G4ParticleDefinition*, 93 G4double kineticEnergy, 94 G4double kineticEnergy, 94 G4double cutEnergy, 95 G4double cutEnergy, 95 G4double maxEnergy) final; 96 G4double maxEnergy) final; 96 97 97 void SampleSecondaries(std::vector<G4Dynamic 98 void SampleSecondaries(std::vector<G4DynamicParticle*>*, 98 const G4MaterialCutsCouple*, 99 const G4MaterialCutsCouple*, 99 const G4DynamicParticle*, 100 const G4DynamicParticle*, 100 G4double tmin, 101 G4double tmin, 101 G4double maxEnergy) final; 102 G4double maxEnergy) final; 102 103 103 G4double SampleFluctuations(const G4Material 104 G4double SampleFluctuations(const G4MaterialCutsCouple*, 104 const G4DynamicParticle*, 105 const G4DynamicParticle*, 105 const G4double, const G4double, << 106 G4double, G4double, G4double) final; 106 const G4double, << 107 107 108 G4double Dispersion(const G4Material*, const 108 G4double Dispersion(const G4Material*, const G4DynamicParticle*, 109 const G4double, const G4double, << 109 G4double, G4double) final; 110 const G4double) final; << 111 110 112 void DefineForRegion(const G4Region* r) fina 111 void DefineForRegion(const G4Region* r) final; 113 112 114 inline G4PAIModelData* GetPAIModelData(); 113 inline G4PAIModelData* GetPAIModelData(); 115 114 116 inline const std::vector<const G4MaterialCut 115 inline const std::vector<const G4MaterialCutsCouple*>& GetVectorOfCouples(); 117 116 118 inline G4double ComputeMaxEnergy(G4double sc 117 inline G4double ComputeMaxEnergy(G4double scaledEnergy); 119 118 120 inline void SetVerboseLevel(G4int verbose); 119 inline void SetVerboseLevel(G4int verbose); 121 120 122 // hide assignment operator << 123 G4PAIModel & operator=(const G4PAIModel &ri << 124 G4PAIModel(const G4PAIModel&) = delete; << 125 << 126 protected: 121 protected: 127 122 128 G4double MaxSecondaryEnergy(const G4Particle 123 G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 129 G4double kinEner 124 G4double kinEnergy) final; 130 125 131 private: 126 private: 132 127 133 inline G4int FindCoupleIndex(const G4Materia 128 inline G4int FindCoupleIndex(const G4MaterialCutsCouple*); 134 129 135 inline void SetParticle(const G4ParticleDefi 130 inline void SetParticle(const G4ParticleDefinition* p); 136 131 >> 132 // hide assignment operator >> 133 G4PAIModel & operator=(const G4PAIModel &right) = delete; >> 134 G4PAIModel(const G4PAIModel&) = delete; >> 135 137 G4int fVerbose; 136 G4int fVerbose; 138 137 139 G4PAIModelData* fModelData; 138 G4PAIModelData* fModelData; 140 139 141 std::vector<const G4MaterialCutsCouple*> fMa 140 std::vector<const G4MaterialCutsCouple*> fMaterialCutsCoupleVector; 142 std::vector<const G4Region*> fPAIRegion 141 std::vector<const G4Region*> fPAIRegionVector; 143 142 144 const G4ParticleDefinition* fParticle; 143 const G4ParticleDefinition* fParticle; 145 const G4ParticleDefinition* fElectron; 144 const G4ParticleDefinition* fElectron; 146 const G4ParticleDefinition* fPositron; 145 const G4ParticleDefinition* fPositron; 147 G4ParticleChangeForLoss* fParticleChange; 146 G4ParticleChangeForLoss* fParticleChange; 148 147 149 G4double fMass; 148 G4double fMass; 150 G4double fRatio; 149 G4double fRatio; 151 G4double fChargeSquare; 150 G4double fChargeSquare; 152 G4double fLowestTcut; 151 G4double fLowestTcut; 153 }; 152 }; 154 153 155 inline G4PAIModelData* G4PAIModel::GetPAIModel 154 inline G4PAIModelData* G4PAIModel::GetPAIModelData() 156 { 155 { 157 return fModelData; 156 return fModelData; 158 } 157 } 159 158 160 inline const std::vector<const G4MaterialCutsC 159 inline const std::vector<const G4MaterialCutsCouple*>& 161 G4PAIModel::GetVectorOfCouples() 160 G4PAIModel::GetVectorOfCouples() 162 { 161 { 163 return fMaterialCutsCoupleVector; 162 return fMaterialCutsCoupleVector; 164 } 163 } 165 164 166 inline G4double G4PAIModel::ComputeMaxEnergy(G 165 inline G4double G4PAIModel::ComputeMaxEnergy(G4double scaledEnergy) 167 { 166 { 168 return MaxSecondaryEnergy(fParticle, scaledE 167 return MaxSecondaryEnergy(fParticle, scaledEnergy/fRatio); 169 } 168 } 170 169 171 inline void G4PAIModel::SetVerboseLevel(G4int 170 inline void G4PAIModel::SetVerboseLevel(G4int verbose) 172 { 171 { 173 fVerbose=verbose; 172 fVerbose=verbose; 174 } 173 } 175 174 176 inline G4int G4PAIModel::FindCoupleIndex(const 175 inline G4int G4PAIModel::FindCoupleIndex(const G4MaterialCutsCouple* couple) 177 { 176 { 178 G4int idx = -1; 177 G4int idx = -1; 179 G4int jMatMax = (G4int)fMaterialCutsCoupleVe << 178 size_t jMatMax = fMaterialCutsCoupleVector.size(); 180 for(G4int jMat = 0;jMat < jMatMax; ++jMat) { << 179 for(size_t jMat = 0;jMat < jMatMax; ++jMat) { 181 if(couple == fMaterialCutsCoupleVector[jMa 180 if(couple == fMaterialCutsCoupleVector[jMat]) { 182 idx = jMat; 181 idx = jMat; 183 break; 182 break; 184 } 183 } 185 } 184 } 186 return idx; 185 return idx; 187 } 186 } 188 187 189 inline void G4PAIModel::SetParticle(const G4Pa 188 inline void G4PAIModel::SetParticle(const G4ParticleDefinition* p) 190 { 189 { 191 if(fParticle != p) { 190 if(fParticle != p) { 192 fParticle = p; 191 fParticle = p; 193 fMass = fParticle->GetPDGMass(); 192 fMass = fParticle->GetPDGMass(); 194 fRatio = CLHEP::proton_mass_c2/fMass; 193 fRatio = CLHEP::proton_mass_c2/fMass; 195 G4double q = fParticle->GetPDGCharge()/CLH 194 G4double q = fParticle->GetPDGCharge()/CLHEP::eplus; 196 fChargeSquare = q*q; 195 fChargeSquare = q*q; 197 } 196 } 198 } 197 } 199 198 200 #endif 199 #endif >> 200 >> 201 >> 202 >> 203 >> 204 >> 205 >> 206 201 207