LDMX Software
Public Member Functions | Private Attributes | List of all members
hcal::WorkingCluster Class Reference

Public Member Functions

 WorkingCluster (const ldmx::HcalHit *eh, const ldmx::HcalGeometry &geom)
 
void add (const ldmx::HcalHit *eh, const ldmx::HcalGeometry &geom)
 
void add (const WorkingCluster &wc)
 
double GetTime ()
 
const TLorentzVector & centroid () const
 
void SetCentroidPxPyPzE (double newCentroidX, double newCentroidY, double newCentroidZ, double newE)
 
void SetTime (double t)
 
std::vector< const ldmx::HcalHit * > getHits () const
 
void addHit (const ldmx::HcalHit *eh)
 
bool empty () const
 
void clear ()
 

Private Attributes

std::vector< const ldmx::HcalHit * > hits_
 
TLorentzVector centroid_
 
double time_ = 0
 

Detailed Description

Definition at line 15 of file WorkingCluster.h.

Constructor & Destructor Documentation

◆ WorkingCluster()

hcal::WorkingCluster::WorkingCluster ( const ldmx::HcalHit eh,
const ldmx::HcalGeometry geom 
)

Definition at line 8 of file WorkingCluster.cxx.

9 {
10 add(eh, hex);
11}

◆ ~WorkingCluster()

hcal::WorkingCluster::~WorkingCluster ( )
inline

Definition at line 19 of file WorkingCluster.h.

19{};

Member Function Documentation

◆ add() [1/2]

void hcal::WorkingCluster::add ( const ldmx::HcalHit eh,
const ldmx::HcalGeometry geom 
)

Definition at line 13 of file WorkingCluster.cxx.

14 {
15 double hitE = eh->getEnergy();
16 TVector3 hitpos = hex.getStripCenterPosition(eh->getID());
17 double hitX = hitpos.x();
18 double hitY = hitpos.y();
19 double hitZ = hitpos.z();
20 double hitT = eh->getTime();
21 // Based on weight for Center-of-Gravity by hitpos*hiE/totalE
22 double newE = hitE + centroid_.E();
23 double newCentroidX = (centroid_.Px() * centroid_.E() + hitE * hitX) / newE;
24 double newCentroidY = (centroid_.Py() * centroid_.E() + hitE * hitY) / newE;
25 double newCentroidZ = (centroid_.Pz() * centroid_.E() + hitE * hitZ) / newE;
26
27 if (time_ < hitT) {
28 time_ = hitT;
29 }
30 centroid_.SetPxPyPzE(newCentroidX, newCentroidY, newCentroidZ, newE);
31 hits_.push_back(eh);
32}
float getEnergy() const
Get the calorimetric energy of the hit, corrected for sampling factors [MeV].
float getTime() const
Get the time of the hit [ns].
int getID() const
Get the detector ID.

◆ add() [2/2]

void hcal::WorkingCluster::add ( const WorkingCluster wc)

Definition at line 34 of file WorkingCluster.cxx.

34 {
35 double clusterE = wc.centroid().E();
36 double centroidX = wc.centroid().Px();
37 double centroidY = wc.centroid().Py();
38 double centroidZ = wc.centroid().Pz();
39
40 double newE = clusterE + centroid_.E();
41 double newCentroidX =
42 (centroid_.Px() * centroid_.E() + clusterE * centroidX) / newE;
43 double newCentroidY =
44 (centroid_.Py() * centroid_.E() + clusterE * centroidY) / newE;
45 double newCentroidZ =
46 (centroid_.Pz() * centroid_.E() + clusterE * centroidZ) / newE;
47
48 centroid_.SetPxPyPzE(newCentroidX, newCentroidY, newCentroidZ, newE);
49 /*if(wc.GetTime() > time_){
50 time_ = wc.GetTime();
51 }*/
52
53 std::vector<const ldmx::HcalHit*> clusterHits = wc.getHits();
54
55 for (unsigned int i = 0; i < clusterHits.size(); i++) {
56 hits_.push_back(clusterHits[i]);
57 }
58}

◆ addHit()

void hcal::WorkingCluster::addHit ( const ldmx::HcalHit eh)
inline

Definition at line 38 of file WorkingCluster.h.

38{ hits_.push_back(eh); }

◆ centroid()

const TLorentzVector & hcal::WorkingCluster::centroid ( ) const
inline

Definition at line 27 of file WorkingCluster.h.

27{ return centroid_; }

◆ clear()

void hcal::WorkingCluster::clear ( )
inline

Definition at line 42 of file WorkingCluster.h.

42{ hits_.clear(); }

◆ empty()

bool hcal::WorkingCluster::empty ( ) const
inline

Definition at line 40 of file WorkingCluster.h.

40{ return hits_.empty(); }

◆ getHits()

std::vector< const ldmx::HcalHit * > hcal::WorkingCluster::getHits ( ) const
inline

Definition at line 36 of file WorkingCluster.h.

36{ return hits_; }

◆ GetTime()

double hcal::WorkingCluster::GetTime ( )
inline

Definition at line 25 of file WorkingCluster.h.

25{ return time_; }

◆ SetCentroidPxPyPzE()

void hcal::WorkingCluster::SetCentroidPxPyPzE ( double  newCentroidX,
double  newCentroidY,
double  newCentroidZ,
double  newE 
)
inline

Definition at line 29 of file WorkingCluster.h.

30 {
31 centroid_.SetPxPyPzE(newCentroidX, newCentroidY, newCentroidZ, newE);
32 }

◆ SetTime()

void hcal::WorkingCluster::SetTime ( double  t)
inline

Definition at line 34 of file WorkingCluster.h.

34{ time_ = t; }

Member Data Documentation

◆ centroid_

TLorentzVector hcal::WorkingCluster::centroid_
private

Definition at line 46 of file WorkingCluster.h.

◆ hits_

std::vector<const ldmx::HcalHit*> hcal::WorkingCluster::hits_
private

Definition at line 45 of file WorkingCluster.h.

◆ time_

double hcal::WorkingCluster::time_ = 0
private

Definition at line 47 of file WorkingCluster.h.


The documentation for this class was generated from the following files: