141 auto const& genBarcodes = *genBarcodesH.
product();
147 auto const& trackingpart = *trackingParticlesH.
product();
150 auto const& calopart = *caloParticlesH.
product();
156 std::map<int, float> detIdToTotalSimEnergy;
159 std::map<int, int> trackid_to_track_index;
160 LogVerbatim(
"CaloParticleDebuggerSimTracks") <<
"\n\n**Printing SimTracks information **";
161 LogVerbatim(
"CaloParticleDebuggerSimTracks") <<
"IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx";
162 for (
size_t i = 0;
i <
tracks.size(); ++
i) {
165 <<
i <<
"\t" <<
t.trackId() <<
"\t" <<
t <<
" Crossed Boundary: " <<
t.crossedBoundary()
166 <<
" Position Boundary: " <<
t.getPositionAtBoundary() <<
" Momentum Boundary: " <<
t.getMomentumAtBoundary()
167 <<
" Vtx: " <<
t.vertIndex() <<
" Momemtum Origin: " <<
t.momentum();
168 trackid_to_track_index[
t.trackId()] =
i;
171 LogVerbatim(
"CaloParticleDebuggerGenParticles") <<
"\n\n**Printing GenParticles information **";
172 LogVerbatim(
"CaloParticleDebuggerGenParticles") <<
"BARCODE\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)";
176 << genBarcodes[
i] <<
"\t" <<
gp.pdgId() <<
"\t" <<
gp.momentum() <<
"\t" <<
gp.vertex();
179 LogVerbatim(
"CaloParticleDebuggerSimVertices") <<
"\n\n**Printing SimVertex information **";
180 LogVerbatim(
"CaloParticleDebuggerSimVertices") <<
"IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID";
183 LogVerbatim(
"CaloParticleDebuggerSimVertices") <<
i <<
"\t" <<
v;
186 LogVerbatim(
"CaloParticleDebuggerTrackingParticles") <<
"\n\n**Printing TrackingParticles information **";
187 for (
size_t i = 0;
i < trackingpart.size(); ++
i) {
188 auto const&
tp = trackingpart[
i];
189 LogVerbatim(
"CaloParticleDebuggerTrackingParticles") <<
i <<
"\t" <<
tp;
192 LogVerbatim(
"CaloParticleDebuggerCaloParticles") <<
"\n\n**Printing CaloParticles information **";
193 for (
size_t i = 0;
i < calopart.size(); ++
i) {
194 auto const&
cp = calopart[
i];
195 LogVerbatim(
"CaloParticleDebuggerCaloParticles") <<
"\n\n" 196 <<
i <<
"\tType: " <<
cp.pdgId() <<
"\tEnergy: " <<
cp.energy()
197 <<
"\tBarcode: " <<
cp.g4Tracks()[0].genpartIndex()
198 <<
" G4_trackID: " <<
cp.g4Tracks()[0].trackId();
199 double total_sim_energy = 0.;
200 double total_cp_energy = 0.;
201 LogVerbatim(
"CaloParticleDebuggerCaloParticles") <<
"--> Overall simclusters in CP: " <<
cp.simClusters().size();
203 auto const& simcs =
cp.simClusters();
204 for (
size_t j = 0;
j < simcs.size(); ++
j) {
205 LogVerbatim(
"CaloParticleDebuggerCaloParticles") << *(simcs[
j]);
208 for (
auto const& sc :
cp.simClusters()) {
209 for (
auto const&
cl : sc->hits_and_fractions()) {
210 total_sim_energy += detIdToTotalSimEnergy[
cl.first] *
cl.second;
211 total_cp_energy +=
cp.energy() *
cl.second;
215 <<
"--> Overall SC energy (sum using sim energies): " << total_sim_energy;
217 <<
"--> Overall SC energy (sum using CaloP energies): " << total_cp_energy;
220 LogVerbatim(
"CaloParticleDebuggerSimClusters") <<
"\n\n**Printing SimClusters information **";
225 <<
i <<
"\tType: " << simcl.pdgId() <<
"\tEnergy: " << simcl.energy() <<
"\tKey: " <<
i;
226 auto const& simtrack = simcl.g4Tracks()[0];
227 LogVerbatim(
"CaloParticleDebuggerSimClusters") <<
" Crossed Boundary: " << simtrack.crossedBoundary()
228 <<
" Position Boundary: " << simtrack.getPositionAtBoundary()
229 <<
" Momentum Boundary: " << simtrack.getMomentumAtBoundary();
230 double total_sim_energy = 0.;
231 LogVerbatim(
"CaloParticleDebuggerSimClusters") <<
"--> Overall simclusters's size: " << simcl.numberOfRecHits();
232 for (
auto const&
cl : simcl.hits_and_fractions()) {
233 total_sim_energy += detIdToTotalSimEnergy[
cl.first] *
cl.second;
235 LogVerbatim(
"CaloParticleDebuggerSimClusters") << simcl;
237 <<
"--> Overall SimCluster energy (sum using sim energies): " << total_sim_energy;
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticlesToken_
T const * product() const
edm::EDGetTokenT< std::vector< int > > genBarcodesToken_
edm::EDGetTokenT< std::vector< SimCluster > > simClustersToken_
edm::EDGetTokenT< std::vector< SimTrack > > simTracksToken_
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticlesToken_
void fillSimHits(std::map< int, float > &, const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticlesToken_
edm::EDGetTokenT< std::vector< SimVertex > > simVerticesToken_