Belle II Software development
EnergyLossForExtrapolator.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#ifndef ENERGYLOSSFOREXTRAPOLATOR_H_
10#define ENERGYLOSSFOREXTRAPOLATOR_H_
11
12#include <CLHEP/Units/SystemOfUnits.h>
13
14#include <globals.hh>
15#include <G4PhysicsTable.hh>
16#include <G4DataVector.hh>
17#include <vector>
18
19class G4ParticleDefinition;
20class G4Material;
21class G4MaterialCutsCouple;
22class G4ProductionCuts;
23
24namespace Belle2 {
30 namespace Simulation {
31
34
35 public:
36
39
42
44 G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*);
45
47 G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*);
48
50 G4double ComputeEnergy(G4double range, const G4ParticleDefinition*);
51
53 G4double EnergyAfterStep(G4double kinEnergy, G4double step,
54 const G4Material*, const G4ParticleDefinition*);
55
57 G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
58 const G4Material*, const G4ParticleDefinition*);
59
61 G4double TrueStepLength(G4double kinEnergy, G4double step,
62 const G4Material*, const G4ParticleDefinition* part);
63
65 //- inline G4double EnergyAfterStep(G4double kinEnergy, G4double step,
66 //- const G4Material*, const G4String& particleName);
67
69 //- inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
70 //- const G4Material*, const G4String& particleName);
71
73 inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
74 const G4Material*,
75 const G4ParticleDefinition* part);
76
78 //- inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
79 //- const G4Material*,
80 //- const G4String& particleName);
81
83 inline G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part,
84 G4double kinEnergy, G4double stepLength);
85
87 //- inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
88 //- const G4Material*, const G4ParticleDefinition*);
89
91 //- inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
92 //- const G4Material*, const G4String& particleName);
93
95 //- inline void SetVerbose(G4int val);
96
98 inline void SetMinKinEnergy(G4double);
99
101 inline void SetMaxKinEnergy(G4double);
102
104 inline void SetMaxEnergyTransfer(G4double);
105
106 private:
107
110 void Initialisation();
111
113 G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*,
114 G4double kinEnergy);
115
117 G4PhysicsTable* PrepareTable();
118
120 const G4ParticleDefinition* FindParticle(const G4String& name);
121
123 void ComputeElectronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
124
126 void ComputeMuonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
127
129 void ComputeHadronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
130
132 void ComputeTransportXS(const G4ParticleDefinition* part, G4PhysicsTable* table);
133
135 inline G4double ComputeValue(G4double x, const G4PhysicsTable* table);
136
139
142
144 const G4ParticleDefinition* m_Particle;
145
147 const G4ParticleDefinition* m_Electron;
148
150 const G4ParticleDefinition* m_Positron;
151
153 const G4ParticleDefinition* m_MuonPlus;
154
156 const G4ParticleDefinition* m_MuonMinus;
157
159 const G4ParticleDefinition* m_PionPlus;
160
162 const G4ParticleDefinition* m_PionMinus;
163
165 const G4ParticleDefinition* m_KaonPlus;
166
168 const G4ParticleDefinition* m_KaonMinus;
169
171 const G4ParticleDefinition* m_Proton;
172
174 const G4ParticleDefinition* m_AntiProton;
175
177 const G4ParticleDefinition* m_Deuteron;
178
180 const G4ParticleDefinition* m_AntiDeuteron;
181
183 G4DataVector m_Cuts;
184
186 G4ProductionCuts* m_ProductionCuts;
187
189 std::vector<const G4MaterialCutsCouple*> m_Couples;
190
192 G4PhysicsTable* m_DedxElectron;
193
195 G4PhysicsTable* m_DedxPositron;
196
198 G4PhysicsTable* m_DedxMuon;
199
201 G4PhysicsTable* m_DedxPion;
202
204 G4PhysicsTable* m_DedxKaon;
205
207 G4PhysicsTable* m_DedxProton;
208
210 G4PhysicsTable* m_DedxDeuteron;
211
213 G4PhysicsTable* m_RangeElectron;
214
216 G4PhysicsTable* m_RangePositron;
217
219 G4PhysicsTable* m_RangeMuon;
220
222 G4PhysicsTable* m_RangePion;
223
225 G4PhysicsTable* m_RangeKaon;
226
228 G4PhysicsTable* m_RangeProton;
229
231 G4PhysicsTable* m_RangeDeuteron;
232
234 G4PhysicsTable* m_InvRangeElectron;
235
237 G4PhysicsTable* m_InvRangePositron;
238
240 G4PhysicsTable* m_InvRangeMuon;
241
243 G4PhysicsTable* m_InvRangePion;
244
246 G4PhysicsTable* m_InvRangeKaon;
247
249 G4PhysicsTable* m_InvRangeProton;
250
252 G4PhysicsTable* m_InvRangeDeuteron;
253
255 G4PhysicsTable* m_MscatElectron;
256
258 const G4Material* m_Material;
259
262
265
267 G4double m_RadLength;
268
270 G4double m_Mass;
271
273 G4double m_ChargeSq;
274
277
279 G4double m_Gamma;
280
283
285 G4double m_BetaSq;
286
288 G4double m_Tmax;
289
292
294 G4double m_UserTmin;
295
297 G4double m_UserTmax;
298
301
303 G4int m_Nbins;
304
307
310 };
311
312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
313
314 //- inline G4double EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy,
315 //- G4double step,
316 //- const G4Material* mat,
317 //- const G4String& name)
318 //- {
319 //- return EnergyAfterStep(kinEnergy, step, mat, FindParticle(name));
320 //- }
321
322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
323
324 //- inline G4double EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
325 //- G4double step,
326 //- const G4Material* mat,
327 //- const G4String& name)
328 //- {
329 //- return EnergyBeforeStep(kinEnergy, step, mat, FindParticle(name));
330 //- }
331
332 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
333
334 //- inline G4double EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
335 //- G4double step,
336 //- const G4Material* mat,
337 //- const G4String& name)
338 //- {
339 //- return AverageScatteringAngle(kinEnergy, step, mat, FindParticle(name));
340 //- }
341 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
342
343 //- inline G4double
344 //- EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
345 //- G4double step,
346 //- const G4Material* mat,
347 //- const G4String& name)
348 //- {
349 //- return EnergyDispersion(kinEnergy, step, mat, FindParticle(name));
350 //- }
351
352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
353
354 inline G4double
356 G4double stepLength,
357 const G4Material* mat,
358 const G4ParticleDefinition* part)
359 {
360 G4double theta = 0.0;
361 if (SetupKinematics(part, mat, kinEnergy)) {
362 G4double t = stepLength / m_RadLength;
363 G4double y = std::max(0.001, t);
364 theta = 19.23 * CLHEP::MeV * std::sqrt(m_ChargeSq * t) * (1.0 + 0.038 * std::log(y)) / (m_BetaSq * m_Gamma * m_Mass);
365 }
366 return theta;
367 }
368
369 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
370
371 inline G4double
373 const G4ParticleDefinition* part,
374 G4double kinEnergy,
375 G4double stepLength)
376 {
377 G4double theta = AverageScatteringAngle(kinEnergy, stepLength, mat, part);
378 return stepLength * std::sqrt(1.0 + 0.625 * theta * theta);
379 }
380
381 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
382
383 //- inline
384 //- G4double EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
385 //- G4double stepLength,
386 //- const G4Material* mat,
387 //- const G4ParticleDefinition* part)
388 //- {
389 //- G4double sig2 = 0.0;
390 //- if (SetupKinematics(part, mat, kinEnergy)) {
391 //- G4double step = ComputeTrueStep(mat, part, kinEnergy, stepLength);
392 //- sig2 = (1.0 / beta2 - 0.5) * CLHEP::twopi_mc2_rcl2 * tmax * step * electronDensity * charge2;
393 //- }
394 //- return sig2;
395 //- }
396
397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
398
399 inline G4double EnergyLossForExtrapolator::ComputeValue(G4double x,
400 const G4PhysicsTable* table)
401 {
402 G4double res = 0.0;
403 G4bool b;
404 if (table) res = ((*table)[m_MaterialIndex])->GetValue(x, b);
405 return res;
406 }
407
408 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
409
410 //- inline void EnergyLossForExtrapolator::SetVerbose(G4int val)
411 //- {
412 //- verbose = val;
413 //- }
414
415 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
416
418 {
419 m_UserTmin = val;
420 }
421
422 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
423
425 {
426 m_UserTmax = val;
427 }
428
429 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
430
432 {
434 }
435
436 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
437
438 } //end namespace Simulation
439
441} //end Belle2 namespace
442
443#endif /* ENERGYLOSSFOREXTRAPOLATOR_H_ */
Calculate energy loss, fluctuation, and multiple-scattering angle for extrapolator.
const G4ParticleDefinition * m_Particle
Pointer to definition of the currently cached particle.
const G4ParticleDefinition * m_KaonPlus
Pointer to definition of the positive kaon.
G4PhysicsTable * m_DedxPion
Pointer to the pion's specific ionization energy loss vs KE table.
void Initialisation()
Initialize tables used to calculate energy loss, fluctuation, and scattering for electrons,...
G4PhysicsTable * m_DedxPositron
Pointer to the positron's specific ionization energy loss vs KE table.
G4double m_RadLength
Cached material radiation length.
void ComputeTransportXS(const G4ParticleDefinition *part, G4PhysicsTable *table)
Fill the table with the multiple-scattering cross section of a particle.
G4double m_KineticEnergy
Cached particle kinetic energy.
G4PhysicsTable * m_MscatElectron
Pointer to the electron's multiple-scattering cross section vs KE table.
G4PhysicsTable * PrepareTable()
Create a new table to store one type of kinematics data for a particle.
G4double m_UserMaxEnergyTransfer
User's upper limit on maximum kinetic-energy loss (default infinity)
G4PhysicsTable * m_InvRangeKaon
Pointer to the kaon's inverse-range vs KE table.
EnergyLossForExtrapolator & operator=(const EnergyLossForExtrapolator &right)
Hide assignment operator.
const G4ParticleDefinition * FindParticle(const G4String &name)
Get the particle definition of the named particle.
G4PhysicsTable * m_RangePositron
Pointer to the positron's range vs KE table.
G4PhysicsTable * m_DedxMuon
Pointer to the muon's specific ionization energy loss vs KE table.
G4int m_Nbins
Number of bins in each energy loss, fluctuation, and multiple-scattering table (70,...
G4PhysicsTable * m_RangeProton
Pointer to the proton's range vs KE table.
G4PhysicsTable * m_DedxKaon
Pointer to the kaon's specific ionization energy loss vs KE table.
G4PhysicsTable * m_InvRangeElectron
Pointer to the electron's inverse-range vs KE table.
const G4ParticleDefinition * m_MuonMinus
Pointer to definition of the negative muon.
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *)
Get specific ionization energy loss for the given kinetic energy and particle.
G4double m_ChargeSq
Cached charge-squared (in units of e)
G4PhysicsTable * m_RangeKaon
Pointer to the kaon's range vs KE table.
void ComputeElectronDEDX(const G4ParticleDefinition *part, G4PhysicsTable *table)
Fill the table with the specific ionization energy loss of an electron.
const G4ParticleDefinition * m_Electron
Pointer to definition of the electron.
G4double m_Tmax
Cached particle's maximum kinetic-energy loss.
G4double m_ElectronDensity
Cached material electron density.
G4double m_LinLossLimit
Step-length limit in units of range (0.01); not modifiable by user.
G4PhysicsTable * m_RangePion
Pointer to the pion's range vs KE table.
G4double EnergyAfterStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
Get kinetic energy after a step in given material by given particle.
G4double m_Gamma
Cached particle's gamma value.
const G4ParticleDefinition * m_AntiDeuteron
Pointer to definition of the antideuteron.
G4PhysicsTable * m_DedxProton
Pointer to the proton's specific ionization energy loss vs KE table.
const G4ParticleDefinition * m_Proton
Pointer to definition of the proton.
G4PhysicsTable * m_InvRangeDeuteron
Pointer to the deuteron's inverse-range vs KE table.
void SetMaxKinEnergy(G4double)
Change the maximum particle kinetic energy for this class (default is 10 TeV)
G4PhysicsTable * m_InvRangePositron
Pointer to the positron's inverse-range vs KE table.
G4double TrueStepLength(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
Get true step length for given particle and kinetic energy.
const G4ParticleDefinition * m_AntiProton
Pointer to definition of the antiproton.
G4bool m_Initialised
UNUSED Flag to indicate that Initialisation() method has been called.
G4PhysicsTable * m_InvRangeMuon
Pointer to the muon's inverse-range vs KE table.
const G4ParticleDefinition * m_KaonMinus
Pointer to definition of the negative kaon.
const G4Material * m_Material
Pointer to internally cached material.
G4PhysicsTable * m_RangeElectron
Pointer to the electron's range vs KE table.
const G4ParticleDefinition * m_PionMinus
Pointer to definition of the negative pion.
void ComputeHadronDEDX(const G4ParticleDefinition *part, G4PhysicsTable *table)
Fill the table with the specific ionization energy loss of a hadron.
G4PhysicsTable * m_InvRangePion
Pointer to the pion's inverse-range vs KE table.
G4PhysicsTable * m_InvRangeProton
Pointer to the proton's inverse-range vs KE table.
void ComputeMuonDEDX(const G4ParticleDefinition *part, G4PhysicsTable *table)
Fill the table with the specific ionization energy loss of a muon.
G4PhysicsTable * m_DedxElectron
Pointer to the electron's specific ionization energy loss vs KE table.
G4double ComputeEnergy(G4double range, const G4ParticleDefinition *)
Get kinetic energy corresponding to the given range and particle.
EnergyLossForExtrapolator()
Constructor (WITHOUT GEANT4 verbosity flag)
const G4ParticleDefinition * m_Deuteron
Pointer to definition of the deuteron.
const G4ParticleDefinition * m_MuonPlus
Pointer to definition of the positive muon.
G4double ComputeValue(G4double x, const G4PhysicsTable *table)
Get the tabulated energy-loss, fluctuation, or scattering value for the given input.
G4bool SetupKinematics(const G4ParticleDefinition *, const G4Material *, G4double kinEnergy)
Save current particle properties, kinetic energy and material in internal cached state.
G4PhysicsTable * m_RangeMuon
Pointer to the muon's range vs KE table.
G4double m_UserTmin
User's minimum kinetic energy for particles (default 1 MeV)
G4double ComputeTrueStep(const G4Material *, const G4ParticleDefinition *part, G4double kinEnergy, G4double stepLength)
Get average scattering angle after a step in given material by given particle.
G4double EnergyBeforeStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
Get kinetic energy before a step in given material by given particle.
G4PhysicsTable * m_DedxDeuteron
Pointer to the deuteron's specific ionization energy loss vs KE table.
G4int m_NMaterials
Number of materials in current geometry.
void SetMaxEnergyTransfer(G4double)
Change the maximum energy loss or gain for this class (default is infinity)
std::vector< const G4MaterialCutsCouple * > m_Couples
List of material-cuts pairings.
void SetMinKinEnergy(G4double)
Get energy dispersion for a step in given material by given particle.
EnergyLossForExtrapolator(const EnergyLossForExtrapolator &)
Hide copy-assignment operator.
G4double m_BetaSq
Cached particle's beta squared.
const G4ParticleDefinition * m_Positron
Pointer to definition of the positron.
G4double AverageScatteringAngle(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
Get kinetic energy after a step in given material by given particle.
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition *)
Get range for the given kinetic energy and particle.
G4PhysicsTable * m_RangeDeuteron
Pointer to the deuteron's range vs KE table.
const G4ParticleDefinition * m_PionPlus
Pointer to definition of the positive pion.
G4ProductionCuts * m_ProductionCuts
Pointer to the internal cache of default G4ProductionCuts.
G4double m_UserTmax
User's maximum kinetic energy for particles (default 10 TeV)
G4double m_BetaGammaSq
Cached particle's beta*gamma squared.
Abstract base class for different kinds of events.