CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
LandauFP420 Class Reference

#include <LandauFP420.h>

Public Member Functions

 LandauFP420 ()
 
double SampleFluctuations (const double momentum, const double mass, double &tmax, const double length, const double meanLoss)
 
 ~LandauFP420 ()
 

Private Attributes

double alim
 
double chargeSquare
 
double e0
 
double e1Fluct
 
double e1LogFluct
 
double e2Fluct
 
double e2LogFluct
 
double electronDensity
 
double f1Fluct
 
double f2Fluct
 
double ipotFluct
 
double ipotLogFluct
 
double minLoss
 
double minNumberInteractionsBohr
 
int nmaxCont1
 
int nmaxCont2
 
double particleMass
 
double problim
 
double rateFluct
 
double sumalim
 
double theBohrBeta2
 

Detailed Description

Definition at line 51 of file LandauFP420.h.

Constructor & Destructor Documentation

◆ LandauFP420()

LandauFP420::LandauFP420 ( )

Definition at line 66 of file LandauFP420.cc.

References chargeSquare, e0, e1Fluct, e1LogFluct, e2Fluct, e2LogFluct, electronDensity, f1Fluct, f2Fluct, ipotFluct, ipotLogFluct, dqm-mbProfile::log, problim, rateFluct, and sumalim.

68  theBohrBeta2(50.0 * keV / proton_mass_c2),
69  minLoss(0.000001 * eV),
70  problim(0.01),
71  alim(10.),
72  nmaxCont1(4),
73  nmaxCont2(16) {
74  sumalim = -log(problim);
75 
76  chargeSquare = 1.; // Assume all particles have charge 1
77  // Taken from Geant4 printout, HARDWIRED for Silicon.
78  ipotFluct = 0.0001736; // material->GetIonisation()->GetMeanExcitationEnergy();
79  electronDensity = 6.797E+20; // material->GetElectronDensity();
80  f1Fluct = 0.8571; // material->GetIonisation()->GetF1fluct();
81  f2Fluct = 0.1429; // material->GetIonisation()->GetF2fluct();
82  e1Fluct = 0.000116; // material->GetIonisation()->GetEnergy1fluct();
83  e2Fluct = 0.00196; // material->GetIonisation()->GetEnergy2fluct();
84  e1LogFluct = -9.063; // material->GetIonisation()->GetLogEnergy1fluct();
85  e2LogFluct = -6.235; // material->GetIonisation()->GetLogEnergy2fluct();
86  rateFluct = 0.4; // material->GetIonisation()->GetRateionexcfluct();
87  ipotLogFluct = -8.659; // material->GetIonisation()->GetLogMeanExcEnergy();
88  e0 = 1.E-5; // material->GetIonisation()->GetEnergy0fluct();
89 }
double e1Fluct
Definition: LandauFP420.h:87
double e2LogFluct
Definition: LandauFP420.h:91
double e1LogFluct
Definition: LandauFP420.h:90
double chargeSquare
Definition: LandauFP420.h:78
double rateFluct
Definition: LandauFP420.h:89
double minLoss
Definition: LandauFP420.h:97
double alim
Definition: LandauFP420.h:100
double sumalim
Definition: LandauFP420.h:99
double electronDensity
Definition: LandauFP420.h:82
double minNumberInteractionsBohr
Definition: LandauFP420.h:95
double ipotFluct
Definition: LandauFP420.h:81
double e2Fluct
Definition: LandauFP420.h:88
double f1Fluct
Definition: LandauFP420.h:85
double f2Fluct
Definition: LandauFP420.h:86
double problim
Definition: LandauFP420.h:98
double e0
Definition: LandauFP420.h:93
double ipotLogFluct
Definition: LandauFP420.h:92
double theBohrBeta2
Definition: LandauFP420.h:96

◆ ~LandauFP420()

LandauFP420::~LandauFP420 ( )

Definition at line 91 of file LandauFP420.cc.

91 {}

