10 #include <unordered_map>
97 particles_to_monitor_(iConfig.getParameter<
std::vector<
int>>(
"particles_to_monitor")),
100 simPFClusters_(consumes<
std::vector<
reco::SuperCluster>>(iConfig.getParameter<
edm::
InputTag>(
"simPFClusters"))),
132 const auto& rechitsEE = *recHitHandleEE;
133 const auto& rechitsFH = *recHitHandleFH;
134 const auto& rechitsBH = *recHitHandleBH;
135 std::map<DetId, const HGCRecHit*> hitmap;
136 for (
unsigned int i = 0;
i < rechitsEE.size(); ++
i) {
137 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
139 for (
unsigned int i = 0;
i < rechitsFH.size(); ++
i) {
140 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
142 for (
unsigned int i = 0;
i < rechitsBH.size(); ++
i) {
143 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
148 std::vector<SimVertex>
const&
simVertices = *simVerticesHandle;
152 std::vector<CaloParticle>
const&
caloParticles = *caloParticleHandle;
156 std::vector<reco::SuperCluster>
const& simPFClusters = *simPFClustersHandle;
163 if (caloParticle.g4Tracks()[0].eventId().event() != 0
or
164 caloParticle.g4Tracks()[0].eventId().bunchCrossing() != 0) {
165 LogDebug(
"CaloParticleValidation") <<
"Excluding CaloParticles from event: "
166 << caloParticle.g4Tracks()[0].eventId().event()
167 <<
" with BX: " << caloParticle.g4Tracks()[0].eventId().bunchCrossing()
171 int id = caloParticle.pdgId();
174 histo.eta_->Fill(caloParticle.eta());
175 histo.pt_->Fill(caloParticle.pt());
176 histo.energy_->Fill(caloParticle.energy());
177 histo.nSimClusters_->Fill(caloParticle.simClusters().size());
183 for (
auto const sc : caloParticle.simClusters()) {
184 simHits += sc->hits_and_fractions().size();
185 for (
auto const& h_and_f : sc->hits_and_fractions()) {
186 if (hitmap.count(h_and_f.first))
187 energy += hitmap[h_and_f.first]->energy() * h_and_f.second;
192 histo.energyDifference_->Fill(1. -
energy / caloParticle.energy());
197 for (
auto const& sc : simPFClusters) {
198 histos.at(0).simPFSuperClusterSize_->Fill((
float)sc.clustersSize());
199 histos.at(0).simPFSuperClusterEnergy_->Fill(sc.rawEnergy());
206 for (
auto const& pfc : simPFCandidates) {
212 histo.pfcandidateEnergy_->Fill(pfc.energy());
213 histo.pfcandidatePt_->Fill(pfc.pt());
214 histo.pfcandidateEta_->Fill(pfc.eta());
215 histo.pfcandidatePhi_->Fill(pfc.phi());
216 histo.pfcandidateElementsInBlocks_->Fill(pfc.elementsInBlocks().size());
219 histo.pfcandidate_vect_sum_pt_->Fill(
std::sqrt(ptx_tot * ptx_tot + pty_tot * pty_tot));
229 histo.eta_ = ibook.
book1D(
"Eta",
"Eta", 80, -4., 4.);
230 histo.energy_ = ibook.
book1D(
"Energy",
"Energy", 250, 0., 500.);
231 histo.pt_ = ibook.
book1D(
"Pt",
"Pt", 100, 0., 100.);
232 histo.nSimClusters_ = ibook.
book1D(
"NSimClusters",
"NSimClusters", 100, 0., 100.);
233 histo.nHitInSimClusters_ = ibook.
book1D(
"NHitInSimClusters",
"NHitInSimClusters", 100, 0., 100.);
234 histo.selfEnergy_ = ibook.
book1D(
"SelfEnergy",
"SelfEnergy", 250, 0., 500.);
235 histo.energyDifference_ = ibook.
book1D(
"EnergyDifference",
"(Energy-SelfEnergy)/Energy", 300, -5., 1.);
236 histo.eta_Zorigin_map_ = ibook.
book2D(
"Eta vs Zorigin",
"Eta vs Zorigin", 80, -4., 4., 1100, -550., 550.);
240 histos[
offset].pfcandidateType_ = ibook.
book1D(
"PFCandidateType",
"PFCandidateType", 10, 0, 10);
241 histos[
offset].pfcandidate_vect_sum_pt_ = ibook.
book1D(
"PFCandidatePtVectSum",
"PFCandidatePtVectSum", 200, 0., 200.);
245 histo.pfcandidateEnergy_ = ibook.
book1D(
"PFCandidateEnergy",
"PFCandidateEnergy", 250, 0., 250.);
246 histo.pfcandidatePt_ = ibook.
book1D(
"PFCandidatePt",
"PFCandidatePt", 250, 0., 250.);
247 histo.pfcandidateEta_ = ibook.
book1D(
"PFCandidateEta",
"PFCandidateEta", 100, -5., 5.);
248 histo.pfcandidatePhi_ = ibook.
book1D(
"PFCandidatePhi",
"PFCandidatePhi", 100, -4., 4.);
249 histo.pfcandidateElementsInBlocks_ = ibook.
book1D(
"PFCandidateElements",
"PFCandidateElements", 20, 0., 20.);
253 histos[0].simPFSuperClusterSize_ = ibook.
book1D(
"SimPFSuperClusterSize",
"SimPFSuperClusterSize", 40, 0., 40.);
254 histos[0].simPFSuperClusterEnergy_ =
255 ibook.
book1D(
"SimPFSuperClusterEnergy",
"SimPFSuperClusterEnergy", 250, 0., 500.);
264 desc.
add<std::vector<int>>(
"particles_to_monitor", {11, -11, 13, -13, 22, 111, 211, -211, 321, -321});
272 descriptions.
add(
"caloparticlevalidationDefault", desc);