LDMX Software
ecal::IntermediateCluster Class Reference

Public Member Functions

 IntermediateCluster (const ldmx::EcalHit &eh, int layer=-1)
 
void add (const ldmx::EcalHit &eh)
 
void add (const ldmx::EcalHit *eh)
 
void add (const IntermediateCluster &wc)
 
const ROOT::Math::XYZTVector & centroid () const
 
std::vector< const ldmx::EcalHit * > getHits () const
 
bool empty () const
 
void clear ()
 
int getLayer () const
 
void setLayer (int layer)
 

Private Attributes

int layer_
 
std::vector< const ldmx::EcalHit * > hits_
 
ROOT::Math::XYZTVector centroid_
 

Detailed Description

Definition at line 16 of file IntermediateCluster.h.

Constructor & Destructor Documentation

◆ IntermediateCluster()

ecal::IntermediateCluster::IntermediateCluster ( const ldmx::EcalHit & eh,
int layer = -1 )

Definition at line 8 of file IntermediateCluster.cxx.

9 : layer_{layer}, hits_{}, centroid_{} {
10 add(eh);
11}

Member Function Documentation

◆ add() [1/3]

void ecal::IntermediateCluster::add ( const IntermediateCluster & wc)

Definition at line 32 of file IntermediateCluster.cxx.

32 {
33 double new_e = wc.centroid().E() + centroid_.E();
34 centroid_.SetXYZT(
35 (centroid_.x() * centroid_.E() + wc.centroid().x() * wc.centroid().E()) /
36 new_e,
37 (centroid_.y() * centroid_.E() + wc.centroid().y() * wc.centroid().E()) /
38 new_e,
39 (centroid_.z() * centroid_.E() + wc.centroid().z() * wc.centroid().E()) /
40 new_e,
41 new_e);
42
43 for (const auto eh : wc.getHits()) {
44 hits_.push_back(eh);
45 }
46}

◆ add() [2/3]

void ecal::IntermediateCluster::add ( const ldmx::EcalHit & eh)

Definition at line 13 of file IntermediateCluster.cxx.

13 {
14 hits_.push_back(&eh);
15
16 double hit_e = eh.getEnergy();
17 double hit_x = eh.getXPos();
18 double hit_y = eh.getYPos();
19 double hit_z = eh.getZPos();
20
21 double new_e = hit_e + centroid_.E();
22 centroid_.SetXYZT((centroid_.x() * centroid_.E() + hit_e * hit_x) / new_e,
23 (centroid_.y() * centroid_.E() + hit_e * hit_y) / new_e,
24 (centroid_.z() * centroid_.E() + hit_e * hit_z) / new_e,
25 new_e);
26}
float getEnergy() const
Get the calorimetric energy of the hit, corrected for sampling factors [MeV].
float getYPos() const
Get the Y position of the hit [mm].
float getZPos() const
Get the Z position of the hit [mm].
float getXPos() const
Get the X position of the hit [mm].

◆ add() [3/3]

void ecal::IntermediateCluster::add ( const ldmx::EcalHit * eh)

Definition at line 28 of file IntermediateCluster.cxx.

28 {
29 if (eh != nullptr) add(*eh);
30}

◆ centroid()

const ROOT::Math::XYZTVector & ecal::IntermediateCluster::centroid ( ) const
inline

Definition at line 24 of file IntermediateCluster.h.

24{ return centroid_; }

◆ clear()

void ecal::IntermediateCluster::clear ( )
inline

Definition at line 27 of file IntermediateCluster.h.

27{ hits_.clear(); }

◆ empty()

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

Definition at line 26 of file IntermediateCluster.h.

26{ return hits_.empty(); }

◆ getHits()

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

Definition at line 25 of file IntermediateCluster.h.

25{ return hits_; }

◆ getLayer()

int ecal::IntermediateCluster::getLayer ( ) const

Definition at line 51 of file IntermediateCluster.cxx.

51{ return layer_; }

◆ setLayer()

void ecal::IntermediateCluster::setLayer ( int layer)

Definition at line 48 of file IntermediateCluster.cxx.

48{ layer_ = layer; }

Member Data Documentation

◆ centroid_

ROOT::Math::XYZTVector ecal::IntermediateCluster::centroid_
private

Definition at line 34 of file IntermediateCluster.h.

◆ hits_

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

Definition at line 33 of file IntermediateCluster.h.

◆ layer_

int ecal::IntermediateCluster::layer_
private

Definition at line 32 of file IntermediateCluster.h.


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