Member Function Documentation

◆ SampleFluctuations()

double LandauFP420::SampleFluctuations ( const double  momentum,
const double  mass,
double &  tmax,
const double  length,
const double  meanLoss 
)

Definition at line 96 of file LandauFP420.cc.

References testProducerWithPsetDescEmpty_cfi::a2, alim, correctionTermsCaloMet_cff::C, chargeSquare, e0, e1Fluct, e1LogFluct, e2Fluct, e2LogFluct, electronDensity, f1Fluct, f2Fluct, dqmMemoryStats::float, mps_fire::i, createfilelist::int, ipotFluct, ipotLogFluct, dqmdumpme::k, dqm-mbProfile::log, EgHLTOffHistBins_cfi::mass, SiStripPI::max, minLoss, minNumberInteractionsBohr, nmaxCont1, nmaxCont2, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, particleMass, rateFluct, mathSSE::sqrt(), sumalim, tmax, w(), and w2.

97  {
98  // calculate actual loss from the mean loss
99  // The model used to get the fluctuation is essentially the same
100  // as in Glandz in Geant3.
101 
102  // shortcut for very very small loss
103  if (meanLoss < minLoss)
104  return meanLoss;
105 
106  // if(dp->GetDefinition() != particle) {
107  particleMass = mass; // dp->GetMass();
108  // G4double q = dp->GetCharge();
109  // chargeSquare = q*q;
110  //}
111 
112  // double gam = (dp->GetKineticEnergy())/particleMass + 1.0;
113  // double gam2 = gam*gam;
114  double gam2 = (momentum * momentum) / (particleMass * particleMass) + 1.0;
115  double beta2 = 1.0 - 1.0 / gam2;
116 
117  // Validity range for delta electron cross section
118  double loss, siga;
119  // Gaussian fluctuation
121  siga = (1.0 / beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length * electronDensity * chargeSquare;
122  siga = sqrt(siga);
123  do {
124  // loss = G4RandGauss::shoot(meanLoss,siga);
125  loss = CLHEP::RandGaussQ::shoot(meanLoss, siga);
126  } while (loss < 0. || loss > 2. * meanLoss);
127 
128  return loss;
129  }
130 
131  // Non Gaussian fluctuation
132  double suma, w1, w2, C, lossc, w;
133  double a1, a2, a3;
134  int p1, p2, p3;
135  int nb;
136  double corrfac, na, alfa, rfac, namean, sa, alfa1, ea, sea;
137  double dp3;
138 
139  w1 = tmax / ipotFluct;
140  w2 = log(2. * electron_mass_c2 * (gam2 - 1.0));
141 
142  C = meanLoss * (1. - rateFluct) / (w2 - ipotLogFluct - beta2);
143 
144  a1 = C * f1Fluct * (w2 - e1LogFluct - beta2) / e1Fluct;
145  a2 = C * f2Fluct * (w2 - e2LogFluct - beta2) / e2Fluct;
146  a3 = rateFluct * meanLoss * (tmax - ipotFluct) / (ipotFluct * tmax * log(w1));
147  if (a1 < 0.)
148  a1 = 0.;
149  if (a2 < 0.)
150  a2 = 0.;
151  if (a3 < 0.)
152  a3 = 0.;
153 
154  suma = a1 + a2 + a3;
155 
156  loss = 0.;
157 
158  if (suma < sumalim) // very small Step
159  {
160  // e0 = material->GetIonisation()->GetEnergy0fluct();//Hardwired in const
161  if (tmax == ipotFluct) {
162  a3 = meanLoss / e0;
163 
164  if (a3 > alim) {
165  siga = sqrt(a3);
166  // p3 = G4std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
167  p3 = std::max(0, int(CLHEP::RandGaussQ::shoot(a3, siga) + 0.5));
168  } else
169  p3 = CLHEP::RandPoisson::shoot(a3);
170  // p3 = G4Poisson(a3);
171 
172  loss = p3 * e0;
173 
174  if (p3 > 0)
175  // loss += (1.-2.*G4UniformRand())*e0 ;
176  loss += (1. - 2. * CLHEP::RandFlat::shoot()) * e0;
177 
178  } else {
179  tmax = tmax - ipotFluct + e0;
180  a3 = meanLoss * (tmax - e0) / (tmax * e0 * log(tmax / e0));
181 
182  if (a3 > alim) {
183  siga = sqrt(a3);
184  // p3 = G4std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
185  p3 = std::max(0, int(CLHEP::RandGaussQ::shoot(a3, siga) + 0.5));
186  } else
187  p3 = CLHEP::RandPoisson::shoot(a3);
188  // p3 = G4Poisson(a3);
189 
190  if (p3 > 0) {
191  w = (tmax - e0) / tmax;
192  if (p3 > nmaxCont2) {
193  dp3 = float(p3);
194  corrfac = dp3 / float(nmaxCont2);
195  p3 = nmaxCont2;
196  } else
197  corrfac = 1.;
198 
199  // for(int i=0; i<p3; i++) loss += 1./(1.-w*G4UniformRand()) ;
200  for (int i = 0; i < p3; i++)
201  loss += 1. / (1. - w * CLHEP::RandFlat::shoot());
202  loss *= e0 * corrfac;
203  }
204  }
205  }
206 
207  else // not so small Step
208  {
209  // excitation type 1
210  if (a1 > alim) {
211  siga = sqrt(a1);
212  // p1 = std::max(0,int(G4RandGauss::shoot(a1,siga)+0.5));
213  p1 = std::max(0, int(CLHEP::RandGaussQ::shoot(a1, siga) + 0.5));
214  } else
215  p1 = CLHEP::RandPoisson::shoot(a1);
216  // p1 = G4Poisson(a1);
217 
218  // excitation type 2
219  if (a2 > alim) {
220  siga = sqrt(a2);
221  // p2 = std::max(0,int(G4RandGauss::shoot(a2,siga)+0.5));
222  p2 = std::max(0, int(CLHEP::RandGaussQ::shoot(a2, siga) + 0.5));
223  } else
224  p2 = CLHEP::RandPoisson::shoot(a2);
225  // p2 = G4Poisson(a2);
226 
227  loss = p1 * e1Fluct + p2 * e2Fluct;
228 
229  // smearing to avoid unphysical peaks
230  if (p2 > 0)
231  // loss += (1.-2.*G4UniformRand())*e2Fluct;
232  loss += (1. - 2. * CLHEP::RandFlat::shoot()) * e2Fluct;
233  else if (loss > 0.)
234  loss += (1. - 2. * CLHEP::RandFlat::shoot()) * e1Fluct;
235 
236  // ionisation .......................................
237  if (a3 > 0.) {
238  if (a3 > alim) {
239  siga = sqrt(a3);
240  p3 = std::max(0, int(CLHEP::RandGaussQ::shoot(a3, siga) + 0.5));
241  } else
242  p3 = CLHEP::RandPoisson::shoot(a3);
243 
244  lossc = 0.;
245  if (p3 > 0) {
246  na = 0.;
247  alfa = 1.;
248  if (p3 > nmaxCont2) {
249  dp3 = float(p3);
250  rfac = dp3 / (float(nmaxCont2) + dp3);
251  namean = float(p3) * rfac;
252  sa = float(nmaxCont1) * rfac;
253  na = CLHEP::RandGaussQ::shoot(namean, sa);
254  if (na > 0.) {
255  alfa = w1 * float(nmaxCont2 + p3) / (w1 * float(nmaxCont2) + float(p3));
256  alfa1 = alfa * log(alfa) / (alfa - 1.);
257  ea = na * ipotFluct * alfa1;
258  sea = ipotFluct * sqrt(na * (alfa - alfa1 * alfa1));
259  lossc += CLHEP::RandGaussQ::shoot(ea, sea);
260  }
261  }
262 
263  nb = int(float(p3) - na);
264  if (nb > 0) {
265  w2 = alfa * ipotFluct;
266  w = (tmax - w2) / tmax;
267  for (int k = 0; k < nb; k++)
268  lossc += w2 / (1. - w * CLHEP::RandFlat::shoot());
269  }
270  }
271  loss += lossc;
272  }
273  }
274 
275  return loss;
276 }
double e1Fluct
Definition: LandauFP420.h:87
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
T w() const
double e2LogFluct
Definition: LandauFP420.h:91
double e1LogFluct
Definition: LandauFP420.h:90
double chargeSquare
Definition: LandauFP420.h:78
double rateFluct
Definition: LandauFP420.h:89
double minLoss
Definition: LandauFP420.h:97
double alim
Definition: LandauFP420.h:100
double sumalim
Definition: LandauFP420.h:99
double electronDensity
Definition: LandauFP420.h:82
T sqrt(T t)
Definition: SSEVec.h:19
static const double tmax[3]
double minNumberInteractionsBohr
Definition: LandauFP420.h:95
double ipotFluct
Definition: LandauFP420.h:81
double particleMass
Definition: LandauFP420.h:77
double e2Fluct
Definition: LandauFP420.h:88
double f1Fluct
Definition: LandauFP420.h:85
double f2Fluct
Definition: LandauFP420.h:86
double e0
Definition: LandauFP420.h:93
double ipotLogFluct
Definition: LandauFP420.h:92

