ProfileSimulator.cc
Go to the documentation of this file.
1 
14 #include <utl/Reader.h>
15 #include <utl/ErrorLogger.h>
16 #include <utl/AugerUnits.h>
17 #include <utl/MathConstants.h>
18 #include <utl/PhysicalConstants.h>
19 #include <utl/PhysicalFunctions.h>
20 #include <utl/TabulatedFunction.h>
21 #include <utl/TabulatedFunctionErrors.h>
22 #include <utl/Trace.h>
23 #include <utl/TraceAlgorithm.h>
24 #include <utl/Particle.h>
25 #include <utl/UTMPoint.h>
26 #include <utl/Point.h>
27 #include <utl/ReferenceEllipsoid.h>
28 #include <utl/RandomEngine.h>
29 #include <utl/config.h>
30 
31 #include <fwk/CentralConfig.h>
32 #include <fwk/RandomEngineRegistry.h>
33 
34 #include <evt/Event.h>
35 #include <evt/ShowerSimData.h>
36 #include <evt/VGaisserHillasParameter.h>
37 #include <evt/GaisserHillas4Parameter.h>
38 #include <evt/DefaultShowerGeometryProducer.h>
39 
40 #include <det/Detector.h>
41 
42 #include <fdet/FDetector.h>
43 #include <fdet/FDetector.h>
44 
45 #include <atm/ProfileResult.h>
46 
47 #include "ProfileSimulator.h"
48 
49 #include <CLHEP/Random/Randomize.h>
50 
51 using namespace ProfileSimulatorOG;
52 using namespace std;
53 using namespace utl;
54 using namespace evt;
55 using namespace fwk;
56 using namespace det;
57 using namespace fdet;
58 using namespace atm;
59 
60 using CLHEP::RandGauss;
61 using CLHEP::RandFlat;
62 using CLHEP::RandExponential;
63 
64 
66 {
67  // pre-set to proton primary
68  fPrimary = int(utl::Particle::eProton);
69 }
70 
71 
73 { }
74 
75 
76 //#warning this module throws NonExistentComponentExceptions, should have schema (JG)
79 {
80  cout << "ProfileSimulator::Init()" << endl;
81  CentralConfig* const cc = CentralConfig::GetInstance();
82 
83  Branch topB = cc->GetTopBranch("ProfileSimulator");
84 
85  Branch typeB = topB.GetChild("type");
86  if (!typeB) {
87  ERROR("Could not find branch type");
89  }
90  typeB.GetData(fProfileType);
91 
92  Branch enCutB = topB.GetChild("energyCutoff");
93  if (!enCutB) {
94  ERROR("Could not find branch energyCutoff");
96  }
97  enCutB.GetData(fEnergyCutoff);
98 
99  if (fProfileType == eFromEnergy) {
100 
101  fRandomEngine = &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector);
102 
103  Branch generateEnergyB = topB.GetChild("generateEnergy");
104  if (!generateEnergyB) {
105  ERROR("Could not find branch generateEnergy");
107  }
108  generateEnergyB.GetData(fGenerateEnergy);
109 
110  Branch constX0B = topB.GetChild("constantX0");
111  if (!constX0B) {
112  ERROR("Could not find branch constantX0");
114  }
115  constX0B.GetData(fConstantX0);
116 
117  if (fConstantX0) {
118  double error = 0;
119  double x0;
120  Branch x0B = topB.GetChild("x0");
121  if (!x0B) {
122  ERROR("Could not find branch x0");
124  }
125  x0B.GetData(x0);
126  fGH.SetShapeParameter(gh::eX0, x0, error);
127  }
128 
129  Branch enMinB = topB.GetChild("energyMin");
130  if (!enMinB) {
131  ERROR("Could not find branch energyMin");
133  }
134  enMinB.GetData(fMinEnergy);
135 
136  Branch enMaxB = topB.GetChild("energyMax");
137  if (!enMaxB) {
138  ERROR("Could not find branch energyMax");
140  }
141  enMaxB.GetData(fMaxEnergy);
142 
143  Branch alphaSpectrumB = topB.GetChild("alphaSpectrum");
144  if (!alphaSpectrumB) {
145  ERROR("Could not find branch alphaSpectrum");
147  }
148  alphaSpectrumB.GetData(fAlphaSpectrum);
149 
150  Branch xMaxSigB = topB.GetChild("xMaxSig");
151  if (!xMaxSigB) {
152  ERROR("Could not find branch xMaxSig");
154  }
155  xMaxSigB.GetData(fXMaxSig);
156 
157  return eSuccess;
158 
159  } // if (fProfileType == eFromEnergy)
160 
161  if (fProfileType == eFromFixParameters) {
162 
163  double error = 0;
164  double x0;
165  Branch x0B = topB.GetChild("x0");
166  if (!x0B) {
167  ERROR("Could not find branch x0");
169  }
170  x0B.GetData(x0);
171  fGH.SetShapeParameter(gh::eX0, x0, error);
172 
173  double xmax;
174  Branch xMaxB = topB.GetChild("xMax");
175  if (!xMaxB) {
176  ERROR("Could not find branch xMax");
178  }
179  xMaxB.GetData(xmax);
180  fGH.SetXMax(xmax, error);
181 
182  double nmax;
183  Branch nMaxB = topB.GetChild("nMax");
184  if (!nMaxB) {
185  ERROR("Could not find branch nMax");
187  }
188  nMaxB.GetData(nmax);
189  fGH.SetNMax(nmax, error);
190 
191  return eSuccess;
192 
193  } /*if (fProfileType == eFromFixParameters)*/ else {
194  ERROR("This Profile Type is not available.");
195  }
196 
197  return eFailure;
198 
199 }
200 
201 
204 {
205  if (event.HasSimShower()) {
206  ERROR("Shower sim data already exists. Cannot produce new Profile event.");
207  return eFailure;
208  }
209  event.MakeSimShower(evt::DefaultShowerGeometryProducer());
210 
211  Detector& theDetector = Detector::GetInstance();
212 
213  // We can use in future the height of one of the telescopes
214  double height = 1200*m;
215  ShowerSimData& shower = event.GetSimShower();
216  // Book energy cutoff used to calculate dE/dX
217  shower.SetEnergyCutoff(fEnergyCutoff);
218 
219  ProfileResult dvh = theDetector.GetAtmosphere().EvaluateDepthVsHeight();
220  double depthG = dvh.Y(height);
221  double xone = 0;
222 
223  if (fProfileType == eFromEnergy) {
224 
225  // Dice azimuth and zenith
226  const CoordinateSystemPtr localCS = shower.GetLocalCoordinateSystem();
227  fPhi = (-shower.GetDirection()).GetPhi(localCS);
228  fTheta = (-shower.GetDirection()).GetTheta(localCS);
229 
230  // Dice primary
231  fPrimary = shower.GetPrimaryParticle();
232 
233  // Dice energy
234  double energy = DicePowerLaw(fMinEnergy, fMaxEnergy, -fAlphaSpectrum);
235 
236  // Book shower energy
237  shower.SetEnergy(energy);
238 
239  // Dice Xone
240  xone = RandomXOne(fPrimary, energy);
241 
242  // Dice Xzero if it is set to be variable
243  if (!fConstantX0) {
244 
245  double xzero = RandomXZero(fPrimary, energy);
246  fGH.SetShapeParameter(gh::eX0, xzero + xone, 0);
247 
248  }
249 
250  // Dice Xmax
251  double xm = RandomXMax(fPrimary, energy);
252  fGH.SetXMax(xm + xone, 0);
253 
254  // Dice lambda
255  //double lm = RandomLambda(fPrimary, energy);
256  fGH.SetShapeParameter(gh::eLambda, utl::kLambdaGH, 0);
257 
258  // Dice Nmax
259  double nm = RandomNMax(fPrimary, energy);
260  fGH.SetNMax(pow(10, nm), 0);
261 
262  } // END from energy
263 
264  // Book Azimuth, Zenith and GH Parameters
265  shower.MakeGHParameters(fGH);
266 
267  // Make tabulated function of long. profile:
268  std::vector<double> depth;
269  std::vector<double> nParticles;
270 
271  const double depthTop = (fGH.GetShapeParameter(gh::eX0) > 0*g/cm2) ?
272  fGH.GetShapeParameter(gh::eX0) : 0.01*g/cm2;
273 
274  const int steps = 200;
275  double deltaD = (depthG/abs(cos(fTheta)) - depthTop) / steps;
276  double depthI = depthTop;
277  TabulatedFunction ghFunc;
278  TabulatedFunction dEdXProf;
279 
280  for (int i = 0; i < steps; ++i) {
281  const double particles =
282  utl::GaisserHillas(depthI, fGH.GetShapeParameter(gh::eX0), fGH.GetXMax(),
283  fGH.GetNMax(), utl::kLambdaGH);
284 
285  ghFunc.PushBack(depthI, particles);
286 
287  double dEdX = EnergyDeposit(depthI, shower.GetGHParameters().GetXMax(), fEnergyCutoff);
288 
289  double deposit = dEdX*particles;
290  dEdXProf.PushBack(depthI, deposit);
291 
292  depthI += deltaD;
293  }
294  shower.MakeLongitudinalProfile(ghFunc);
295  INFO ("Longitudinal profile filled");
296 
297  shower.MakedEdX(dEdXProf);
298  INFO ("Shower dEdX profile filled");
299 
300  return eSuccess;
301 }
302 
303 
306 {
307  return eSuccess;
308 }
309 
310 
324 double
325 ProfileSimulator::DicePowerLaw(const double min, const double max, const double index)
326  const
327 {
328  double x = 0;
329 
330  if (min > 0 && max > 0) {
331  double randNo = RandFlat::shoot(&fRandomEngine->GetEngine(), 0, 1);
332  if (index != -1) {
333  x = pow(pow(min, index + 1) + randNo * (pow(max, index + 1) - pow(min, index + 1)),
334  1 / (index + 1));
335  } else {
336  x = min*pow(max/min, randNo);
337  }
338  } else
339  INFO("Impossible to dice!");
340 
341  return x;
342 }
343 
344 
350 double
351 ProfileSimulator::RandomXOne(const int primary, const double energy)
352  const
353 {
354  const double enExp = log10(energy);
355  const double eEx[] = { 17.5, 18, 18.5, 19, 19.5, 20, 20.5, 21 };
356 
357  int i = 0;
358  if (eEx[1] <= enExp && enExp < eEx[2])
359  i = 1;
360  else if (eEx[2] <= enExp && enExp < eEx[3])
361  i = 2;
362  else if (eEx[3] <= enExp && enExp < eEx[4])
363  i = 3;
364  else if (eEx[4] <= enExp && enExp < eEx[5])
365  i = 4;
366  else if (eEx[5] <= enExp && enExp < eEx[6])
367  i = 5;
368  else if (eEx[6] <= enExp)
369  i = 6;
370 
371  if (primary == utl::Particle::eProton) {
372  const double c[] = { 49.701, 50.099, 46.640, 47.805, 43.782, 41.703, 40.328, 39.397 };
373  const double rXOne = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp) / (eEx[i+1] - eEx[i]);
374  return RandExponential::shoot(&fRandomEngine->GetEngine(), rXOne) * g/cm2;
375  }
376 
377  const double c[] = { 11.490, 11.738, 11.576, 11.834, 10.894, 11.376, 10.374, 10.473 };
378  const double rXOne = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp) / (eEx[i+1] - eEx[i]);
379  return RandExponential::shoot(&fRandomEngine->GetEngine(), rXOne) * g/cm2;
380 }
381 
382 
387 double
388 ProfileSimulator::RandomXZero(const int primary, const double energy)
389  const
390 {
391  const double enExp = log10(energy);
392  const double eEx[] = { 17.5, 18, 18.5, 19, 19.5, 20, 20.5, 21 };
393 
394  int i = 0;
395  if (eEx[1] <= enExp && enExp < eEx[2])
396  i = 1;
397  else if (eEx[2] <= enExp && enExp < eEx[3])
398  i = 2;
399  else if (eEx[3] <= enExp && enExp < eEx[4])
400  i = 3;
401  else if (eEx[4] <= enExp && enExp < eEx[5])
402  i = 4;
403  else if (eEx[5] <= enExp && enExp < eEx[6])
404  i = 5;
405  else if (eEx[6] <= enExp)
406  i = 6;
407 
408  if (primary == utl::Particle::eProton) {
409  const double c[] = { -165.721, -180.741, -202.48, -213.481, -219.733, -221.584, -219.707, -211.232 };
410  const double c_s[] = { 74.837, 64.832, 65.819, 63.105, 61.768, 53.593, 53.542, 51.322 };
411  const double rX0 = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp) / (eEx[i+1] - eEx[i]);
412  const double x0Sig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp) / (eEx[i+1] - eEx[i]);
413  return RandGauss::shoot(rX0, x0Sig) * g/cm2;
414  }
415 
416  const double c[] = { -98.287, -117.574, -133.692, -152.395, -171.399, -188.069, -203.030, -212.375 };
417  const double c_s[] = { 39.532, 43.111, 41.771, 39.977, 36.580, 32.515, 28.729, 25.103 };
418  const double rX0 = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp) / (eEx[i+1] - eEx[i]);
419  const double x0Sig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp) / (eEx[i+1] - eEx[i]);
420  return RandGauss::shoot(rX0, x0Sig) * g/cm2;
421 }
422 
423 
428 double
429 ProfileSimulator::RandomXMax(const int primary, const double energy)
430  const
431 {
432  double xMaxSig = 0;
433  double enExp = log10(energy);
434  double rXMax, randomXMax;
435 
436  const double eEx[] = { 17.5, 18, 18.5, 19, 19.5, 20, 20.5, 21 };
437 
438  int i = 0;
439  if (enExp >= eEx[1] && enExp < eEx[2]) i = 1;
440  if(enExp >= eEx[2] && enExp < eEx[3]) i = 2;
441  if(enExp >= eEx[3] && enExp < eEx[4]) i = 3;
442  if(enExp >= eEx[4] && enExp < eEx[5]) i = 4;
443  if(enExp >= eEx[5] && enExp < eEx[6]) i = 5;
444  if(enExp >= eEx[6]) i = 6;
445 
446  if (primary == utl::Particle::eProton) {
447 
448  double c[8] ={ 643.683, 671.343, 698.360, 727.941, 752.808, 775.352,
449  802.121, 823.171 };
450  double c_s[8] = { 49.153, 42.425, 39.745, 42.068, 44.504, 40.818,
451  40.371, 36.101 };
452 
453  rXMax = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp)
454  / (eEx[i+1] - eEx[i]);
455  xMaxSig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp)
456  / (eEx[i+1] - eEx[i]);
457  randomXMax = RandGauss::shoot(rXMax, xMaxSig);
458  }
459  else {
460 
461  double c[8] = { 586.590, 619.281, 648.269, 679.845, 709.612,
462  739.855, 770.108, 797.705 };
463  double c_s[8] ={ 21.540, 20.686, 17.408, 17.671, 17.301, 16.968,
464  18.668, 18.979 };
465 
466  rXMax = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp)
467  / (eEx[i+1] - eEx[i]);
468  xMaxSig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp)
469  / (eEx[i+1] - eEx[i]);
470  randomXMax = RandGauss::shoot(rXMax, xMaxSig);
471  }
472 
473  return randomXMax*(g/cm/cm);
474 
475 }// end of Shower::RandomXMax
476 
477 
483  double energy) const {
484  double lambdaSig =0.;
485  double enExp = log10(energy);
486 
487  double rlambda, randomlambda;
488 
489  double eEx[8] = {17.5, 18.0, 18.5, 19.0, 19.5, 20.0, 20.5, 21.0};
490  int i = 0;
491 
492  if(enExp >= eEx[1] && enExp < eEx[2]) i = 1;
493  if(enExp >= eEx[2] && enExp < eEx[3]) i = 2;
494  if(enExp >= eEx[3] && enExp < eEx[4]) i = 3;
495  if(enExp >= eEx[4] && enExp < eEx[5]) i = 4;
496  if(enExp >= eEx[5] && enExp < eEx[6]) i = 5;
497  if(enExp >= eEx[6]) i = 6;
498 
499  if (primary == utl::Particle::eProton) {
500 
501  double c[8] = { 58.473, 57.178, 56.578, 57.302, 58.475, 60.919,
502  62.840, 64.999 };
503  double c_s[8] = { 12.256, 6.428, 6.268, 5.825, 6.026, 7.297,
504  7.309, 6.763 };
505 
506  rlambda = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp)
507  / (eEx[i+1] - eEx[i]);
508  lambdaSig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp)
509  / (eEx[i+1] - eEx[i]);
510  randomlambda = RandGauss::shoot(rlambda, lambdaSig);
511 
512  }
513  else {
514 
515  double c[8] = { 65.921, 63.033, 61.048, 59.358, 58.569, 57.887,
516  58.009, 58.629 };
517  double c_s[8] = { 4.093, 3.555, 2.989, 2.435, 2.445, 2.016,
518  2.248, 2.442 };
519 
520  rlambda = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp)
521  / (eEx[i+1] - eEx[i]);
522  lambdaSig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp)
523  / (eEx[i+1] - eEx[i]);
524  randomlambda = RandGauss::shoot(rlambda, lambdaSig);
525 
526  }
527  return randomlambda*(g/cm/cm);
528 
529 }// end of Shower::Randomlambda
530 
535 double ProfileSimulator::RandomNMax(int primary,
536  double energy) const {
537 
538  double NMaxSig =0.;
539  double enExp = log10(energy);
540  double rNMax, randomNMax;
541 
542  double eEx[8] = { 17.5, 18.0, 18.5, 19.0, 19.5, 20.0, 20.5, 21.0 };
543  int i = 0;
544 
545  if(enExp >= eEx[1] && enExp < eEx[2]) i = 1;
546  if(enExp >= eEx[2] && enExp < eEx[3]) i = 2;
547  if(enExp >= eEx[3] && enExp < eEx[4]) i = 3;
548  if(enExp >= eEx[4] && enExp < eEx[5]) i = 4;
549  if(enExp >= eEx[5] && enExp < eEx[6]) i = 5;
550  if(enExp >= eEx[6]) i = 6;
551 
552  if (primary == utl::Particle::eProton) {
553 
554  double c[8] = {8.31744, 8.81478, 9.31236, 9.80634, 10.3005,
555  10.7908, 11.282, 11.7698};
556  double c_s[8] = {0.02134, 0.01762, 0.01344, 0.01284, 0.01262,
557  0.01728, 0.01972, 0.02892};
558 
559  rNMax = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + ( c[i+1] - c[i] )*enExp)
560  / (eEx[i+1] - eEx[i]);
561  NMaxSig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp)
562  / (eEx[i+1] - eEx[i]);
563  randomNMax = RandGauss::shoot(rNMax, NMaxSig);
564 
565  }
566  else {
567 
568  double c[8] = { 8.28851, 8.79259, 9.29535, 9.79570, 10.29420,
569  10.79200, 11.28860, 11.78570 };
570  double c_s[8] = { 0.01048, 0.01050, 0.00949, 0.00892, 0.00892,
571  0.008912, 0.00849, 0.00725 };
572 
573  rNMax = (c[i]*eEx[i+1] - c[i+1]*eEx[i] + (c[i+1] - c[i])*enExp)
574  / (eEx[i+1] - eEx[i]);
575  NMaxSig = (c_s[i]*eEx[i+1] - c_s[i+1]*eEx[i] + (c_s[i+1] - c_s[i])*enExp)
576  / (eEx[i+1] - eEx[i]);
577 
578  randomNMax = RandGauss::shoot(rNMax, NMaxSig);
579 
580  }
581 
582  return randomNMax;
583 
584 }// end of Shower::RandomNMax
585 
590 double ProfileSimulator::CalculateNMax(double depth, double xZero,
591  double xMax, double energy) const {
592 
593  const double kDepthMax = 4000.0*(g/cm/cm);
594  const double kExpMax = 1.0e20;
595 
596  double gaisserHillas = -kExpMax;
597  double auxXMax = xMax - xZero;
598 
599  if(depth <= 0 || depth > kDepthMax)
600  return(gaisserHillas);
601  if(depth > 0) {
602  gaisserHillas = (auxXMax*(log(depth/auxXMax) + 1) - depth)/utl::kLambdaGH
603  + log(pow(10.0, (log10(energy) - 9.215)));
604  }
605  else {
606  gaisserHillas = 0.0;
607  }
608  if (gaisserHillas < -kExpMax) {
609  gaisserHillas = -kExpMax;
610  }
611  else if (gaisserHillas > kExpMax) {
612  gaisserHillas = kExpMax;
613  }
614  return (exp(gaisserHillas));
615 
616 }// end of ProfileSimulator::CalculateNMax
617 
618 
627 double ProfileSimulator::CalculatedEdX(double age, double density) const {
628 
629  // Parametrizations
630  // Shower age parametrization
631  const double kParamAge[21] =
632  { 0.0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00,
633  1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00};
634 
635  // dE/dX parametrization
636  const double kParamdEdX1[21] =
637  { 0.0, 2.9679, 2.7096, 2.5285, 2.3801, 2.2935, 2.2213, 2.1586, 2.1023,
638  2.0506, 2.0022, 1.9563, 1.9123, 1.8696, 1.8278, 1.7867, 1.7459,
639  1.7052, 1.6643, 1.6229, 1.5806 };
640 
641  // Density parametrization
642  const double kParamRho1[21] =
643  { 0.0, 0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04,
644  0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04,
645  0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04, 0.119E-04,
646  0.119E-04, 0.119E-04 };
647 
648  // dE/dX parametrization
649  const double kParamdEdX2[21] =
650  { 0.0, 2.7043, 2.5086, 2.3723, 2.2588, 2.1914, 2.1339, 2.0828, 2.0361,
651  1.9923, 1.9508, 1.9108, 1.8719, 1.8338, 1.7963, 1.7589, 1.7216,
652  1.6841, 1.6461, 1.6074, 1.5676 };
653 
654  // Density parametrization
655  const double kParamRho2[21] =
656  { 0.0, 0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02,
657  0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02,
658  0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02, 0.119E-02,
659  0.119E-02, 0.119E-02 };
660 
661 
662  int i1, i2;
663  double rho = density;
664 
665  if (age < 0.1)
666  age = 0.1;
667  if(rho < 1.0e-6*(g/cm/cm/cm))
668  rho = 1.0e-6*(g/cm/cm/cm);
669  int i = int(age*10);
670  if (i < 1) {
671  i1 = 1;
672  i2 = 2;
673  }
674  else {
675  if (i >= 19){
676  i1 = 19;
677  i2 = 20;
678  }
679  else {
680  i1 = i;
681  i2 = i + 1;
682  }
683  }
684  double dEdXTmp1 = (kParamdEdX1[i1]
685  + (kParamdEdX1[i2] - kParamdEdX1[i1])
686  *(age - kParamAge[i1])/(kParamAge[i2] - kParamAge[i1]))
687  *MeV/(g/cm/cm);
688  double dEdXTmp2 = (kParamdEdX2[i1]
689  + (kParamdEdX2[i2] - kParamdEdX2[i1])
690  *(age - kParamAge[i1])/(kParamAge[i2] - kParamAge[i1]))
691  *MeV/(g/cm/cm);
692 
693  double dEdX = dEdXTmp1 + (dEdXTmp2 - dEdXTmp1)
694  *log(rho/(kParamRho1[i1]*(g/cm/cm/cm)))
695  /log(kParamRho2[i1]/kParamRho1[i1]);
696 
697  return dEdX;
698 
699 }// end of CalculatedEdX
700 
701 
702 // Configure (x)emacs for this file ...
703 // Local Variables:
704 // mode:c++
705 // compile-command: "make -k"
706 // End:
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger coordinate system associated to the shower core position.
int GetPrimaryParticle() const
Get the type of the shower primary particle.
Definition: ShowerSimData.h:84
const evt::VGaisserHillasParameter & GetGHParameters() const
Get the Gaisser-Hillas parameters of the shower.
double RandomXOne(int primary, double energy) const
Class to hold collection (x,y) points and provide interpolation between them.
void SetEnergyCutoff(const double energy, const ProfileType type=eElectron)
Set the enegy cutoff for which the profile of charged particles was calculated.
bool HasSimShower() const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void MakeGHParameters(const evt::VGaisserHillasParameter &ghPar)
Make the Gaisser-Hillas parameters of the shower.
Base class for exceptions trying to access non-existing components.
void PushBack(const double x, const double y)
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
double RandomLambda(int primary, double energy) const
double pow(const double x, const unsigned int i)
void MakedEdX(const utl::TabulatedFunction &dEdX)
Make the energy deposit of the shower.
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
constexpr double MeV
Definition: AugerUnits.h:184
double CalculatedEdX(double age, double density) const
This function is obsolete Calculation of the mean energy deposition in the atmosphere.
Interface class to access Shower Simulated parameters.
Definition: ShowerSimData.h:49
const atm::Atmosphere & GetAtmosphere() const
Definition: Detector.h:113
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
#define max(a, b)
Class representing a document branch.
Definition: Branch.h:107
void MakeLongitudinalProfile(const utl::TabulatedFunction &lp, const ProfileType type=eCharged)
Make the longitudinal charge profile of the shower.
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
double RandomXZero(int primary, double energy) const
double RandomNMax(int primary, double energy) const
Class describing the Atmospheric profile.
Definition: ProfileResult.h:25
double abs(const SVector< n, T > &v)
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
const atm::ProfileResult & EvaluateDepthVsHeight() const
Tabulated function giving Y=depth as a function of X=height.
void SetEnergy(const double theEnergy)
Set the energy of the shower primary particle.
Definition: ShowerSimData.h:91
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
constexpr double g
Definition: AugerUnits.h:200
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
double CalculateNMax(double depth, double xZero, double xMax, double energy) const
double RandomXMax(int primary, double energy) const
double GaisserHillas(const double x, const double x0, const double xMax, const double nMax, const double lambda)
Calculate the Gaisser-Hillas function.
double DicePowerLaw(double min, double max, double index) const
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
constexpr double kLambdaGH
constexpr double cm
Definition: AugerUnits.h:117
double EnergyDeposit(const double age, const double enCut)
Parametrization for the average energy deposit per particle.
fwk::VModule::ResultFlag Run(evt::Event &theEvent)
Run: invoked once per event.
Main configuration utility.
Definition: CentralConfig.h:51
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
constexpr double m
Definition: AugerUnits.h:121
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
constexpr double cm2
Definition: AugerUnits.h:118

, generated on Tue Sep 26 2023.