LDMX Software
ldmx::CascadeHistory Class Reference

All CascadeSteps from a single photonuclear interaction. More...

#include <CascadeHistory.h>

Public Member Functions

void clear ()
 
void setIncidentTrackId (int trackId)
 
void setTargetNucleus (int a, int z)
 
void setIncidentEnergy (double energy)
 
void setExcitationEnergy (double energy)
 
void setResidualNucleus (int a, int z)
 
void addStep (const CascadeStep &step)
 
void addStep (CascadeStep &&step)
 
void reserve (size_t n)
 
int getIncidentTrackId () const
 
int getTargetA () const
 
int getTargetZ () const
 
double getIncidentEnergy () const
 
double getExcitationEnergy () const
 
int getResidualA () const
 
int getResidualZ () const
 
size_t getNumSteps () const
 
bool empty () const
 
const std::vector< CascadeStep > & getSteps () const
 
std::vector< CascadeStep > & getSteps ()
 
const CascadeStepgetStep (size_t i) const
 
const CascadeStepgetStepByHistoryId (int historyId) const
 
const CascadeStepgetIncidentStep () const
 
std::vector< const CascadeStep * > getStepsAtGeneration (int generation) const
 
std::vector< const CascadeStep * > getInteractingSteps () const
 
std::vector< const CascadeStep * > getEscapedSteps () const
 
int getMaxGeneration () const
 
int getNumInteractions () const
 
void print () const
 

Private Member Functions

 ClassDef (CascadeHistory, 1)
 

Private Attributes

int incident_track_id_ {-1}
 
int target_a_ {0}
 
int target_z_ {0}
 
double incident_energy_ {0.0}
 
double excitation_energy_ {0.0}
 
int residual_a_ {0}
 
int residual_z_ {0}
 
std::vector< CascadeStepsteps_
 

Detailed Description

All CascadeSteps from a single photonuclear interaction.

Keyed by the initiating photon's track ID for correlation with SimParticle. Parent-daughter relationships are encoded via history IDs (parentId = -1 for incident particle).

Definition at line 24 of file CascadeHistory.h.

Member Function Documentation

◆ addStep() [1/2]

void ldmx::CascadeHistory::addStep ( CascadeStep && step)
inline

Definition at line 44 of file CascadeHistory.h.

44{ steps_.push_back(std::move(step)); }

◆ addStep() [2/2]

void ldmx::CascadeHistory::addStep ( const CascadeStep & step)
inline

Definition at line 43 of file CascadeHistory.h.

43{ steps_.push_back(step); }

◆ clear()

void ldmx::CascadeHistory::clear ( )

Definition at line 11 of file CascadeHistory.cxx.

11 {
12 incident_track_id_ = -1;
13 target_a_ = 0;
14 target_z_ = 0;
15 steps_.clear();
16}

◆ empty()

bool ldmx::CascadeHistory::empty ( ) const
inline

Definition at line 56 of file CascadeHistory.h.

56{ return steps_.empty(); }

◆ getEscapedSteps()

std::vector< const CascadeStep * > ldmx::CascadeHistory::getEscapedSteps ( ) const

Definition at line 57 of file CascadeHistory.cxx.

57 {
58 std::vector<const CascadeStep*> result;
59 for (const auto& step : steps_) {
60 if (step.didEscape()) {
61 result.push_back(&step);
62 }
63 }
64 return result;
65}

◆ getExcitationEnergy()

double ldmx::CascadeHistory::getExcitationEnergy ( ) const
inline

Definition at line 51 of file CascadeHistory.h.

51{ return excitation_energy_; }

◆ getIncidentEnergy()

double ldmx::CascadeHistory::getIncidentEnergy ( ) const
inline

Definition at line 50 of file CascadeHistory.h.

50{ return incident_energy_; }

◆ getIncidentStep()

const CascadeStep * ldmx::CascadeHistory::getIncidentStep ( ) const

Definition at line 27 of file CascadeHistory.cxx.

27 {
28 for (const auto& step : steps_) {
29 if (step.getGeneration() == 0 && step.getParentId() == -1) {
30 return &step;
31 }
32 }
33 return steps_.empty() ? nullptr : &steps_.front();
34}

◆ getIncidentTrackId()

int ldmx::CascadeHistory::getIncidentTrackId ( ) const
inline

Definition at line 47 of file CascadeHistory.h.

47{ return incident_track_id_; }

◆ getInteractingSteps()

std::vector< const CascadeStep * > ldmx::CascadeHistory::getInteractingSteps ( ) const

Definition at line 47 of file CascadeHistory.cxx.

47 {
48 std::vector<const CascadeStep*> result;
49 for (const auto& step : steps_) {
50 if (step.didInteract()) {
51 result.push_back(&step);
52 }
53 }
54 return result;
55}

◆ getMaxGeneration()

int ldmx::CascadeHistory::getMaxGeneration ( ) const

Definition at line 67 of file CascadeHistory.cxx.

67 {
68 int max_gen = -1;
69 for (const auto& step : steps_) {
70 if (step.getGeneration() > max_gen) {
71 max_gen = step.getGeneration();
72 }
73 }
74 return max_gen;
75}

◆ getNumInteractions()

int ldmx::CascadeHistory::getNumInteractions ( ) const

Definition at line 77 of file CascadeHistory.cxx.

77 {
78 int count = 0;
79 for (const auto& step : steps_) {
80 if (step.didInteract()) {
81 ++count;
82 }
83 }
84 return count;
85}

◆ getNumSteps()

size_t ldmx::CascadeHistory::getNumSteps ( ) const
inline

Definition at line 55 of file CascadeHistory.h.

55{ return steps_.size(); }

◆ getResidualA()

