testPhysicalFunctions.cc
Go to the documentation of this file.
1 
12 #include <cppunit/extensions/HelperMacros.h>
13 
14 #include <utl/ErrorLogger.h>
15 #include <utl/MathConstants.h>
16 #include <utl/PhysicalConstants.h>
17 #include <utl/PhysicalFunctions.h>
18 #include <utl/AugerUnits.h>
19 #include <tst/Verify.h>
20 #include <utl/AugerException.h>
21 #include <string>
22 
23 using namespace utl;
24 using namespace std;
25 using namespace tst;
26 
27 
31 class testPhysicalFunctions : public CppUnit::TestFixture {
32 
33  CPPUNIT_TEST_SUITE(testPhysicalFunctions);
34  CPPUNIT_TEST(testGaisserHillas);
35  CPPUNIT_TEST(testEnergy);
36  CPPUNIT_TEST(testBeta);
37  CPPUNIT_TEST(testRefractionIndex);
38  CPPUNIT_TEST(testCherenkovThreshold);
39  CPPUNIT_TEST(testShowerAge);
40  CPPUNIT_TEST(testEnergyDeposit);
41  CPPUNIT_TEST_SUITE_END();
42 
43 public:
44 
46 
47  double x0 = 12.89*(g/cm/cm);
48  double nMax = 6.245e+9;
49  double xMax = 700.0*(g/cm/cm);
50  double l = kLambdaGH;
51 
52  CPPUNIT_ASSERT(Verify<CloseTo>(GaisserHillas(xMax, x0, xMax, nMax, l),
53  nMax));
54 
55  }
56 
57  void testEnergy() {
58 
59  double energy = 2.121*MeV;
60 
61  double beta = Beta(energy);
62  CPPUNIT_ASSERT(Verify<CloseTo>(Energy(beta), energy));
63 
64  }
65 
66  void testBeta() {
67 
68  double energy = 12.123*MeV;
69  double beta = Beta(energy);
70  CPPUNIT_ASSERT(Verify<CloseTo>(Beta(energy), beta));
71 
72  }
73 
75 
76  double depth = 756.778*(g/cm/cm);
77 
78  CPPUNIT_ASSERT(Verify<CloseTo>(RefractionIndex::LorentzLorentz(depth), 1.0002145));
79 
80  }
81 
83 
84  double n = 1.5111;
85  CPPUNIT_ASSERT(Verify<CloseTo>(CherenkovThreshold(1.5111),
86  CherenkovThreshold(n)));
87 
88  }
89 
90  void testShowerAge() {
91  double age = 1.0;
92  CPPUNIT_ASSERT(Verify<CloseTo>(ShowerAge(300.3,300.3), age));
93  }
94 
96  double age = ShowerAge(300*g/cm/cm,600*g/cm/cm);
97  CPPUNIT_ASSERT(Verify<CloseTo>(EnergyDeposit(age,1*MeV),
98  EnergyDeposit(300*g/cm/cm,600*g/cm/cm,1*MeV)));
99  }
100 
101 
102 };
103 
105 
106 // Configure (x)emacs for this file ...
107 // Local Variables:
108 // mode:c++
109 // compile-command: "make -C .. -k testTime && ../testTime"
110 // End:
double Energy(const double beta)
Calculate the electron energy for a relativistic beta.
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
constexpr double MeV
Definition: AugerUnits.h:184
double CherenkovThreshold(const double nRef)
Calculate the electron Cherenkov threshold energy for refraction index.
constexpr double g
Definition: AugerUnits.h:200
double Beta(const double energy)
Calculate the electron energy versus the relativistic beta.
double GaisserHillas(const double x, const double x0, const double xMax, const double nMax, const double lambda)
Calculate the Gaisser-Hillas function.
double LorentzLorentz(const double verticalDepth)
Calculate the refraction index for a given depth.
constexpr double kLambdaGH
double ShowerAge(const double slantDepth, const double showerMax)
General definition of shower age.
constexpr double cm
Definition: AugerUnits.h:117
double EnergyDeposit(const double age, const double enCut)
Parametrization for the average energy deposit per particle.

, generated on Tue Sep 26 2023.