LDMX Software
Classes | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
ldmx::SimCalorimeterHit Class Reference

Stores simulated calorimeter hit information. More...

#include <SimCalorimeterHit.h>

Classes

class  Contrib
 Information about a contribution to the hit in the associated cell. More...
 

Public Member Functions

 SimCalorimeterHit ()=default
 Class constructor.
 
virtual ~SimCalorimeterHit ()=default
 Class destructor.
 
void Clear ()
 Clear the data in the object.
 
void Print () const
 Print out the object.
 
int getID () const
 Get the detector ID.
 
void setID (const int id)
 Set the detector ID.
 
float getEdep () const
 Get the energy deposition of the hit [MeV].
 
void setEdep (const float edep)
 Set the energy deposition of the hit [MeV].
 
std::vector< float > getPosition () const
 Get the XYZ position of the hit [mm].
 
std::vector< float > getPreStepPosition () const
 Get the XYZ pre-step position of the hit in the coordinate frame of the sensitive volume [mm].
 
std::vector< float > getPostStepPosition () const
 Get the XYZ post-step position of the hit in the coordinate frame of the sensitive volume [mm].
 
void setPosition (const float x, const float y, const float z)
 Set the XYZ position of the hit [mm].
 
void setPreStepPosition (const float x, const float y, const float z)
 Set the XYZ pre-step position of the hit in the coordinate frame of the sensitive volume [mm].
 
void setPostStepPosition (const float x, const float y, const float z)
 Set the XYZ post-step position of the hit in the coordinate frame of the sensitive volume [mm].
 
void setPathLength (const float length)
 Set the physical path length for the interaction [mm].
 
float getPathLength () const
 Get the physical path length for the interaction [mm].
 
void setPreStepTime (const float time)
 Set global pre-step time of the hit [ns].
 
void setPostStepTime (const float time)
 Set global post-step time of the hit [ns].
 
void setVelocity (float velocity)
 Set the velocity of the track [mm/ns].
 
float getTime () const
 Get the global time of the hit [ns].
 
float getPreStepTime () const
 Get the pre-step time of the hit [ns].
 
float getPostStepTime () const
 Get the post-step time of the hit [ns].
 
float getVelocity () const
 Get the track velocity of the hit [mm/ns].
 
void setTime (const float time)
 Set the time of the hit [ns].
 
unsigned getNumberOfContribs () const
 Get the number of hit contributions.
 
void addContrib (int incidentID, int trackID, int pdgCode, float edep, float time)
 Add a hit contribution from a SimParticle.
 
Contrib getContrib (int i) const
 Get a hit contribution by index.
 
int findContribIndex (int trackID, int pdgCode) const
 Find the index of a hit contribution from a SimParticle and PDG code.
 
void updateContrib (int i, float edep, float time)
 Update an existing hit contribution by incrementing its edep and setting the time if the new time is less than the old one.
 
bool operator< (const SimCalorimeterHit &rhs) const
 Sort by time of hit.
 

Static Public Attributes

static const std::string ECAL_COLLECTION
 name of the ecal sim collection, should match gdml
 
static const std::string HCAL_COLLECTION
 name of the hcal sim collection, should match gdml
 

Private Attributes

int id_ {0}
 Member variables used in all calorimeter types.
 
float edep_ {0}
 The energy deposition.
 
float x_ {0}
 The X position.
 
float y_ {0}
 The Y position.
 
float z_ {0}
 The Z position.
 
float time_ {0}
 The global time of the hit.
 
std::vector< int > trackIDContribs_
 The list of track IDs contributing to the hit.
 
std::vector< int > incidentIDContribs_
 The list of incident IDs contributing to the hit.
 
std::vector< int > pdgCodeContribs_
 The list of PDG codes contributing to the hit.
 
std::vector< float > edepContribs_
 The list of energy depositions contributing to the hit.
 
std::vector< float > timeContribs_
 The list of times contributing to the hit.
 
unsigned nContribs_ {0}
 The number of hit contributions.
 
float pathLength_ {-1}
 The true path length [mm].
 
float preStepX_ {0}
 The X, Y, and Z positions [mm] before the interaction in the coordinate frame of the sensitive volume.
 