Member Data Documentation

◆ alim

double LandauFP420::alim
private

Definition at line 100 of file LandauFP420.h.

Referenced by SampleFluctuations().

◆ chargeSquare

double LandauFP420::chargeSquare
private

Definition at line 78 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ e0

double LandauFP420::e0
private

Definition at line 93 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ e1Fluct

double LandauFP420::e1Fluct
private

Definition at line 87 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ e1LogFluct

double LandauFP420::e1LogFluct
private

Definition at line 90 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ e2Fluct

double LandauFP420::e2Fluct
private

Definition at line 88 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ e2LogFluct

double LandauFP420::e2LogFluct
private

Definition at line 91 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ electronDensity

double LandauFP420::electronDensity
private

Definition at line 82 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ f1Fluct

double LandauFP420::f1Fluct
private

Definition at line 85 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ f2Fluct

double LandauFP420::f2Fluct
private

Definition at line 86 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ ipotFluct

double LandauFP420::ipotFluct
private

Definition at line 81 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ ipotLogFluct

double LandauFP420::ipotLogFluct
private

Definition at line 92 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ minLoss

double LandauFP420::minLoss
private

Definition at line 97 of file LandauFP420.h.

Referenced by SampleFluctuations().

◆ minNumberInteractionsBohr

double LandauFP420::minNumberInteractionsBohr
private

Definition at line 95 of file LandauFP420.h.

Referenced by SampleFluctuations().

◆ nmaxCont1

int LandauFP420::nmaxCont1
private

Definition at line 101 of file LandauFP420.h.

Referenced by SampleFluctuations().

◆ nmaxCont2

int LandauFP420::nmaxCont2
private

Definition at line 102 of file LandauFP420.h.

Referenced by SampleFluctuations().

◆ particleMass

double LandauFP420::particleMass
private

Definition at line 77 of file LandauFP420.h.

Referenced by SampleFluctuations().

◆ problim

double LandauFP420::problim
private

Definition at line 98 of file LandauFP420.h.

Referenced by LandauFP420().

◆ rateFluct

double LandauFP420::rateFluct
private

Definition at line 89 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ sumalim

double LandauFP420::sumalim
private

Definition at line 99 of file LandauFP420.h.

Referenced by LandauFP420(), and SampleFluctuations().

◆ theBohrBeta2

double LandauFP420::theBohrBeta2
private

Definition at line 96 of file LandauFP420.h.