ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtRawEvent.cxx
Go to the documentation of this file.
1 /*********************************************************************
2  * AtTPC AtRawEvent Stores a RawEvent composed by the AtTC pads *
3  * Author: Y. Ayyad *
4  * Log: 07-03-2015 17:16 JST *
5  * Adapted from STRawEvent from SPiRITROOT by G. Jhang *
6  * Edited by Adam Anthony 2/17/2020 *
7  *********************************************************************/
8 
9 #include "AtRawEvent.h"
10 
11 #include "AtPad.h"
12 #include "AtPadReference.h" // for AtPadReference (ptr only), operator==
13 
15 
17  : AtBaseEvent(obj), fFpnMap(obj.fFpnMap), fSimMCPointMap(obj.fSimMCPointMap)
18 {
19  for (const auto &pad : obj.fPadList)
20  fPadList.push_back(pad->ClonePad());
21 }
22 
24 {
25  swap(*this, object);
26  return *this;
27 }
28 
29 /*
30 void AtRawEvent::CopyAllButData(const AtRawEvent *event)
31 {
32  fEventID = event->fEventID;
33  fTimestamp = event->fTimestamp;
34  fIsGood = event->fIsGood;
35  fIsInGate = event->fIsInGate;
36 }
37 */
38 
39 void AtRawEvent::Clear(Option_t *opt)
40 {
41  AtBaseEvent::Clear(opt);
42 
43  fPadList.clear();
44  fFpnMap.clear();
45  fSimMCPointMap.clear();
46  fGTraceList.clear();
47 }
48 
49 void AtRawEvent::RemovePad(Int_t padNum)
50 {
51  for (auto it = fPadList.begin(); it != fPadList.end(); ++it)
52  if ((*it)->GetPadNum() == padNum)
53  fPadList.erase(it);
54 }
55 
56 const AtPad *AtRawEvent::GetPad(Int_t padNum) const
57 {
58  for (auto &pad : fPadList)
59  if (pad->GetPadNum() == padNum)
60  return pad.get();
61  return nullptr;
62 }
63 
64 const AtPad *AtRawEvent::GetFpn(const AtPadReference &ref) const
65 {
66  auto padIt = fFpnMap.find(ref);
67  if (padIt == fFpnMap.end())
68  return nullptr;
69  else
70  return &(padIt->second);
71 }
72 
78 {
79  auto [it, added] = fFpnMap.emplace(ref, AtPad());
80  return &(it->second);
81 }
AtPad.h
AtRawEvent::AtRawEvent
AtRawEvent()
Definition: AtRawEvent.h:52
AtRawEvent.h
AtRawEvent::GetPad
AtPad * GetPad(Int_t padNum)
Definition: AtRawEvent.h:124
AtRawEvent::Clear
void Clear(Option_t *opt=nullptr) override
Copy everything but the data (pads, aux pads, and MCPointMap) to this event.
Definition: AtRawEvent.cxx:39
AtPadReference.h
AtRawEvent::RemovePad
void RemovePad(Int_t padNum)
Definition: AtRawEvent.cxx:49
AtRawEvent
Definition: AtRawEvent.h:34
ClassImp
ClassImp(AtRawEvent)
AtBaseEvent
Base class for all event types in ATTPCROOT.
Definition: AtBaseEvent.h:20
AtBaseEvent::Clear
void Clear(Option_t *opt) override
Definition: AtBaseEvent.cxx:13
AtRawEvent::swap
friend void swap(AtRawEvent &first, AtRawEvent &second)
Definition: AtRawEvent.h:59
AtRawEvent::AddFPN
AtPad * AddFPN(const AtPadReference &ref)
Create a new FPN channel.
Definition: AtRawEvent.cxx:77
AtRawEvent::operator=
AtRawEvent & operator=(AtRawEvent object)
Definition: AtRawEvent.cxx:23
AtPad
Container class for AtPadBase objects.
Definition: AtPad.h:38
AtPadReference
Definition: AtPadReference.h:20
AtRawEvent::GetFpn
AtPad * GetFpn(const AtPadReference &ref)
Definition: AtRawEvent.h:126