float preStepY_ {0}
 
float preStepZ_ {0}
 
float preStepTime_ {0}
 The global time before the interaction [ns].
 
float postStepX_ {0}
 The X, Y, and Z positions [mm] after the interaction in the coordinate frame of the sensitive volume.
 
float postStepY_ {0}
 
float postStepZ_ {0}
 
float postStepTime_ {0}
 The global time after the interaction [ns].
 
float velocity_ {-1}
 The track velocity [mm/ns].
 

Detailed Description

Stores simulated calorimeter hit information.

Note
This class represents simulated hit information from a calorimeter detector. It provides access to the cell ID, energy deposition, cell position and time. Additionally, individual depositions or steps from MC particles are tabulated as contributions stored in vectors. Contribution information includes a reference to the relevant SimParticle, the PDG code of the actual particle which deposited energy (may be different from the actual SimParticle), the time of the contribution and the energy deposition.

Definition at line 31 of file SimCalorimeterHit.h.

Member Function Documentation

◆ addContrib()

void ldmx::SimCalorimeterHit::addContrib ( int  incidentID,
int  trackID,
int  pdgCode,
float  edep,
float  time 
)

Add a hit contribution from a SimParticle.

Parameters
incidentIDthe Geant4 track ID for the particle's parent incident on the Calorimeter region
trackIDthe Geant4 track ID for the particle
pdgCodeThe PDG code of the actual track.
edepThe energy deposition of the hit [MeV].
timeThe time of the hit [ns].

Referenced by simcore::TrigScintSD::ProcessHits().

◆ findContribIndex()

int ldmx::SimCalorimeterHit::findContribIndex ( int  trackID,
int  pdgCode 
) const

Find the index of a hit contribution from a SimParticle and PDG code.

Parameters
trackIDthe track ID of the particle causing the hit
pdgCodeThe PDG code of the contribution.
Returns
The index of the contribution or -1 if none exists.

◆ getContrib()

Contrib ldmx::SimCalorimeterHit::getContrib ( int  i) const

Get a hit contribution by index.

Parameters
iThe index of the hit contribution.
Returns
The hit contribution at the index.

Referenced by hcal::HcalDigiProducer::produce().

◆ getEdep()

float ldmx::SimCalorimeterHit::getEdep ( ) const
inline

Get the energy deposition of the hit [MeV].

Returns
The energy deposition of the hit.

Definition at line 106 of file SimCalorimeterHit.h.

106{ return edep_; }
float edep_
The energy deposition.

References edep_.

◆ getID()

int ldmx::SimCalorimeterHit::getID ( ) const
inline

Get the detector ID.

Returns
The detector ID.

Definition at line 94 of file SimCalorimeterHit.h.

94{ return id_; }
int id_
Member variables used in all calorimeter types.

References id_.

Referenced by ecal::EcalDigiProducer::produce(), and hcal::HcalDigiProducer::produce().

◆ getNumberOfContribs()

unsigned ldmx::SimCalorimeterHit::getNumberOfContribs ( ) const
inline

Get the number of hit contributions.

Returns
The number of hit contributions.

Definition at line 231 of file SimCalorimeterHit.h.

231{ return nContribs_; }
unsigned nContribs_
The number of hit contributions.

References nContribs_.

Referenced by dqm::SimObjects::analyze(), and hcal::HcalDigiProducer::produce().

◆ getPathLength()

float ldmx::SimCalorimeterHit::getPathLength ( ) const
inline

Get the physical path length for the interaction [mm].

Returns
physical path length

Definition at line 181 of file SimCalorimeterHit.h.

181{ return pathLength_; }
float pathLength_
The true path length [mm].

References pathLength_.

◆ getPosition()

std::vector< float > ldmx::SimCalorimeterHit::getPosition ( ) const
inline

Get the XYZ position of the hit [mm].

Returns
The XYZ position of the hit.

Definition at line 118 of file SimCalorimeterHit.h.

118{ return {x_, y_, z_}; }
float z_
The Z position.
float y_
The Y position.
float x_
The X position.

References x_, y_, and z_.

