NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
TrdK.h
Go to the documentation of this file.
1 
7 #ifndef NAIA_TRDK_H
8 #define NAIA_TRDK_H
9 
10 // gbatch headers
11 #ifdef ENABLE_PRODUCTION_CODE
12 #include "TrdKCluster.h"
13 #include "root.h"
14 #endif
15 
17 #include "Containers/TrTrack.h"
18 #include "Containers/Utils.h"
19 
20 #include "TVector3.h"
21 
22 #include <array>
23 #include <map>
24 #include <vector>
25 
26 namespace NAIA {
27 
32 template <class T> using TrdChargeVariable = std::vector<T>;
36 template <class T> using TrdLikelihoodVariable = std::vector<T>;
40 template <class T> using TrdLikelihoodRVariable = std::vector<T>;
44 template <class T> using TrdOnTrackVariable = std::vector<T>;
45 
46 namespace TrdK {
47 enum class BuildType { NONE = 0, TrkTrack, BetaH, TrdTrack };
48 }
49 
57 class TrdKBaseData : public TObject {
58 public:
59  TrdKBaseData() = default;
60 
66  explicit TrdKBaseData(bool standalone) : _isStandalone{standalone} {};
67 
69 
70  // quality-related
71  bool AlignStatus{false};
72  bool CalibStatus{false};
73  bool ChargeStatus{false};
74 
75  // clang-format off
78 
79  // charge-related
81 
82  // likelihood-related
85  // clang-format off
86 
89 
90  std::array<float, 2> DirectionalStoermerCutoff;
91 
92  float Cleanliness{0};
93  float IPChi2{std::numeric_limits<float>::max()};
94 
95 #ifdef ENABLE_PRODUCTION_CODE
96  bool Fill(TrdKCluster *trdkPtr, TrTrackR *pTrTrack);
97 
98  void SetBeta(double beta) { _beta = beta; }
99  // void SetTrTrackPtr(TrTrackR *trackPtr) { pTrTrack = trackPtr; }
100 #endif
101 
106  void Clear();
107 
112  void Dump() const;
113 
122  TVector3 InterpolateAtZ(float z) const;
123 
124  // ugly but better than saving 6 doubles for every event
125  // NB: it's gonna throw if the TrdK object is not valid
126  // NB2: thanks ROOT for not supporting std::vector<std::array>. Hopefully this is the only case where we have
127  // to use TVector3
128 
134  const TVector3 &GetLinePoint() const { return m_pointAndDir.at(0); }
140  const TVector3 &GetLineDirection() const { return m_pointAndDir.at(1); }
141 
142  const TrTrackBaseData *trkBase{nullptr};
143 
144 protected:
145  bool _isStandalone = false;
146 
147 private:
148  void ResizeMembers();
149 
150  // this is used to store point and direction of the TRD reconstruction
151  std::vector<TVector3> m_pointAndDir;
152 
153  float _beta = 1.0;
154 
155  ClassDef(TrdKBaseData, 1)
156 };
157 
166 class TrdKBase : public OnDemandContainer<TrdKBase>, public TrdKBaseData {
167 public:
168  static const std::string BranchName;
169 
171 };
172 
180 class TrdKBaseStandalone : public OnDemandContainer<TrdKBaseStandalone>, public TrdKBaseData {
181 public:
182  static const std::string BranchName;
183 
185 };
186 
187 } // namespace NAIA
188 
189 #endif
bool ChargeStatus
Charge reconstruction status.
Definition: TrdK.h:73
std::vector< T > TrdOnTrackVariable
Definition: TrdK.h:44
void Clear()
Clear container content.
Definition: TrdK.cpp:79
float Cleanliness
Cleanliness. Whatever this means. I don&#39;t know, go ask Kounine.
Definition: TrdK.h:92
TrdKBaseData(bool standalone)
Constructor used by standalone version of container.
Definition: TrdK.h:66
OnDemandContainer container class description.
Accessor class for base TrdK info.
Definition: TrdK.h:166
bool _isStandalone
Definition: TrdK.h:145
TrdLikelihoodRVariable< double > LikelihoodRatio
Trd likelihood ratio estimator. See TrdK::LikelihoodRType for list of available types.
Definition: TrdK.h:84
const TrTrackBaseData * trkBase
Definition: TrdK.h:142
void ResizeMembers()
Definition: TrdKFill.cpp:11
TrdChargeVariable< float > Charge
Reconstructed charge in different Trd regions. See TrdK::ChargeType for list of available regions...
Definition: TrdK.h:80
std::vector< T > TrdLikelihoodRVariable
Definition: TrdK.h:40
const TVector3 & GetLinePoint() const
Get the origin of the TrdK clusters linear fit.
Definition: TrdK.h:134
LayerVariable< float > Edep
Energy deposition in each Trd layer.
Definition: TrdK.h:87
std::array< float, 2 > DirectionalStoermerCutoff
Stoermer cutoff estimated by the TrdK track direction (for both negative and positive particles) ...
Definition: TrdK.h:90
Container class for base Trd info.
Definition: TrdK.h:57
TrdK::BuildType Type
Definition: TrdK.h:68
bool CalibStatus
Calibration status.
Definition: TrdK.h:72
std::vector< T > TrdLikelihoodVariable
Definition: TrdK.h:36
std::map< unsigned int, T > LayerVariable
Definition: Utils.h:54
void Dump() const
Dump on screen container content.
Definition: TrdK.cpp:11
Container class for base TrTrack info.
Definition: TrTrack.h:62
Mixin class to add &quot;read-on-demand&quot; behavior to an existing container class.
TrdLikelihoodVariable< double > Likelihood
Trd likelihood estimator. See TrdK::LikelihoodType for list of available types.
Definition: TrdK.h:83
TVector3 InterpolateAtZ(float z) const
Get Trd track interpolation at given height.
Definition: TrdK.cpp:98
static const std::string BranchName
Definition: TrdK.h:182
TrTrack container class description.
float IPChi2
Impact point chi-square. Whatever this means. I don&#39;t know, go ask Kounine.
Definition: TrdK.h:93
TrdOnTrackVariable< float > Amps
Sum of the amplitude of reconstructed hits on and off main track. See TrdK::QualType for list of avai...
Definition: TrdK.h:77
std::vector< TVector3 > m_pointAndDir
Definition: TrdK.h:151
TrdKBaseData()=default
TrdOnTrackVariable< int > NHits
Number of reconstructed hits on and off main track. See TrdK::QualType for list of available types...
Definition: TrdK.h:76
static const std::string BranchName
Definition: TrdK.h:168
bool AlignStatus
Alignment status.
Definition: TrdK.h:71
LayerVariable< float > Pathlength
Estimated particle pathlength in each Trd layer.
Definition: TrdK.h:88
const TVector3 & GetLineDirection() const
Get the direction of the TrdK clusters linear fit.
Definition: TrdK.h:140
std::vector< T > TrdChargeVariable
Definition: TrdK.h:32
Accessor class for base TrdK info (standalone reconstruction)
Definition: TrdK.h:180
BuildType
Definition: TrdK.h:47