CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SiG4UniversalFluctuation Class Reference

#include <SiG4UniversalFluctuation.h>

Public Member Functions

double SampleFluctuations (const double momentum, const double mass, double &tmax, const double length, const double meanLoss)
 
 SiG4UniversalFluctuation (CLHEP::HepRandomEngine &)
 
 ~SiG4UniversalFluctuation ()
 

Private Attributes

double alim
 
double chargeSquare
 
double e0
 
double e1Fluct
 
double e1LogFluct
 
double e2Fluct
 
double e2LogFluct
 
double electronDensity
 
double f1Fluct
 
double f2Fluct
 
CLHEP::RandFlat * flatDistribution
 
CLHEP::RandGaussQ * gaussQDistribution
 
double ipotFluct
 
double ipotLogFluct
 
double minLoss
 
double minNumberInteractionsBohr
 
double nmaxCont1
 
double nmaxCont2
 
double particleMass
 
CLHEP::RandPoisson * poissonDistribution
 
double problim
 
double rateFluct
 
CLHEP::HepRandomEngine & rndEngine
 
double sumalim
 
double theBohrBeta2
 

Detailed Description

Definition at line 67 of file SiG4UniversalFluctuation.h.

Constructor & Destructor Documentation

SiG4UniversalFluctuation::SiG4UniversalFluctuation ( CLHEP::HepRandomEngine &  eng)

Definition at line 74 of file SiG4UniversalFluctuation.cc.

References chargeSquare, e0, e1Fluct, e1LogFluct, e2Fluct, e2LogFluct, electronDensity, f1Fluct, f2Fluct, flatDistribution, gaussQDistribution, ipotFluct, ipotLogFluct, create_public_lumi_plots::log, poissonDistribution, problim, rateFluct, rndEngine, and sumalim.

75  :rndEngine(eng),
80  theBohrBeta2(50.0*keV/proton_mass_c2),
81  minLoss(10.*eV),
82  problim(5.e-3),
83  alim(10.),
84  nmaxCont1(4.),
85  nmaxCont2(16.)
86 {
87  sumalim = -log(problim);
88  //lastMaterial = 0;
89 
90  // Add these definitions d.k.
91  chargeSquare = 1.; //Assume all particles have charge 1
92  // Taken from Geant4 printout, HARDWIRED for Silicon.
93  ipotFluct = 0.0001736; //material->GetIonisation()->GetMeanExcitationEnergy();
94  electronDensity = 6.797E+20; // material->GetElectronDensity();
95  f1Fluct = 0.8571; // material->GetIonisation()->GetF1fluct();
96  f2Fluct = 0.1429; //material->GetIonisation()->GetF2fluct();
97  e1Fluct = 0.000116;// material->GetIonisation()->GetEnergy1fluct();
98  e2Fluct = 0.00196; //material->GetIonisation()->GetEnergy2fluct();
99  e1LogFluct = -9.063; //material->GetIonisation()->GetLogEnergy1fluct();
100  e2LogFluct = -6.235; //material->GetIonisation()->GetLogEnergy2fluct();
101  rateFluct = 0.4; //material->GetIonisation()->GetRateionexcfluct();
102  ipotLogFluct = -8.659; //material->GetIonisation()->GetLogMeanExcEnergy();
103  e0 = 1.E-5; //material->GetIonisation()->GetEnergy0fluct();
104 
105  gaussQDistribution = new CLHEP::RandGaussQ(rndEngine);
106  poissonDistribution = new CLHEP::RandPoisson(rndEngine);
107  flatDistribution = new CLHEP::RandFlat(rndEngine);
108 
109  //cout << " init new fluct +++++++++++++++++++++++++++++++++++++++++"<<endl;
110 }
CLHEP::RandGaussQ * gaussQDistribution
CLHEP::RandPoisson * poissonDistribution
CLHEP::HepRandomEngine & rndEngine
SiG4UniversalFluctuation::~SiG4UniversalFluctuation ( )

