Geant4  10.01.p02
XWrapperContinousDiscreteProcess.cc
Go to the documentation of this file.
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 
28 
29 #include "G4Step.hh"
30 #include "G4StepPoint.hh"
31 #include "G4VParticleChange.hh"
32 
33 #include "G4Material.hh"
34 #include "G4NistManager.hh"
36 #include "G4Navigator.hh"
37 #include "G4GeometryTolerance.hh"
38 
39 #include "G4SystemOfUnits.hh"
40 
41 
45  if (verboseLevel>1) {
46  G4cout << GetProcessName() << " is created "<< G4endl;
47  }
49 }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
55  G4VContinuousDiscreteProcess* toRegister)
57  fRegisteredProcess = toRegister;
58  if (verboseLevel>1) {
59  G4cout << GetProcessName() << " is created "<< G4endl;
60  }
62 }
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65 
68  G4ProcessType aProcessType)
69 :G4VContinuousDiscreteProcess(aName,aProcessType){
70  if (verboseLevel>1) {
71  G4cout << GetProcessName() << " is created "<< G4endl;
72  }
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
77 
79  ;
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
83 
87  ;
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
91 
94  fRegisteredProcess = toRegister;
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
98 
101  G4int flag){
102  fRegisteredProcess = toRegister;
103  bNucleiOrElectronFlag = flag;
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
107 
109  bNucleiOrElectronFlag = flag;
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
113 
115  return bNucleiOrElectronFlag;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
119 
121  //Retrieve nuclei and electron density
122  //from ExExChParticleUserInfo object
123  ExExChParticleUserInfo* chanInfo =
125 
126  G4double vDensity = 1.;
127 
128  if(chanInfo){
129  if(bNucleiOrElectronFlag == +1){
130  vDensity = chanInfo->GetNucleiDensity();
131  }
132  else if(bNucleiOrElectronFlag == -1){
133  vDensity = chanInfo->GetElectronDensity();
134  }
135  else{
136  vDensity = (chanInfo->GetNucleiDensity()
137  + chanInfo->GetElectronDensity())/2.;
138  }
139  }
140  else {
141  G4cout << G4endl << "XWrapperContinuousDiscreteProcess::";
142  G4cout << "ERROR - no ExExChParticleUserInfo object Detected";
143  G4cout << G4endl;
144  }
145 
146  return vDensity;
147 }
148 
149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
150 
153  //Retrieve nuclei and electron density
154  //from ExExChParticleUserInfo object
155  ExExChParticleUserInfo* chanInfo =
157 
158  G4double vDensityPreviousStep = 1.;
159 
160  if(chanInfo){
161  if(bNucleiOrElectronFlag == +1){
162  vDensityPreviousStep = chanInfo->GetNucleiDensityPreviousStep();
163  }
164  else if(bNucleiOrElectronFlag == -1){
165  vDensityPreviousStep = chanInfo->GetElectronDensityPreviousStep();
166  }
167  else{
168  vDensityPreviousStep =
169  (chanInfo->GetNucleiDensityPreviousStep()
170  + chanInfo->GetElectronDensityPreviousStep())/2.;
171  }
172  }
173  else {
174  G4cout << G4endl << "XWrapperContinuousDiscreteProcess::";
175  G4cout << "ERROR - no ExExChParticleUserInfo";
176  G4cout << "object Detected" << G4endl;
177  }
178 
179  return vDensityPreviousStep;
180 }
181 
182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
183 
184 
185 
186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
187 
188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
189 
190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
191 
192 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
193 
194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
195 
196 
197 
198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
199 
205 }
206 
207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
208 
211  G4double, //previousStepSize,
213  return DBL_MAX;
214 }
215 
216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
217 
220  G4double previousStepSize,
222 
223  G4double vDensity = GetDensity(aTrack);
224  G4double vDensityPreviousStep = GetDensityPreviousStep(aTrack);
225 
226  if ( (previousStepSize < 0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
227  // beginning of tracking (or just after DoIt of this process)
229  } else if ( previousStepSize > 0.0) {
230  // subtract NumberOfInteractionLengthLeft
232  * vDensityPreviousStep);
233  } else {
234  // zero step DO NOTHING
235  }
236 
237  G4double regIntLength =
239  previousStepSize * vDensityPreviousStep,
240  condition);
241  G4double regIntNumber =
243  currentInteractionLength = regIntLength / regIntNumber;
244  theNumberOfInteractionLengthLeft = regIntNumber;
245 
248  currentInteractionLength /= vDensity;
250 }
251 
252 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
253 
256  G4double previousStepSize,
257  G4double currentMinimumStep,
258  G4double& currentSafety,
259  G4GPILSelection* selection){
260  G4double vDensityPreviousStep = GetDensityPreviousStep(aTrack);
261 
263  previousStepSize * vDensityPreviousStep,
264  currentMinimumStep,
265  currentSafety,
266  selection);
267 }
268 
269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
270 
272 PostStepDoIt(const G4Track& aTrack,
273  const G4Step& aStep ){
274  G4double vDensity = GetDensity(aTrack);
275  G4double vStepLengthSaved = aStep.GetStepLength();
276  const_cast<G4Step&>(aStep).SetStepLength(aStep.GetStepLength() * vDensity);
278  const_cast<G4Step&>(aStep).SetStepLength(vStepLengthSaved);
279  return pParticleChange;
280 }
281 
282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
283 
285 AlongStepDoIt(const G4Track& aTrack,
286  const G4Step& aStep ){
287  G4double vDensity = GetDensity(aTrack);
288  G4double vStepLengthSaved = aStep.GetStepLength();
289  const_cast<G4Step&>(aStep).SetStepLength(aStep.GetStepLength() * vDensity);
291  const_cast<G4Step&>(aStep).SetStepLength(vStepLengthSaved);
292  return pParticleChange;
293 }
294 
295 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
296 
299  G4double,
300  G4double,
301  G4double& ){
302  return DBL_MAX;
303 }
304 
305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
virtual G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *)
G4double condition(const G4ErrorSymMatrix &m)
void RegisterProcess(G4VContinuousDiscreteProcess *)
G4int verboseLevel
Definition: G4VProcess.hh:368
G4double GetStepLength() const
virtual G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
G4double theNumberOfInteractionLengthLeft
Definition: G4VProcess.hh:293
int G4int
Definition: G4Types.hh:78
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimumStep, G4double &currentSafety, G4GPILSelection *selection)
G4VUserTrackInformation * GetUserInformation() const
virtual void StartTracking(G4Track *)
Definition: G4VProcess.cc:101
G4double GetNumberOfInteractionLengthLeft() const
Definition: G4VProcess.hh:453
G4GLOB_DLL std::ostream G4cout
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4double currentInteractionLength
Definition: G4VProcess.hh:297
XWrapperContinuousDiscreteProcess(const G4String &processName="XWrapperContinuousDiscreteProcess")
Definition: G4Step.hh:76
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
virtual G4double GetContinuousStepLimit(const G4Track &, G4double, G4double, G4double &)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
virtual G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double, G4ForceCondition *)
#define G4endl
Definition: G4ios.hh:61
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void SubtractNumberOfInteractionLengthLeft(G4double previousStepSize)
Definition: G4VProcess.hh:544
G4double theInitialNumberOfInteractionLength
Definition: G4VProcess.hh:300
double G4double
Definition: G4Types.hh:76
G4ForceCondition
#define DBL_MAX
Definition: templates.hh:83
G4GPILSelection
G4ProcessType