testSDetectorCrowns.cc
Go to the documentation of this file.
1 #include <map>
2 #include <sstream>
3 #include <iostream>
4 #include <string>
5 #include <vector>
6 
7 #include <det/Detector.h>
8 #include <sdet/SDetector.h>
9 #include <fwk/CentralConfig.h>
10 #include <utl/TimeStamp.h>
11 #include <utl/TabulatedFunction.h>
12 #include <utl/Reader.h>
13 #include <utl/CoordinateSystem.h>
14 #include <utl/Point.h>
15 #include <utl/TimeStamp.h>
16 #include <utl/UTCDateTime.h>
17 #include <utl/AugerException.h>
18 #include <utl/ErrorLogger.h>
19 #include <fwk/CoordinateSystemRegistry.h>
20 
21 #include <evt/Event.h>
22 #include <sevt/SEvent.h>
23 #include <sevt/Station.h>
24 
25 #include <cppunit/extensions/HelperMacros.h>
26 #include <tst/Verify.h>
27 
28 using namespace det;
29 using namespace std;
30 using namespace fwk;
31 using namespace utl;
32 using namespace tst;
33 using namespace sdet;
34 
35 
36 class SDetectorTest : public CppUnit::TestFixture {
37 
38  CPPUNIT_TEST_SUITE(SDetectorTest);
39  CPPUNIT_TEST(testCrowns);
40  CPPUNIT_TEST_SUITE_END();
41 
42 public:
43  void
45  {
46  ErrorLogger::GetInstance().SetVerbosity(Verbosity::eVerbose);
47 
48  // CentralConfig must be created first.
49  CentralConfig::GetInstance(BOOTSTRAPFILE);
50 
51  // Create a detector
52  Detector::GetInstance();
53  }
54 
55  void tearDown() { }
56 
57  void
59  {
60 
61  Detector& det = Detector::GetInstance();
62  det.Update(UTCDateTime(2005,1,1).GetTimeStamp());
63  const SDetector& sDet = det.GetSDetector();
64  const Station& s133 = sDet.GetStation(133);
65 
66  // checking crowns
67 
68  CPPUNIT_ASSERT(Verify<Equal>(s133.GetName(), string("Uli")));
69 
70  Station::StationIdCollection crown = s133.GetCrown(0);
71  CPPUNIT_ASSERT(Verify<Equal>(crown.size(), size_t(1)));
72  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 133) != crown.end());
73 
74  crown = s133.GetCrown(1);
75  CPPUNIT_ASSERT(Verify<Equal>(crown.size(), size_t(5)));
76  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 142) != crown.end());
77  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 106) != crown.end());
78  //CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 132) != crown.end()); //removed this one for testing
79  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 147) != crown.end());
80  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 146) != crown.end());
81  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 135) != crown.end());
82 
83  crown = s133.GetCrown(2);
84  CPPUNIT_ASSERT(Verify<Equal>(crown.size(), size_t(12)));
85  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 143) != crown.end());
86  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 144) != crown.end());
87  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 145) != crown.end());
88  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 105) != crown.end());
89  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 134) != crown.end());
90  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 113) != crown.end());
91  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 111) != crown.end());
92  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 219) != crown.end());
93  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 232) != crown.end());
94  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 222) != crown.end());
95  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 194) != crown.end());
96  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 191) != crown.end());
97 
98  crown = s133.GetCrown(3);
99  CPPUNIT_ASSERT(Verify<Equal>(crown.size(), size_t(18)));
100  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 192) != crown.end());
101  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 193) != crown.end());
102  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 198) != crown.end());
103  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 195) != crown.end());
104  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 148) != crown.end());
105  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 149) != crown.end());
106  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 150) != crown.end());
107  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 102) != crown.end());
108  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 138) != crown.end());
109  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 185) != crown.end()); //this is a paired station
110  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 112) != crown.end());
111  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 229) != crown.end());
112  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 223) != crown.end());
113  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 220) != crown.end());
114  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 225) != crown.end());
115  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 231) != crown.end());
116  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 224) != crown.end());
117  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 316) != crown.end());
118 
119  crown = s133.GetCrown(4);
120  CPPUNIT_ASSERT(Verify<Equal>(crown.size(), size_t(24)));
121  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 101) != crown.end());
122  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 186) != crown.end()); // this is a paired station
123  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 119) != crown.end());
124  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 122) != crown.end());
125  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 218) != crown.end());
126  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 226) != crown.end());
127  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 207) != crown.end());
128  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 227) != crown.end());
129  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 233) != crown.end());
130  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 243) != crown.end());
131  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 241) != crown.end());
132  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 246) != crown.end());
133  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 274) != crown.end());
134  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 295) != crown.end());
135  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 202) != crown.end());
136  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 200) != crown.end());
137  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 201) != crown.end());
138  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 121) != crown.end());
139  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 167) != crown.end());
140  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 169) != crown.end());
141  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 170) != crown.end());
142  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 158) != crown.end());
143  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 151) != crown.end());
144  CPPUNIT_ASSERT(find(crown.begin(), crown.end(), 131) != crown.end());
145 
146  CPPUNIT_ASSERT(Verify<Equal>(sDet.GetStation(36).GetCrown(1).size(), size_t(0)));
147  }
148 
149 };
150 
151 
void Update(const utl::TimeStamp &time, const bool invData=true, const bool invComp=true, const bool forceRadio=false)
Update detector: deletes currently constructed stations and sets new time.
Definition: Detector.cc:179
const StationIdCollection & GetCrown(const int level) const
Returns a list of station id&#39;s in the crown. If the argument is 0, it returns the station id...
Detector description interface for Station-related data.
Traditional name.
Definition: Verbosity.h:17
int crown(double x1, double x2, double y1, double y2)
Definition: XbArray.cc:14
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
const std::string & GetName() const
Station name.
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
const sdet::SDetector & GetSDetector() const
Definition: Detector.cc:119
Detector description interface for SDetector-related data.
Definition: SDetector.h:42
const Station & GetStation(const int stationId) const
Get station by Station Id.
Definition: SDetector.cc:192

, generated on Tue Sep 26 2023.