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

Public Member Functions

 WorkingCluster (const ldmx::EcalHit *eh, const ldmx::EcalGeometry &geom)
 
void add (const ldmx::EcalHit *eh, const ldmx::EcalGeometry &geom)
 
void add (const WorkingCluster &wc)
 
const TLorentzVector & centroid () const
 
std::vector< const ldmx::EcalHit * > getHits () const
 
bool empty () const
 
void clear ()
 

Private Attributes

std::vector< const ldmx::EcalHit * > hits_
 
TLorentzVector centroid_
 

Detailed Description

Definition at line 16 of file WorkingCluster.h.

Constructor & Destructor Documentation

◆ WorkingCluster()

ecal::WorkingCluster::WorkingCluster ( const ldmx::EcalHit eh,
const ldmx::EcalGeometry geom 
)

Definition at line 11 of file WorkingCluster.cxx.

12 {
13 add(eh, hex);
14}
void add(const ldmx::EcalHit *eh, const ldmx::EcalGeometry &geom)

◆ ~WorkingCluster()

ecal::WorkingCluster::~WorkingCluster ( )
inline

Definition at line 20 of file WorkingCluster.h.

20{};

Member Function Documentation

◆ add() [1/2]

void ecal::WorkingCluster::add ( const ldmx::EcalHit eh,
const ldmx::EcalGeometry geom 
)

The ID number is implicitly converted to EcalID

Definition at line 16 of file WorkingCluster.cxx.

17 {
18 double hitE = eh->getEnergy();
19
21 auto [hitX, hitY, hitZ] = hex.getPosition(eh->getID());
22
23 double newE = hitE + centroid_.E();
24 double newCentroidX = (centroid_.Px() * centroid_.E() + hitE * hitX) / newE;
25 double newCentroidY = (centroid_.Py() * centroid_.E() + hitE * hitY) / newE;
26 double newCentroidZ = (centroid_.Pz() * centroid_.E() + hitE * hitZ) / newE;
27
28 centroid_.SetPxPyPzE(newCentroidX, newCentroidY, newCentroidZ, newE);
29
30 hits_.push_back(eh);
31}
float getEnergy() const
Get the calorimetric energy of the hit, corrected for sampling factors [MeV].
int getID() const
Get the detector ID.

References ldmx::CalorimeterHit::getEnergy(), and ldmx::CalorimeterHit::getID().

◆ add() [2/2]

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

Definition at line 33 of file WorkingCluster.cxx.

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

◆ centroid()

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

Definition at line 26 of file WorkingCluster.h.

26{ return centroid_; }

◆ clear()

void ecal::WorkingCluster::clear ( )
inline

Definition at line 32 of file WorkingCluster.h.

32{ hits_.clear(); }

◆ empty()

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

Definition at line 30 of file WorkingCluster.h.

30{ return hits_.empty(); }

◆ getHits()

std::vector< const ldmx::EcalHit * > ecal::WorkingCluster::getHits ( ) const
inline

Definition at line 28 of file WorkingCluster.h.

28{ return hits_; }

Member Data Documentation

◆ centroid_

TLorentzVector ecal::WorkingCluster::centroid_
private

Definition at line 36 of file WorkingCluster.h.

◆ hits_

std::vector<const ldmx::EcalHit*> ecal::WorkingCluster::hits_
private

Definition at line 35 of file WorkingCluster.h.


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