15 : TICLCandidatesToken_(ticlCandidates),
16 simTICLCandidatesToken_(simTICLCandidatesToken),
17 recoTracksToken_(recoTracksToken),
18 trackstersToken_(trackstersToken),
19 associatorMapRtSToken_(associatorMapRtSToken),
20 associatorMapStRToken_(associatorMapStRToken),
30 ibook.
book1D(
"N of tracksters in candidate",
"N of tracksters in candidate", 100, 0, 99);
32 ibook.
book1D(
"Candidates raw energy",
"Candidates raw energy;E (GeV)", 250, 0, 250);
34 ibook.
book1D(
"Candidates regressed energy",
"Candidates regressed energy;E (GeV)", 250, 0, 250);
35 histograms.h_candidate_pT = ibook.
book1D(
"Candidates pT",
"Candidates pT;p_{T}", 250, 0, 250);
36 histograms.h_candidate_charge = ibook.
book1D(
"Candidates charge",
"Candidates charge;Charge", 3, -1.5, 1.5);
37 histograms.h_candidate_pdgId = ibook.
book1D(
"Candidates PDG Id",
"Candidates PDG ID", 100, -220, 220);
38 histograms.h_candidate_partType = ibook.
book1D(
"Candidates type",
"Candidates type", 9, -0.5, 8.5);
41 const std::vector<std::string>
neutrals{
"photons",
"neutral_pions",
"neutral_hadrons"};
42 for (
long unsigned int i = 0;
i <
neutrals.size();
i++) {
46 "N of tracksters in candidate for " +
neutrals[
i],
51 neutrals[
i] +
"candidates regressed energy",
neutrals[
i] +
" candidates regressed energy;E (GeV)", 250, 0, 250));
56 histograms.h_neut_candidate_partType.push_back(
59 histograms.h_den_fake_neut_energy_candidate.push_back(
62 "num_fake_pid_cand_vs_energy_" +
neutrals[
i],
neutrals[
i] +
" PID fake vs energy;E (GeV)", 50, 0, 250));
63 histograms.h_num_fake_neut_energy_candidate_energy.push_back(
65 neutrals[
i] +
" PID and energy fake vs energy;E (GeV)",
69 histograms.h_den_fake_neut_pt_candidate.push_back(
72 "num_fake_pid_cand_vs_pt_" +
neutrals[
i],
neutrals[
i] +
" PID fake vs pT;p_{T} (GeV)", 50, 0, 250));
73 histograms.h_num_fake_neut_pt_candidate_energy.push_back(
75 neutrals[
i] +
" PID and energy fake vs pT;p_{T} (GeV)",
79 histograms.h_den_fake_neut_eta_candidate.push_back(
82 "num_fake_pid_cand_vs_eta_" +
neutrals[
i],
neutrals[
i] +
" PID fake vs eta;#eta (GeV)", 50, -3, 3));
83 histograms.h_num_fake_neut_eta_candidate_energy.push_back(
85 neutrals[
i] +
" PID and energy fake vs eta;#eta (GeV)",
90 "den_fake_cand_vs_phi_" +
neutrals[
i],
neutrals[
i] +
" candidates phi;#phi (GeV)", 50, -3.14159, 3.14159));
92 "num_fake_pid_cand_vs_phi_" +
neutrals[
i],
neutrals[
i] +
" PID fake vs phi;#phi (GeV)", 50, -3.14159, 3.14159));
93 histograms.h_num_fake_neut_phi_candidate_energy.push_back(
95 neutrals[
i] +
" PID and energy fake vs phi;#phi (GeV)",
100 histograms.h_den_neut_energy_candidate.push_back(
102 histograms.h_num_neut_energy_candidate_pdgId.push_back(
104 neutrals[
i] +
" track and PID efficiency vs energy;E (GeV)",
108 histograms.h_num_neut_energy_candidate_energy.push_back(
110 neutrals[
i] +
" track, PID and energy efficiency vs energy;E (GeV)",
117 "num_pid_cand_vs_pt_" +
neutrals[
i],
neutrals[
i] +
" track and PID efficiency vs pT;p_{T} (GeV)", 50, 0, 250));
118 histograms.h_num_neut_pt_candidate_energy.push_back(
120 neutrals[
i] +
" track, PID and energy efficiency vs pT;p_{T} (GeV)",
124 histograms.h_den_neut_eta_candidate.push_back(
127 "num_pid_cand_vs_eta_" +
neutrals[
i],
neutrals[
i] +
" track and PID efficiency vs eta;#eta (GeV)", 50, -3, 3));
128 histograms.h_num_neut_eta_candidate_energy.push_back(
130 neutrals[
i] +
" track, PID and energy efficiency vs eta;#eta (GeV)",
135 "den_cand_vs_phi_" +
neutrals[
i],
neutrals[
i] +
" simCandidates phi;#phi (GeV)", 50, -3.14159, 3.14159));
136 histograms.h_num_neut_phi_candidate_pdgId.push_back(
138 neutrals[
i] +
" track and PID efficiency vs phi;#phi (GeV)",
142 histograms.h_num_neut_phi_candidate_energy.push_back(
144 neutrals[
i] +
" track, PID and energy efficiency vs phi;#phi (GeV)",
150 const std::vector<std::string>
charged{
"electrons",
"muons",
"charged_hadrons"};
151 for (
long unsigned int i = 0;
i <
charged.size();
i++) {
155 "N of tracksters in candidate for " +
charged[
i],
"N of tracksters in candidate for " +
charged[
i], 100, 0, 99));
157 charged[
i] +
"candidates regressed energy",
charged[
i] +
" candidates regressed energy;E (GeV)", 250, 0, 250));
162 histograms.h_chg_candidate_partType.push_back(
165 histograms.h_den_fake_chg_energy_candidate.push_back(
166 ibook.
book1D(
"den_fake_cand_vs_energy_" +
charged[
i],
charged[
i] +
" candidates energy;E (GeV)", 50, 0, 250));
168 "num_fake_track_cand_vs_energy_" +
charged[
i],
charged[
i] +
" track fake vs energy;E (GeV)", 50, 0, 250));
170 "num_fake_pid_cand_vs_energy_" +
charged[
i],
charged[
i] +
" track and PID fake vs energy;E (GeV)", 50, 0, 250));
171 histograms.h_num_fake_chg_energy_candidate_energy.push_back(
173 charged[
i] +
" track, PID and energy fake vs energy;E (GeV)",
177 histograms.h_den_fake_chg_pt_candidate.push_back(
178 ibook.
book1D(
"den_fake_cand_vs_pt_" +
charged[
i],
charged[
i] +
" candidates pT;p_{T} (GeV)", 50, 0, 250));
180 "num_fake_track_cand_vs_pt_" +
charged[
i],
charged[
i] +
" track fake vs pT;p_{T} (GeV)", 50, 0, 250));
182 "num_fake_pid_cand_vs_pt_" +
charged[
i],
charged[
i] +
" track and PID fake vs pT;p_{T} (GeV)", 50, 0, 250));
183 histograms.h_num_fake_chg_pt_candidate_energy.push_back(
185 charged[
i] +
" track, PID and energy fake vs pT;p_{T} (GeV)",
189 histograms.h_den_fake_chg_eta_candidate.push_back(
190 ibook.
book1D(
"den_fake_cand_vs_eta_" +
charged[
i],
charged[
i] +
" candidates eta;#eta (GeV)", 50, -3, 3));
192 "num_fake_track_cand_vs_eta_" +
charged[
i],
charged[
i] +
" track fake vs eta;#eta (GeV)", 50, -3, 3));
194 "num_fake_pid_cand_vs_eta_" +
charged[
i],
charged[
i] +
" track and PID fake vs eta;#eta (GeV)", 50, -3, 3));
195 histograms.h_num_fake_chg_eta_candidate_energy.push_back(
197 charged[
i] +
" track, PID and energy fake vs eta;#eta (GeV)",
202 "den_fake_cand_vs_phi_" +
charged[
i],
charged[
i] +
" candidates phi;#phi (GeV)", 50, -3.14159, 3.14159));
204 charged[
i] +
" track fake vs phi;#phi (GeV)",
208 histograms.h_num_fake_chg_phi_candidate_pdgId.push_back(
210 charged[
i] +
" track and PID fake vs phi;#phi (GeV)",
214 histograms.h_num_fake_chg_phi_candidate_energy.push_back(
216 charged[
i] +
" track, PID and energy fake vs phi;#phi (GeV)",
221 histograms.h_den_chg_energy_candidate.push_back(
222 ibook.
book1D(
"den_cand_vs_energy_" +
charged[
i],
charged[
i] +
" simCandidates energy;E (GeV)", 50, 0, 250));
224 "num_track_cand_vs_energy_" +
charged[
i],
charged[
i] +
" track efficiency vs energy;E (GeV)", 50, 0, 250));
226 "num_pid_cand_vs_energy_" +
charged[
i],
charged[
i] +
" track and PID efficiency vs energy;E (GeV)", 50, 0, 250));
227 histograms.h_num_chg_energy_candidate_energy.push_back(
229 charged[
i] +
" track, PID and energy efficiency vs energy;E (GeV)",
236 "num_track_cand_vs_pt_" +
charged[
i],
charged[
i] +
" track efficiency vs pT;p_{T} (GeV)", 50, 0, 250));
238 "num_pid_cand_vs_pt_" +
charged[
i],
charged[
i] +
" track and PID efficiency vs pT;p_{T} (GeV)", 50, 0, 250));
239 histograms.h_num_chg_pt_candidate_energy.push_back(
241 charged[
i] +
" track, PID and energy efficiency vs pT;p_{T} (GeV)",
248 "num_track_cand_vs_eta_" +
charged[
i],
charged[
i] +
" track efficiency vs eta;#eta (GeV)", 50, -3, 3));
250 "num_pid_cand_vs_eta_" +
charged[
i],
charged[
i] +
" track and PID efficiency vs eta;#eta (GeV)", 50, -3, 3));
251 histograms.h_num_chg_eta_candidate_energy.push_back(
253 charged[
i] +
" track, PID and energy efficiency vs eta;#eta (GeV)",
258 "den_cand_vs_phi_" +
charged[
i],
charged[
i] +
" simCandidates phi;#phi (GeV)", 50, -3.14159, 3.14159));
260 charged[
i] +
" track efficiency vs phi;#phi (GeV)",
264 histograms.h_num_chg_phi_candidate_pdgId.push_back(
266 charged[
i] +
" track and PID efficiency vs phi;#phi (GeV)",
270 histograms.h_num_chg_phi_candidate_energy.push_back(
272 charged[
i] +
" track, PID and energy efficiency vs phi;#phi (GeV)",
286 auto simTICLCandidates = *simTICLCandidates_h;
290 auto recoTracks = *recoTracks_h;
294 auto trackstersMerged = *Tracksters_h;
298 auto const& mergeTsRecoToSimMap = *mergeTsRecoToSim_h;
302 auto const& mergeTsSimToRecoMap = *mergeTsSimToReco_h;
305 for (
const auto&
cand : TICLCandidates) {
306 histograms.h_tracksters_in_candidate->Fill(
cand.tracksters().size());
312 const auto& arr =
cand.idProbabilities();
313 histograms.h_candidate_partType->Fill(std::max_element(arr.begin(), arr.end()) - arr.begin());
316 std::vector<int> chargedCandidates;
317 std::vector<int> neutralCandidates;
318 chargedCandidates.reserve(simTICLCandidates.size());
319 neutralCandidates.reserve(simTICLCandidates.size());
321 for (
size_t i = 0;
i < simTICLCandidates.size(); ++
i) {
322 const auto& simCand = simTICLCandidates[
i];
327 chargedCandidates.emplace_back(
i);
331 neutralCandidates.emplace_back(
i);
335 chargedCandidates.shrink_to_fit();
336 neutralCandidates.shrink_to_fit();
338 for (
const auto i : chargedCandidates) {
339 const auto& simCand = simTICLCandidates[
i];
345 int32_t simCandTrackIdx = -1;
346 if (simCand.trackPtr().get() !=
nullptr)
352 if (simCand.trackPtr().get()->pt() < 1
or simCand.trackPtr().get()->missingOuterHits() > 5
or 357 histograms.h_den_chg_energy_candidate[
index]->Fill(simCand.rawEnergy());
362 int32_t cand_idx = -1;
363 float shared_energy = 0.;
364 const auto ts_vec = mergeTsSimToRecoMap[
i];
365 if (!ts_vec.empty()) {
367 std::min_element(ts_vec.begin(), ts_vec.end(), [](
auto const& ts1_id_pair,
auto const& ts2_id_pair) {
368 return ts1_id_pair.second.second < ts2_id_pair.second.second;
370 shared_energy = min_elem->second.first;
371 cand_idx = min_elem->first;
377 auto& recoCand = TICLCandidates[cand_idx];
381 auto cand_it = std::find_if(TICLCandidates.begin(), TICLCandidates.end(), [tsPtr](
TICLCandidate const&
cand) {
382 if (!
cand.tracksters().empty())
383 return cand.tracksters()[0] == tsPtr;
387 if (cand_it != TICLCandidates.end())
393 if (recoCand.trackPtr().get() !=
nullptr) {
395 if (simCandTrackIdx == candTrackIdx) {
397 histograms.h_num_chg_energy_candidate_track[
index]->Fill(simCand.rawEnergy());
409 if (simCand.pdgId() == recoCand.pdgId()) {
411 histograms.h_num_chg_energy_candidate_pdgId[
index]->Fill(simCand.rawEnergy());
417 if (shared_energy / simCand.rawEnergy() > 0.5) {
419 histograms.h_num_chg_energy_candidate_energy[
index]->Fill(simCand.rawEnergy());
427 for (
const auto i : neutralCandidates) {
428 const auto& simCand = simTICLCandidates[
i];
434 histograms.h_den_neut_energy_candidate[
index]->Fill(simCand.rawEnergy());
439 int32_t cand_idx = -1;
440 float shared_energy = 0.;
441 const auto ts_vec = mergeTsSimToRecoMap[
i];
442 if (!ts_vec.empty()) {
444 std::min_element(ts_vec.begin(), ts_vec.end(), [](
auto const& ts1_id_pair,
auto const& ts2_id_pair) {
445 return ts1_id_pair.second.second < ts2_id_pair.second.second;
447 shared_energy = min_elem->second.first;
448 cand_idx = min_elem->first;
455 auto& recoCand = TICLCandidates[cand_idx];
459 auto cand_it = std::find_if(TICLCandidates.begin(), TICLCandidates.end(), [tsPtr](
TICLCandidate const&
cand) {
460 if (!
cand.tracksters().empty())
461 return cand.tracksters()[0] == tsPtr;
465 if (cand_it != TICLCandidates.end())
471 if (recoCand.trackPtr().get() !=
nullptr)
475 if (simCand.pdgId() == recoCand.pdgId()) {
477 histograms.h_num_neut_energy_candidate_pdgId[
index]->Fill(simCand.rawEnergy());
483 if (shared_energy / simCand.rawEnergy() > 0.5) {
485 histograms.h_num_neut_energy_candidate_energy[
index]->Fill(simCand.rawEnergy());
487 histograms.h_num_neut_eta_candidate_energy[
index]->Fill(simCand.eta());
488 histograms.h_num_neut_phi_candidate_energy[
index]->Fill(simCand.phi());
494 chargedCandidates.clear();
495 neutralCandidates.clear();
496 chargedCandidates.reserve(TICLCandidates.size());
497 neutralCandidates.reserve(TICLCandidates.size());
499 auto isCharged = [](
int pdgId) {
504 for (
size_t i = 0;
i < TICLCandidates.size(); ++
i) {
505 const auto&
cand = TICLCandidates[
i];
508 chargedCandidates.emplace_back(
i);
510 neutralCandidates.emplace_back(
i);
515 chargedCandidates.shrink_to_fit();
516 neutralCandidates.shrink_to_fit();
519 for (
const auto i : chargedCandidates) {
520 const auto&
cand = TICLCandidates[
i];
526 int32_t candTrackIdx = -1;
529 if (
cand.tracksters().empty())
548 const auto& arr =
cand.idProbabilities();
549 histograms.h_chg_candidate_partType[
index]->Fill(std::max_element(arr.begin(), arr.end()) - arr.begin());
551 int32_t simCand_idx = -1;
552 const auto sts_vec = mergeTsRecoToSimMap[mergeTs_id];
553 float shared_energy = 0.;
555 if (!sts_vec.empty()) {
557 std::min_element(sts_vec.begin(), sts_vec.end(), [](
auto const& sts1_id_pair,
auto const& sts2_id_pair) {
558 return sts1_id_pair.second.second < sts2_id_pair.second.second;
560 shared_energy = min_elem->second.first;
561 simCand_idx = min_elem->first;
564 if (simCand_idx == -1)
567 const auto& simCand = simTICLCandidates[simCand_idx];
568 if (simCand.trackPtr().get() !=
nullptr) {
569 const auto simCandTrackIdx = simCand.trackPtr().get() -
edm::Ptr<reco::Track>(recoTracks_h, 0).
get();
570 if (simCandTrackIdx != candTrackIdx) {
588 if (simCand.pdgId() !=
cand.pdgId()) {
598 if (shared_energy / simCand.rawEnergy() < 0.5) {
607 for (
const auto i : neutralCandidates) {
608 const auto&
cand = TICLCandidates[
i];
615 if (
cand.tracksters().empty())
634 const auto& arr =
cand.idProbabilities();
635 histograms.h_neut_candidate_partType[
index]->Fill(std::max_element(arr.begin(), arr.end()) - arr.begin());
637 int32_t simCand_idx = -1;
638 const auto sts_vec = mergeTsRecoToSimMap[mergeTs_id];
639 float shared_energy = 0.;
641 if (!sts_vec.empty()) {
643 std::min_element(sts_vec.begin(), sts_vec.end(), [](
auto const& sts1_id_pair,
auto const& sts2_id_pair) {
644 return sts1_id_pair.second.second < sts2_id_pair.second.second;
646 shared_energy = min_elem->second.first;
647 simCand_idx = min_elem->first;
650 if (simCand_idx == -1)
653 const auto& simCand = simTICLCandidates[simCand_idx];
656 if (simCand.pdgId() !=
cand.pdgId()) {
666 if (shared_energy / simCand.rawEnergy() < 0.5) {
edm::EDGetTokenT< std::vector< TICLCandidate > > simTICLCandidatesToken_
virtual void setCurrentFolder(std::string const &fullpath)
edm::EDGetTokenT< std::vector< reco::Track > > recoTracksToken_
edm::EDGetTokenT< std::vector< TICLCandidate > > TICLCandidatesToken_
Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge)
~TICLCandidateValidator()
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Abs< T >::type abs(const T &t)
T const * get() const
Returns C++ pointer to the item.
edm::EDGetTokenT< ticl::TracksterToTracksterMap > associatorMapRtSToken_
edm::EDGetTokenT< std::vector< ticl::Trackster > > trackstersToken_
void bookCandidatesHistos(DQMStore::IBooker &ibook, Histograms &histograms, std::string baseDir) const
edm::EDGetTokenT< ticl::TracksterToTracksterMap > associatorMapStRToken_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void fillCandidateHistos(const edm::Event &event, const Histograms &histograms, edm::Handle< ticl::TracksterCollection > simTrackstersCP_h) const