testUSStdADBProfileModel.cc
Go to the documentation of this file.
1 
10 #include <det/Detector.h>
11 #include <atm/AerosolDB.h>
12 #include <atm/AerosolZone.h>
13 #include <atm/AttSlice.h>
14 #include <atm/PFSlice.h>
15 #include <atm/MolecularZone.h>
16 #include <atm/ProfileResult.h>
17 
18 #include <atm/USStdADBProfileModel.h>
19 
20 #include <fwk/CentralConfig.h>
21 
22 #include <utl/TimeStamp.h>
23 #include <utl/ErrorLogger.h>
24 
25 #include <cppunit/extensions/HelperMacros.h>
26 #include <tst/Verify.h>
27 
28 #include <iostream>
29 
30 using namespace std;
31 using namespace det;
32 using namespace atm;
33 using namespace fwk;
34 using namespace utl;
35 using namespace tst;
36 
37 
38 class testUSStdADBProfileModel : public CppUnit::TestFixture{
39 
40  CPPUNIT_TEST_SUITE(testUSStdADBProfileModel);
41 
42  CPPUNIT_TEST(testHasData);
43  CPPUNIT_TEST_EXCEPTION(testNoDataForTimeStamp, NoDataForModelException);
44  CPPUNIT_TEST(testEvaluateDepthVsHeight);
45  CPPUNIT_TEST(testEvaluateHeightVsDepth);
46  CPPUNIT_TEST(testEvaluateTemperatureVsHeight);
47  CPPUNIT_TEST(testEvaluateDensityVsHeight);
48  CPPUNIT_TEST(testEvaluateRefractionIndexVsHeight);
49 
50  CPPUNIT_TEST_SUITE_END();
51 
52 private:
53 
54 public:
55 
56  void setUp(){
57  //CentralConfig* theCC =
58  CentralConfig::GetInstance(BOOTSTRAPFILE);
59  ErrorLogger::GetInstance().SetVerbosity(Verbosity::eVerbose);
60  }
61 
62  void tearDown(){
63  }
64 
65  void testHasData() {
66  Detector::GetInstance().Update(TimeStamp(1111112));
67  USStdADBProfileModel modelWithData;
68  modelWithData.Init();
69  CPPUNIT_ASSERT(Verify<Equal>(modelWithData.HasData(), true));
70 
71  Detector::GetInstance().Update(TimeStamp());
72  USStdADBProfileModel modelWithoutData;
73  modelWithoutData.Init();
74  CPPUNIT_ASSERT(Verify<Equal>(modelWithoutData.HasData(), false));
75  }
76 
78  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
79  Detector::GetInstance().Update(TimeStamp());
81  }
82 
84 
85  Detector::GetInstance().Update(TimeStamp(1111112));
86  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
87  ProfileResult depthVsHeight = theAtm.EvaluateDepthVsHeight();
88 
89  CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.Y(500.*meter), 973.732*gram/cm/cm, 1e-3));
90  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateDepthError(500.*meter), 973.732*gram/cm/cm / 10., 1e-3));
91 
92  CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.Y(11000.*meter), 230.918*gram/cm/cm, 1e-3));
93 // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateDepthError(11000.*meter), 230.918*gram/cm/cm / 10., 1e-3));
94 
95  CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.Y(26500.*meter), 20.3484*gram/cm/cm, 1e-3));
96 // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateDepthError(26500.*meter), 20.3484*gram/cm/cm / 10., 1e-2));
97 
98  CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.Y(0.), 1033.93*gram/cm/cm, 1e-3));
99  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateDepthError(0.), 1033.93*gram/cm/cm / 10., 1e-3));
100 
101 
102  }
103 
105 
106  Detector::GetInstance().Update(TimeStamp(1111112));
107  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
108  ProfileResult heightVsDepth = theAtm.EvaluateHeightVsDepth();
109 
110  CPPUNIT_ASSERT(Verify<CloseTo>( heightVsDepth.Y(20.3484*gram/cm/cm), 26500.*meter, 1e-3));
111 // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateHeightError(20.3484*gram/cm/cm),
112 // theAtm.EvaluateHeight(20.3484*gram/cm/cm)/10., 1e-3));
113 
114  CPPUNIT_ASSERT(Verify<CloseTo>( heightVsDepth.Y(973.732*gram/cm/cm), 500.*meter, 1e-3));
115 // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateHeightError(973.732*gram/cm/cm),
116 // theAtm.EvaluateHeight(973.732*gram/cm/cm)/10., 1e-3));
117 
118  CPPUNIT_ASSERT(Verify<CloseTo>( heightVsDepth.Y(230.918*gram/cm/cm), 11000.*meter, 1e-3));
119 // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateHeightError(230.918*gram/cm/cm),
120 // theAtm.EvaluateHeight(230.918*gram/cm/cm)/10., 1e-3));
121 
122  }
123 
125 
126  Detector::GetInstance().Update(TimeStamp(1111112));
127  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
128  ProfileResult temperatureVsHeight = theAtm.EvaluateTemperatureVsHeight();
129 
130  CPPUNIT_ASSERT(Verify<CloseTo>( temperatureVsHeight.Y(0.), 288.15*kelvin, 1e-3));
131  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateTemperatureError(0.),288.15*kelvin / 10., 1e-3));
132 
133  CPPUNIT_ASSERT(Verify<CloseTo>( temperatureVsHeight.Y(11500.), 216.65*kelvin, 1e-3));
134  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateTemperatureError(11500.), 216.65*kelvin/10., 1e-3));
135 
136  CPPUNIT_ASSERT(Verify<CloseTo>( temperatureVsHeight.Y(29500.), 226.15*kelvin, 1e-3));
137  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateTemperatureError(29500.), 226.15*kelvin/10., 1e-3));
138 
139  }
140 
142 
143  Detector::GetInstance().Update(TimeStamp(1111112));
144  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
145  ProfileResult densityVsHeight = theAtm.EvaluateDensityVsHeight();
146 
147  CPPUNIT_ASSERT(Verify<CloseTo>( densityVsHeight.Y(0.), 1.23e-3*g/cm/cm/cm));
148  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateDensityError(0.), 1.23e-3*g/cm/cm/cm / 10.));
149 
150  CPPUNIT_ASSERT(Verify<CloseTo>( densityVsHeight.Y(11500.*meter), 3.36458e-4*g/cm/cm/cm));
151  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateDensityError(11500.*meter), 3.36458e-4*g/cm/cm/cm / 10., 1.e-2));
152 
153  CPPUNIT_ASSERT(Verify<CloseTo>( densityVsHeight.Y(29000.*meter), 2.10e-5*g/cm/cm/cm));
154  // CPPUNIT_ASSERT(Verify<CloseTo>( theAtm.EvaluateDensityError(29000.*meter), 2.10e-5*g/cm/cm/cm / 10.));
155 
156  }
157 
159 
160  Detector::GetInstance().Update(TimeStamp(1111112));
161  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
162  ProfileResult riVsHeight = theAtm.EvaluateRefractionIndexVsHeight();
163 
164  CPPUNIT_ASSERT(Verify<CloseTo>( riVsHeight.Y(0.), 1.00029, 1e-3));
165 
166  }
167 
168 };
169 
171 
172 
173 // Configure (x)emacs for this file ...
174 // Local Variables:
175 // mode:c++
176 // compile-command: "make -C .. -k"
177 // End:
Top of the interface to Atmosphere information.
const atm::ProfileResult & EvaluateDensityVsHeight() const
Tabulated function giving Y=density as a function of X=height.
const double meter
Definition: GalacticUnits.h:29
Traditional name.
Definition: Verbosity.h:17
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
Exception to use in a atmosphere model cannot find data it needs.
Extracts profile info from US Standard Atmosphere.
Class describing the Atmospheric profile.
Definition: ProfileResult.h:25
const atm::ProfileResult & EvaluateDepthVsHeight() const
Tabulated function giving Y=depth as a function of X=height.
constexpr double g
Definition: AugerUnits.h:200
constexpr double kelvin
Definition: AugerUnits.h:259
bool HasData() const override
True if a data source is for the given model.
constexpr double cm
Definition: AugerUnits.h:117
const atm::ProfileResult & EvaluateHeightVsDepth() const
Tabulated function giving Y=height as a function of X=depth.
const atm::ProfileResult & EvaluateRefractionIndexVsHeight() const
Tabulated function giving Y=refraction index as a function of X=height.
constexpr double gram
Definition: AugerUnits.h:195
const atm::ProfileResult & EvaluateTemperatureVsHeight() const
Tabulated function giving Y=temperature as a function of X=height.

, generated on Tue Sep 26 2023.