131 std::vector<int> sorted_tracks_idx(
tracks.size());
132 iota(begin(sorted_tracks_idx),
end(sorted_tracks_idx), 0);
133 sort(begin(sorted_tracks_idx),
end(sorted_tracks_idx), [&
tracks](
int i,
int j) {
139 std::vector<int> sorted_genParticles_idx(
genParticles.size());
140 iota(begin(sorted_genParticles_idx),
end(sorted_genParticles_idx), 0);
141 sort(begin(sorted_genParticles_idx),
end(sorted_genParticles_idx), [&
genParticles](
int i,
int j) {
147 std::vector<int> sorted_vertices_idx(
vertices.size());
148 iota(begin(sorted_vertices_idx),
end(sorted_vertices_idx), 0);
149 sort(begin(sorted_vertices_idx),
end(sorted_vertices_idx), [&
vertices](
int i,
int j) {
154 auto const& trackingpart = *trackingParticlesH.
product();
155 std::vector<int> sorted_tp_idx(trackingpart.size());
156 iota(begin(sorted_tp_idx),
end(sorted_tp_idx), 0);
157 sort(begin(sorted_tp_idx),
end(sorted_tp_idx), [&trackingpart](
int i,
int j) {
158 return trackingpart[
i].eta() < trackingpart[
j].eta();
162 auto const& calopart = *caloParticlesH.
product();
163 std::vector<int> sorted_cp_idx(calopart.size());
164 iota(begin(sorted_cp_idx),
end(sorted_cp_idx), 0);
165 sort(begin(sorted_cp_idx),
end(sorted_cp_idx), [&calopart](
int i,
int j) {
166 return calopart[
i].eta() < calopart[
j].eta();
170 auto const& simclusters = *simClustersH.
product();
171 std::vector<int> sorted_simcl_idx(simclusters.size());
172 iota(begin(sorted_simcl_idx),
end(sorted_simcl_idx), 0);
173 sort(begin(sorted_simcl_idx),
end(sorted_simcl_idx), [&simclusters](
int i,
int j) {
174 return simclusters[
i].eta() < simclusters[
j].eta();
178 std::map<int, float> detIdToTotalSimEnergy;
183 std::map<int, int> trackid_to_track_index;
184 std::cout <<
"Printing SimTracks information" << std::endl;
185 std::cout <<
"IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx" << std::endl;
186 for (
auto i : sorted_tracks_idx) {
188 std::cout <<
idx <<
"\t" <<
t.trackId() <<
"\t" <<
t << std::endl;
189 trackid_to_track_index[
t.trackId()] =
idx;
193 std::cout <<
"Printing GenParticles information" << std::endl;
194 std::cout <<
"IDX\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)" << std::endl;
195 for (
auto i : sorted_genParticles_idx) {
197 std::cout <<
i <<
"\t" <<
gp.pdgId() <<
"\t" <<
gp.momentum() <<
"\t" <<
gp.vertex() << std::endl;
200 std::cout <<
"Printing SimVertex information" << std::endl;
201 std::cout <<
"IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID" << std::endl;
202 for (
auto i : sorted_vertices_idx) {
206 std::cout <<
"Printing TrackingParticles information" << std::endl;
207 for (
auto i : sorted_tp_idx) {
208 auto const&
tp = trackingpart[
i];
212 std::cout <<
"Printing CaloParticles information" << std::endl;
214 for (
auto i : sorted_cp_idx) {
215 auto const&
cp = calopart[
i];
217 <<
idx++ <<
" |Eta|: " <<
std::abs(
cp.momentum().eta()) <<
"\tType: " <<
cp.pdgId()
218 <<
"\tEnergy: " <<
cp.energy() <<
"\tIdx: " <<
cp.g4Tracks()[0].trackId()
220 double total_sim_energy = 0.;
221 double total_cp_energy = 0.;
222 std::cout <<
"--> Overall simclusters's size: " <<
cp.simClusters().size() << std::endl;
224 auto const& simcs =
cp.simClusters();
225 std::vector<int> sorted_sc_idx(simcs.size());
226 iota(begin(sorted_sc_idx),
end(sorted_sc_idx), 0);
227 sort(begin(sorted_sc_idx),
end(sorted_sc_idx), [&simcs](
int i,
int j) {
228 return simcs[
i]->momentum().eta() < simcs[
j]->momentum().eta();
230 for (
auto i : sorted_sc_idx) {
234 for (
auto const& sc :
cp.simClusters()) {
235 for (
auto const&
cl : sc->hits_and_fractions()) {
236 total_sim_energy += detIdToTotalSimEnergy[
cl.first] *
cl.second;
237 total_cp_energy +=
cp.energy() *
cl.second;
240 std::cout <<
"--> Overall SC energy (sum using sim energies): " << total_sim_energy << std::endl;
241 std::cout <<
"--> Overall SC energy (sum using CaloP energies): " << total_cp_energy << std::endl;
245 std::cout <<
"Printing SimClusters information" << std::endl;
246 for (
auto i : sorted_simcl_idx) {
247 auto const& simcl = simclusters[
i];
249 <<
idx++ <<
" |Eta|: " <<
std::abs(simcl.momentum().eta()) <<
"\tType: " << simcl.pdgId()
250 <<
"\tEnergy: " << simcl.energy() <<
"\tKey: " <<
i << std::endl;
251 double total_sim_energy = 0.;
252 std::cout <<
"--> Overall simclusters's size: " << simcl.numberOfRecHits() << std::endl;
253 for (
auto const&
cl : simcl.hits_and_fractions()) {
254 total_sim_energy += detIdToTotalSimEnergy[
cl.first] *
cl.second;
257 std::cout <<
"--> Overall SimCluster energy (sum using sim energies): " << total_sim_energy << std::endl;