NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
UnbExtHit.h
Go to the documentation of this file.
1 
7 #ifndef NAIA_UNBEXTHIT_H
8 #define NAIA_UNBEXTHIT_H
9 
10 // gbatch headers
11 #ifdef ENABLE_PRODUCTION_CODE
12 #include "root.h"
13 #endif
14 
16 #include "Containers/Tof.h"
17 #include "Containers/TrdK.h"
18 #include "Containers/Utils.h"
19 
20 #include <array>
21 #include <map>
22 #include <vector>
23 
24 namespace NAIA {
25 
29 template <class T> using HitChargeVariable = std::map<TrTrack::ChargeRecoType, T>;
30 
36 class UnbExtHitBaseData : public TObject {
37 public:
42  enum class ExtHit : char { L1 = 0, L9 = 1 };
43 
44 #ifdef ENABLE_PRODUCTION_CODE
45  bool Fill(AMSEventR *evPtr, bool use_trd = false);
46 
47  void SetBeta(double beta) { _beta = beta; }
48  void SetMC(bool isMC) { _isMC = isMC; }
49 #endif
50 
55  void Clear();
56 
61  void Dump() const;
62 
68  bool IsHitPresent(ExtHit hit) const { return m_hits.find(hit) != end(m_hits); }
69 
76  int ChargeStatus(ExtHit hit) { return m_hits[hit].ChargeStatus; }
77 
84  float HitPosX(ExtHit hit) { return m_hits[hit].HitPosX; }
85 
92  float HitPosY(ExtHit hit) { return m_hits[hit].HitPosY; }
93 
101  float Charge(ExtHit hit, TrTrack::ChargeRecoType chType) { return m_hits[hit].Charge[chType]; }
102 
103  const TofBaseData *tofBase = nullptr;
104  const TrdKBaseData *trdBase = nullptr;
105 
106  struct HitData {
107  int ChargeStatus = 0xFFFFFFFF;
108 
109  float HitPosX = std::numeric_limits<float>::max();
110  float HitPosY = std::numeric_limits<float>::max();
111 
113  };
114 
115 private:
116  bool _isMC = false;
117  float _beta = 1.0f;
118 
119  std::map<ExtHit, HitData> m_hits;
120 
121  ClassDef(UnbExtHitBaseData, 1)
122 };
123 
132 class UnbExtHitBase : public OnDemandContainer<UnbExtHitBase>, public UnbExtHitBaseData {
133 public:
134  static const std::string BranchName;
135 
137 };
138 
139 } // namespace NAIA
140 #endif
const TrdKBaseData * trdBase
needed to get basic info without computing twice
Definition: UnbExtHit.h:104
int ChargeStatus(ExtHit hit)
Get the charge status for required hit.
Definition: UnbExtHit.h:76
needed to get basic info without computing twice
Definition: UnbExtHit.h:106
OnDemandContainer container class description.
float HitPosX(ExtHit hit)
Hit position, X side.
Definition: UnbExtHit.h:84
float HitPosY(ExtHit hit)
Hit position, Y side.
Definition: UnbExtHit.h:92
std::map< TrTrack::ChargeRecoType, T > HitChargeVariable
Definition: UnbExtHit.h:29
Container class for base Tof info.
Definition: Tof.h:46
static const std::string BranchName
Definition: UnbExtHit.h:134
Accessor class for base unbiased external hits info.
Definition: UnbExtHit.h:132
Container class for base Trd info.
Definition: TrdK.h:57
Container class for base unbiased external hits info.
Definition: UnbExtHit.h:36
ChargeRecoType
Definition: Utils.h:90
bool IsHitPresent(ExtHit hit) const
Checks if there is a hit on required layer.
Definition: UnbExtHit.h:68
TrdK container class description.
Mixin class to add &quot;read-on-demand&quot; behavior to an existing container class.
void Clear()
Clear container content.
Definition: UnbExtHit.cpp:9
void Dump() const
Dump on screen container content.
Definition: UnbExtHit.cpp:15
Tof container class description.
float Charge(ExtHit hit, TrTrack::ChargeRecoType chType)
Hit charge.
Definition: UnbExtHit.h:101
const TofBaseData * tofBase
Definition: UnbExtHit.h:103
HitChargeVariable< float > Charge
Definition: UnbExtHit.h:112
std::map< ExtHit, HitData > m_hits
Definition: UnbExtHit.h:119
ExtHit
Handy enum to distinguish L1 and L9.
Definition: UnbExtHit.h:42
NAIAChain::EventItr end(NAIAChain &chain)
Definition: NAIAChain.h:298