CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CMSmplIonisation.cc
Go to the documentation of this file.
1 //
2 // -------------------------------------------------------------------
3 //
4 // GEANT4 Class file
5 //
6 //
7 // File name: CMSmplIonisation
8 //
9 // Author: Vladimir Ivanchenko copied from Geant4 10.5p01
10 //
11 // Creation date: 02.03.2019
12 //
13 //
14 // -------------------------------------------------------------------
15 //
16 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
17 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
18 
21 #include "G4PhysicalConstants.hh"
22 #include "G4SystemOfUnits.hh"
23 #include "G4Electron.hh"
24 
25 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
26 
27 using namespace std;
28 
29 CMSmplIonisation::CMSmplIonisation(G4double mCharge, const G4String& name)
30  : G4VEnergyLossProcess(name),
31  magneticCharge(mCharge),
32  isInitialised(false)
33 {
34  // By default classical magnetic charge is used
35  if(magneticCharge == 0.0) { magneticCharge = eplus*0.5/fine_structure_const; }
36 
37  SetVerboseLevel(0);
38  SetProcessSubType(fIonisation);
39  SetStepFunction(0.2, 1*mm);
40  SetSecondaryParticle(G4Electron::Electron());
41 }
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 
46 {}
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
50 G4bool CMSmplIonisation::IsApplicable(const G4ParticleDefinition&)
51 {
52  return true;
53 }
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
56 
57 G4double CMSmplIonisation::MinPrimaryEnergy(const G4ParticleDefinition* mpl,
58  const G4Material*,
59  G4double cut)
60 {
61  G4double x = 0.5*cut/electron_mass_c2;
62  G4double mass = mpl->GetPDGMass();
63  G4double ratio = electron_mass_c2/mass;
64  G4double gam = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
65  return mass*(gam - 1.0);
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69 
70 void CMSmplIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* p,
71  const G4ParticleDefinition*)
72 {
73  if(isInitialised) { return; }
74 
75  SetBaseParticle(nullptr);
76 
77  // monopole model is responsible both for energy loss and fluctuations
80  ion->SetParticle(p);
81 
82  // define size of dedx and range tables
83  G4double emin = std::min(MinKinEnergy(),ion->LowEnergyLimit());
84  G4double emax = std::max(MaxKinEnergy(),ion->HighEnergyLimit());
85  ion->SetLowEnergyLimit(emin);
86  ion->SetHighEnergyLimit(emax);
87  SetMinKinEnergy(emin);
88  SetMaxKinEnergy(emax);
89  AddEmModel(1,ion,ion);
90 
91  isInitialised = true;
92 }
93 
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95 
97 {}
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
100 
CMSmplIonisation(G4double mCharge=0.0, const G4String &name="mplIoni")
void SetParticle(const G4ParticleDefinition *p)
T sqrt(T t)
Definition: SSEVec.h:48
T min(T a, T b)
Definition: MathUtil.h:58
G4double MinPrimaryEnergy(const G4ParticleDefinition *p, const G4Material *, G4double cut) final
void PrintInfo() override
void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *) override
~CMSmplIonisation() override
G4bool IsApplicable(const G4ParticleDefinition &p) override
volatile std::atomic< bool > shutdown_flag false
Definition: DDAxes.h:10