testBug594.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/UTCDateTime.h>
12 #include <utl/TabulatedFunction.h>
13 #include <utl/Reader.h>
14 #include <utl/CoordinateSystem.h>
15 #include <utl/Point.h>
16 #include <utl/AugerException.h>
17 #include <utl/ErrorLogger.h>
18 #include <fwk/CoordinateSystemRegistry.h>
19 
20 #include <evt/Event.h>
21 #include <sevt/SEvent.h>
22 #include <sevt/Station.h>
23 
24 #include <cppunit/extensions/HelperMacros.h>
25 
26 using namespace det;
27 using namespace std;
28 using namespace fwk;
29 using namespace utl;
30 using namespace sdet;
31 
32 
33 class SDetectorTest : public CppUnit::TestFixture {
34 
35  CPPUNIT_TEST_SUITE(SDetectorTest);
36  CPPUNIT_TEST(testBug594);
37  CPPUNIT_TEST_SUITE_END();
38 
39 public:
40  void
42  {
43  ErrorLogger::GetInstance().SetVerbosity(Verbosity::eVerbose);
44 
45  // Switch off the exception trows for case of unfound schema
46  // This way we don't have to generate another copy of the station
47  // list with a different schema hook
48  CentralConfig::GetInstance(BOOTSTRAPFILE, false, false);
49 
50  // Create a detector
51  Detector::GetInstance();
52  }
53 
54  void tearDown() { }
55 
56 
57  void
59  {
60 
61  cout << "in testBug594" << endl;
62 
63  Detector& det = Detector::GetInstance();
64  det.Update(UTCDateTime(2007,9,1,1,1,1).GetTimeStamp());
65  const SDetector& sDet = det.GetSDetector();
66  const int sId = 1494;
67  const Station& st = sDet.GetStation(sId);
68 
69  cerr << "Station: " << sId << endl;
70 
71  set<int> stations;
72  stations.insert(sId);
73 
74  for (int i = 1; i < 10; ++i) {
75  cerr << "Crown " << i << ':';
76  const Station::StationIdCollection crown = st.GetCrown(i);
77  for (Station::StationIdCollection::const_iterator sIt = crown.begin();
78  sIt != crown.end(); ++sIt) {
79  cerr << ' ' << *sIt;
80  const bool inserted = stations.insert(*sIt).second;
81  if (!inserted)
82  cerr << "Station " << *sIt << " from crown " << i << " "
83  "has been already encountered in lower crowns!" << endl;
84  CPPUNIT_ASSERT(inserted);
85  }
86  cerr << endl;
87  }
88  }
89 
90 };
91 
92 
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.
void testBug594()
Definition: testBug594.cc:58
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)
void tearDown()
Definition: testBug594.cc:54
void setUp()
Definition: testBug594.cc:41
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
const sdet::SDetector & GetSDetector() const
Definition: Detector.cc:119
if(dataRoot)
Definition: XXMLManager.h:1003
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.