Referenced by hcal::HcalDigiProducer::produce().

◆ getPostStepPosition()

std::vector< float > ldmx::SimCalorimeterHit::getPostStepPosition ( ) const
inline

Get the XYZ post-step position of the hit in the coordinate frame of the sensitive volume [mm].

Returns
The XYZ position of the hit.

Definition at line 133 of file SimCalorimeterHit.h.

133 {
134 return {postStepX_, postStepY_, postStepZ_};
135 }
float postStepX_
The X, Y, and Z positions [mm] after the interaction in the coordinate frame of the sensitive volume.

References postStepX_.

◆ getPostStepTime()

float ldmx::SimCalorimeterHit::getPostStepTime ( ) const
inline

Get the post-step time of the hit [ns].

Returns
The global time of the hit after the interaction.

Definition at line 213 of file SimCalorimeterHit.h.

213{ return postStepTime_; }
float postStepTime_
The global time after the interaction [ns].

References postStepTime_.

◆ getPreStepPosition()

std::vector< float > ldmx::SimCalorimeterHit::getPreStepPosition ( ) const
inline

Get the XYZ pre-step position of the hit in the coordinate frame of the sensitive volume [mm].

Returns
The local XYZ position of the hit.

Definition at line 125 of file SimCalorimeterHit.h.

125 {
126 return {preStepX_, preStepY_, preStepZ_};
127 }
float preStepX_
The X, Y, and Z positions [mm] before the interaction in the coordinate frame of the sensitive volume...

References preStepX_.

◆ getPreStepTime()

float ldmx::SimCalorimeterHit::getPreStepTime ( ) const
inline

Get the pre-step time of the hit [ns].

Returns
The global time of the hit before the interaction.

Definition at line 208 of file SimCalorimeterHit.h.

208{ return preStepTime_; }
float preStepTime_
The global time before the interaction [ns].

References preStepTime_.

◆ getTime()

float ldmx::SimCalorimeterHit::getTime ( ) const
inline

Get the global time of the hit [ns].

Returns
The global time of the hit.

Definition at line 203 of file SimCalorimeterHit.h.

203{ return time_; }
float time_
The global time of the hit.

References time_.

Referenced by operator<().

◆ getVelocity()

float ldmx::SimCalorimeterHit::getVelocity ( ) const
inline

Get the track velocity of the hit [mm/ns].

Returns
Thetrack velocity of the hit.

Definition at line 219 of file SimCalorimeterHit.h.

219{ return velocity_; }
float velocity_
The track velocity [mm/ns].

References velocity_.

◆ operator<()

bool ldmx::SimCalorimeterHit::operator< ( const SimCalorimeterHit rhs) const
inline

Sort by time of hit.

Definition at line 272 of file SimCalorimeterHit.h.

272 {
273 return this->getTime() < rhs.getTime();
274 }
float getTime() const
Get the global time of the hit [ns].

References getTime().

◆ setEdep()

void ldmx::SimCalorimeterHit::setEdep ( const float  edep)
inline

Set the energy deposition of the hit [MeV].

Parameters
edepThe energy deposition of the hit.

Definition at line 112 of file SimCalorimeterHit.h.

112{ this->edep_ = edep; }

References edep_.

◆ setID()

void ldmx::SimCalorimeterHit::setID ( const int  id)
inline

Set the detector ID.

@id The detector ID.

Definition at line 100 of file SimCalorimeterHit.h.

100{ this->id_ = id; }

References id_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ setPathLength()

void ldmx::SimCalorimeterHit::setPathLength ( const float  length)
inline

Set the physical path length for the interaction [mm].

Parameters
lengthThe physical path lenght

Definition at line 176 of file SimCalorimeterHit.h.

176{ pathLength_ = length; }

References pathLength_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ setPosition()

void ldmx::SimCalorimeterHit::setPosition ( const float  x,
const float  y,
const float  z 
)
inline

Set the XYZ position of the hit [mm].

Parameters
xThe X position.
yThe Y position.
zThe Z position.

Definition at line 142 of file SimCalorimeterHit.h.

142 {
143 this->x_ = x;
144 this->y_ = y;
145 this->z_ = z;
146 }

