testSuperMieModel.cc
Go to the documentation of this file.
1 
10 #include <cppunit/extensions/HelperMacros.h>
11 
12 #include <det/Detector.h>
13 #include <fdet/FDetector.h>
14 #include <fdet/Eye.h>
15 
16 #include <fwk/CoordinateSystemRegistry.h>
17 
18 #include <atm/AerosolDB.h>
19 #include <atm/AttenuationResult.h>
20 #include <atm/ScatteringResult.h>
21 
22 #include <fwk/CentralConfig.h>
23 
24 #include <utl/TimeStamp.h>
25 #include <utl/UTCDateTime.h>
26 #include <utl/ErrorLogger.h>
27 
28 #include <utl/Point.h>
29 #include <utl/TabulatedFunctionErrors.h>
30 #include <utl/ReferenceEllipsoid.h>
31 
32 #include <tst/Verify.h>
33 
34 #include <iostream>
35 
36 using namespace std;
37 using namespace det;
38 using namespace fdet;
39 using namespace atm;
40 using namespace fwk;
41 using namespace utl;
42 using namespace tst;
43 
44 
45 class testSuperMieModel : public CppUnit::TestFixture {
46 
47  CPPUNIT_TEST_SUITE(testSuperMieModel);
48  CPPUNIT_TEST(testGetAttFromDB);
49  CPPUNIT_TEST(testGetAttFromXML);
50  CPPUNIT_TEST(testGetScatFromDB);
51  CPPUNIT_TEST(testGetScatFromXML);
52 
53  CPPUNIT_TEST(testUncertaintyDB);
54  CPPUNIT_TEST(testUncertaintyXML);
55 
56  CPPUNIT_TEST_SUITE_END();
57 
58 public:
59  void
61  {
62  CentralConfig::GetInstance(BOOTSTRAPFILE);
63  ErrorLogger::GetInstance().SetVerbosity(Verbosity::eVerbose);
64  }
65 
66  void tearDown() { }
67 
69  {
70  // set a time which should be valid for the test database.
71  //
72  Detector::GetInstance().Update(UTCDateTime(2005,1,1,0,0,0).GetTimeStamp());
73  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
74 
75  vector<double> wlength;
76  wlength.push_back(300.*nanometer);
77  wlength.push_back(355.*nanometer);
78  wlength.push_back(400.*nanometer);
79 
80  // Los Leones
81  //
83  CSll(Detector::GetInstance().GetFDetector().GetEye("Los Leones").GetLocalCoordinateSystem() );
84 
85  Point All(0., 0., 0., CSll);
86  Point Bll(0., 0., 9000.*m, CSll);
87 
88  AttenuationResult AttABll = theAtm.EvaluateMieAttenuation(All, Bll, wlength);
89  CPPUNIT_ASSERT(Verify<CloseTo>(AttABll.GetTransmissionFactor().Y(355*nanometer),0.979985, 1.e-5));
90  }
91 
92  void
94  {
95  // Set time for which there is no data in the test database.
96  // The smart model should use the parametric model in this case
97  //
98  Detector::GetInstance().Update(TimeStamp(111));
99  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
100 
101  vector<double> wlength;
102  wlength.push_back(300.*nanometer);
103  wlength.push_back(355.*nanometer);
104  wlength.push_back(400.*nanometer);
105 
106  // Los Leones
107  //
109  CSll(Detector::GetInstance().GetFDetector().GetEye("Los Leones").GetLocalCoordinateSystem() );
110 
111  Point All(0., 0., 0., CSll);
112  Point Bll(0., 0., 2600.*m, CSll);
113 
114  AttenuationResult AttABll = theAtm.EvaluateMieAttenuation(All, Bll, wlength);
115  CPPUNIT_ASSERT(Verify<CloseTo>(AttABll.GetTransmissionFactor().Y(300.*nanometer), 0.915745));
116  }
117 
118  void
120  {
121  // set a time which should be valid for the test database.
122  //
123  Detector::GetInstance().Update(UTCDateTime(2005,1,1,0,0,0).GetTimeStamp());
124  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
126  CSll(Detector::GetInstance().GetFDetector().GetEye("Los Leones").GetLocalCoordinateSystem() );
127 
128  vector<double> wlength;
129  wlength.push_back(300*nanometer);
130  wlength.push_back(355*nanometer);
131  wlength.push_back(400*nanometer);
132 
133  Point pointA(0., 0. , 0., CSll);
134  Point pointB(0., 0. , 1400.*m, CSll);
135 
136  ScatteringResult scatAB1 =
137  theAtm.EvaluateMieScattering(pointA, pointB,
138  20.*degree, 1.*km, wlength);
139  CPPUNIT_ASSERT(Verify<CloseTo>(1.e8*scatAB1.GetScatteringFactor().Y(400.*nanometer), 0.856146, 1.e-5));
140  }
141 
142  void
144  {
145  // set to time for which no data exist in the test database
146  //
147  Detector::GetInstance().Update(TimeStamp(111));
148  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
149 
150  vector<double> wlength;
151  wlength.push_back(300*nanometer);
152  wlength.push_back(350*nanometer);
153  wlength.push_back(400*nanometer);
154 
156  CSll(Detector::GetInstance().GetFDetector().GetEye("Los Leones").GetLocalCoordinateSystem() );
157  Point pointA(0., 0. , 0., CSll);
158  Point pointB(0., 0. , 1400.*m, CSll);
159 
160  ScatteringResult scatAB1 =
161  theAtm.EvaluateMieScattering(pointA, pointB,
162  20.*degree, 1.*km, wlength);
163  CPPUNIT_ASSERT(Verify<CloseTo>(1.e8*scatAB1.GetScatteringFactor().Y(400.*nanometer), 2.70631, 1.e-5));
164  }
165 
167  Detector::GetInstance().Update(UTCDateTime(2005,1,1,0,0,0).GetTimeStamp());
168 
170  CSll(Detector::GetInstance().GetFDetector().GetEye("Los Leones").GetLocalCoordinateSystem() );
171 
172  ReferenceEllipsoid wgs84(ReferenceEllipsoid::Get(ReferenceEllipsoid::eWGS84));
173 
174  Point All(0., 0., 0., CSll);
175  Point Bll(0., 0., 2600.*m, CSll);
176 
177  vector<double> wlength;
178  wlength.push_back(300.*nanometer);
179  wlength.push_back(355.*nanometer);
180  wlength.push_back(400.*nanometer);
181 
182  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
183  AttenuationResult attABll = theAtm.EvaluateMieAttenuation(All,
184  Bll,
185  wlength);
186  CPPUNIT_ASSERT(Verify<CloseTo>(attABll.GetTransmissionFactor().Y(355*nanometer), 0.9814559317));
187  theAtm.SetUncertaintyBound(Atmosphere::eMie, 1.);
188  attABll = theAtm.EvaluateMieAttenuation(All,
189  Bll,
190  wlength);
191  CPPUNIT_ASSERT(Verify<CloseTo>(attABll.GetTransmissionFactor().Y(355*nanometer), 0.9796204908));
192  theAtm.SetUncertaintyBound(Atmosphere::eMie, -1.);
193  attABll = theAtm.EvaluateMieAttenuation(All,
194  Bll,
195  wlength);
196  CPPUNIT_ASSERT(Verify<CloseTo>(attABll.GetTransmissionFactor().Y(355*nanometer), 0.9832947194));
197  }
198 
200  // Set time for which there is no data in the test database.
201  // The smart model should use the parametric model in this case
202  //
203  Detector::GetInstance().Update(TimeStamp(111));
204  const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
205 
206  vector<double> wlength;
207  wlength.push_back(300.*nanometer);
208  wlength.push_back(355.*nanometer);
209  wlength.push_back(400.*nanometer);
210 
211  // Los Leones
212  //
214  CSll(Detector::GetInstance().GetFDetector().GetEye("Los Leones").GetLocalCoordinateSystem() );
215 
216  Point All(0., 0., 0., CSll);
217  Point Bll(0., 0., 2600.*m, CSll);
218 
219  AttenuationResult attABll = theAtm.EvaluateMieAttenuation(All,
220  Bll,
221  wlength);
222  CPPUNIT_ASSERT(Verify<CloseTo>(attABll.GetTransmissionFactor().Y(355*nanometer), 0.928318));
223 
224  theAtm.SetUncertaintyBound(Atmosphere::eMie, 1.);
225  attABll = theAtm.EvaluateMieAttenuation(All,
226  Bll,
227  wlength);
228  CPPUNIT_ASSERT(Verify<CloseTo>(attABll.GetTransmissionFactor().Y(355*nanometer), 0.928318));
229  theAtm.SetUncertaintyBound(Atmosphere::eMie, -1.);
230  attABll = theAtm.EvaluateMieAttenuation(All,
231  Bll,
232  wlength);
233  CPPUNIT_ASSERT(Verify<CloseTo>(attABll.GetTransmissionFactor().Y(355*nanometer), 0.928318));
234 
235  }
236 
237 };
238 
239 
241 
242 
243 // Configure (x)emacs for this file ...
244 // Local Variables:
245 // mode:c++
246 // compile-command: "make -C .. -k"
247 // End:
Top of the interface to Atmosphere information.
const double degree
Point object.
Definition: Point.h:32
atm::AttenuationResult EvaluateMieAttenuation(const utl::Point &xInit, const utl::Point &xFinal, const std::vector< double > &wLength) const
const utl::TabulatedFunctionErrors & GetTransmissionFactor() const
Transmission factor.
Traditional name.
Definition: Verbosity.h:17
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
constexpr double nanometer
Definition: AugerUnits.h:102
Class holding the output of the ScatteringResult function.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Reference ellipsoids for UTM transformations.
const double km
const utl::TabulatedFunctionErrors & GetScatteringFactor() const
Scattering factor.
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
constexpr double m
Definition: AugerUnits.h:121
void SetUncertaintyBound(const ModelWithUncertainty model, const double nSigma) const
alter Model &quot;model&quot; by &quot;nSigma&quot; standard deviations
Class describing the Atmospheric attenuation.
atm::ScatteringResult EvaluateMieScattering(const utl::Point &xA, const utl::Point &xB, const double angle, const double distance, const std::vector< double > &xLength) const

, generated on Tue Sep 26 2023.