Definition at line 117 of file SiG4UniversalFluctuation.cc.

References flatDistribution, gaussQDistribution, and poissonDistribution.

118 {
119  delete gaussQDistribution;
120  delete poissonDistribution;
121  delete flatDistribution;
122 
123 }
CLHEP::RandGaussQ * gaussQDistribution
CLHEP::RandPoisson * poissonDistribution

Member Function Documentation

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

Definition at line 126 of file SiG4UniversalFluctuation.cc.

References alim, funct::C, chargeSquare, e0, e1Fluct, e1LogFluct, e2Fluct, e2LogFluct, electronDensity, f1Fluct, f2Fluct, flatDistribution, gam, gaussQDistribution, i, ipotFluct, ipotLogFluct, gen::k, create_public_lumi_plots::log, scaleCards::mass, max(), minLoss, minNumberInteractionsBohr, nmaxCont1, nmaxCont2, p1, p2, p3, particleMass, poissonDistribution, scaleCards::rate, rateFluct, mathSSE::sqrt(), sumalim, w(), w2, and vdt::x.

Referenced by SiLinearChargeDivider::fluctuateEloss(), and SiPixelDigitizerAlgorithm::fluctuateEloss().

131 {
132 // Calculate actual loss from the mean loss.
133 // The model used to get the fluctuations is essentially the same
134 // as in Glandz in Geant3 (Cern program library W5013, phys332).
135 // L. Urban et al. NIM A362, p.416 (1995) and Geant4 Physics Reference Manual
136 
137  // shortcut for very very small loss (out of validity of the model)
138  //
139  if (meanLoss < minLoss) return meanLoss;
140 
141  //if(!particle) InitialiseMe(dp->GetDefinition());
142  //G4double tau = dp->GetKineticEnergy()/particleMass;
143  //G4double gam = tau + 1.0;
144  //G4double gam2 = gam*gam;
145  //G4double beta2 = tau*(tau + 2.0)/gam2;
146 
147  particleMass = mass; // dp->GetMass();
148  double gam2 = (momentum*momentum)/(particleMass*particleMass) + 1.0;
149  double beta2 = 1.0 - 1.0/gam2;
150  double gam = sqrt(gam2);
151 
152  double loss(0.), siga(0.);
153 
154  // Gaussian regime
155  // for heavy particles only and conditions
156  // for Gauusian fluct. has been changed
157  //
158  if ((particleMass > electron_mass_c2) &&
159  (meanLoss >= minNumberInteractionsBohr*tmax))
160  {
161  double massrate = electron_mass_c2/particleMass ;
162  double tmaxkine = 2.*electron_mass_c2*beta2*gam2/
163  (1.+massrate*(2.*gam+massrate)) ;
164  if (tmaxkine <= 2.*tmax)
165  {
166  //electronDensity = material->GetElectronDensity();
167  siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
169  siga = sqrt(siga);
170  double twomeanLoss = meanLoss + meanLoss;
171  if (twomeanLoss < siga) {
172  double x;
173  do {
174  loss = twomeanLoss*flatDistribution->fire();
175  x = (loss - meanLoss)/siga;
176  } while (1.0 - 0.5*x*x < flatDistribution->fire());
177  } else {
178  do {
179  loss = gaussQDistribution->fire(meanLoss,siga);
180  } while (loss < 0. || loss > twomeanLoss);
181  }
182  return loss;
183  }
184  }
185 
186  // Glandz regime : initialisation
187  //
188 // if (material != lastMaterial) {
189 // f1Fluct = material->GetIonisation()->GetF1fluct();
190 // f2Fluct = material->GetIonisation()->GetF2fluct();
191 // e1Fluct = material->GetIonisation()->GetEnergy1fluct();
192 // e2Fluct = material->GetIonisation()->GetEnergy2fluct();
193 // e1LogFluct = material->GetIonisation()->GetLogEnergy1fluct();
194 // e2LogFluct = material->GetIonisation()->GetLogEnergy2fluct();
195 // rateFluct = material->GetIonisation()->GetRateionexcfluct();
196 // ipotFluct = material->GetIonisation()->GetMeanExcitationEnergy();
197 // ipotLogFluct = material->GetIonisation()->GetLogMeanExcEnergy();
198 // lastMaterial = material;
199 // }
200 
201  double a1 = 0. , a2 = 0., a3 = 0. ;
202  double p1,p2,p3;
203  double rate = rateFluct ;
204 
205  double w1 = tmax/ipotFluct;
206  double w2 = log(2.*electron_mass_c2*beta2*gam2)-beta2;
207 
208  if(w2 > ipotLogFluct)
209  {
210  double C = meanLoss*(1.-rateFluct)/(w2-ipotLogFluct);
211  a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
212  a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
213  if(a2 < 0.)
214  {
215  a1 = 0. ;
216  a2 = 0. ;
217  rate = 1. ;
218  }
219  }
220  else
221  {
222  rate = 1. ;
223  }
224 
225  a3 = rate*meanLoss*(tmax-ipotFluct)/(ipotFluct*tmax*log(w1));
226 
227  double suma = a1+a2+a3;
228 
229  // Glandz regime
230  //
231  if (suma > sumalim)
232  {
233  p1 = 0., p2 = 0 ;
234  if((a1+a2) > 0.)
235  {
236  // excitation type 1
237  if (a1>alim) {
238  siga=sqrt(a1) ;
239  p1 = max(0.,gaussQDistribution->fire(a1,siga)+0.5);
240  } else {
241  p1 = double(poissonDistribution->fire(a1));
242  }
243 
244  // excitation type 2
245  if (a2>alim) {
246  siga=sqrt(a2) ;
247  p2 = max(0.,gaussQDistribution->fire(a2,siga)+0.5);
248  } else {
249  p2 = double(poissonDistribution->fire(a2));
250  }
251 
252  loss = p1*e1Fluct+p2*e2Fluct;
253 
254  // smearing to avoid unphysical peaks
255  if (p2 > 0.)
256  loss += (1.-2.*flatDistribution->fire())*e2Fluct;
257  else if (loss>0.)
258  loss += (1.-2.*flatDistribution->fire())*e1Fluct;
259  if (loss < 0.) loss = 0.0;
260  }
261 
262  // ionisation
263  if (a3 > 0.) {
264  if (a3>alim) {
265  siga=sqrt(a3) ;
266  p3 = max(0.,gaussQDistribution->fire(a3,siga)+0.5);
267  } else {
268  p3 = double(poissonDistribution->fire(a3));
269  }
270  double lossc = 0.;
271  if (p3 > 0) {
272  double na = 0.;
273  double alfa = 1.;
274  if (p3 > nmaxCont2) {
275  double rfac = p3/(nmaxCont2+p3);
276  double namean = p3*rfac;
277  double sa = nmaxCont1*rfac;
278  na = gaussQDistribution->fire(namean,sa);
279  if (na > 0.) {
280  alfa = w1*(nmaxCont2+p3)/(w1*nmaxCont2+p3);
281  double alfa1 = alfa*log(alfa)/(alfa-1.);
282  double ea = na*ipotFluct*alfa1;
283  double sea = ipotFluct*sqrt(na*(alfa-alfa1*alfa1));
284  lossc += gaussQDistribution->fire(ea,sea);
285  }
286  }
287 
288  if (p3 > na) {
289  w2 = alfa*ipotFluct;
290  double w = (tmax-w2)/tmax;
291  int nb = int(p3-na);
292  for (int k=0; k<nb; k++) lossc += w2/(1.-w*flatDistribution->fire());
293  }
294  }
295  loss += lossc;
296  }
297  return loss;
298  }
299 
300  // suma < sumalim; very small energy loss;
301  //
302  //double e0 = material->GetIonisation()->GetEnergy0fluct();
303 
304  a3 = meanLoss*(tmax-e0)/(tmax*e0*log(tmax/e0));
305  if (a3 > alim)
306  {
307  siga=sqrt(a3);
308  p3 = max(0.,gaussQDistribution->fire(a3,siga)+0.5);
309  } else {
310  p3 = double(poissonDistribution->fire(a3));
311  }
312  if (p3 > 0.) {
313  double w = (tmax-e0)/tmax;
314  double corrfac = 1.;
315  if (p3 > nmaxCont2) {
316  corrfac = p3/nmaxCont2;
317  p3 = nmaxCont2;
318  }
319  int ip3 = (int)p3;
320  for (int i=0; i<ip3; i++) loss += 1./(1.-w*flatDistribution->fire());
321  loss *= e0*corrfac;
322  // smearing for losses near to e0
323  if(p3 <= 2.)
324  loss += e0*(1.-2.*flatDistribution->fire()) ;
325  }
326 
327  return loss;
328 }
int i
Definition: DBlmapReader.cc:9
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
const T & max(const T &a, const T &b)
T sqrt(T t)
Definition: SSEVec.h:46
double p2[4]
Definition: TauolaWrapper.h:90
list rate
Definition: scaleCards.py:77
int k[5][pyjets_maxn]
static const double tmax[3]
CLHEP::RandGaussQ * gaussQDistribution
double p1[4]
Definition: TauolaWrapper.h:89
tuple mass
Definition: scaleCards.py:27
x
Definition: VDTMath.h:216
CLHEP::RandPoisson * poissonDistribution
T w() const
double p3[4]
Definition: TauolaWrapper.h:91