References x_, y_, and z_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ setPostStepPosition()

void ldmx::SimCalorimeterHit::setPostStepPosition ( const float  x,
const float  y,
const float  z 
)
inline

Set the XYZ post-step position of the hit in the coordinate frame of the sensitive volume [mm].

Parameters
xThe X position.
yThe Y position.
zThe Z position.

Definition at line 166 of file SimCalorimeterHit.h.

166 {
167 postStepX_ = x;
168 postStepY_ = y;
169 postStepZ_ = z;
170 }

References postStepX_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ setPostStepTime()

void ldmx::SimCalorimeterHit::setPostStepTime ( const float  time)
inline

Set global post-step time of the hit [ns].

Parameters
timeThe time before the step

Definition at line 191 of file SimCalorimeterHit.h.

191{ postStepTime_ = time; }

References postStepTime_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ setPreStepPosition()

void ldmx::SimCalorimeterHit::setPreStepPosition ( const float  x,
const float  y,
const float  z 
)
inline

Set the XYZ pre-step position of the hit in the coordinate frame of the sensitive volume [mm].

Parameters
xThe X position.
yThe Y position.
zThe Z position.

Definition at line 154 of file SimCalorimeterHit.h.

154 {
155 preStepX_ = x;
156 preStepY_ = y;
157 preStepZ_ = z;
158 }

References preStepX_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ setPreStepTime()

void ldmx::SimCalorimeterHit::setPreStepTime ( const float  time)
inline

Set global pre-step time of the hit [ns].

Parameters
timeThe time before the step

Definition at line 186 of file SimCalorimeterHit.h.

186{ preStepTime_ = time; }

References preStepTime_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ setTime()

void ldmx::SimCalorimeterHit::setTime ( const float  time)
inline

Set the time of the hit [ns].

Parameters
timeThe time of the hit.

Definition at line 225 of file SimCalorimeterHit.h.

225{ this->time_ = time; }

References time_.

◆ setVelocity()

void ldmx::SimCalorimeterHit::setVelocity ( float  velocity)
inline

Set the velocity of the track [mm/ns].

Parameters
velocityThe track velocity

Definition at line 197 of file SimCalorimeterHit.h.

197{ velocity_ = velocity; }

References velocity_.

Referenced by simcore::TrigScintSD::ProcessHits().

◆ updateContrib()

void ldmx::SimCalorimeterHit::updateContrib ( int  i,
float  edep,
float  time 
)

Update an existing hit contribution by incrementing its edep and setting the time if the new time is less than the old one.

Parameters
iThe index of the contribution.
edepThe additional energy contribution [MeV].
timeThe time of the contribution [ns].

Member Data Documentation

◆ ECAL_COLLECTION

const std::string ldmx::SimCalorimeterHit::ECAL_COLLECTION
static

name of the ecal sim collection, should match gdml

Definition at line 34 of file SimCalorimeterHit.h.

◆ edep_

float ldmx::SimCalorimeterHit::edep_ {0}
private

The energy deposition.

Definition at line 288 of file SimCalorimeterHit.h.

288{0};

Referenced by getEdep(), and setEdep().

◆ edepContribs_

std::vector<float> ldmx::SimCalorimeterHit::edepContribs_
private

The list of energy depositions contributing to the hit.

Definition at line 328 of file SimCalorimeterHit.h.

◆ HCAL_COLLECTION

const std::string ldmx::SimCalorimeterHit::HCAL_COLLECTION
static

name of the hcal sim collection, should match gdml

Definition at line 37 of file SimCalorimeterHit.h.

◆ id_

int ldmx::SimCalorimeterHit::id_ {0}
private

Member variables used in all calorimeter types.

The detector ID.

Definition at line 283 of file SimCalorimeterHit.h.

283{0};

Referenced by getID(), and setID().

◆ incidentIDContribs_

std::vector<int> ldmx::SimCalorimeterHit::incidentIDContribs_
private

The list of incident IDs contributing to the hit.

Definition at line 318 of file SimCalorimeterHit.h.

◆ nContribs_

