4 #define BOOK1D(name, title, nbinsx, lowx, highx) \
6 db_ ? db_->book1D(#name, title, nbinsx, lowx, highx)->getTH1F() : new TH1F(#name, title, nbinsx, lowx, highx)
9 #define BOOK2D(name, title, nbinsx, lowx, highx, nbinsy, lowy, highy) \
10 h##name = db_ ? db_->book2D(#name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)->getTH2F() \
11 : new TH2F(#name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)
15 #define SETAXES(name, xtitle, ytitle) \
16 h##name->GetXaxis()->SetTitle(xtitle); \
17 h##name->GetYaxis()->SetTitle(ytitle)
37 cout <<
"Benchmark output written to file " <<
outputFile_.c_str() << endl;
41 cout <<
"No output file specified (" <<
outputFile_ <<
"). Results will not be saved!" << endl;
45 string benchmarkLabel,
51 string sGenMatchObjectLabel,
52 bool applyEcalCrackCut,
68 cout <<
"PFTauElecRejectionBenchmark Setup parameters ==============================================" << endl;
69 cout <<
"Filename to write histograms " << Filename << endl;
88 cout <<
"Info: DQM is not available to provide data storage service. Using TFile to save histograms. " << endl;
92 BOOK1D(EoverP,
"E/p", 100, 0., 4.);
93 SETAXES(EoverP,
"E/p",
"Entries");
95 BOOK1D(EoverP_barrel,
"E/p barrel", 100, 0., 4.);
96 SETAXES(EoverP_barrel,
"E/p barrel",
"Entries");
98 BOOK1D(EoverP_endcap,
"E/p endcap", 100, 0., 4.);
99 SETAXES(EoverP_endcap,
"E/p endcap",
"Entries");
101 BOOK1D(EoverP_preid0,
"E/p (preid=0)", 100, 0., 4.);
102 SETAXES(EoverP_preid0,
"E/p",
"Entries");
104 BOOK1D(EoverP_preid1,
"E/p (preid=1)", 100, 0., 4.);
105 SETAXES(EoverP_preid1,
"E/p",
"Entries");
108 BOOK1D(HoverP,
"H/p", 100, 0., 2.);
109 SETAXES(HoverP,
"H/p",
"Entries");
111 BOOK1D(HoverP_barrel,
"H/p barrel", 100, 0., 2.);
112 SETAXES(HoverP_barrel,
"H/p barrel",
"Entries");
114 BOOK1D(HoverP_endcap,
"H/p endcap", 100, 0., 2.);
115 SETAXES(HoverP_endcap,
"H/p endcap",
"Entries");
117 BOOK1D(HoverP_preid0,
"H/p (preid=0)", 100, 0., 2.);
118 SETAXES(HoverP_preid0,
"H/p",
"Entries");
120 BOOK1D(HoverP_preid1,
"H/p (preid=1)", 100, 0., 2.);
121 SETAXES(HoverP_preid1,
"H/p",
"Entries");
124 BOOK1D(Emfrac,
"EM fraction", 100, 0., 1.01);
125 SETAXES(Emfrac,
"em fraction",
"Entries");
127 BOOK1D(Emfrac_barrel,
"EM fraction barrel", 100, 0., 1.01);
128 SETAXES(Emfrac_barrel,
"em fraction barrel",
"Entries");
130 BOOK1D(Emfrac_endcap,
"EM fraction endcap", 100, 0., 1.01);
131 SETAXES(Emfrac_endcap,
"em fraction endcap",
"Entries");
133 BOOK1D(Emfrac_preid0,
"EM fraction (preid=0)", 100, 0., 1.01);
134 SETAXES(Emfrac_preid0,
"em fraction",
"Entries");
136 BOOK1D(Emfrac_preid1,
"EM fraction (preid=1)", 100, 0., 1.01);
137 SETAXES(Emfrac_preid1,
"em fraction",
"Entries");
140 BOOK1D(ElecPreID,
"PFElectron PreID decision", 6, 0., 1.01);
141 SETAXES(ElecPreID,
"PFElectron PreID decision",
"Entries");
144 BOOK1D(ElecMVA,
"PFElectron MVA", 100, -1.01, 1.01);
145 SETAXES(ElecMVA,
"PFElectron MVA",
"Entries");
148 BOOK1D(TauElecDiscriminant,
"PFTau-Electron Discriminant", 6, 0., 1.01);
149 SETAXES(TauElecDiscriminant,
"PFTau-Electron Discriminant",
"Entries");
152 BOOK1D(pfcand_deltaEta,
"PFCand cluster dEta", 100, 0., 0.8);
153 SETAXES(pfcand_deltaEta,
"PFCand cluster #Delta(#eta)",
"Entries");
155 BOOK1D(pfcand_deltaEta_weightE,
"PFCand cluster dEta, energy weighted", 100, 0., 0.8);
156 SETAXES(pfcand_deltaEta_weightE,
"PFCand cluster #Delta(#eta)",
"Entries");
158 BOOK1D(pfcand_deltaPhiOverQ,
"PFCand cluster dPhi/q", 100, -0.8, 0.8);
159 SETAXES(pfcand_deltaPhiOverQ,
"PFCand cluster #Delta(#phi)/q",
"Entries");
161 BOOK1D(pfcand_deltaPhiOverQ_weightE,
"PFCand cluster dEta/q, energy weighted", 100, -0.8, 0.8);
162 SETAXES(pfcand_deltaPhiOverQ_weightE,
"PFCand cluster #Delta(#phi)/q",
"Entries");
165 BOOK1D(leadTk_pt,
"leading KF track pt", 100, 0., 80.);
166 SETAXES(leadTk_pt,
"leading KF track p_{T} (GeV)",
"Entries");
168 BOOK1D(leadTk_eta,
"leading KF track eta", 100, -4., 4.);
169 SETAXES(leadTk_eta,
"leading KF track #eta",
"Entries");
171 BOOK1D(leadTk_phi,
"leading KF track phi", 100, -3.2, 3.2);
172 SETAXES(leadTk_phi,
"leading KF track #phi",
"Entries");
175 BOOK1D(leadGsfTk_pt,
"leading Gsf track pt", 100, 0., 80.);
176 SETAXES(leadGsfTk_pt,
"leading Gsf track p_{T} (GeV)",
"Entries");
178 BOOK1D(leadGsfTk_eta,
"leading Gsf track eta", 100, -4., 4.);
179 SETAXES(leadGsfTk_eta,
"leading Gsf track #eta",
"Entries");
181 BOOK1D(leadGsfTk_phi,
"leading Gsf track phi", 100, -3.2, 3.2);
182 SETAXES(leadGsfTk_phi,
"leading Gsf track #phi",
"Entries");
185 BOOK2D(HoPvsEoP,
"H/p vs. E/p", 100, 0., 2., 100, 0., 2.);
186 SETAXES(HoPvsEoP,
"E/p",
"H/p");
188 BOOK2D(HoPvsEoP_preid0,
"H/p vs. E/p (preid=0)", 100, 0., 2., 100, 0., 2.);
189 SETAXES(HoPvsEoP_preid0,
"E/p",
"H/p");
191 BOOK2D(HoPvsEoP_preid1,
"H/p vs. E/p (preid=0)", 100, 0., 2., 100, 0., 2.);
192 SETAXES(HoPvsEoP_preid1,
"E/p",
"H/p");
195 BOOK2D(EmfracvsEoP,
"emfrac vs. E/p", 100, 0., 2., 100, 0., 1.01);
196 SETAXES(EmfracvsEoP,
"E/p",
"em fraction");
198 BOOK2D(EmfracvsEoP_preid0,
"emfrac vs. E/p (preid=0)", 100, 0., 2., 100, 0., 1.01);
199 SETAXES(EmfracvsEoP_preid0,
"E/p",
"em fraction");
201 BOOK2D(EmfracvsEoP_preid1,
"emfrac vs. E/p (preid=0)", 100, 0., 2., 100, 0., 1.01);
202 SETAXES(EmfracvsEoP_preid1,
"E/p",
"em fraction");
213 TLorentzVector taunet;
214 HepMC::GenEvent::particle_iterator
p;
215 for (
p = generated_event->particles_begin();
p != generated_event->particles_end();
p++) {
216 if (
std::abs((*p)->pdg_id()) == 15 && (*p)->status() == 2) {
217 bool lept_decay =
false;
218 TLorentzVector
tau((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(), (*p)->momentum().e());
219 HepMC::GenVertex::particle_iterator
z = (*p)->end_vertex()->particles_begin(HepMC::descendants);
220 for (;
z != (*p)->end_vertex()->particles_end(HepMC::descendants);
z++) {
224 taunet.SetPxPyPzE((*z)->momentum().px(), (*z)->momentum().py(), (*z)->momentum().pz(), (*z)->momentum().e());
226 if (lept_decay ==
false) {
227 TLorentzVector jetMom =
tau - taunet;
231 }
else if (
std::abs((*p)->pdg_id()) == 11 && (*p)->status() == 1) {
232 TLorentzVector elec((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(), (*p)->momentum().e());
244 if ((*pfTauIsoDiscr)[thePFTau] == 1) {
260 TLorentzVector pftau((*thePFTau).px(), (*thePFTau).py(), (*thePFTau).pz(), (*thePFTau).energy());
267 hEoverP->Fill((*thePFTau).ecalStripSumEOverPLead());
268 hHoverP->Fill((*thePFTau).hcal3x3OverPLead());
269 hEmfrac->Fill((*thePFTau).emFraction());
271 if (
std::abs(myleadTk->eta()) < 1.5) {
275 }
else if (
std::abs(myleadTk->eta()) > 1.5 &&
std::abs(myleadTk->eta()) < 2.5) {
282 if ((*thePFTau).electronPreIDOutput() < -1)
285 hElecMVA->Fill((*thePFTau).electronPreIDOutput());
289 hHoPvsEoP->Fill((*thePFTau).ecalStripSumEOverPLead(), (*thePFTau).hcal3x3OverPLead());
290 hEmfracvsEoP->Fill((*thePFTau).emFraction(), (*thePFTau).hcal3x3OverPLead());
292 if ((*thePFTau).electronPreIDDecision() == 1) {
296 hHoPvsEoP_preid1->Fill((*thePFTau).ecalStripSumEOverPLead(), (*thePFTau).hcal3x3OverPLead());
302 hHoPvsEoP_preid0->Fill((*thePFTau).ecalStripSumEOverPLead(), (*thePFTau).hcal3x3OverPLead());
309 std::vector<CandidatePtr> myPFCands = (*thePFTau).pfTauTagInfoRef()->PFCands();
310 for (
int i = 0;
i < (
int)myPFCands.size();
i++) {
312 if (pfCand ==
nullptr)
325 double deltaPhiOverQ =
deltaPhi / (double)myleadTk->charge();
343 return (
eta < 0.018 || (
eta > 0.423 &&
eta < 0.461) || (
eta > 0.770 &&
eta < 0.806) || (
eta > 1.127 &&
eta < 1.163) ||
344 (
eta > 1.460 &&
eta < 1.558));