30void ElectroNuclearDQM::findReconstructableKinematics(
31 const std::vector<const ldmx::SimParticle*>& daughters) {
38 std::vector<const ldmx::SimParticle*> recon;
39 for (
const auto* d : daughters) {
40 std::vector<double> pvec_raw{d->getMomentum()};
41 ROOT::Math::XYZVector pvec(pvec_raw[0], pvec_raw[1], pvec_raw[2]);
42 if (pvec.Theta() * (180.0 / 3.14159) >= 80.0)
continue;
44 auto pdg_id{std::abs(d->getPdgID())};
45 double p_mag{pvec.R()};
46 double ke{d->getEnergy() - d->getMass()};
49 if (ke <= 1000.0)
continue;
50 }
else if (pdg_id == 211) {
51 if (p_mag <= 100.0)
continue;
52 }
else if (pdg_id == 2212 || pdg_id == 321 || pdg_id == 130 ||
54 if (p_mag <= 800.0)
continue;
55 }
else if (pdg_id == 111) {
56 if (ke <= 2000.0)
continue;
63 int recon_neutron_mult{0}, recon_proton_mult{0};
64 int recon_charged_pion_mult{0}, recon_neutral_pion_mult{0};
65 double recon_total_ke{0}, recon_total_neutron_ke{0};
66 double recon_hardest_ke{-1}, recon_hardest_theta{-1};
67 double recon_hardest_n_ke{-1}, recon_hardest_n_theta{-1};
68 double recon_hardest_p_ke{-1}, recon_hardest_p_theta{-1};
69 double recon_hardest_pi_ke{-1}, recon_hardest_pi_theta{-1};
70 double recon_hardest_pi0_ke{-1}, recon_hardest_pi0_theta{-1};
72 for (
const auto* d : recon) {
73 auto pdg_id{std::abs(d->getPdgID())};
74 double ke{d->getEnergy() - d->getMass()};
77 std::vector<double> pvec_raw{d->getMomentum()};
78 ROOT::Math::XYZVector pvec(pvec_raw[0], pvec_raw[1], pvec_raw[2]);
79 auto theta{pvec.Theta() * (180.0 / 3.14159)};
81 if (recon_hardest_ke < ke) {
82 recon_hardest_ke = ke;
83 recon_hardest_theta = theta;
88 recon_total_neutron_ke += ke;
89 if (recon_hardest_n_ke < ke) {
90 recon_hardest_n_ke = ke;
91 recon_hardest_n_theta = theta;
93 }
else if (pdg_id == 2212) {
95 if (recon_hardest_p_ke < ke) {
96 recon_hardest_p_ke = ke;
97 recon_hardest_p_theta = theta;
99 }
else if (pdg_id == 211) {
100 recon_charged_pion_mult++;
101 if (recon_hardest_pi_ke < ke) {
102 recon_hardest_pi_ke = ke;
103 recon_hardest_pi_theta = theta;
105 }
else if (pdg_id == 111) {
106 recon_neutral_pion_mult++;
107 if (recon_hardest_pi0_ke < ke) {
108 recon_hardest_pi0_ke = ke;
109 recon_hardest_pi0_theta = theta;
114 if (!recon.empty()) {
115 auto leading_pdg{std::abs(recon[0]->getPdgID())};
117 if (leading_pdg == 211)
119 else if (leading_pdg == 111)
121 else if (leading_pdg == 321)
123 else if (leading_pdg == 130 || leading_pdg == 310)
125 else if (leading_pdg == 2212)
127 else if (leading_pdg == 2112)
129 histograms_.fill(
"recon_leading_particle_type", leading_type);
132 auto recon_event_type{classifyEvent(recon, 0)};
133 histograms_.fill(
"event_type_recon",
static_cast<int>(recon_event_type));
135 histograms_.fill(
"recon_hardest_ke", recon_hardest_ke);
136 histograms_.fill(
"recon_hardest_theta", recon_hardest_theta);
137 histograms_.fill(
"recon_hardest_n_ke", recon_hardest_n_ke);
138 histograms_.fill(
"recon_hardest_n_theta", recon_hardest_n_theta);
139 histograms_.fill(
"recon_hardest_p_ke", recon_hardest_p_ke);
140 histograms_.fill(
"recon_hardest_p_theta", recon_hardest_p_theta);
141 histograms_.fill(
"recon_hardest_pi_ke", recon_hardest_pi_ke);
142 histograms_.fill(
"recon_hardest_pi_theta", recon_hardest_pi_theta);
143 histograms_.fill(
"recon_hardest_pi0_ke", recon_hardest_pi0_ke);
144 histograms_.fill(
"recon_hardest_pi0_theta", recon_hardest_pi0_theta);
145 histograms_.fill(
"en_recon_neutron_mult", recon_neutron_mult);
146 histograms_.fill(
"en_recon_proton_mult", recon_proton_mult);
147 histograms_.fill(
"en_recon_charged_pion_mult", recon_charged_pion_mult);
148 histograms_.fill(
"en_recon_neutral_pion_mult", recon_neutral_pion_mult);
149 histograms_.fill(
"en_recon_total_ke", recon_total_ke);
150 histograms_.fill(
"en_recon_total_neutron_ke", recon_total_neutron_ke);
155 sim_particles_coll_name_, sim_particles_passname_)};
156 if (particle_map.empty())
return;
159 auto [trackID, en_electron] = analysis::getRecoil(particle_map);
163 const auto en_daughters{
164 findDaughters(particle_map, en_electron,
165 ldmx::SimParticle::ProcessType::electronNuclear)};
167 findENElectronProperties(en_electron, en_daughters);
169 histograms_.fill(
"en_particle_mult", en_electron->getDaughters().size());
171 if (en_daughters.empty()) {
172 ldmx_log(warn) <<
"No EN daughters found, skipping kinematics";
176 findExtendedKinematics(en_daughters,
"en");
177 findReconstructableKinematics(en_daughters);
Class representing a simulated particle.
double getEnergy() const
Get the energy of this particle [MeV].
std::vector< double > getVertex() const
Get a vector containing the vertex of this particle in mm.