REvent/Station.cc
Go to the documentation of this file.
1 #include <revt/Station.h>
2 
3 #include <revt/REvent.h>
4 #include <revt/Channel.h>
5 #include <revt/StationTriggerData.h>
6 #include <revt/StationSimData.h>
7 #include <revt/StationRecData.h>
8 #include <revt/StationGPSData.h>
9 #include <revt/StationHeader.h>
10 
11 #include <det/Detector.h>
12 #include <rdet/RDetector.h>
13 #include <rdet/Station.h>
14 
15 #include <utl/ErrorLogger.h>
16 #include <utl/AugerException.h>
17 
18 #include <cstddef>
19 #include <iostream>
20 
21 using namespace std;
22 using namespace utl;
23 using namespace det;
24 using namespace revt;
25 
26 
27 Station::Station(const int sId) :
28  fId(sId)
29 {
30  const auto& dStation = det::Detector::GetInstance().GetRDetector().GetStation(sId);
31  for (const auto cId : dStation.GetListOfChannelIds())
32  fChannels.push_back(new Channel(sId, cId));
33 }
34 
35 
36 Station::Station(const Station& station) :
37  fId(station.fId),
38  fSimData(station.fSimData),
39  fRecData(station.fRecData),
40  fTriggerData(station.fTriggerData),
41  fGPSData(station.fGPSData),
42  fStationHeader(station.fStationHeader),
43  fRawTraceStartTime(station.fRawTraceStartTime),
44  fRawTraceStartTimeLocked(station.fRawTraceStartTimeLocked),
45  fFFTDataContainer(station.fFFTDataContainer),
46  fReconstructionStatus(station.fReconstructionStatus),
47  fExcludedReason(station.fExcludedReason),
48  fIsSaturated(station.fIsSaturated),
49  fRejectedReason(station.fRejectedReason),
50  fHWTemperature(station.fHWTemperature),
51  fHWTemperatureInt(station.fHWTemperatureInt),
52  fHWTemperatureExt(station.fHWTemperatureExt)
53 {
54  for (const auto cp : station.fChannels)
55  fChannels.push_back(new Channel(*cp));
56 }
57 
58 
60 {
61  for (const auto cp : fChannels)
62  delete cp;
63 }
64 
65 
66 Station&
67 Station::operator=(const Station& station)
68 {
69  if (this != &station) {
70  fId = station.fId;
71  fSimData = station.fSimData;
72  fRecData = station.fRecData;
73  fTriggerData = station.fTriggerData;
74  fGPSData = station.fGPSData;
81  fIsSaturated = station.fIsSaturated;
86 
87  for (const auto cp : fChannels)
88  delete cp;
89  fChannels.clear();
90 
91  for (const auto& cp : station.ChannelsRange())
92  fChannels.push_back(new Channel(cp));
93  }
94 
95  return *this;
96 }
97 
98 
99 bool
100 Station::HasChannel(const int channelId)
101  const
102 {
103  const rdet::Station& dStation = det::Detector::GetInstance().GetRDetector().GetStation(fId);
104  return dStation.HasChannel(channelId);
105 }
106 
107 
108 const Channel&
109 Station::GetChannel(const int channelId)
110  const
111 {
112  const rdet::Station& dStation = det::Detector::GetInstance().GetRDetector().GetStation(fId);
113 
114  if (!dStation.HasChannel(channelId)) {
115  std::ostringstream err;
116  err << "Invalid Channel id " << channelId;
117  ERROR(err);
118  throw utl::NonExistentComponentException(err.str());
119  }
120 
121  return *fChannels[dStation.GetInternalChannelId(channelId)];
122 }
123 
124 
125 const StationSimData&
127  const
128 {
129  return *fSimData;
130 }
131 
132 
133 void
135 {
136  if (fSimData) {
137  ERROR("SimData already exists - Not Replacing");
138  }
139  else
140  fSimData = new StationSimData;
141 }
142 
143 
144 const StationRecData&
146  const
147 {
148  return *fRecData;
149 }
150 
151 
152 void
154 {
155  if (fRecData)
156  ERROR("Rec Data already exists - Not Replacing");
157  else
158  fRecData = new StationRecData;
159 }
160 
161 
162 const StationTriggerData&
164  const
165 {
166  return *fTriggerData;
167 }
168 
169 
170 void
172 {
173  if (fTriggerData)
174  ERROR("Trigger Data already exists - Not Replacing");
175  else
177 }
178 
179 
180 const StationGPSData&
182  const
183 {
184  return *fGPSData;
185 }
186 
187 
188 void
190 {
191  if (fGPSData)
192  ERROR("GPS Data already exists - Not Replacing");
193  else
194  fGPSData = new StationGPSData;
195 }
196 
197 
198 void
200 {
201  if (fStationHeader)
202  ERROR("Station header already exists - Not replacing");
203  else
205 }
206 
207 
208 const StationHeader&
210  const
211 {
212  return *fStationHeader;
213 }
214 
215 
216 void
218 {
219  if (reason == revt::eNotExcluded) {
220  ERROR("You are trying to manually set the station to eNotExcluded."
221  "This is not allowed.");
222  } else {
224  fExcludedReason = reason;
225  }
226 }
227 
228 
229 void
230 Station::SetRejectedReason(const unsigned long long int reason)
231 {
232  if (reason == revt::eNoRejection) {
233  ERROR("You are trying to manually set the station to eNotRejected."
234  "This is not allowed.");
235  } else {
237  fRejectedReason |= reason;
238  }
239 }
240 
Class to access station level reconstructed data.
StationSimData & GetSimData()
Get simulated data at station level.
Station Level Simulated Data
Station & operator=(const Station &station)
StationTriggerData & GetTriggerData()
Get Trigger data for the station.
Detector description interface for Station-related data.
StationRecData & GetRecData()
Get station level reconstructed data.
void MakeSimData()
Make station simulated data object.
Station Trigger Data description
Station(const Station &station)
int GetInternalChannelId(const int channelId) const
bool fRawTraceStartTimeLocked
Base class for exceptions trying to access non-existing components.
utl::ShadowPtr< StationGPSData > fGPSData
void MakeGPSData()
Make GPS data object.
void MakeTriggerData()
Make trigger data object.
bool HasChannel(const int pmtId) const
Check if a particular Channel object exists.
double fHWTemperatureExt
class to hold data at the radio Station level.
ExcludedReason fExcludedReason
utl::InitializedShadowPtr< StationFFTDataContainer > fFFTDataContainer
container for the radio time and frequency data
void MakeStationHeader()
Make Station Header object.
utl::ShadowPtr< StationHeader > fStationHeader
std::vector< Channel * > fChannels
ReconstructionStatus fReconstructionStatus
StationGPSData & GetGPSData()
Get GPS data for the station.
bool HasChannel(const int channelId) const
void SetRejectedReason(const unsigned long long int reason)
utl::ShadowPtr< StationRecData > fRecData
Channel & GetChannel(const int pmtId)
Retrieve a Channel by Id.
void MakeRecData()
Make station reconstructed data object.
unsigned long long int fRejectedReason
Class that holds the data associated to an individual radio channel.
void SetExcludedReason(const ExcludedReason reason)
double fHWTemperature
StationHeader & GetStationHeader()
Get the Station Header.
Store information provided by the DAQ about the station.
Definition: StationHeader.h:13
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
utl::TimeStamp fRawTraceStartTime
double fHWTemperatureInt
utl::ShadowPtr< StationTriggerData > fTriggerData
utl::ShadowPtr< StationSimData > fSimData

, generated on Tue Sep 26 2023.