ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtRawEvent.h
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 
10 #ifndef AtRAWEVENT_H
11 #define AtRAWEVENT_H
12 
13 #include "AtBaseEvent.h"
14 #include "AtGenericTrace.h" // IWYU pragma: keep
15 #include "AtPadReference.h" // IWYU pragma: keep
16 
17 #include <Rtypes.h>
18 
19 #include <cstddef>
20 #include <functional> // for hash
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <type_traits>
25 #include <unordered_map> // for unordered_map
26 #include <utility>
27 #include <vector>
28 
29 class AtPad;
30 class TBuffer;
31 class TClass;
32 class TMemberInspector;
33 
34 class AtRawEvent : public AtBaseEvent {
35 private:
36  using AtPadPtr = std::unique_ptr<AtPad>;
37  using FpnMap = std::unordered_map<AtPadReference, AtPad>;
38  using PadVector = std::vector<AtPadPtr>;
39  using AtGenTracePtr = std::unique_ptr<AtGenericTrace>;
40  using GenTraceVector = std::vector<AtGenTracePtr>;
41 
42  PadVector fPadList;
43  FpnMap fFpnMap;
44  GenTraceVector fGTraceList;
45 
46  std::multimap<Int_t, std::size_t> fSimMCPointMap; //<! Monte Carlo Point - Hit map for kinematics
47 
48  friend class AtFilterTask;
49  friend class AtFilterFFT;
50 
51 public:
52  AtRawEvent() : AtBaseEvent("AtRawEvent"){};
53  AtRawEvent(AtRawEvent &&obj) = default;
54  AtRawEvent(const AtRawEvent &object);
55  AtRawEvent(const AtBaseEvent &object) : AtBaseEvent(object) { SetName("AtRawEvent"); }
57  virtual ~AtRawEvent() = default;
58 
59  friend void swap(AtRawEvent &first, AtRawEvent &second)
60  {
61  using std::swap;
62  swap(dynamic_cast<AtBaseEvent &>(first), dynamic_cast<AtBaseEvent &>(second));
63  swap(first.fPadList, second.fPadList);
64  swap(first.fFpnMap, second.fFpnMap);
65  swap(first.fSimMCPointMap, second.fSimMCPointMap);
66  };
67 
69  // void CopyAllButData(const AtRawEvent *event);
70 
71  void Clear(Option_t *opt = nullptr) override;
72 
81  template <typename... Ts>
82  AtPad *AddPad(Ts &&...params)
83  {
84  fPadList.push_back(std::make_unique<AtPad>(std::forward<Ts>(params)...));
85  return fPadList.back().get();
86  }
87 
96  template <typename T, typename = std::enable_if_t<std::is_base_of<AtPad, std::decay_t<T>>::value>>
97  AtPad *AddPad(std::unique_ptr<T> ptr)
98  {
99  fPadList.push_back(std::move(ptr));
100  return fPadList.back().get();
101  }
102 
103  AtPad *AddFPN(const AtPadReference &ref);
104 
105  void RemovePad(Int_t padNum);
106  void SetSimMCPointMap(std::multimap<Int_t, std::size_t> map) { fSimMCPointMap = std::move(map); }
107 
108  template <typename... Ts>
110  {
111  fGTraceList.push_back(std::make_unique<AtGenericTrace>(std::forward<Ts>(params)...));
112  return fGTraceList.back().get();
113  }
114 
115  AtGenericTrace *AddGenericTrace(std::unique_ptr<AtGenericTrace> ptr)
116  {
117  fGTraceList.push_back(std::move(ptr));
118  return fGTraceList.back().get();
119  }
120 
121  // getters
122  Int_t GetNumPads() const { return fPadList.size(); }
123  Int_t GetNumAuxPads() const { return fAuxPadMap.size(); }
124  AtPad *GetPad(Int_t padNum) { return const_cast<AtPad *>(const_cast<const AtRawEvent *>(this)->GetPad(padNum)); }
125  const AtPad *GetPad(Int_t padNum) const;
127  {
128  return const_cast<AtPad *>(const_cast<const AtRawEvent *>(this)->GetFpn(ref));
129  }
130  const AtPad *GetFpn(const AtPadReference &ref) const;
131  const PadVector &GetPads() const { return fPadList; }
132  PadVector &GetPads() { return const_cast<PadVector &>(const_cast<const AtRawEvent *>(this)->GetPads()); }
133 
134  const GenTraceVector &GetGenTraces() const { return fGTraceList; }
135 
136  const FpnMap &GetFpnPads() const { return fFpnMap; }
137  std::multimap<Int_t, std::size_t> &GetSimMCPointMap() { return fSimMCPointMap; }
138 
140 };
141 
142 #endif
swap
void swap(AtPad &a, AtPad &b) noexcept
Definition: AtPad.cxx:22
AtRawEvent::AtRawEvent
AtRawEvent()
Definition: AtRawEvent.h:52
AtBaseEvent.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
AtRawEvent::AtRawEvent
AtRawEvent(AtRawEvent &&obj)=default
AtPadReference.h
AtRawEvent::GetNumAuxPads
Int_t GetNumAuxPads() const
Definition: AtRawEvent.h:123
AtRawEvent::ClassDefOverride
ClassDefOverride(AtRawEvent, 7)
AtRawEvent::RemovePad
void RemovePad(Int_t padNum)
Definition: AtRawEvent.cxx:49
AtRawEvent::SetSimMCPointMap
void SetSimMCPointMap(std::multimap< Int_t, std::size_t > map)
Definition: AtRawEvent.h:106
AtRawEvent::AddGenericTrace
AtGenericTrace * AddGenericTrace(std::unique_ptr< AtGenericTrace > ptr)
Definition: AtRawEvent.h:115
AtBaseEvent::fAuxPadMap
AuxPadMap fAuxPadMap
Definition: AtBaseEvent.h:29
AtRawEvent
Definition: AtRawEvent.h:34
AtGenericTrace
Trace recorded by other data acquisition systems.
Definition: AtGenericTrace.h:21
AtFilterFFT
Definition: AtFilterFFT.h:33
AtRawEvent::AddPad
AtPad * AddPad(std::unique_ptr< T > ptr)
Move a pad into the event.
Definition: AtRawEvent.h:97
AtRawEvent::GetPads
PadVector & GetPads()
Definition: AtRawEvent.h:132
AtRawEvent::GetPads
const PadVector & GetPads() const
Definition: AtRawEvent.h:131
AtBaseEvent
Base class for all event types in ATTPCROOT.
Definition: AtBaseEvent.h:20
AtRawEvent::GetGenTraces
const GenTraceVector & GetGenTraces() const
Definition: AtRawEvent.h:134
AtRawEvent::AddPad
AtPad * AddPad(Ts &&...params)
Create a new pad in this event.
Definition: AtRawEvent.h:82
AtRawEvent::swap
friend void swap(AtRawEvent &first, AtRawEvent &second)
Definition: AtRawEvent.h:59
AtRawEvent::AtRawEvent
AtRawEvent(const AtBaseEvent &object)
Definition: AtRawEvent.h:55
AtRawEvent::GetFpnPads
const FpnMap & GetFpnPads() const
Definition: AtRawEvent.h:136
AtFilterTask
Definition: AtFilterTask.h:15
AtRawEvent::AddGenericTrace
AtGenericTrace * AddGenericTrace(Ts &&...params)
Definition: AtRawEvent.h:109
AtRawEvent::GetNumPads
Int_t GetNumPads() const
Definition: AtRawEvent.h:122
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
AtRawEvent::~AtRawEvent
virtual ~AtRawEvent()=default
AtGenericTrace.h
AtRawEvent::GetSimMCPointMap
std::multimap< Int_t, std::size_t > & GetSimMCPointMap()
Definition: AtRawEvent.h:137
AtPadReference
Definition: AtPadReference.h:20
AtRawEvent::GetFpn
AtPad * GetFpn(const AtPadReference &ref)
Definition: AtRawEvent.h:126