89 : simTracks_(iConfig.getParameter<
edm::
InputTag>(
"simTracks")),
90 genParticles_(iConfig.getParameter<
edm::
InputTag>(
"genParticles")),
91 simVertices_(iConfig.getParameter<
edm::
InputTag>(
"simVertices")),
92 trackingParticles_(iConfig.getParameter<
edm::
InputTag>(
"trackingParticles")),
93 caloParticles_(iConfig.getParameter<
edm::
InputTag>(
"caloParticles")),
94 simClusters_(iConfig.getParameter<
edm::
InputTag>(
"simClusters")),
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);
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();
171 std::vector<int> sorted_simcl_idx(
simclusters.size());
172 iota(begin(sorted_simcl_idx),
end(sorted_simcl_idx), 0);
178 std::map<int, float> detIdToTotalSimEnergy;
183 std::map<int, int> trackid_to_track_index;
184 LogVerbatim(
"CaloParticleDebuggerSimTracks") <<
"\n\n**Printing SimTracks information **";
185 LogVerbatim(
"CaloParticleDebuggerSimTracks") <<
"IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx";
186 for (
auto i : sorted_tracks_idx) {
188 LogVerbatim(
"CaloParticleDebuggerSimTracks") <<
idx <<
"\t" <<
t.trackId() <<
"\t" <<
t;
190 <<
"Crossed Boundary: " <<
t.crossedBoundary() <<
" Position Boundary: " <<
t.getPositionAtBoundary()
191 <<
" Momentum Boundary: " <<
t.getMomentumAtBoundary() <<
" Vtx: " <<
t.vertIndex()
192 <<
" Momemtum Origin: " <<
t.momentum();
193 trackid_to_track_index[
t.trackId()] =
idx;
197 LogVerbatim(
"CaloParticleDebuggerGenParticles") <<
"\n\n**Printing GenParticles information **";
198 LogVerbatim(
"CaloParticleDebuggerGenParticles") <<
"IDX\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)";
199 for (
auto i : sorted_genParticles_idx) {
202 <<
i <<
"\t" <<
gp.pdgId() <<
"\t" <<
gp.momentum() <<
"\t" <<
gp.vertex();
205 LogVerbatim(
"CaloParticleDebuggerSimVertices") <<
"\n\n**Printing SimVertex information **";
206 LogVerbatim(
"CaloParticleDebuggerSimVertices") <<
"IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID";
207 for (
auto i : sorted_vertices_idx) {
209 LogVerbatim(
"CaloParticleDebuggerSimVertices") <<
i <<
"\t" <<
v;
212 LogVerbatim(
"CaloParticleDebuggerTrackingParticles") <<
"\n\n**Printing TrackingParticles information **";
213 for (
auto i : sorted_tp_idx) {
214 auto const&
tp = trackingpart[
i];
215 LogVerbatim(
"CaloParticleDebuggerTrackingParticles") <<
i <<
"\t" <<
tp;
218 LogVerbatim(
"CaloParticleDebuggerCaloParticles") <<
"\n\n**Printing CaloParticles information **";
220 for (
auto i : sorted_cp_idx) {
221 auto const&
cp = calopart[
i];
224 <<
idx++ <<
" |Eta|: " <<
std::abs(
cp.momentum().eta()) <<
"\tType: " <<
cp.pdgId()
225 <<
"\tEnergy: " <<
cp.energy() <<
"\tIdx: " <<
cp.g4Tracks()[0].trackId();
226 double total_sim_energy = 0.;
227 double total_cp_energy = 0.;
228 LogVerbatim(
"CaloParticleDebuggerCaloParticles") <<
"--> Overall simclusters in CP: " <<
cp.simClusters().size();
230 auto const& simcs =
cp.simClusters();
231 std::vector<int> sorted_sc_idx(simcs.size());
232 iota(begin(sorted_sc_idx),
end(sorted_sc_idx), 0);
233 sort(begin(sorted_sc_idx),
end(sorted_sc_idx), [&simcs](
int i,
int j) {
234 return simcs[
i]->momentum().eta() < simcs[
j]->momentum().eta();
236 for (
auto i : sorted_sc_idx) {
237 LogVerbatim(
"CaloParticleDebuggerCaloParticles") << *(simcs[
i]);
240 for (
auto const& sc :
cp.simClusters()) {
241 for (
auto const&
cl : sc->hits_and_fractions()) {
242 total_sim_energy += detIdToTotalSimEnergy[
cl.first] *
cl.second;
243 total_cp_energy +=
cp.energy() *
cl.second;
247 <<
"--> Overall SC energy (sum using sim energies): " << total_sim_energy;
249 <<
"--> Overall SC energy (sum using CaloP energies): " << total_cp_energy;
253 LogVerbatim(
"CaloParticleDebuggerSimClusters") <<
"\n\n**Printing SimClusters information **";
254 for (
auto i : sorted_simcl_idx) {
258 <<
idx++ <<
" |Eta|: " <<
std::abs(simcl.momentum().eta()) <<
"\tType: " << simcl.pdgId()
259 <<
"\tEnergy: " << simcl.energy() <<
"\tKey: " <<
i;
260 auto const& simtrack = simcl.g4Tracks()[0];
261 LogVerbatim(
"CaloParticleDebuggerSimClusters") <<
" Crossed Boundary: " << simtrack.crossedBoundary()
262 <<
" Position Boundary: " << simtrack.getPositionAtBoundary()
263 <<
" Momentum Boundary: " << simtrack.getMomentumAtBoundary();
264 double total_sim_energy = 0.;
265 LogVerbatim(
"CaloParticleDebuggerSimClusters") <<
"--> Overall simclusters's size: " << simcl.numberOfRecHits();
266 for (
auto const&
cl : simcl.hits_and_fractions()) {
267 total_sim_energy += detIdToTotalSimEnergy[
cl.first] *
cl.second;
269 LogVerbatim(
"CaloParticleDebuggerSimClusters") << simcl;
271 <<
"--> Overall SimCluster energy (sum using sim energies): " << total_sim_energy;
297 fhgeom = static_cast<const HGCalGeometry*>(
299 bhgeomnew = static_cast<const HGCalGeometry*>(
307 hgtopo[0] = &(
eegeom->topology());
308 hgtopo[1] = &(fhgeom->topology());
310 hgtopo[2] = &(bhgeomnew->topology());
312 for (
unsigned i = 0;
i < 3; ++
i) {
324 const bool isHcal = (collectionTag.instance().find(
"HcalHits") != std::string::npos);
326 for (
auto const&
simHit : *hSimHits) {
328 const uint32_t simId =
simHit.id();
338 int subdet,
layer, cell,
sec, subsec, zp;
341 std::pair<int, int> recoLayerCell = ddd->
simToReco(cell,
layer,
sec, hgtopo[subdet - 3]->detectorType());
342 cell = recoLayerCell.first;
343 layer = recoLayerCell.second;
353 detIdToTotalSimEnergy[
id.rawId()] +=
simHit.energy();
367 desc.add<std::vector<edm::InputTag>>(
"collectionTags",
371 descriptions.
add(
"caloParticleDebugger",
desc);