Telescope_ROOT.cc
Go to the documentation of this file.
1 #include <io/Telescope_ROOT.h>
2 #include <io/TelescopeSimData_ROOT.h>
3 #include <io/TelescopeTriggerData_ROOT.h>
4 #include <io/StreamerUtilities.h>
5 
6 using namespace io;
7 
8 
9 ClassImp(Telescope_ROOT)
10 
11 
13 {
14  delete fSim;
15  delete fTrigger;
16 }
17 
18 
21 {
22  if (this != &t) {
24  fEyeId = t.fEyeId;
25  DeepCopy(fSim, t.fSim);
28  fChannels = t.fChannels;
29  fPixels = t.fPixels;
32  fStatus = t.fStatus;
33  }
34  return *this;
35 }
36 
37 
39  fTelescopeId(t.GetId()),
40  fEyeId(t.GetEyeId()),
41  fTracesStartTime(t.GetTracesStartTime()),
42  fChannels(t.ChannelsBegin(), t.ChannelsEnd()),
43  fPixels(t.PixelsBegin(fevt::ComponentSelector::eExists),
44  t.PixelsEnd(fevt::ComponentSelector::eExists)),
45  fTimeOffset(t.GetTimeOffset()),
46  fRawTelPointing(t.GetRawTelPointing()),
47  fStatus(t.GetStatus())
48 {
49  if (t.HasSimData())
51 
52  if (t.HasTriggerData())
54 
55  if (fStatus == 0)
56  fStatus = -1;
57 }
58 
59 
60 void
62  const
63 {
64  if (fTelescopeId != t.GetId() || fEyeId != t.GetEyeId())
65  throw utl::IOFailureException("This should not happen!");
66 
68 
69  if (fStatus == -1)
70  t.SetStatus(static_cast<fevt::ComponentSelector::Status>(0));
71  else if (!fStatus)
73  else
74  t.SetStatus(static_cast<fevt::ComponentSelector::Status>(fStatus));
75 
76  if (fSim) {
77  t.MakeSimData();
78  *fSim >> t.GetSimData();
79  }
80 
81  if (fTrigger) {
82  t.MakeTriggerData();
83  *fTrigger >> t.GetTriggerData();
84  }
85 
87 
88  for (const auto& ch : fChannels) {
89  t.MakeChannel(ch.fId);
90  ch >> t.GetChannel(ch.fId);
91  }
92 
93  for (const auto& px : fPixels) {
94  t.MakePixel(px.fId);
95  px >> t.GetPixel(px.fId);
96  }
97 
99 }
Telescope Class being actually streamed when using ROOT IO.
bool HasTriggerData() const
void ConvertCopy(T *&destination, const U &source)
void SetStatus(const ComponentSelector::Status status)
void SetTimeOffset(const unsigned int toffset)
unsigned int GetEyeId() const
unsigned int fTelescopeId
std::string fRawTelPointing
TelescopeSimData_ROOT * fSim
Base class to report exceptions in IO.
utl::TimeStamp Convert() const
void MakePixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Make Pixel telescopeId.
Telescope_ROOT & operator=(const Telescope_ROOT &t)
fevt::TelescopeSimData & GetSimData()
Channel & GetChannel(const unsigned int channelId)
void DeepCopy(T *&destination, U *const source)
unsigned int fTimeOffset
void SetTracesStartTime(const utl::TimeStamp &tstamp)
unsigned int fEyeId
TelescopeTriggerData_ROOT * fTrigger
std::vector< Channel_ROOT > fChannels
void SetRawTelPointing(const std::string &pointing)
std::vector< Pixel_ROOT > fPixels
void MakeChannel(const unsigned int channelId)
void operator>>(fevt::Telescope &t) const
fTelescopeId(t.GetTelescopeId())
Pixel & GetPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Pixel by Id, throw exception if not existent.
unsigned int GetId() const
Fluorescence Detector Telescope Event.
TimeStamp_ROOT fTracesStartTime
fevt::TelescopeTriggerData & GetTriggerData()
bool HasSimData() const

, generated on Tue Sep 26 2023.