Member Data Documentation

double SiG4UniversalFluctuation::alim
private

Definition at line 132 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations().

double SiG4UniversalFluctuation::chargeSquare
private

Definition at line 110 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::e0
private

Definition at line 125 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::e1Fluct
private

Definition at line 119 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::e1LogFluct
private

Definition at line 122 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::e2Fluct
private

Definition at line 120 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::e2LogFluct
private

Definition at line 123 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::electronDensity
private

Definition at line 114 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::f1Fluct
private

Definition at line 117 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::f2Fluct
private

Definition at line 118 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

CLHEP::RandFlat* SiG4UniversalFluctuation::flatDistribution
private
CLHEP::RandGaussQ* SiG4UniversalFluctuation::gaussQDistribution
private
double SiG4UniversalFluctuation::ipotFluct
private

Definition at line 113 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::ipotLogFluct
private

Definition at line 124 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::minLoss
private

Definition at line 129 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations().

double SiG4UniversalFluctuation::minNumberInteractionsBohr
private

Definition at line 127 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations().

double SiG4UniversalFluctuation::nmaxCont1
private

Definition at line 133 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations().

double SiG4UniversalFluctuation::nmaxCont2
private

Definition at line 134 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations().

double SiG4UniversalFluctuation::particleMass
private

Definition at line 109 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations().

CLHEP::RandPoisson* SiG4UniversalFluctuation::poissonDistribution
private
double SiG4UniversalFluctuation::problim
private

Definition at line 130 of file SiG4UniversalFluctuation.h.

Referenced by SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::rateFluct
private

Definition at line 121 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

CLHEP::HepRandomEngine& SiG4UniversalFluctuation::rndEngine
private

Definition at line 98 of file SiG4UniversalFluctuation.h.

Referenced by SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::sumalim
private

Definition at line 131 of file SiG4UniversalFluctuation.h.

Referenced by SampleFluctuations(), and SiG4UniversalFluctuation().

double SiG4UniversalFluctuation::theBohrBeta2
private

Definition at line 128 of file SiG4UniversalFluctuation.h.