ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtBaseEvent.cxx
Go to the documentation of this file.
1 #include "AtBaseEvent.h"
2 
3 #include <FairLogger.h>
4 
5 AtBaseEvent::AtBaseEvent(std::string name) : TNamed(name.c_str(), "") {}
6 
8 {
9  swap(*this, object);
10  return *this;
11 }
12 
13 void AtBaseEvent::Clear(Option_t *opt)
14 {
15  TNamed::Clear(opt);
16 
17  fEventID = -1;
18  fAuxPadMap.clear();
19  std::fill(fTimestamp.begin(), fTimestamp.end(), 0);
20 
21  fIsGood = true;
22  fIsInGate = false;
23  fEventName = "";
24 }
25 
26 const AtAuxPad *AtBaseEvent::GetAuxPad(std::string auxName) const
27 {
28  auto padIt = fAuxPadMap.find(auxName);
29  if (padIt == fAuxPadMap.end())
30  return nullptr;
31  else
32  return &(padIt->second);
33 }
34 
35 void AtBaseEvent::SetTimestamp(ULong64_t timestamp, int index)
36 {
37  if (index < fTimestamp.size())
38  fTimestamp[index] = timestamp;
39  else
40  LOG(error) << "Failed to add timestamp with index " << index << " to raw event. Max number of timestamps is "
41  << fTimestamp.size();
42 }
43 
44 std::pair<AtAuxPad *, bool> AtBaseEvent::AddAuxPad(std::string auxName)
45 {
46  auto ret = fAuxPadMap.emplace(auxName, AtAuxPad(auxName));
47  auto pad = &(ret.first->second);
48  return {pad, ret.second};
49 }
50 
AtBaseEvent::fEventID
ULong_t fEventID
Definition: AtBaseEvent.h:24
AtBaseEvent::GetAuxPad
AtAuxPad * GetAuxPad(std::string auxPad)
Definition: AtBaseEvent.h:74
AtBaseEvent.h
AtBaseEvent::fTimestamp
std::vector< ULong64_t > fTimestamp
Definition: AtBaseEvent.h:28
AtBaseEvent::fIsGood
Bool_t fIsGood
Definition: AtBaseEvent.h:25
AtBaseEvent::fAuxPadMap
AuxPadMap fAuxPadMap
Definition: AtBaseEvent.h:29
AtBaseEvent::fIsInGate
Bool_t fIsInGate
Definition: AtBaseEvent.h:26
AtBaseEvent::AtBaseEvent
AtBaseEvent(std::string name="AtBaseEvent")
Definition: AtBaseEvent.cxx:5
AtBaseEvent::AddAuxPad
std::pair< AtAuxPad *, bool > AddAuxPad(std::string auxName)
Add new auxilary pad (AtAuxPad) to event.
Definition: AtBaseEvent.cxx:44
AtBaseEvent
Base class for all event types in ATTPCROOT.
Definition: AtBaseEvent.h:20
AtBaseEvent::operator=
AtBaseEvent & operator=(AtBaseEvent object)
Definition: AtBaseEvent.cxx:7
AtBaseEvent::Clear
void Clear(Option_t *opt) override
Definition: AtBaseEvent.cxx:13
AtBaseEvent::SetTimestamp
void SetTimestamp(ULong64_t timestamp, int index=0)
Definition: AtBaseEvent.cxx:35
AtBaseEvent::swap
friend void swap(AtBaseEvent &first, AtBaseEvent &second)
Definition: AtBaseEvent.h:39
AtBaseEvent::fEventName
std::string fEventName
Definition: AtBaseEvent.h:30
AtAuxPad
Definition: AtAuxPad.h:25
ClassImp
ClassImp(AtBaseEvent)