32void ElectroNuclearDQM::findReconstructableKinematics(
33 const std::vector<const ldmx::SimParticle*>& daughters) {
40 std::vector<const ldmx::SimParticle*> recon;
41 for (
const auto* d : daughters) {
42 std::vector<double> pvec_raw{d->getMomentum()};
43 ROOT::Math::XYZVector pvec(pvec_raw[0], pvec_raw[1], pvec_raw[2]);
44 if (pvec.Theta() * (180.0 / 3.14159) >= 80.0)
continue;
46 auto pdg_id{std::abs(d->getPdgID())};
47 double p_mag{pvec.R()};
48 double ke{d->getEnergy() - d->getMass()};
51 if (ke <= 1000.0)
continue;
52 }
else if (pdg_id == 211) {
53 if (p_mag <= 100.0)
continue;
54 }
else if (pdg_id == 2212 || pdg_id == 321 || pdg_id == 130 ||
56 if (p_mag <= 800.0)
continue;
57 }
else if (pdg_id == 111) {
58 if (ke <= 2000.0)
continue;
65 int recon_neutron_mult{0}, recon_proton_mult{0};
66 int recon_charged_pion_mult{0}, recon_neutral_pion_mult{0};
67 double recon_total_ke{0}, recon_total_neutron_ke{0};
68 double recon_hardest_ke{-1}, recon_hardest_theta{-1};
69 double recon_hardest_n_ke{-1}, recon_hardest_n_theta{-1};
70 double recon_hardest_p_ke{-1}, recon_hardest_p_theta{-1};
71 double recon_hardest_pi_ke{-1}, recon_hardest_pi_theta{-1};
72 double recon_hardest_pi0_ke{-1}, recon_hardest_pi0_theta{-1};
74 for (
const auto* d : recon) {
75 auto pdg_id{std::abs(d->getPdgID())};
76 double ke{d->getEnergy() - d->getMass()};
79 std::vector<double> pvec_raw{d->getMomentum()};
80 ROOT::Math::XYZVector pvec(pvec_raw[0], pvec_raw[1], pvec_raw[2]);
81 auto theta{pvec.Theta() * (180.0 / 3.14159)};
83 if (recon_hardest_ke < ke) {
84 recon_hardest_ke = ke;
85 recon_hardest_theta = theta;
90 recon_total_neutron_ke += ke;
91 if (recon_hardest_n_ke < ke) {
92 recon_hardest_n_ke = ke;
93 recon_hardest_n_theta = theta;
95 }
else if (pdg_id == 2212) {
97 if (recon_hardest_p_ke < ke) {
98 recon_hardest_p_ke = ke;
99 recon_hardest_p_theta = theta;
101 }
else if (pdg_id == 211) {
102 recon_charged_pion_mult++;
103 if (recon_hardest_pi_ke < ke) {
104 recon_hardest_pi_ke = ke;
105 recon_hardest_pi_theta = theta;
107 }
else if (pdg_id == 111) {
108 recon_neutral_pion_mult++;
109 if (recon_hardest_pi0_ke < ke) {
110 recon_hardest_pi0_ke = ke;
111 recon_hardest_pi0_theta = theta;
116 if (!recon.empty()) {
117 auto leading_pdg{std::abs(recon[0]->getPdgID())};
119 if (leading_pdg == 211)
121 else if (leading_pdg == 111)
123 else if (leading_pdg == 321)
125 else if (leading_pdg == 130 || leading_pdg == 310)
127 else if (leading_pdg == 2212)
129 else if (leading_pdg == 2112)
131 histograms_.fill(
"recon_leading_particle_type", leading_type);
134 auto recon_event_type{classifyEvent(recon, 0)};
135 histograms_.fill(
"event_type_recon",
static_cast<int>(recon_event_type));
137 histograms_.fill(
"recon_hardest_ke", recon_hardest_ke);
138 histograms_.fill(
"recon_hardest_theta", recon_hardest_theta);
139 histograms_.fill(
"recon_hardest_n_ke", recon_hardest_n_ke);
140 histograms_.fill(
"recon_hardest_n_theta", recon_hardest_n_theta);
141 histograms_.fill(
"recon_hardest_p_ke", recon_hardest_p_ke);
142 histograms_.fill(
"recon_hardest_p_theta", recon_hardest_p_theta);
143 histograms_.fill(
"recon_hardest_pi_ke", recon_hardest_pi_ke);
144 histograms_.fill(
"recon_hardest_pi_theta", recon_hardest_pi_theta);
145 histograms_.fill(
"recon_hardest_pi0_ke", recon_hardest_pi0_ke);
146 histograms_.fill(
"recon_hardest_pi0_theta", recon_hardest_pi0_theta);
147 histograms_.fill(
"en_recon_neutron_mult", recon_neutron_mult);
148 histograms_.fill(
"en_recon_proton_mult", recon_proton_mult);
149 histograms_.fill(
"en_recon_charged_pion_mult", recon_charged_pion_mult);
150 histograms_.fill(
"en_recon_neutral_pion_mult", recon_neutral_pion_mult);
151 histograms_.fill(
"en_recon_total_ke", recon_total_ke);
152 histograms_.fill(
"en_recon_total_neutron_ke", recon_total_neutron_ke);
157 sim_particles_coll_name_, sim_particles_passname_)};
158 if (particle_map.empty())
return;
161 auto [trackID, en_electron] = analysis::getRecoil(particle_map);
165 const auto en_daughters{
166 findDaughters(particle_map, en_electron,
167 ldmx::SimParticle::ProcessType::electronNuclear)};
169 findENElectronProperties(en_electron, en_daughters);
171 histograms_.fill(
"en_particle_mult", en_electron->getDaughters().size());
173 if (en_daughters.empty()) {
174 ldmx_log(warn) <<
"No EN daughters found, skipping kinematics";
178 findExtendedKinematics(en_daughters,
"en");
179 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.