int ldmx::CascadeHistory::getResidualA ( ) const
inline

Definition at line 52 of file CascadeHistory.h.

52{ return residual_a_; }

◆ getResidualZ()

int ldmx::CascadeHistory::getResidualZ ( ) const
inline

Definition at line 53 of file CascadeHistory.h.

53{ return residual_z_; }

◆ getStep()

const CascadeStep & ldmx::CascadeHistory::getStep ( size_t i) const
inline

Definition at line 59 of file CascadeHistory.h.

59{ return steps_.at(i); }

◆ getStepByHistoryId()

const CascadeStep * ldmx::CascadeHistory::getStepByHistoryId ( int historyId) const

Definition at line 18 of file CascadeHistory.cxx.

18 {
19 for (const auto& step : steps_) {
20 if (step.getHistoryId() == historyId) {
21 return &step;
22 }
23 }
24 return nullptr;
25}

◆ getSteps() [1/2]

std::vector< CascadeStep > & ldmx::CascadeHistory::getSteps ( )
inline

Definition at line 58 of file CascadeHistory.h.

58{ return steps_; }

◆ getSteps() [2/2]

const std::vector< CascadeStep > & ldmx::CascadeHistory::getSteps ( ) const
inline

Definition at line 57 of file CascadeHistory.h.

57{ return steps_; }

◆ getStepsAtGeneration()

std::vector< const CascadeStep * > ldmx::CascadeHistory::getStepsAtGeneration ( int generation) const

Definition at line 36 of file CascadeHistory.cxx.

37 {
38 std::vector<const CascadeStep*> result;
39 for (const auto& step : steps_) {
40 if (step.getGeneration() == generation) {
41 result.push_back(&step);
42 }
43 }
44 return result;
45}

◆ getTargetA()

int ldmx::CascadeHistory::getTargetA ( ) const
inline

Definition at line 48 of file CascadeHistory.h.

48{ return target_a_; }

◆ getTargetZ()

int ldmx::CascadeHistory::getTargetZ ( ) const
inline

Definition at line 49 of file CascadeHistory.h.

49{ return target_z_; }

◆ print()

void ldmx::CascadeHistory::print ( ) const

Definition at line 87 of file CascadeHistory.cxx.

87 {
88 std::cout << "CascadeHistory: " << steps_.size() << " steps"
89 << ", target A=" << target_a_ << " Z=" << target_z_
90 << ", incident track=" << incident_track_id_ << "\n";
91
92 for (const auto& step : steps_) {
93 std::cout << " [" << step.getHistoryId() << "] "
94 << "PDG=" << step.getPdgId() << " gen=" << step.getGeneration()
95 << " zone=" << step.getZone() << " E=" << step.getEnergy()
96 << " MeV";
97 if (step.getParentId() >= 0) {
98 std::cout << " parent=" << step.getParentId();
99 }
100 if (step.didInteract()) {
101 std::cout << " -> " << step.getNumDaughters() << " daughters";
102 }
103 if (step.didEscape()) {
104 std::cout << " [escaped]";
105 }
106 std::cout << "\n";
107 }
108}

◆ reserve()

void ldmx::CascadeHistory::reserve ( size_t n)
inline

Definition at line 45 of file CascadeHistory.h.

45{ steps_.reserve(n); }

◆ setExcitationEnergy()

void ldmx::CascadeHistory::setExcitationEnergy ( double energy)
inline

Definition at line 37 of file CascadeHistory.h.

37{ excitation_energy_ = energy; }

◆ setIncidentEnergy()

void ldmx::CascadeHistory::setIncidentEnergy ( double energy)
inline

Definition at line 36 of file CascadeHistory.h.

36{ incident_energy_ = energy; }

◆ setIncidentTrackId()

void ldmx::CascadeHistory::setIncidentTrackId ( int trackId)
inline

Definition at line 31 of file CascadeHistory.h.

31{ incident_track_id_ = trackId; }

◆ setResidualNucleus()

void ldmx::CascadeHistory::setResidualNucleus ( int a,
int z )
inline

Definition at line 38 of file CascadeHistory.h.

38 {
39 residual_a_ = a;
40 residual_z_ = z;
41 }

◆ setTargetNucleus()

void ldmx::CascadeHistory::setTargetNucleus ( int a,
int z )
inline

Definition at line 32 of file CascadeHistory.h.

32 {
33 target_a_ = a;
34 target_z_ = z;
35 }

Member Data Documentation

◆ excitation_energy_

double ldmx::CascadeHistory::excitation_energy_ {0.0}
private

Definition at line 76 of file CascadeHistory.h.

76{0.0}; // [MeV]

◆ incident_energy_

double ldmx::CascadeHistory::incident_energy_ {0.0}
private

Definition at line 75 of file CascadeHistory.h.

75{0.0}; // [MeV]

◆ incident_track_id_

int ldmx::CascadeHistory::incident_track_id_ {-1}
private

Definition at line 72 of file CascadeHistory.h.

72{-1};

◆ residual_a_

int ldmx::CascadeHistory::residual_a_ {0}
private

Definition at line 77 of file CascadeHistory.h.

77{0};

◆ residual_z_

int ldmx::CascadeHistory::residual_z_ {0}
private

Definition at line 78 of file CascadeHistory.h.

78{0};

◆ steps_

std::vector<CascadeStep> ldmx::CascadeHistory::steps_
private

Definition at line 79 of file CascadeHistory.h.

◆ target_a_

int ldmx::CascadeHistory::target_a_ {0}
private

Definition at line 73 of file CascadeHistory.h.

73{0};

◆ target_z_

int ldmx::CascadeHistory::target_z_ {0}
private

Definition at line 74 of file CascadeHistory.h.

74{0};

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