testMEventImpl.cc
Go to the documentation of this file.
1 
9 #include <fwk/CentralConfig.h>
10 #include <evt/Event.h>
11 #include <mevt/MEvent.h>
12 #include <mevt/Header.h>
13 
14 #include <det/Detector.h>
15 #include <mdet/MDetector.h>
16 
17 #include <iostream>
18 
19 #include <utl/TimeStamp.h>
20 #include <utl/UTCDateTime.h>
21 
22 #include <tst/Verify.h>
23 
24 #include <cppunit/extensions/HelperMacros.h>
25 
26 using namespace std;
27 using namespace utl;
28 using namespace tst;
29 using namespace mevt;
30 
31 
33 {
34  if (fIsOwnerOfEvent)
35  delete fEvent;
36 }
37 
38 
39 void
41 {
42  if (!fEvent)
43  fEvent = new evt::Event;
44  fEvent->MakeMEvent();
45 
46  fwk::CentralConfig::GetInstance(BOOTSTRAPFILE);
47 
48  fTime = UTCDateTime(2012,12,12,12,12,0).GetTimeStamp();
49  det::Detector::GetInstance().Update(fTime);
50 
51  // Add all stations in the Detector (commissioned at current time)
52  // to the MEvent
53  //
54  MEvent& mEvent = fEvent->GetMEvent();
55  const mdet::MDetector& theMDetector = det::Detector::GetInstance().GetMDetector();
56 
57  fNCounters = 0;
58  for (mdet::MDetector::CounterConstIterator cIt = theMDetector.CountersBegin();
59  cIt != theMDetector.CountersEnd(); ++cIt) {
60  mEvent.MakeCounter(cIt->GetId());
61  ++fNCounters;
62  }
63 
64  // there should be 19 counters now
65  CPPUNIT_ASSERT(Verify<Equal>(fNCounters, 22));
66 }
67 
68 
69 void
70 testMEventImpl::setUp(evt::Event& event, const bool testIO)
71 {
72  delete fEvent;
73  fEvent = &event;
74  this->setUp();
75  fIsOwnerOfEvent = false;
76 
77  fTestIO = testIO;
78 }
79 
80 
81 void
83 {
84  Header& header = mEvent.GetHeader();
85  header.SetId(999);
86  header.SetTime(fTime);
87 }
88 
89 
90 void
92 {
93  const Header& header = mEvent.GetHeader();
94 
95  CPPUNIT_ASSERT(Verify<Equal>(header.GetId(), 999));
96  CPPUNIT_ASSERT(Verify<Equal>(header.GetTime(), fTime));
97 }
98 
99 
100 void
102 {
103  MEvent& mEvent = fEvent->GetMEvent();
104  setHeaderValues(mEvent);
105  checkHeaderValues(mEvent);
106 }
void SetId(const int id)
Definition: MEvent/Header.h:28
int GetId() const
Definition: MEvent/Header.h:24
CounterConstIterator CountersEnd() const
End iterator over the counters.
Definition: MDetector.h:99
Detector associated to muon detector hierarchy.
Definition: MDetector.h:32
utl::TimeStamp GetTime() const
Definition: MEvent/Header.h:22
CounterGroup::ConstIterator CounterConstIterator
Defines a more meaningful (and shorter) type for iterators.
Definition: MDetector.h:44
void setHeaderValues(mevt::MEvent &mEvent)
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
Header information for muon events.
Definition: MEvent/Header.h:20
void MakeCounter(const int cId)
Definition: MEvent.h:40
CounterConstIterator CountersBegin() const
Begin iterator over the counters.
Definition: MDetector.h:92
Header & GetHeader()
Definition: MEvent.h:65
void SetTime(const utl::TimeStamp &time)
Definition: MEvent/Header.h:26
void checkHeaderValues(const mevt::MEvent &mEvent)
Root of the Muon event hierarchy.
Definition: MEvent.h:25
TimeStamp GetTimeStamp() const
Definition: UTCDateTime.cc:115

, generated on Tue Sep 26 2023.