[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 | // |
---|
[961] | 26 | // $Id: G4MultipleScattering.cc,v 1.75 2008/10/15 17:53:44 vnivanch Exp $ |
---|
[1007] | 27 | // GEANT4 tag $Name: geant4-09-02 $ |
---|
[819] | 28 | // |
---|
| 29 | // ----------------------------------------------------------------------------- |
---|
| 30 | // |
---|
| 31 | // GEANT4 Class file |
---|
| 32 | // |
---|
| 33 | // File name: G4MultipleScattering |
---|
| 34 | // |
---|
| 35 | // Author: Laszlo Urban |
---|
| 36 | // |
---|
| 37 | // Creation date: March 2001 |
---|
| 38 | // |
---|
| 39 | // 16/05/01 value of cparm changed , L.Urban |
---|
| 40 | // 18/05/01 V.Ivanchenko Clean up against Linux ANSI compilation |
---|
| 41 | // 07/08/01 new methods Store/Retrieve PhysicsTable (mma) |
---|
| 42 | // 23-08-01 new angle and z distribution,energy dependence reduced, |
---|
| 43 | // Store,Retrieve methods commented out temporarily, L.Urban |
---|
| 44 | // 27-08-01 in BuildPhysicsTable:aParticleType.GetParticleName()=="mu+" (mma) |
---|
| 45 | // 28-08-01 GetContinuousStepLimit and AlongStepDoIt moved from .icc file (mma) |
---|
| 46 | // 03-09-01 value of data member factlim changed, L.Urban |
---|
| 47 | // 10-09-01 small change in GetContinuousStepLimit, L.Urban |
---|
| 48 | // 11-09-01 G4MultipleScatteringx put as default G4MultipleScattering |
---|
| 49 | // store/retrieve physics table reactivated (mma) |
---|
| 50 | // 13-09-01 corr. in ComputeTransportCrossSection, L.Urban |
---|
| 51 | // 14-09-01 protection in GetContinuousStepLimit, L.Urban |
---|
| 52 | // 17-09-01 migration of Materials to pure STL (mma) |
---|
| 53 | // 27-09-01 value of data member factlim changed, L.Urban |
---|
| 54 | // 31-10-01 big fixed in PostStepDoIt,L.Urban |
---|
| 55 | // 17-04-02 NEW angle distribution + boundary algorithm modified, L.Urban |
---|
| 56 | // 22-04-02 boundary algorithm modified -> important improvement in timing |
---|
| 57 | // 24-04-02 some minor changes in boundary algorithm, L.Urban |
---|
| 58 | // 06-05-02 bug fixed in GetContinuousStepLimit, L.Urban |
---|
| 59 | // 24-05-02 changes in angle distribution and boundary algorithm, L.Urban |
---|
| 60 | // 11-06-02 bug fixed in ComputeTransportCrossSection, L.Urban |
---|
| 61 | // 12-08-02 bug fixed in PostStepDoIt (lateral displacement), L.Urban |
---|
| 62 | // 15-08-02 new angle distribution, L.Urban |
---|
| 63 | // 26-09-02 angle distribution + boundary algorithm modified, L.Urban |
---|
| 64 | // 15-10-02 temporary fix for proton scattering |
---|
| 65 | // 30-10-02 modified angle distribution,mods in boundary algorithm, |
---|
| 66 | // changes in data members, L.Urban |
---|
| 67 | // 11-12-02 precision problem in ComputeTransportCrossSection |
---|
| 68 | // for small Tkin/for heavy particles cured from L.Urban |
---|
| 69 | // 20-01-03 Migrade to cut per region (V.Ivanchenko) |
---|
| 70 | // 05-02-03 changes in data members, new sampling for geom. |
---|
| 71 | // path length, step dependence reduced with new |
---|
| 72 | // method |
---|
| 73 | // 28-03-03 Move to model design (V.Ivanchenko) |
---|
| 74 | // 08-08-03 STD substitute standard (V.Ivanchenko) |
---|
| 75 | // 23-04-04 value of data member dtrl changed from 0.15 to 0.05 (L.Urban) |
---|
| 76 | // 17-08-04 name of facxsi changed to factail (L.Urban) |
---|
| 77 | // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko) |
---|
| 78 | // 07-02-05 correction in order to have a working Setsamplez function (L.Urban) |
---|
| 79 | // 15-04-05 optimize internal interface (V.Ivanchenko) |
---|
| 80 | // 12-09-05 new TruePathLengthLimit - facrange works for every track from |
---|
| 81 | // start, geometry also influences the limit |
---|
| 82 | // 02-10-05 conditions limiting the step are finalized + code cleaning (L.Urban) |
---|
| 83 | // 03-10-05 weaker step limitation for Tkin > Tlimit (L.Urban) |
---|
| 84 | // 05-10-05 value of data member tlimitmin has been changed (L.Urban) |
---|
| 85 | // 06-10-05 correction in TruePathLengthLimit, timing improved.(L.Urban) |
---|
| 86 | // 07-10-05 bug fixed in TruePathLengthLimit (L.Urban) |
---|
| 87 | // 11-10-05 change in TruePathLengthLimit conditions,slightly better |
---|
| 88 | // timing and much weaker cut dependence (L.Urban) |
---|
| 89 | // 13-10-05 move SetFacrange(0.02) from InitialiseProcess to constructor |
---|
| 90 | // 23-10-05 new Boolean data member prec (false ~ 7.1 like, true new step |
---|
| 91 | // limit in TruePathLengthLimit, L.Urban) |
---|
| 92 | // 25-10-05 prec renamed to steppingAlgorithm, set function triggers |
---|
| 93 | // 'default' facrange too, true - 0.02, false - 0.2 (L.Urban) |
---|
| 94 | // 26-10-05 the above is put in the function MscStepLimitation() (mma) |
---|
| 95 | // 05-11-05 tlimitmin = facrange*rungecut (instead of a fixed value)L.Urban |
---|
| 96 | // 13-11-05 some code cleaning, slightly better timing (L.Urban) |
---|
| 97 | // 01-12-05 add control on verbosity in SetMscStepLimitation |
---|
| 98 | // 06-12-05 tlimitmin = facrange*rangecut(e-) for every particle |
---|
| 99 | // 07-12-05 volume name World removed, rangecut computed using index |
---|
| 100 | // instead of particle name L.Urban |
---|
| 101 | // 08-12-05 world is now: navigator->GetWorldVolume() L.Urban |
---|
| 102 | // 11-12-05 data member rangecut removed, steplimit does not depend |
---|
| 103 | // on cut any more (L.Urban) |
---|
| 104 | // 17-01-06 value of data member factail changed (1. --> 0.75), |
---|
| 105 | // value of facgeom is 3.5 instead of 4 (L.Urban) |
---|
| 106 | // 19-01-07 tlimitmin = facrange*50*micrometer, i.e. it depends on the |
---|
| 107 | // value of facrange (L.Urban) |
---|
| 108 | // 16-02-06 value of factail changed, samplez = true (L.Urban) |
---|
| 109 | // 07-03-06 Create G4UrbanMscModel and move there step limit calculation (VI) |
---|
| 110 | // 10-05-06 SetMscStepLimitation at initialisation (V.Ivantchenko) |
---|
| 111 | // 11-05-06 values of data members tkinlimit, factail have been |
---|
| 112 | // changed (L.Urban) |
---|
| 113 | // 13-10-06 data member factail removed, new data member skin |
---|
| 114 | // together with set function, data member tkinlimit |
---|
| 115 | // changed to lambdalimit (L.Urban) |
---|
| 116 | // 20-10-06 default value of skin = 0 (no single scattering), |
---|
| 117 | // single scattering for skin > 0, |
---|
| 118 | // there is no z sampling by default (L.Urban) |
---|
| 119 | // 23-10-06 skin = 1 by default (L.Urban) |
---|
| 120 | // 23-11-06 skin = 1 by default for e+-, 0 for other particles (VI) |
---|
| 121 | // 12-02-07 skin can be changed via UI command, default skin=1 (VI) |
---|
| 122 | // 24-04-07 default skin=0 (temporal protection) (VI) |
---|
[961] | 123 | // 11-03-08 use G4VMscModel interface (VI) |
---|
[819] | 124 | // |
---|
| 125 | // ----------------------------------------------------------------------------- |
---|
| 126 | // |
---|
| 127 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 128 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 129 | |
---|
| 130 | #include "G4MultipleScattering.hh" |
---|
| 131 | #include "G4UrbanMscModel.hh" |
---|
| 132 | #include "G4MscStepLimitType.hh" |
---|
[961] | 133 | #include "G4UrbanMscModel.hh" |
---|
[819] | 134 | |
---|
| 135 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 136 | |
---|
| 137 | using namespace std; |
---|
| 138 | |
---|
| 139 | G4MultipleScattering::G4MultipleScattering(const G4String& processName) |
---|
| 140 | : G4VMultipleScattering(processName) |
---|
| 141 | { |
---|
[961] | 142 | isInitialized = false; |
---|
[819] | 143 | } |
---|
| 144 | |
---|
| 145 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 146 | |
---|
| 147 | G4MultipleScattering::~G4MultipleScattering() |
---|
| 148 | {} |
---|
| 149 | |
---|
| 150 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 151 | |
---|
| 152 | G4bool G4MultipleScattering::IsApplicable (const G4ParticleDefinition& p) |
---|
| 153 | { |
---|
| 154 | return (p.GetPDGCharge() != 0.0 && !p.IsShortLived()); |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 158 | |
---|
| 159 | void G4MultipleScattering::InitialiseProcess(const G4ParticleDefinition* p) |
---|
| 160 | { |
---|
| 161 | // Modification of parameters between runs |
---|
| 162 | if(isInitialized) { |
---|
| 163 | if (p->GetParticleType() != "nucleus") { |
---|
| 164 | mscUrban->SetStepLimitType(StepLimitType()); |
---|
| 165 | mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag()); |
---|
| 166 | mscUrban->SetSkin(Skin()); |
---|
| 167 | mscUrban->SetRangeFactor(RangeFactor()); |
---|
| 168 | mscUrban->SetGeomFactor(GeomFactor()); |
---|
| 169 | } |
---|
| 170 | return; |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | // defaults for ions, which cannot be overwritten |
---|
| 174 | if (p->GetParticleType() == "nucleus") { |
---|
| 175 | SetStepLimitType(fMinimal); |
---|
| 176 | SetLateralDisplasmentFlag(false); |
---|
| 177 | SetBuildLambdaTable(false); |
---|
| 178 | } |
---|
| 179 | |
---|
| 180 | // initialisation of parameters - defaults for particles other |
---|
| 181 | // than ions can be overwritten by users |
---|
[961] | 182 | mscUrban = new G4UrbanMscModel(); |
---|
| 183 | mscUrban->SetStepLimitType(StepLimitType()); |
---|
[819] | 184 | mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag()); |
---|
[961] | 185 | mscUrban->SetSkin(Skin()); |
---|
| 186 | mscUrban->SetRangeFactor(RangeFactor()); |
---|
| 187 | mscUrban->SetGeomFactor(GeomFactor()); |
---|
[819] | 188 | |
---|
| 189 | AddEmModel(1,mscUrban); |
---|
| 190 | isInitialized = true; |
---|
| 191 | /* |
---|
| 192 | G4cout << "G4MultipleScattering::InitialiseProcess for " |
---|
| 193 | << p->GetParticleName() |
---|
| 194 | << " skin= " << Skin() |
---|
| 195 | << " SA= " << steppingAlgorithm |
---|
| 196 | << G4endl; |
---|
| 197 | */ |
---|
| 198 | } |
---|
| 199 | |
---|
| 200 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 201 | |
---|
| 202 | void G4MultipleScattering::PrintInfo() |
---|
| 203 | { |
---|
[961] | 204 | G4cout << " RangeFactor= " << RangeFactor() |
---|
| 205 | << ", step limit type: " << StepLimitType() |
---|
| 206 | << ", lateralDisplacement: " << LateralDisplasmentFlag() |
---|
| 207 | << ", skin= " << Skin() |
---|
| 208 | << ", geomFactor= " << GeomFactor() |
---|
[819] | 209 | << G4endl; |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 213 | |
---|