ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtHit.h
Go to the documentation of this file.
1 #ifndef ATHIT_H
2 #define ATHIT_H
3 
4 #include <Math/Point3D.h>
5 #include <Math/Point3Dfwd.h>
6 #include <Math/Vector3D.h>
7 #include <Math/Vector3Dfwd.h>
8 #include <Rtypes.h>
9 #include <TObject.h>
10 
11 #include <algorithm>
12 #include <memory>
13 #include <vector>
14 class TBuffer;
15 class TClass;
16 class TMemberInspector;
17 namespace H5 {
18 class CompType;
19 }
20 
27 class AtHit : public TObject {
28 public:
31  struct MCSimPoint;
32 
33 protected:
34  Double_t fCharge; //< Charge of hit
35  Double_t fChargeVariance{0}; //< Charge variance
36  XYZPoint fPosition; //< Position of hit
37  XYZVector fPositionVariance{}; //< Position variance (unused by AtHitCluster)
38  Int_t fHitID; //< Unique ID of hit
39  Int_t fPadNum; //< Pad that generated hit
40 
41  Double_t fTraceIntegral{-1}; //< Integrated pulse charge of full trace
42  Int_t fHitMult{1}; //< Hit multiplicity in the pad where the hit was found
43  Int_t fTimeStamp{0}; //< TB of hit
44  Double_t fTimeStampCorr{0}; //< TB of hit using center of gravity
45  Double_t fTimeStampCorrInter{0}; //< Interpolated TB of hit
46 
47  std::vector<AtHit::MCSimPoint> fMCSimPointArray;
48 
49 public:
50  AtHit(Int_t hitID = -1); //< Default constructor for IO
51  AtHit(Int_t padNum, XYZPoint location, Double_t charge); //< Primary constructor
52  AtHit(Int_t hitID, Int_t padNum, XYZPoint location, Double_t charge); //< Specify hit ID on creation
53  AtHit(const AtHit &) = default; //< Copy constructor
54  AtHit(AtHit &&) = default; //< Move constructor
55  AtHit &operator=(const AtHit &) = default; //< Copy assignment
56  AtHit &operator=(AtHit &&) = default; //< Move assignment
57  virtual ~AtHit() = default;
58  virtual std::unique_ptr<AtHit> Clone(); //< Create a copy of sub-type
59 
61  H5::CompType GetHDF5Type();
62 
63  void SetCharge(Double_t charge) { fCharge = charge; }
64  void SetChargeVariance(Double_t chargeVar) { fChargeVariance = chargeVar; }
65  void SetPosition(const XYZPoint &pos) { fPosition = pos; }
66  virtual void SetPositionVariance(const XYZVector &vec) { fPositionVariance = vec; }
67  void SetHitID(Int_t hitID) { fHitID = hitID; }
68  void SetPadNum(Int_t padNum) { fPadNum = padNum; }
69 
70  void SetTraceIntegral(Double_t integral) { fTraceIntegral = integral; }
71  void SetHitMult(Int_t HitMult) { fHitMult = HitMult; }
72  void SetTimeStamp(Int_t Time) { fTimeStamp = Time; }
73  void SetTimeStampCorr(Double_t TimeCorr) { fTimeStampCorr = TimeCorr; }
74  void SetTimeStampCorrInter(Double_t TimeCorrInter) { fTimeStampCorrInter = TimeCorrInter; }
75 
76  void AddMCSimPoint(const AtHit::MCSimPoint &point) { fMCSimPointArray.push_back(point); }
77 
78  Int_t GetHitID() const { return fHitID; }
79  const XYZPoint &GetPosition() const { return fPosition; }
80  const XYZVector &GetPositionVariance() const { return fPositionVariance; }
82  Double_t GetCharge() const { return fCharge; }
83  Int_t GetPadNum() const { return fPadNum; }
84  Double_t GetTraceIntegral() const { return fTraceIntegral; }
85  Int_t GetHitMult() const { return fHitMult; }
86  Int_t GetTimeStamp() const { return fTimeStamp; }
87  Double_t GetTimeStampCorr() const { return fTimeStampCorr; }
88  Double_t GetTimeStampCorrInter() const { return fTimeStampCorrInter; }
89  const std::vector<AtHit::MCSimPoint> &GetMCSimPointArray() const { return fMCSimPointArray; }
90 
91  static Bool_t SortHit(const AtHit &lhs, const AtHit &rhs) { return lhs.GetPadNum() < rhs.GetPadNum(); }
92  static Bool_t SortHit(const std::unique_ptr<AtHit> &lhs, const std::unique_ptr<AtHit> &rhs)
93  {
94  return SortHit(*lhs, *rhs);
95  }
96 
97  static Bool_t SortHitTimePtr(const std::unique_ptr<AtHit> &lhs, const std::unique_ptr<AtHit> &rhs)
98  {
99  return SortHitTime(*lhs, *rhs);
100  }
101 
102  static Bool_t SortHitTime(const AtHit &lhs, const AtHit &rhs) { return lhs.GetTimeStamp() < rhs.GetTimeStamp(); }
103 
104  struct MCSimPoint {
105  int pointID;
106  int trackID;
107  double energy;
108  double eloss;
109  double angle;
110  int A;
111  int Z;
113  MCSimPoint(int pointID_, int trackID_, double energy_, double eloss_, double angle_, int A_, int Z_)
114  : pointID(pointID_), trackID(trackID_), energy(energy_), eloss(eloss_), angle(angle_), A(A_), Z(Z_)
115  {
116  }
117  };
118 
120 };
121 
125 struct AtHit_t {
126  double x;
127  double y;
128  double z;
129  int t;
130  double A;
131  int trackID;
134  double energyMC;
135  double elossMC;
136  double angleMC;
137  int AMC;
138  int ZMC;
139 };
140 
141 #endif
AtHit::GetPositionSigma
XYZVector GetPositionSigma() const
Definition: AtHit.cxx:25
AtHit::XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtHit.h:29
AtHit::ClassDef
ClassDef(AtHit, 5)
AtHit::fTraceIntegral
Double_t fTraceIntegral
Definition: AtHit.h:41
AtHit_t::pointIDMC
int pointIDMC
Definition: AtHit.h:132
AtHit::SetChargeVariance
void SetChargeVariance(Double_t chargeVar)
Definition: AtHit.h:64
AtHit::operator=
AtHit & operator=(const AtHit &)=default
AtHit::MCSimPoint::trackID
int trackID
Definition: AtHit.h:106
AtHit::SetTimeStamp
void SetTimeStamp(Int_t Time)
Definition: AtHit.h:72
AtHit::fTimeStampCorr
Double_t fTimeStampCorr
Definition: AtHit.h:44
AtHit::fPositionVariance
XYZVector fPositionVariance
Definition: AtHit.h:37
AtHit::MCSimPoint::eloss
double eloss
Definition: AtHit.h:108
AtHit::AtHit
AtHit(const AtHit &)=default
AtHit::GetTimeStampCorr
Double_t GetTimeStampCorr() const
Definition: AtHit.h:87
AtHit::fPadNum
Int_t fPadNum
Definition: AtHit.h:39
XYZVector
ROOT::Math::XYZVector XYZVector
Definition: AtFindVertex.h:20
AtHit::XYZVector
ROOT::Math::XYZVector XYZVector
Definition: AtHit.h:30
AtHit::GetMCSimPointArray
const std::vector< AtHit::MCSimPoint > & GetMCSimPointArray() const
Definition: AtHit.h:89
AtHit_t::trackID
int trackID
Definition: AtHit.h:131
AtHit_t::A
double A
Definition: AtHit.h:130
AtHit_t::trackIDMC
int trackIDMC
Definition: AtHit.h:133
AtHit::SetTimeStampCorrInter
void SetTimeStampCorrInter(Double_t TimeCorrInter)
Definition: AtHit.h:74
AtHit_t::y
double y
Definition: AtHit.h:127
AtHit::SetHitID
void SetHitID(Int_t hitID)
Definition: AtHit.h:67
AtHit::GetHitID
Int_t GetHitID() const
Definition: AtHit.h:78
AtHit::AddMCSimPoint
void AddMCSimPoint(const AtHit::MCSimPoint &point)
Definition: AtHit.h:76
AtHit_t::ZMC
int ZMC
Definition: AtHit.h:138
AtHit_t::elossMC
double elossMC
Definition: AtHit.h:135
AtHit::fChargeVariance
Double_t fChargeVariance
Definition: AtHit.h:35
XYZPoint
ROOT::Math::XYZPoint XYZPoint
Definition: AtPatternCircle2D.h:18
AtHit_t::x
double x
Definition: AtHit.h:126
AtHit::fPosition
XYZPoint fPosition
Definition: AtHit.h:36
AtHit::fCharge
Double_t fCharge
Definition: AtHit.h:31
AtHit::GetTraceIntegral
Double_t GetTraceIntegral() const
Definition: AtHit.h:84
AtHit::fTimeStampCorrInter
Double_t fTimeStampCorrInter
Definition: AtHit.h:45
AtHit::operator=
AtHit & operator=(AtHit &&)=default
AtHit::~AtHit
virtual ~AtHit()=default
AtHit::MCSimPoint::A
int A
Definition: AtHit.h:110
AtHit::GetTimeStamp
Int_t GetTimeStamp() const
Definition: AtHit.h:86
AtHit::GetPosition
const XYZPoint & GetPosition() const
Definition: AtHit.h:79
AtHit::SortHitTimePtr
static Bool_t SortHitTimePtr(const std::unique_ptr< AtHit > &lhs, const std::unique_ptr< AtHit > &rhs)
Definition: AtHit.h:97
AtHit_t::angleMC
double angleMC
Definition: AtHit.h:136
AtHit_t::energyMC
double energyMC
Definition: AtHit.h:134
AtHit::SetPosition
void SetPosition(const XYZPoint &pos)
Definition: AtHit.h:65
AtHit::SortHitTime
static Bool_t SortHitTime(const AtHit &lhs, const AtHit &rhs)
Definition: AtHit.h:102
AtHit::GetHitMult
Int_t GetHitMult() const
Definition: AtHit.h:85
AtHit::MCSimPoint::pointID
int pointID
Definition: AtHit.h:105
AtHit::GetHDF5Type
H5::CompType GetHDF5Type()
Returns the type specification of a hit.
Definition: AtHit.cxx:30
AtHit::MCSimPoint::Z
int Z
Definition: AtHit.h:111
H5
Definition: AtHit.h:17
AtHit::AtHit
AtHit(AtHit &&)=default
AtHit::SetPositionVariance
virtual void SetPositionVariance(const XYZVector &vec)
Definition: AtHit.h:66
AtHit::GetTimeStampCorrInter
Double_t GetTimeStampCorrInter() const
Definition: AtHit.h:88
AtHit_t::z
double z
Definition: AtHit.h:128
AtHit::fHitMult
Int_t fHitMult
Definition: AtHit.h:42
AtHit::fTimeStamp
Int_t fTimeStamp
Definition: AtHit.h:43
Z_
#define Z_(_r, _c)
Definition: fastcluster_dm.cxx:345
AtHit::SortHit
static Bool_t SortHit(const AtHit &lhs, const AtHit &rhs)
Definition: AtHit.h:91
AtHit::GetPositionVariance
const XYZVector & GetPositionVariance() const
Definition: AtHit.h:80
AtHit_t::AMC
int AMC
Definition: AtHit.h:137
AtHit::MCSimPoint::MCSimPoint
MCSimPoint(int pointID_, int trackID_, double energy_, double eloss_, double angle_, int A_, int Z_)
Definition: AtHit.h:113
AtHit::MCSimPoint::energy
double energy
Definition: AtHit.h:107
AtHit::SetPadNum
void SetPadNum(Int_t padNum)
Definition: AtHit.h:68
AtHit::SetCharge
void SetCharge(Double_t charge)
Definition: AtHit.h:63
AtHit::AtHit
AtHit(Int_t hitID=-1)
Definition: AtHit.cxx:11
AtHit::GetPadNum
Int_t GetPadNum() const
Definition: AtHit.h:83
AtHit::fMCSimPointArray
std::vector< AtHit::MCSimPoint > fMCSimPointArray
Definition: AtHit.h:47
AtHit::SortHit
static Bool_t SortHit(const std::unique_ptr< AtHit > &lhs, const std::unique_ptr< AtHit > &rhs)
Definition: AtHit.h:92
AtHit::fHitID
Int_t fHitID
Definition: AtHit.h:38
AtHit::MCSimPoint
Definition: AtHit.h:104
AtHit_t
Definition: AtHit.h:125
AtHit::Clone
virtual std::unique_ptr< AtHit > Clone()
Definition: AtHit.cxx:20
AtHit::MCSimPoint::MCSimPoint
MCSimPoint()
Definition: AtHit.h:112
AtHit::SetTraceIntegral
void SetTraceIntegral(Double_t integral)
Definition: AtHit.h:70
AtHit::GetCharge
Double_t GetCharge() const
Definition: AtHit.h:82
AtHit::SetTimeStampCorr
void SetTimeStampCorr(Double_t TimeCorr)
Definition: AtHit.h:73
AtHit::MCSimPoint::angle
double angle
Definition: AtHit.h:109
AtHit
Point in space with charge.
Definition: AtHit.h:27
AtHit_t::t
int t
Definition: AtHit.h:129
AtHit::SetHitMult
void SetHitMult(Int_t HitMult)
Definition: AtHit.h:71