Cluster.h
Go to the documentation of this file.
1 //
2 // Cluster.h
3 //
4 // Created by Eldwan Brianne on 08/29/18.
5 //
6 
7 #ifndef GAR_RECONSTRUCTIONDATAPRODUCTS_Cluster_h
8 #define GAR_RECONSTRUCTIONDATAPRODUCTS_Cluster_h
9 
10 #include <iostream>
11 
12 #include "CLHEP/Vector/ThreeVector.h"
13 
14 #include <map>
15 #include <list>
16 
20 
21 namespace gar {
22  namespace rec {
23 
24  class Cluster {
25 
26  public:
27  Cluster();
28 
29  // let the compiler provide the dtor
30 
31  private:
32  static gar::rec::IDNumber const FirstNumber = 300000;
34 
35  float fEnergy{0}; ///< energy of the ecal cluster in GeV
36  float fEnergyError{0}; ///< energy of the ecal cluster in GeV
37  float fTime{0}; ///< time of the ecal cluster in ns
38  float fTimeDiffFirstLast{0}; ///<time difference between the first and last layer of the cluster in ns
39  float fPosition[3] = {0, 0, 0}; ///< position of the cluster in cm
40  float fShape[6] = {0, 0, 0, 0, 0, 0}; ///< cluster shape parameters (Ellipsoid r1, r2, r3, vol, width)
41  float fTheta{0}; ///< intrasic direction of the cluster theta
42  float fPhi{0}; ///< intrasic direction of the cluster phi
43  float fEigenVector[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; ///< EigenVectors of the cluster corresponding to the 3 main axis sorted in ascending order (main principal axis with smallest inertial of mass) normalised to length of 1
44  int fParticleId{0}; ///< particle id flag
45  std::vector<gar::rec::Track*> fTracks{}; ///< vector of tracks associated to the cluster
46  std::vector<gar::rec::CaloHit*> fHits{}; ///< vector of hit contribution
47  std::vector<float> fWeights{}; ///< vector of energy contribution of the hits
48 
49  #ifndef __GCCXML__
50 
51  public:
52 
53  //Copy constructor
54  Cluster(const gar::rec::Cluster &) = default;
55 
56  bool operator==(const Cluster& rhs) const;
57  bool operator!=(const Cluster& rhs) const;
59 
60  void addHit(gar::rec::CaloHit* hit, float contribution);
62  void setEnergy(float energy);
63  void setEnergyError(float energy_error);
64  void setTime(float time, float time_diff);
65  void setPosition(const float* position);
66  void setITheta(float theta);
67  void setIPhi(float phi);
68  void setEigenVectors(const float* eigenvectors);
69  void setShape(const float* shape);
70  void setParticleID(int pid);
71 
72  float Energy() const;
73  float EnergyError() const;
74  float Time() const;
75  float TimeDiffFirstLast() const;
76  const float* Position() const;
77  float ITheta() const;
78  float IPhi() const;
79  const float* EigenVectors() const;
80  const float* Shape() const;
81  int ParticleID() const;
82  const std::vector<gar::rec::Track*>& Tracks() const;
83  const std::vector<gar::rec::CaloHit*>& CalorimeterHits() const;
84  const std::vector<float>& HitContributions() const;
85 
86  friend std::ostream& operator << (std::ostream & o, gar::rec::Cluster const& h);
87 
88  #endif
89 
90  };
91 
92  inline float gar::rec::Cluster::Energy() const { return fEnergy; }
93  inline float gar::rec::Cluster::EnergyError() const { return fEnergyError; }
94  inline float gar::rec::Cluster::Time() const { return fTime; }
96  inline const float* gar::rec::Cluster::Position() const { return fPosition; }
97  inline float gar::rec::Cluster::ITheta() const { return fTheta; }
98  inline float gar::rec::Cluster::IPhi() const { return fPhi; }
99  inline const float* gar::rec::Cluster::EigenVectors() const { return fEigenVector; }
100  inline const float* gar::rec::Cluster::Shape() const { return fShape; }
101  inline int gar::rec::Cluster::ParticleID() const { return fParticleId; }
102  inline const std::vector<gar::rec::Track*>& gar::rec::Cluster::Tracks() const { return fTracks; }
103  inline const std::vector<gar::rec::CaloHit*>& gar::rec::Cluster::CalorimeterHits() const { return fHits; }
104  inline const std::vector<float>& gar::rec::Cluster::HitContributions() const { return fWeights; }
105  } // rec
106 } // gar
107 
108 
109 #endif /* GAR_RECONSTRUCTIONDATAPRODUCTS_Cluster_h */
float fTimeDiffFirstLast
time difference between the first and last layer of the cluster in ns
Definition: Cluster.h:38
rec
Definition: tracks.py:88
void setParticleID(int pid)
Definition: Cluster.cxx:59
void setShape(const float *shape)
Definition: Cluster.cxx:54
bool operator!=(const Cluster &rhs) const
Definition: Cluster.cxx:102
float fPosition[3]
position of the cluster in cm
Definition: Cluster.h:39
double time_diff(rusage const &a, rusage const &b)
float TimeDiffFirstLast() const
Definition: Cluster.h:95
void setEigenVectors(const float *eigenvectors)
Definition: Cluster.cxx:49
void setEnergyError(float energy_error)
Definition: Cluster.cxx:23
int fParticleId
particle id flag
Definition: Cluster.h:44
friend std::ostream & operator<<(std::ostream &o, gar::rec::Cluster const &h)
Definition: Cluster.cxx:75
float ITheta() const
Definition: Cluster.h:97
std::vector< gar::rec::CaloHit * > fHits
vector of hit contribution
Definition: Cluster.h:46
float IPhi() const
Definition: Cluster.h:98
void setEnergy(float energy)
Definition: Cluster.cxx:18
void addTrack(gar::rec::Track *trk)
Definition: Cluster.cxx:70
float fShape[6]
cluster shape parameters (Ellipsoid r1, r2, r3, vol, width)
Definition: Cluster.h:40
float fEnergy
energy of the ecal cluster in GeV
Definition: Cluster.h:35
void setPosition(const float *position)
Definition: Cluster.cxx:34
const std::vector< gar::rec::CaloHit * > & CalorimeterHits() const
Definition: Cluster.h:103
float fTheta
intrasic direction of the cluster theta
Definition: Cluster.h:41
gar::rec::IDNumber getIDNumber() const
Definition: Cluster.cxx:106
int ParticleID() const
Definition: Cluster.h:101
std::vector< gar::rec::Track * > fTracks
vector of tracks associated to the cluster
Definition: Cluster.h:45
std::vector< float > fWeights
vector of energy contribution of the hits
Definition: Cluster.h:47
const float * EigenVectors() const
Definition: Cluster.h:99
float fTime
time of the ecal cluster in ns
Definition: Cluster.h:37
gar::rec::IDNumber fIDnumero
Definition: Cluster.h:33
static gar::rec::IDNumber const FirstNumber
Definition: Cluster.h:32
Detector simulation of raw signals on wires.
float fEnergyError
energy of the ecal cluster in GeV
Definition: Cluster.h:36
const float * Position() const
Definition: Cluster.h:96
void addHit(gar::rec::CaloHit *hit, float contribution)
Definition: Cluster.cxx:64
General GArSoft Utilities.
void setIPhi(float phi)
Definition: Cluster.cxx:44
void setITheta(float theta)
Definition: Cluster.cxx:39
float Time() const
Definition: Cluster.h:94
const std::vector< gar::rec::Track * > & Tracks() const
Definition: Cluster.h:102
float fPhi
intrasic direction of the cluster phi
Definition: Cluster.h:42
const float * Shape() const
Definition: Cluster.h:100
float Energy() const
Definition: Cluster.h:92
const std::vector< float > & HitContributions() const
Definition: Cluster.h:104
size_t IDNumber
Definition: IDNumberGen.h:71
bool operator==(const Cluster &rhs) const
Definition: Cluster.cxx:98
float EnergyError() const
Definition: Cluster.h:93
float fEigenVector[9]
EigenVectors of the cluster corresponding to the 3 main axis sorted in ascending order (main principa...
Definition: Cluster.h:43
void setTime(float time, float time_diff)
Definition: Cluster.cxx:28