10 #include <unordered_map>
95 particles_to_monitor_(iConfig.getParameter<
std::
vector<
int>>(
"particles_to_monitor")),
122 const auto hitmap = *hitMapHandle;
126 std::vector<SimVertex>
const&
simVertices = *simVerticesHandle;
130 std::vector<CaloParticle>
const&
caloParticles = *caloParticleHandle;
134 std::vector<reco::SuperCluster>
const& simPFClusters = *simPFClustersHandle;
141 if (caloParticle.g4Tracks()[0].eventId().event() != 0
or
142 caloParticle.g4Tracks()[0].eventId().bunchCrossing() != 0) {
143 LogDebug(
"CaloParticleValidation") <<
"Excluding CaloParticles from event: "
144 << caloParticle.g4Tracks()[0].eventId().event()
145 <<
" with BX: " << caloParticle.g4Tracks()[0].eventId().bunchCrossing()
149 int id = caloParticle.pdgId();
152 histo.eta_->Fill(caloParticle.eta());
153 histo.pt_->Fill(caloParticle.pt());
154 histo.energy_->Fill(caloParticle.energy());
155 histo.nSimClusters_->Fill(caloParticle.simClusters().size());
161 for (
auto const& sc : caloParticle.simClusters()) {
162 simHits += sc->hits_and_fractions().size();
163 for (
auto const& h_and_f : sc->hits_and_fractions()) {
164 if (hitmap.count(h_and_f.first))
165 energy += hitmap.at(h_and_f.first)->energy() * h_and_f.second;
170 histo.energyDifference_->Fill(1. -
energy / caloParticle.energy());
175 for (
auto const& sc : simPFClusters) {
176 histos.at(0).simPFSuperClusterSize_->Fill((
float)sc.clustersSize());
177 histos.at(0).simPFSuperClusterEnergy_->Fill(sc.rawEnergy());
184 for (
auto const& pfc : simPFCandidates) {
190 histo.pfcandidateEnergy_->Fill(pfc.energy());
191 histo.pfcandidatePt_->Fill(pfc.pt());
192 histo.pfcandidateEta_->Fill(pfc.eta());
193 histo.pfcandidatePhi_->Fill(pfc.phi());
194 histo.pfcandidateElementsInBlocks_->Fill(pfc.elementsInBlocks().size());
197 histo.pfcandidate_vect_sum_pt_->Fill(
std::sqrt(ptx_tot * ptx_tot + pty_tot * pty_tot));
207 histo.eta_ = ibook.
book1D(
"Eta",
"Eta", 80, -4., 4.);
208 histo.energy_ = ibook.
book1D(
"Energy",
"Energy", 250, 0., 500.);
209 histo.pt_ = ibook.
book1D(
"Pt",
"Pt", 100, 0., 100.);
210 histo.nSimClusters_ = ibook.
book1D(
"NSimClusters",
"NSimClusters", 100, 0., 100.);
211 histo.nHitInSimClusters_ = ibook.
book1D(
"NHitInSimClusters",
"NHitInSimClusters", 100, 0., 100.);
212 histo.selfEnergy_ = ibook.
book1D(
"SelfEnergy",
"SelfEnergy", 250, 0., 500.);
213 histo.energyDifference_ = ibook.
book1D(
"EnergyDifference",
"(Energy-SelfEnergy)/Energy", 300, -5., 1.);
214 histo.eta_Zorigin_map_ = ibook.
book2D(
"Eta vs Zorigin",
"Eta vs Zorigin", 80, -4., 4., 1100, -550., 550.);
218 histos[
offset].pfcandidateType_ = ibook.
book1D(
"PFCandidateType",
"PFCandidateType", 10, 0, 10);
219 histos[
offset].pfcandidate_vect_sum_pt_ = ibook.
book1D(
"PFCandidatePtVectSum",
"PFCandidatePtVectSum", 200, 0., 200.);
223 histo.pfcandidateEnergy_ = ibook.
book1D(
"PFCandidateEnergy",
"PFCandidateEnergy", 250, 0., 250.);
224 histo.pfcandidatePt_ = ibook.
book1D(
"PFCandidatePt",
"PFCandidatePt", 250, 0., 250.);
225 histo.pfcandidateEta_ = ibook.
book1D(
"PFCandidateEta",
"PFCandidateEta", 100, -5., 5.);
226 histo.pfcandidatePhi_ = ibook.
book1D(
"PFCandidatePhi",
"PFCandidatePhi", 100, -4., 4.);
227 histo.pfcandidateElementsInBlocks_ = ibook.
book1D(
"PFCandidateElements",
"PFCandidateElements", 20, 0., 20.);
231 histos[0].simPFSuperClusterSize_ = ibook.
book1D(
"SimPFSuperClusterSize",
"SimPFSuperClusterSize", 40, 0., 40.);
232 histos[0].simPFSuperClusterEnergy_ =
233 ibook.
book1D(
"SimPFSuperClusterEnergy",
"SimPFSuperClusterEnergy", 250, 0., 500.);
242 desc.add<std::vector<int>>(
"particles_to_monitor", {11, -11, 13, -13, 22, 111, 211, -211, 321, -321});
248 descriptions.
add(
"caloparticlevalidationDefault",
desc);