CaloCluster.cxx
Go to the documentation of this file.
1 /*
2  * CaloCluster.cxx
3  *
4  * Created on: Feb 23, 2021
5  * Author: chilgenb
6  */
7 
9 
10 using namespace garana;
11 
13  fRegion(INT_MAX),
14  fEnergy(FLT_MAX),
15  fEnergyError(FLT_MAX),
16  fTimeDiffFirstLast(FLT_MAX),
17  fTheta(FLT_MAX),
18  fPhi(FLT_MAX)
19 {
20 
21  for(size_t i=0; i<6; i++) {
22  if(i<3){
23  fPosition.SetXYZT(FLT_MAX,FLT_MAX,FLT_MAX,FLT_MAX);
24  TVector3 v;
25  fEigenVecs.push_back(v);
26  }
27  fShape[i] = FLT_MAX;
28  }
29 }
30 
31 CaloCluster::CaloCluster(const TLorentzVector& pos, const int& region, const float& energy, const float& energyErr, const float& timeDiff,
32  const float* shape, const float& theta, const float& phi, const std::vector<TVector3>& eigenVecs,
33  const std::vector<std::pair<int,float>>& edeps ) :
34  fRegion(region),
35  fEnergy(energy),
36  fEnergyError(energyErr),
37  fTimeDiffFirstLast(timeDiff),
38  fTheta(theta),
39  fPhi(phi),
40  fEigenVecs(eigenVecs),
41  fTrueEnergy(edeps)
42 {
43  fPosition = pos;
44 
45  for(size_t i=0; i<6; i++)
46  fShape[i] = shape[i];
47 
48 }
49 
50 const TLorentzVector* CaloCluster::Position() const{
51  return &fPosition;
52  }
53 
54 int const& CaloCluster::Region() const {
55  return fRegion;
56 }
57 
58  float const& CaloCluster::Energy() const {
59  return fEnergy;
60  }
61 
62  float const& CaloCluster::EnergyError() const {
63  return fEnergyError;
64  }
65 
66  float const& CaloCluster::TimeDifference() const {
67  return fTimeDiffFirstLast;
68  }
69 
70  const float* CaloCluster::Shape() const {
71  return fShape;
72  }
73 
74  float const& CaloCluster::Theta() const {
75  return fTheta;
76  }
77 
78  float const& CaloCluster::Phi() const {
79  return fPhi;
80  }
81 
82  const std::vector<TVector3>* CaloCluster::EigenVecs() const {
83  return &fEigenVecs;
84  }
85 
86  size_t CaloCluster::NIdes() const {
87  return fTrueEnergy.size();
88  }
89 
90  const std::pair<int,float>* CaloCluster::GetTrackIdEdep(const size_t& iide) const {
91  return &fTrueEnergy.at(iide);
92  }
93 
95  float edep = 0.;
96  for(auto const& trkdep : fTrueEnergy)
97  edep += trkdep.second;
98  return edep;
99  }
100 
101  int const& CaloCluster::TrackIdMaxDep() const {
102  float maxdep = 0.;
103  int imaxdep = 0;
104  for(size_t idep=0; idep<NIdes(); idep++ ) {
105  auto const& trkdep = GetTrackIdEdep(idep);
106  if( trkdep->second > maxdep ) {
107  imaxdep = idep;
108  maxdep = trkdep->second;
109  }
110  }
111 
112  return (GetTrackIdEdep(imaxdep))->first;
113  }
114 
115  float const& CaloCluster::MaxDeposit() const {
116  float maxdep = 0.;
117  int imaxdep = 0;
118  for(size_t idep=0; idep<NIdes(); idep++ ) {
119  auto const& trkdep = GetTrackIdEdep(idep);
120  if( trkdep->second > maxdep ) {
121  imaxdep = idep;
122  maxdep = trkdep->second;
123  }
124  }
125 
126  return (GetTrackIdEdep(imaxdep))->second;
127  }
float const & Energy() const
Definition: CaloCluster.cxx:58
float fEnergyError
uncertainty of the cluster energy [GeV]
Definition: CaloCluster.h:55
TLorentzVector fPosition
4-position of the cluster [cm,ns]
Definition: CaloCluster.h:52
float const & Phi() const
Definition: CaloCluster.cxx:78
float const & EnergyError() const
Definition: CaloCluster.cxx:62
struct vector vector
float fEnergy
energy of the ECal cluster [GeV]
Definition: CaloCluster.h:54
float fShape[6]
cluster shape parameters (Ellipsoid r1, r2, r3, vol, width)
Definition: CaloCluster.h:57
vector< std::pair< int, float > > fTrueEnergy
true energy (second) [GeV] deposited by MCParticle with trackID (first)
Definition: CaloCluster.h:61
int fRegion
what ECal region is it in, barrel or endcap; could add more. e.g, forward vs. backward barrel ...
Definition: CaloCluster.h:53
float fTimeDiffFirstLast
time difference between the first and last layer of the cluster [ns]
Definition: CaloCluster.h:56
const float * Shape() const
Definition: CaloCluster.cxx:70
size_t NIdes() const
Definition: CaloCluster.cxx:86
float fTheta
intrasic direction of the cluster theta
Definition: CaloCluster.h:58
const vector< TVector3 > * EigenVecs() const
Definition: CaloCluster.cxx:82
float TotalTrueEnergy() const
Definition: CaloCluster.cxx:94
const std::pair< int, float > * GetTrackIdEdep(const size_t &iide) const
Definition: CaloCluster.cxx:90
float const & MaxDeposit() const
const TLorentzVector * Position() const
Definition: CaloCluster.cxx:50
int const & Region() const
Definition: CaloCluster.cxx:54
float fPhi
intrasic direction of the cluster phi
Definition: CaloCluster.h:59
float const & TimeDifference() const
Definition: CaloCluster.cxx:66
vector< TVector3 > fEigenVecs
Eigenvectors of the cluster in ascending order (principal axis with smallest inertial mass) normalise...
Definition: CaloCluster.h:60
float const & Theta() const
Definition: CaloCluster.cxx:74
int const & TrackIdMaxDep() const