Cluster.cxx
Go to the documentation of this file.
2 
3 namespace gar {
4  namespace rec {
5 
6  //--------------------------------------------------------------------------
7  //Default constructor
9  // The default constructor is used e.g. by art::DataViewImpl::getHandle
10  // Make sure all Cluster objects are numbered, lest art deep-copy uninitialized
11  // instances and then operator==() evaluates meaninglessly true.
14  return;
15  }
16 
17  //--------------------------------------------------------------------------
18  void Cluster::setEnergy(float energy ) {
19  fEnergy = energy ;
20  }
21 
22  //--------------------------------------------------------------------------
23  void Cluster::setEnergyError(float energy_error ) {
24  fEnergyError = energy_error ;
25  }
26 
27  //--------------------------------------------------------------------------
28  void Cluster::setTime(float time, float time_diff ) {
29  fTime = time ;
31  }
32 
33  //--------------------------------------------------------------------------
34  void Cluster::setPosition(const float* position) {
35  for(int i=0;i<3;i++) { fPosition[i] = position[i]; }
36  }
37 
38  //--------------------------------------------------------------------------
40  fTheta = theta;
41  }
42 
43  //--------------------------------------------------------------------------
44  void Cluster::setIPhi(float phi){
45  fPhi = phi;
46  }
47 
48  //--------------------------------------------------------------------------
49  void Cluster::setEigenVectors(const float* eigenvectors){
50  for(int i=0;i<9;i++) { fEigenVector[i] = eigenvectors[i]; }
51  }
52 
53  //--------------------------------------------------------------------------
54  void Cluster::setShape(const float* shape) {
55  for(int i=0;i<6;i++) { fShape[i] = shape[i]; }
56  }
57 
58  //--------------------------------------------------------------------------
60  fParticleId = pid;
61  }
62 
63  //--------------------------------------------------------------------------
64  void Cluster::addHit(gar::rec::CaloHit* hit, float contribution) {
65  fHits.push_back( hit ) ;
66  fWeights.push_back( contribution ) ;
67  }
68 
69  //--------------------------------------------------------------------------
71  fTracks.push_back( trk ) ;
72  }
73 
74  //--------------------------------------------------------------------------
75  std::ostream& operator<< (std::ostream& o, gar::rec::Cluster const& h)
76  {
77  o << "Cluster "
78  << "\n\tEnergy = "
79  << h.Energy()
80  << "\n\tTime = "
81  << h.Time()
82  << "\n\tPID = "
83  << h.ParticleID()
84  << "\n\tID number = "
85  << h.getIDNumber()
86  << "\n\tMain EigenVector = ("
87  << h.EigenVectors()[0] << ", " << h.EigenVectors()[1] << ", " << h.EigenVectors()[2] << ")"
88  << "\n\tPosition = "
89  << h.Position()[0] << ", " << h.Position()[1] << ", " << h.Position()[2] << ")";
90 
91  return o;
92  }
93 
94 
95 
96  //--------------------------------------------------------------------------
97  // ID number methods
98  bool Cluster::operator==(const Cluster& rhs) const {
99  return (this->fIDnumero == rhs.fIDnumero);
100  }
101 
102  bool Cluster::operator!=(const Cluster& rhs) const {
103  return (this->fIDnumero != rhs.fIDnumero);
104  }
105 
107 
108 
109 
110  }
111 }
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)
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
static IDNumberGen * create(IDNumber iniValue=std::numeric_limits< IDNumber >::max())
Definition: IDNumberGen.cxx:18
std::vector< gar::rec::CaloHit * > fHits
vector of hit contribution
Definition: Cluster.h:46
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
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
float fPhi
intrasic direction of the cluster phi
Definition: Cluster.h:42
float Energy() const
Definition: Cluster.h:92
size_t IDNumber
Definition: IDNumberGen.h:71
bool operator==(const Cluster &rhs) const
Definition: Cluster.cxx:98
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