unsigned ldmx::SimCalorimeterHit::nContribs_ {0}
private

The number of hit contributions.

Definition at line 338 of file SimCalorimeterHit.h.

338{0};

Referenced by getNumberOfContribs().

◆ pathLength_

float ldmx::SimCalorimeterHit::pathLength_ {-1}
private

The true path length [mm].

Can in general differ from the distance between the pre and post step position.

Definition at line 349 of file SimCalorimeterHit.h.

349{-1};

Referenced by getPathLength(), and setPathLength().

◆ pdgCodeContribs_

std::vector<int> ldmx::SimCalorimeterHit::pdgCodeContribs_
private

The list of PDG codes contributing to the hit.

Definition at line 323 of file SimCalorimeterHit.h.

◆ postStepTime_

float ldmx::SimCalorimeterHit::postStepTime_ {0}
private

The global time after the interaction [ns].

Definition at line 372 of file SimCalorimeterHit.h.

372{0};

Referenced by getPostStepTime(), and setPostStepTime().

◆ postStepX_

float ldmx::SimCalorimeterHit::postStepX_ {0}
private

The X, Y, and Z positions [mm] after the interaction in the coordinate frame of the sensitive volume.

Definition at line 366 of file SimCalorimeterHit.h.

366{0};

Referenced by getPostStepPosition(), and setPostStepPosition().

◆ postStepY_

float ldmx::SimCalorimeterHit::postStepY_ {0}
private

Definition at line 367 of file SimCalorimeterHit.h.

367{0};

◆ postStepZ_

float ldmx::SimCalorimeterHit::postStepZ_ {0}
private

Definition at line 368 of file SimCalorimeterHit.h.

368{0};

◆ preStepTime_

float ldmx::SimCalorimeterHit::preStepTime_ {0}
private

The global time before the interaction [ns].

Definition at line 361 of file SimCalorimeterHit.h.

361{0};

Referenced by getPreStepTime(), and setPreStepTime().

◆ preStepX_

float ldmx::SimCalorimeterHit::preStepX_ {0}
private

The X, Y, and Z positions [mm] before the interaction in the coordinate frame of the sensitive volume.

Definition at line 355 of file SimCalorimeterHit.h.

355{0};

Referenced by getPreStepPosition(), and setPreStepPosition().

◆ preStepY_

float ldmx::SimCalorimeterHit::preStepY_ {0}
private

Definition at line 356 of file SimCalorimeterHit.h.

356{0};

◆ preStepZ_

float ldmx::SimCalorimeterHit::preStepZ_ {0}
private

Definition at line 357 of file SimCalorimeterHit.h.

357{0};

◆ time_

float ldmx::SimCalorimeterHit::time_ {0}
private

The global time of the hit.

Definition at line 308 of file SimCalorimeterHit.h.

308{0};

Referenced by getTime(), and setTime().

◆ timeContribs_

std::vector<float> ldmx::SimCalorimeterHit::timeContribs_
private

The list of times contributing to the hit.

Definition at line 333 of file SimCalorimeterHit.h.

◆ trackIDContribs_

std::vector<int> ldmx::SimCalorimeterHit::trackIDContribs_
private

The list of track IDs contributing to the hit.

Definition at line 313 of file SimCalorimeterHit.h.

◆ velocity_

float ldmx::SimCalorimeterHit::velocity_ {-1}
private

The track velocity [mm/ns].

Definition at line 377 of file SimCalorimeterHit.h.

377{-1};

Referenced by getVelocity(), and setVelocity().

◆ x_

float ldmx::SimCalorimeterHit::x_ {0}
private

The X position.

Definition at line 293 of file SimCalorimeterHit.h.

293{0};

Referenced by getPosition(), and setPosition().

◆ y_

float ldmx::SimCalorimeterHit::y_ {0}
private

The Y position.

Definition at line 298 of file SimCalorimeterHit.h.

298{0};

Referenced by getPosition(), and setPosition().

◆ z_

float ldmx::SimCalorimeterHit::z_ {0}
private

The Z position.

Definition at line 303 of file SimCalorimeterHit.h.

303{0};

Referenced by getPosition(), and setPosition().


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