[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // $Id: G4MuMscModel.hh,v 1.4 2007/11/09 19:48:09 vnivanch Exp $ |
---|
| 27 | // GEANT4 tag $Name: geant4-09-01-patch-02 $ |
---|
| 28 | // |
---|
| 29 | // ------------------------------------------------------------------- |
---|
| 30 | // |
---|
| 31 | // |
---|
| 32 | // GEANT4 Class header file |
---|
| 33 | // |
---|
| 34 | // |
---|
| 35 | // File name: G4MuMscModel |
---|
| 36 | // |
---|
| 37 | // Author: V.Ivanchenko on base of L.Urban model |
---|
| 38 | // |
---|
| 39 | // Creation date: 25.10.2007 |
---|
| 40 | // |
---|
| 41 | // Modifications: |
---|
| 42 | // |
---|
| 43 | // |
---|
| 44 | // Class Description: |
---|
| 45 | // |
---|
| 46 | // Implementation of the model of multiple scattering based on |
---|
| 47 | // H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model |
---|
| 48 | |
---|
| 49 | // ------------------------------------------------------------------- |
---|
| 50 | // |
---|
| 51 | |
---|
| 52 | #ifndef G4MuMscModel_h |
---|
| 53 | #define G4MuMscModel_h 1 |
---|
| 54 | |
---|
| 55 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 56 | |
---|
| 57 | #include "G4eCoulombScatteringModel.hh" |
---|
| 58 | #include "G4PhysicsTable.hh" |
---|
| 59 | #include "G4MscStepLimitType.hh" |
---|
| 60 | #include "G4MaterialCutsCouple.hh" |
---|
| 61 | |
---|
| 62 | class G4LossTableManager; |
---|
| 63 | class G4ParticleChangeForMSC; |
---|
| 64 | class G4SafetyHelper; |
---|
| 65 | |
---|
| 66 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 67 | |
---|
| 68 | class G4MuMscModel : public G4eCoulombScatteringModel |
---|
| 69 | { |
---|
| 70 | |
---|
| 71 | public: |
---|
| 72 | |
---|
| 73 | G4MuMscModel(G4double frange = 0.2, |
---|
| 74 | G4double thetaMax = 0.04, |
---|
| 75 | G4double tMax = TeV*TeV, |
---|
| 76 | const G4String& nam = "MuMscUni"); |
---|
| 77 | |
---|
| 78 | virtual ~G4MuMscModel(); |
---|
| 79 | |
---|
| 80 | void Initialise(const G4ParticleDefinition*, const G4DataVector&); |
---|
| 81 | |
---|
| 82 | G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, |
---|
| 83 | G4double KineticEnergy, |
---|
| 84 | G4double AtomicNumber, |
---|
| 85 | G4double AtomicWeight=0., |
---|
| 86 | G4double cut = DBL_MAX, |
---|
| 87 | G4double emax= DBL_MAX); |
---|
| 88 | |
---|
| 89 | void SampleScattering(const G4DynamicParticle*, G4double safety); |
---|
| 90 | |
---|
| 91 | void SampleSecondaries(std::vector<G4DynamicParticle*>*, |
---|
| 92 | const G4MaterialCutsCouple*, |
---|
| 93 | const G4DynamicParticle*, |
---|
| 94 | G4double, |
---|
| 95 | G4double); |
---|
| 96 | |
---|
| 97 | G4double ComputeTruePathLengthLimit(const G4Track& track, |
---|
| 98 | G4PhysicsTable* theLambdaTable, |
---|
| 99 | G4double currentMinimalStep); |
---|
| 100 | |
---|
| 101 | G4double ComputeGeomPathLength(G4double truePathLength); |
---|
| 102 | |
---|
| 103 | G4double ComputeTrueStepLength(G4double geomStepLength); |
---|
| 104 | |
---|
| 105 | inline void SetStepLimitType(G4MscStepLimitType); |
---|
| 106 | |
---|
| 107 | inline void SetLateralDisplasmentFlag(G4bool val); |
---|
| 108 | |
---|
| 109 | inline G4double GetLambda(G4double kinEnergy); |
---|
| 110 | |
---|
| 111 | inline G4double GetLambda2(G4double kinEnergy); |
---|
| 112 | |
---|
| 113 | // inline void SetThetaLimit(G4double); |
---|
| 114 | |
---|
| 115 | inline void SetRangeFactor(G4double); |
---|
| 116 | |
---|
| 117 | private: |
---|
| 118 | |
---|
| 119 | void BuildTables(); |
---|
| 120 | |
---|
| 121 | G4double ComputeLambda2(G4double kinEnergy, G4double cut); |
---|
| 122 | |
---|
| 123 | inline void DefineMaterial(const G4MaterialCutsCouple*); |
---|
| 124 | |
---|
| 125 | // hide assignment operator |
---|
| 126 | G4MuMscModel & operator=(const G4MuMscModel &right); |
---|
| 127 | G4MuMscModel(const G4MuMscModel&); |
---|
| 128 | |
---|
| 129 | G4ParticleChangeForMSC* fParticleChange; |
---|
| 130 | |
---|
| 131 | G4SafetyHelper* safetyHelper; |
---|
| 132 | G4PhysicsTable* theLambdaTable; |
---|
| 133 | G4PhysicsTable* theLambda2Table; |
---|
| 134 | G4LossTableManager* theManager; |
---|
| 135 | const G4DataVector* currentCuts; |
---|
| 136 | |
---|
| 137 | G4double dtrl; |
---|
| 138 | G4double facrange; |
---|
| 139 | G4double thetaLimit; |
---|
| 140 | G4double numlimit; |
---|
| 141 | G4double tlimitminfix; |
---|
| 142 | G4double invsqrt12; |
---|
| 143 | G4double lowBinEnergy; |
---|
| 144 | G4double highBinEnergy; |
---|
| 145 | |
---|
| 146 | // cash |
---|
| 147 | G4double preKinEnergy; |
---|
| 148 | G4double xSection; |
---|
| 149 | G4double ecut; |
---|
| 150 | G4double lambda0; |
---|
| 151 | G4double tPathLength; |
---|
| 152 | G4double zPathLength; |
---|
| 153 | G4double lambdaeff; |
---|
| 154 | G4double currentRange; |
---|
| 155 | G4double par1; |
---|
| 156 | G4double par2; |
---|
| 157 | G4double par3; |
---|
| 158 | |
---|
| 159 | G4int currentMaterialIndex; |
---|
| 160 | |
---|
| 161 | G4int nbins; |
---|
| 162 | G4int nwarnings; |
---|
| 163 | G4int nwarnlimit; |
---|
| 164 | |
---|
| 165 | const G4MaterialCutsCouple* currentCouple; |
---|
| 166 | |
---|
| 167 | G4MscStepLimitType steppingAlgorithm; |
---|
| 168 | |
---|
| 169 | G4bool samplez; |
---|
| 170 | G4bool latDisplasment; |
---|
| 171 | G4bool isInitialized; |
---|
| 172 | G4bool buildTables; |
---|
| 173 | G4bool newrun; |
---|
| 174 | G4bool inside; |
---|
| 175 | }; |
---|
| 176 | |
---|
| 177 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 178 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 179 | |
---|
| 180 | inline |
---|
| 181 | void G4MuMscModel::SetLateralDisplasmentFlag(G4bool val) |
---|
| 182 | { |
---|
| 183 | latDisplasment = val; |
---|
| 184 | } |
---|
| 185 | |
---|
| 186 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 187 | /* |
---|
| 188 | inline |
---|
| 189 | void G4MuMscModel::SetThetaLimit(G4double val) |
---|
| 190 | { |
---|
| 191 | thetaLimit = val; |
---|
| 192 | } |
---|
| 193 | */ |
---|
| 194 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 195 | |
---|
| 196 | inline |
---|
| 197 | void G4MuMscModel::SetRangeFactor(G4double val) |
---|
| 198 | { |
---|
| 199 | facrange = val; |
---|
| 200 | } |
---|
| 201 | |
---|
| 202 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 203 | |
---|
| 204 | inline |
---|
| 205 | void G4MuMscModel::SetStepLimitType(G4MscStepLimitType val) |
---|
| 206 | { |
---|
| 207 | steppingAlgorithm = val; |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 211 | |
---|
| 212 | inline |
---|
| 213 | void G4MuMscModel::DefineMaterial(const G4MaterialCutsCouple* cup) |
---|
| 214 | { |
---|
| 215 | if(cup != currentCouple) { |
---|
| 216 | currentCouple = cup; |
---|
| 217 | currentMaterialIndex = currentCouple->GetIndex(); |
---|
| 218 | } |
---|
| 219 | } |
---|
| 220 | |
---|
| 221 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 222 | |
---|
| 223 | inline |
---|
| 224 | G4double G4MuMscModel::GetLambda(G4double e) |
---|
| 225 | { |
---|
| 226 | G4double x; |
---|
| 227 | if(theLambdaTable) { |
---|
| 228 | G4bool b; |
---|
| 229 | x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b); |
---|
| 230 | } else { |
---|
| 231 | x = CrossSection(currentCouple,particle,e); |
---|
| 232 | } |
---|
| 233 | if(x > DBL_MIN) x = 1./x; |
---|
| 234 | else x = DBL_MAX; |
---|
| 235 | return x; |
---|
| 236 | } |
---|
| 237 | |
---|
| 238 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 239 | |
---|
| 240 | inline |
---|
| 241 | G4double G4MuMscModel::GetLambda2(G4double e) |
---|
| 242 | { |
---|
| 243 | G4double x; |
---|
| 244 | if(theLambda2Table) { |
---|
| 245 | G4bool b; |
---|
| 246 | x = ((*theLambda2Table)[currentMaterialIndex])->GetValue(e, b); |
---|
| 247 | } else { |
---|
| 248 | x = ComputeLambda2(e, (*currentCuts)[currentMaterialIndex]); |
---|
| 249 | } |
---|
| 250 | return x; |
---|
| 251 | } |
---|
| 252 | |
---|
| 253 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 254 | |
---|
| 255 | #endif |
---|
| 256 | |
---|