18 std::vector<ldmx::SimCalorimeterHit> ecal_sim_hits =
23 std::sort(ecal_sim_hits.begin(), ecal_sim_hits.end(),
26 return lhs.getID() < rhs.getID();
29 std::vector<ldmx::EcalHit> ecal_rec_hits =
event.getCollection<
ldmx::EcalHit>(
33 std::sort(ecal_rec_hits.begin(), ecal_rec_hits.end(),
35 return lhs.getID() < rhs.getID();
39 int num_noise_hits{0};
40 double total_rec_energy{0.};
41 int num_mod_with_0hits{0};
42 int num_mod_with_1hits{0};
43 int num_mod_with_2hits{0};
44 int num_mod_with_more_than_2hits{0};
45 std::vector<int> my_costum_mod_ids;
47 std::set<int> my_costum_mod_ids_set;
55 int layer = ecal_id.
layer() + 1;
57 int my_mod_costum_id = layer * 100 + module_id;
59 my_costum_mod_ids.push_back(my_mod_costum_id);
60 my_costum_mod_ids_set.insert(my_mod_costum_id);
63 total_rec_energy += rec_hit.getEnergy();
66 if (rec_hit.isNoise()) {
73 int raw_id = rec_hit.getID();
76 double sim_pos_x_weighted = 0.;
77 double sim_pos_y_weighted = 0.;
78 double sim_pos_z_weighted = 0.;
82 double total_sim_energy_dep = 0.;
84 if (raw_id == sim_hit.getID()) {
85 num_sim_hits += sim_hit.getNumberOfContribs();
86 total_sim_energy_dep += sim_hit.getEdep();
87 sim_pos_x_weighted += sim_hit.getPosition()[0] * sim_hit.getEdep();
88 sim_pos_y_weighted += sim_hit.getPosition()[1] * sim_hit.getEdep();
89 sim_pos_z_weighted += sim_hit.getPosition()[2] * sim_hit.getEdep();
91 }
else if (raw_id < sim_hit.getID()) {
97 sim_pos_x_weighted /= total_sim_energy_dep;
98 sim_pos_y_weighted /= total_sim_energy_dep;
99 sim_pos_z_weighted /= total_sim_energy_dep;
100 auto residual_x = rec_hit.getXPos() - sim_pos_x_weighted;
101 auto residual_y = rec_hit.getYPos() - sim_pos_y_weighted;
102 auto residual_z = rec_hit.getZPos() - sim_pos_z_weighted;
111 rec_hit.getAmplitude());
113 rec_hit.getEnergy());
116 std::map<int, int> module_hits;
117 for (
const int &my_costum_mod_id : my_costum_mod_ids) {
118 module_hits[my_costum_mod_id]++;
123 num_mod_with_0hits =
num_layers_ * 7 - my_costum_mod_ids_set.size();
125 for (
const auto &module_hit : module_hits) {
126 if (module_hit.second == 1) {
127 num_mod_with_1hits++;
128 }
else if (module_hit.second == 2) {
129 num_mod_with_2hits++;
130 }
else if (module_hit.second > 2) {
132 num_mod_with_more_than_2hits++;
143 if (num_mod_with_1hits > 0)
145 if (num_mod_with_2hits > 0)
147 if (num_mod_with_more_than_2hits > 0)
149 num_mod_with_more_than_2hits);
151 if (total_rec_energy > 6000.) {