source: trunk/source/processes/electromagnetic/standard/src/G4MultipleScattering71.cc@ 1005

Last change on this file since 1005 was 991, checked in by garnier, 17 years ago

update

File size: 9.2 KB
Line 
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: G4MultipleScattering71.cc,v 1.5 2008/07/16 11:27:41 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-02 $
28//
29// -----------------------------------------------------------------------------
30// 16/05/01 value of cparm changed , L.Urban
31// 18/05/01 V.Ivanchenko Clean up against Linux ANSI compilation
32// 07/08/01 new methods Store/Retrieve PhysicsTable (mma)
33// 23-08-01 new angle and z distribution,energy dependence reduced,
34// Store,Retrieve methods commented out temporarily, L.Urban
35// 27-08-01 in BuildPhysicsTable:aParticleType.GetParticleName()=="mu+" (mma)
36// 28-08-01 GetContinuousStepLimit and AlongStepDoIt moved from .icc file (mma)
37// 03-09-01 value of data member factlim changed, L.Urban
38// 10-09-01 small change in GetContinuousStepLimit, L.Urban
39// 11-09-01 G4MultipleScatteringx put as default G4MultipleScattering
40// store/retrieve physics table reactivated (mma)
41// 13-09-01 corr. in ComputeTransportCrossSection, L.Urban
42// 14-09-01 protection in GetContinuousStepLimit, L.Urban
43// 17-09-01 migration of Materials to pure STL (mma)
44// 27-09-01 value of data member factlim changed, L.Urban
45// 31-10-01 big fixed in PostStepDoIt,L.Urban
46// 17-04-02 NEW angle distribution + boundary algorithm modified, L.Urban
47// 22-04-02 boundary algorithm modified -> important improvement in timing (L.Urban)
48// 24-04-02 some minor changes in boundary algorithm, L.Urban
49// 06-05-02 bug fixed in GetContinuousStepLimit, L.Urban
50// 24-05-02 changes in angle distribution and boundary algorithm, L.Urban
51// 11-06-02 bug fixed in ComputeTransportCrossSection, L.Urban
52// 12-08-02 bug fixed in PostStepDoIt (lateral displacement), L.Urban
53// 15-08-02 new angle distribution, L.Urban
54// 26-09-02 angle distribution + boundary algorithm modified, L.Urban
55// 15-10-02 temporary fix for proton scattering
56// 30-10-02 modified angle distribution,mods in boundary algorithm,
57// changes in data members, L.Urban
58// 11-12-02 precision problem in ComputeTransportCrossSection
59// for small Tkin/for heavy particles cured from L.Urban
60// 20-01-03 Migrade to cut per region (V.Ivanchenko)
61// 05-02-03 changes in data members, new sampling for geom.
62// path length, step dependence reduced with new
63// method
64// 28-03-03 Move to model design (V.Ivanchenko)
65// 08-08-03 STD substitute standard (V.Ivanchenko)
66// 23-04-04 value of data member dtrl changed from 0.15 to 0.05 (L.Urban)
67// 17-08-04 name of facxsi changed to factail (L.Urban)
68// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
69// 07-02-05 correction in order to have a working Setsamplez function (L.Urban)
70// 15-04-05 optimize internal interface (V.Ivanchenko)
71// 03-10-05 Process is freezed with the name 71 (V.Ivanchenko)
72// -----------------------------------------------------------------------------
73//
74//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76
77#include "G4MultipleScattering71.hh"
78#include "G4LossTableManager.hh"
79#include "G4MscModel71.hh"
80
81//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82
83using namespace std;
84
85G4MultipleScattering71::G4MultipleScattering71(const G4String& processName)
86 : G4VMultipleScattering(processName),
87 totBins(120),
88 facrange(0.199),
89 dtrl(0.05),
90 NuclCorrPar (0.0615),
91 FactPar(0.40),
92 factail(1.0),
93 cf(1.001),
94 stepnolastmsc(-1000000),
95 nsmallstep(5),
96 samplez(true),
97 boundary(true),
98 isInitialized(false)
99{
100 lowKineticEnergy = 0.1*keV;
101 highKineticEnergy= 100.*TeV;
102
103 tlimit = 1.e10*mm;
104 tlimitmin = 1.e-7*mm;
105
106 SetBinning(totBins);
107 SetMinKinEnergy(lowKineticEnergy);
108 SetMaxKinEnergy(highKineticEnergy);
109}
110
111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
112
113G4MultipleScattering71::~G4MultipleScattering71()
114{}
115
116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117
118void G4MultipleScattering71::InitialiseProcess(const G4ParticleDefinition* particle)
119{
120 if(isInitialized) return;
121
122 if (particle->GetParticleType() == "nucleus") {
123 boundary = false;
124 SetLateralDisplasmentFlag(false);
125 SetBuildLambdaTable(false);
126 Setsamplez(false) ;
127 } else {
128 SetLateralDisplasmentFlag(true);
129 SetBuildLambdaTable(true);
130 }
131 G4MscModel71* em = new G4MscModel71(dtrl,NuclCorrPar,FactPar,factail,samplez);
132 em->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
133 em->SetLowEnergyLimit(lowKineticEnergy);
134 em->SetHighEnergyLimit(highKineticEnergy);
135 AddEmModel(1, em);
136 isInitialized = true;
137}
138
139//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140
141G4double G4MultipleScattering71::TruePathLengthLimit(const G4Track& track,
142 G4double& lambda,
143 G4double currentMinimalStep)
144{
145
146 G4double tPathLength = currentMinimalStep;
147
148 // special treatment near boundaries ?
149 if (boundary) {
150
151 G4int stepno = track.GetCurrentStepNumber() ;
152 // first step
153 if (stepno == 1) {
154 stepnolastmsc = -1000000 ;
155 tlimit = 1.e10;
156 } else if (stepno > 1) {
157
158 if (track.GetStep()->GetPreStepPoint()->GetStepStatus() == fGeomBoundary) {
159
160 stepnolastmsc = stepno;
161 // if : diff.treatment for small/not small Z
162 if (range > lambda) tlimit = facrange*range;
163 else tlimit = facrange*lambda;
164
165 if(tlimit < tlimitmin) tlimit = tlimitmin;
166 if(tPathLength > tlimit) tPathLength = tlimit;
167
168 } else if (stepno > stepnolastmsc && stepno - stepnolastmsc < nsmallstep
169 && tPathLength > tlimit) {
170 tlimit *= cf;
171 tPathLength = tlimit;
172 }
173 }
174 }
175
176 return tPathLength;
177}
178
179//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
180
181G4double G4MultipleScattering71::GetContinuousStepLimit(
182 const G4Track& track,
183 G4double,
184 G4double currentMinimalStep,
185 G4double&)
186{
187 DefineMaterial(track.GetMaterialCutsCouple());
188 const G4MaterialCutsCouple* couple = CurrentMaterialCutsCouple();
189 G4double e = track.GetKineticEnergy();
190 model = dynamic_cast<G4MscModel71*>(SelectModel(e));
191 const G4ParticleDefinition* p = track.GetDefinition();
192 G4double lambda0 = GetLambda(p, e);
193 range = G4LossTableManager::Instance()->GetRangeFromRestricteDEDX(p,e,couple);
194 if(range < currentMinimalStep) currentMinimalStep = range;
195 truePathLength = TruePathLengthLimit(track,lambda0,currentMinimalStep);
196 // G4cout << "StepLimit: tpl= " << truePathLength << " lambda0= "
197 // << lambda0 << " range= " << currentRange
198 // << " currentMinStep= " << currentMinimalStep << G4endl;
199 if (truePathLength < currentMinimalStep) valueGPILSelectionMSC = CandidateForSelection;
200 geomPathLength = model->GeomPathLength(LambdaTable(),couple,
201 p,e,lambda0,range,truePathLength);
202 if(geomPathLength > lambda0) geomPathLength = lambda0;
203 return geomPathLength;
204}
205
206//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
207
208void G4MultipleScattering71::PrintInfo()
209{
210 if(boundary) {
211 G4cout << " Boundary algorithm is active with facrange= "
212 << facrange
213 << G4endl;
214 }
215 G4cout << " WARNING: This process is obsolete and will be soon removed"
216 << G4endl;
217
218}
219
220//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221
Note: See TracBrowser for help on using the repository browser.