CEvent/Station.cc
Go to the documentation of this file.
1 
4 #include <cevt/Station.h>
5 
6 #include <cevt/CEvent.h>
7 #include <cevt/Pad.h>
8 #include <cevt/StationSimData.h>
9 #include <cevt/StationRecData.h>
10 // #include <cevt/StationTriggerData.h>
11 // #include <cevt/StationCalibData.h>
12 // #include <cevt/StationGPSData.h>
13 #include <det/Detector.h>
14 #include <sdet/Station.h>
15 
16 #include <utl/Particle.h>
17 #include <utl/ErrorLogger.h>
18 #include <utl/AugerException.h>
19 #include <cstddef>
20 #include <iostream>
21 
22 using namespace std;
23 using namespace utl;
24 using namespace det;
25 using namespace cevt;
26 
27 
28 // move to static map which is created on first request
29 //
30 const string Station::fgSourceNameLookup[eLastSource + 1] = {
31  "Total (shower + bkgnd)",
32  "e+, e-",
33  "photons",
34  "mu+, mu- (shower)",
35  "hadrons (shower)",
36  "decay electron",
38  "delta ray",
39  "e+,e- from shower e+,e-",
40  "e+,e- from shower muon",
41  "e+,e- from shower photon",
42  "e+,e- from other source",
44  "photon from shower e+,e-",
45  "photon from shower muon",
46  "photon from shower photon",
47  "photon from other source",
49  "e+, e- (bkgnd)",
50  "photons (bkgnd)",
51  "mu+, mu- (bkgnd)",
52  "hadrons (bkgnd)",
53  "other neutrals (neutrino,pi0)",
54  "photon from muon decay in shower",
55  "electron from muon decay in shower", // 22
56  "","","","","","","", // 29
57  "","","","","","","","","","", // 39
58  "","","","","","","","","","", //49
59  "User-defined source 0",
60  "User-defined source 1",
61  "User-defined source 2",
62  "User-defined source 3",
63  "User-defined source 4",
64  "User-defined source 5",
65  "User-defined source 6",
66  "User-defined source 7",
67  "User-defined source 8",
68  "User-defined source 9"
69 };
70 
71 
72 string
74 {
75  return fgSourceNameLookup[sc];
76 }
77 
78 #define PHOTON utl::Particle::ePhoton
79 #define ELECTRONS utl::Particle::eElectron: \
80  case utl::Particle::ePositron
81 #define MUONS utl::Particle::eMuon: \
82  case utl::Particle::eAntiMuon
83 #define HADRONS utl::Particle::eProton: \
84  case utl::Particle::eAntiProton: \
85  case utl::Particle::eNeutron: \
86  case utl::Particle::eAntiNeutron: \
87  case utl::Particle::ePiPlus: \
88  case utl::Particle::ePiMinus: \
89  case utl::Particle::eEta: \
90  case utl::Particle::eKaon0L: \
91  case utl::Particle::eKaon0S: \
92  case utl::Particle::eKaonPlus: \
93  case utl::Particle::eKaonMinus: \
94  case utl::Particle::eLambda: \
95  case utl::Particle::eAntiLambda: \
96  case utl::Particle::eLambdac
97 #define NEUTRALS utl::Particle::eNuElectron: \
98  case utl::Particle::eAntiNuElectron: \
99  case utl::Particle::eNuMuon: \
100  case utl::Particle::eAntiNuMuon: \
101  case utl::Particle::eNuTau: \
102  case utl::Particle::eAntiNuTau: \
103  case utl::Particle::ePiZero: \
104  case utl::Particle::eRhoZero
105 
107 Station::GetSignalComponent(const utl::Particle& particle)
108 {
109  switch (particle.GetType()) {
110  case ELECTRONS:
111  if (!particle.HasParent()) { // shower electrons arriving at RPC
112  if (particle.GetSource() == Particle::eShower)
114  else if (particle.GetSource() == Particle::eShowerFromMuonDecay)
116  else
118  }
119  else { // secondary electrons at RPC
120  if (particle.GetParent().GetType() == Particle::eMuon ||
121  particle.GetParent().GetType() == Particle::eAntiMuon) {
123  }
124  else if (particle.GetParent().GetType() == Particle::eElectron ||
125  particle.GetParent().GetType() == Particle::ePositron) {
126 
127  if (particle.GetParent().GetSource() == Particle::eShower)
129  else if (particle.GetParent().GetSource() == Particle::eShowerFromMuonDecay)
131  else
133  }
134  else if (particle.GetParent().GetType() == Particle::ePhoton) {
135  if (particle.GetParent().GetSource() == Particle::eShower)
137  else if (particle.GetParent().GetSource() == Particle::eShowerFromMuonDecay)
139  else
141  }
142  else
144  }
145  case PHOTON:
146  if (!particle.HasParent()) { // shower photons arriving at RPC
147  if (particle.GetSource() == Particle::eShower)
149  else if (particle.GetSource() == Particle::eShowerFromMuonDecay)
151  else
153  }
154  else { // secondary photons at RPC
155  if (particle.GetParent().GetType() == Particle::eMuon ||
156  particle.GetParent().GetType() == Particle::eAntiMuon) {
158  }
159  else if (particle.GetParent().GetType() == Particle::eElectron ||
160  particle.GetParent().GetType() == Particle::ePositron) {
161  if (particle.GetParent().GetSource() == Particle::eShower)
163  else if (particle.GetParent().GetSource() == Particle::eShowerFromMuonDecay)
165  else
167  }
168  else if (particle.GetParent().GetType() == Particle::ePhoton) {
169  if (particle.GetParent().GetSource() == Particle::eShower)
171  else if (particle.GetParent().GetSource() == Particle::eShowerFromMuonDecay)
173  else
175  }
176  else
178  }
179  case MUONS:
180  return cevt::Station::eMuon;
181  case HADRONS:
182  return cevt::Station::eHadron;
183  case NEUTRALS:
185  default:
186  ERROR("Illegal Component in Station::GetSignalComponent; unknown particle !");
188  }
189 }
190 
191 
192 Station::Station(const int id) :
193  fId(id),
194  fReconstructionStatus(eCandidate),
195  fRejectionStatus(eNoRejection)
196 {
197 }
198 
199 
200 Station::Station(const Station& station) :
201  fId(station.fId),
202  // fPads below
203  fSimData(station.fSimData),
204  fRecData(station.fRecData),
205 // fCalibData(station.fCalibData),
206 // fTriggerData(station.fTriggerData),
207 // fGPSData(station.fGPSData),
208  fHitsStartTime(station.fHitsStartTime),
209  fHits(station.fHits),
210  fReconstructionStatus(station.fReconstructionStatus),
211  fRejectionStatus(station.fRejectionStatus)
212 {
213  for (InternalConstPadIterator padIt = station.fPads.begin();
214  padIt != station.fPads.end(); ++padIt)
215  fPads.push_back(new Pad(**padIt));
216 }
217 
218 
220 {
221  for (InternalPadIterator padIt = fPads.begin();
222  padIt != fPads.end(); ++padIt)
223  delete *padIt;
224 }
225 
226 
227 Station&
229 {
230  if (this != &station) {
231 
232  fId = station.fId;
233 
234  for (InternalPadIterator padIt = fPads.begin();
235  padIt != fPads.end(); ++padIt)
236  delete *padIt;
237 
238  fPads.clear();
239 
240  for (ConstPadIterator padIt = station.PadsBegin();
241  padIt != station.PadsEnd(); ++padIt)
242  fPads.push_back(new Pad(*padIt));
243 
244  fSimData = station.fSimData;
245  fRecData = station.fRecData;
246 // fCalibData = station.fCalibData;
247 // fTriggerData = station.fTriggerData;
248 // fGPSData = station.fGPSData;
249  fHitsStartTime = station.fHitsStartTime;
250  fHits = station.fHits;
253  }
254 
255  return *this;
256 }
257 
258 
259 bool
260 Station::HasPad(const unsigned int padId)
261  const
262 {
263  for (InternalConstPadIterator padIt = fPads.begin();
264  padIt != fPads.end(); ++padIt)
265  if ((*padIt)->GetId() == padId)
266  return true;
267 
268 
269  return false;
270 
271 }
272 
273 
274 Pad&
275 Station::GetPad(const unsigned int padId)
276 {
277  for (InternalPadIterator padIt = fPads.begin();
278  padIt != fPads.end(); ++padIt)
279  if ((*padIt)->GetId() == padId)
280  return **padIt;
281 
282  std::ostringstream err;
283  err << "Invalid Pad id " << padId;
284  ERROR(err);
285  throw (utl::NonExistentComponentException(err.str()));
286 }
287 
288 
289 const Pad&
290 Station::GetPad(const unsigned int padId)
291  const
292 {
293  for (InternalConstPadIterator padIt = fPads.begin();
294  padIt != fPads.end(); ++padIt)
295  if ((*padIt)->GetId() == padId)
296  return **padIt;
297 
298  std::ostringstream err;
299  err << "Invalid Pad id " << padId;
300  ERROR(err);
301  throw (utl::NonExistentComponentException(err.str()));
302 }
303 
304 
305 void
306 Station::MakePad(const unsigned int padId)
307 {
308  if (HasPad(padId)) {
309  std::ostringstream err;
310  err << "Pad id " << padId << " already exists - Not replacing !";
311  ERROR(err);
312 
313  }
314  else
315  fPads.push_back(new Pad(fId, padId));
316 }
317 
318 
319 void
321 {
322  if (fSimData) {
323  ERROR("SimData already exists - Not Replacing");
324  }
325  else
326  fSimData = new StationSimData;
327 }
328 
329 
330 void
332 {
333  if (fRecData) {
334  ERROR("Rec Data already exists - Not Replacing");
335  }
336  else
337  fRecData = new StationRecData;
338 }
339 
340 
341 // void
342 // Station::MakeTriggerData()
343 // {
344 // if (fTriggerData) {
345 // ERROR("Trigger Data already exists - Not Replacing");
346 // }
347 // else
348 // fTriggerData = new StationTriggerData;
349 // }
350 
351 
352 // void
353 // Station::MakeCalibData()
354 // {
355 // if (fCalibData) {
356 // ERROR("Calib Data already exists - Not Replacing");
357 // }
358 // else
359 // fCalibData = new StationCalibData;
360 // }
361 
362 
363 // void
364 // Station::MakeGPSData()
365 // {
366 // if (fGPSData) {
367 // ERROR("GPS Data already exists - Not Replacing");
368 // }
369 // else
370 // fGPSData = new StationGPSData;
371 // }
372 
373 
374 void
376 {
377  fHits->AddTimeDistribution(1*ns, source);
378 }
379 
380 
381 unsigned int Station::GetTotalHits(const SignalComponent source) const
382 {
383  if (fHits->HasLabel(source)) {
384  const TimeDistributionI& hits = fHits->GetTimeDistribution(source);
385  return static_cast<unsigned int>(TimeDistributionAlgorithm::Sum(hits,hits.GetStart(),hits.GetStop()));
386  }
387  else
388  return 0;
389 }
390 
391 
392 
393 // Configure (x)emacs for this file ...
394 // Local Variables:
395 // mode: c++
396 // compile-command: "make -C .. CEvent/Station.o -k"
397 // End:
static const SignalComponent eBackgroundPhoton
photons from background
int GetStart() const
First slot with data.
utl::ShadowPtr< StationSimData > fSimData
static const SignalComponent ePhotonFromOtherSource
Station Level Simulated Data
static const SignalComponent ePhotonFromShowerPhoton
Pad & GetPad(const unsigned int padId)
Retrive a Pad by Id.
Describes a particle for Simulation.
Definition: Particle.h:26
static const SignalComponent ePhotonFromShowerMuon
void MakeHits(const SignalComponent source=eTotal)
Make a time distribution. Source may be specified.
Station(const Station &station)
std::vector< Pad * >::const_iterator InternalConstPadIterator
static const SignalComponent eOtherNeutrals
other neutral particles
Histogram class for time distributions with suppressed empty bins.
Class to access station level reconstructed data.
static const SignalComponent eElectronFromOtherSource
static const SignalComponent eHadron
all hadrons from shower
Base class for exceptions trying to access non-existing components.
Particle & GetParent()
Definition: Particle.h:148
class to hold data at Pad level
Definition: Pad.h:27
std::string GetSignalComponentName(const SignalComponent comp)
static const SignalComponent eLastSource
utl::InitializedShadowPtr< utl::MultiTimeDistributionI > fHits
static const SignalComponent eElectronFromShowerPhoton
bool HasPad(const unsigned int padId) const
Check if a particular Pad object exists.
const double ns
#define NEUTRALS
static const SignalComponent eShowerMuonDecayElectron
electrons from muon decay in shower
ReconstructionStatus fReconstructionStatus
Station & operator=(const Station &station)
#define HADRONS
int GetStop() const
Last slot with data (1 less than First slot if no data)
void MakeRecData()
Make station reconstructed data object.
static const SignalComponent eElectronFromShowerElectron
separate electron components
unsigned int GetTotalHits(const SignalComponent source=eTotal) const
Get the total number of counts, optionally specifying a component.
bool HasParent() const
Definition: Particle.h:147
class to hold data at Station level
PadIterator PadsEnd()
end Pad iterator for read/write
std::vector< Pad * > fPads
static const SignalComponent ePhotonFromShowerElectron
secondary photons
#define MUONS
static const SignalComponent eShowerMuonDecayPhoton
photons from muon decay in shower
Source GetSource() const
Source of the particle (eg. shower or background)
Definition: Particle.h:107
utl::TimeStamp fHitsStartTime
struct particle_info particle[80]
static const SignalComponent eMuon
mu+ and mu- (including signal from mu decay electrons) from shower
int GetType() const
Definition: Particle.h:101
utl::ShadowPtr< StationRecData > fRecData
#define PHOTON
std::vector< Pad * >::iterator InternalPadIterator
void MakePad(const unsigned int padId)
Make a Pad by Id.
static const SignalComponent eElectronFromShowerMuon
PadIterator PadsBegin()
begin Pad iterator for read/write
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
#define ELECTRONS
static const SignalComponent eBackgroundElectron
electrons from background
boost::indirect_iterator< InternalConstPadIterator, const Pad & > ConstPadIterator
Iterator over station for read.
void MakeSimData()
Make station simulated data object.

, generated on Tue Sep 26 2023.