LDMX Software
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}
A very simple wrapper enabling us to more easily tell the output stream to style the input word in he...

◆ ~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 hit_e = eh->getEnergy();
16 ROOT::Math::XYZVector hitpos = hex.getStripCenterPosition(eh->getID());
17 double hit_x = hitpos.x();
18 double hit_y = hitpos.y();
19 double hit_z = hitpos.z();
20 double hit_t = eh->getTime();
21 // Based on weight for Center-of-Gravity by hitpos*hiE/totalE
22 double new_e = hit_e + centroid_.E();
23 double new_centroid_x =
24 (centroid_.Px() * centroid_.E() + hit_e * hit_x) / new_e;
25 double new_centroid_y =
26 (centroid_.Py() * centroid_.E() + hit_e * hit_y) / new_e;
27 double new_centroid_z =
28 (centroid_.Pz() * centroid_.E() + hit_e * hit_z) / new_e;
29
30 if (time_ < hit_t) {
31 time_ = hit_t;
32 }
33 centroid_.SetPxPyPzE(new_centroid_x, new_centroid_y, new_centroid_z, new_e);
34 hits_.push_back(eh);
35}
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 37 of file WorkingCluster.cxx.

37 {
38 double cluster_e = wc.centroid().E();
39 double centroid_x = wc.centroid().Px();
40 double centroid_y = wc.centroid().Py();
41 double centroid_z = wc.centroid().Pz();
42
43 double new_e = cluster_e + centroid_.E();
44 double new_centroid_x =
45 (centroid_.Px() * centroid_.E() + cluster_e * centroid_x) / new_e;
46 double new_centroid_y =
47 (centroid_.Py() * centroid_.E() + cluster_e * centroid_y) / new_e;
48 double new_centroid_z =
49 (centroid_.Pz() * centroid_.E() + cluster_e * centroid_z) / new_e;
50
51 centroid_.SetPxPyPzE(new_centroid_x, new_centroid_y, new_centroid_z, new_e);
52 /*if(wc.GetTime() > time_){
53 time_ = wc.GetTime();
54 }*/
55
56 std::vector<const ldmx::HcalHit*> cluster_hits = wc.getHits();
57
58 for (unsigned int i = 0; i < cluster_hits.size(); i++) {
59 hits_.push_back(cluster_hits[i]);
60 }
61}

◆ 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: