4 #define BOOK1D(name,title,nbinsx,lowx,highx) \ 5 h##name = db_ ? db_->book1D(#name,title,nbinsx,lowx,highx)->getTH1F() \ 6 : 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); h##name->GetYaxis()->SetTitle(ytitle) 38 cout <<
"Benchmark output written to file " <<
outputFile_.c_str() << endl;
43 cout <<
"No output file specified ("<<
outputFile_<<
"). Results will not be saved!" << endl;
50 string benchmarkLabel,
56 string sGenMatchObjectLabel,
57 bool applyEcalCrackCut,
73 cout<<
"PFTauElecRejectionBenchmark Setup parameters =============================================="<<endl;
74 cout <<
"Filename to write histograms " << Filename<<endl;
76 cout <<
"maxDeltaRMax " << maxDeltaR << endl;
90 db_->setCurrentFolder(path);
94 cout <<
"Info: DQM is not available to provide data storage service. Using TFile to save histograms. "<<endl;
98 BOOK1D(EoverP,
"E/p",100, 0., 4.);
99 SETAXES(EoverP,
"E/p",
"Entries");
101 BOOK1D(EoverP_barrel,
"E/p barrel",100, 0., 4.);
102 SETAXES(EoverP_barrel,
"E/p barrel",
"Entries");
104 BOOK1D(EoverP_endcap,
"E/p endcap",100, 0., 4.);
105 SETAXES(EoverP_endcap,
"E/p endcap",
"Entries");
107 BOOK1D(EoverP_preid0,
"E/p (preid=0)",100, 0., 4.);
108 SETAXES(EoverP_preid0,
"E/p",
"Entries");
110 BOOK1D(EoverP_preid1,
"E/p (preid=1)",100, 0., 4.);
111 SETAXES(EoverP_preid1,
"E/p",
"Entries");
114 BOOK1D(HoverP,
"H/p",100, 0., 2.);
115 SETAXES(HoverP,
"H/p",
"Entries");
117 BOOK1D(HoverP_barrel,
"H/p barrel",100, 0., 2.);
118 SETAXES(HoverP_barrel,
"H/p barrel",
"Entries");
120 BOOK1D(HoverP_endcap,
"H/p endcap",100, 0., 2.);
121 SETAXES(HoverP_endcap,
"H/p endcap",
"Entries");
123 BOOK1D(HoverP_preid0,
"H/p (preid=0)",100, 0., 2.);
124 SETAXES(HoverP_preid0,
"H/p",
"Entries");
126 BOOK1D(HoverP_preid1,
"H/p (preid=1)",100, 0., 2.);
127 SETAXES(HoverP_preid1,
"H/p",
"Entries");
130 BOOK1D(Emfrac,
"EM fraction",100, 0., 1.01);
131 SETAXES(Emfrac,
"em fraction",
"Entries");
133 BOOK1D(Emfrac_barrel,
"EM fraction barrel",100, 0., 1.01);
134 SETAXES(Emfrac_barrel,
"em fraction barrel",
"Entries");
136 BOOK1D(Emfrac_endcap,
"EM fraction endcap",100, 0., 1.01);
137 SETAXES(Emfrac_endcap,
"em fraction endcap",
"Entries");
139 BOOK1D(Emfrac_preid0,
"EM fraction (preid=0)",100, 0., 1.01);
140 SETAXES(Emfrac_preid0,
"em fraction",
"Entries");
142 BOOK1D(Emfrac_preid1,
"EM fraction (preid=1)",100, 0., 1.01);
143 SETAXES(Emfrac_preid1,
"em fraction",
"Entries");
146 BOOK1D(ElecPreID,
"PFElectron PreID decision",6, 0., 1.01);
147 SETAXES(ElecPreID,
"PFElectron PreID decision",
"Entries");
150 BOOK1D(ElecMVA,
"PFElectron MVA",100, -1.01, 1.01);
151 SETAXES(ElecMVA,
"PFElectron MVA",
"Entries");
154 BOOK1D(TauElecDiscriminant,
"PFTau-Electron Discriminant",6, 0., 1.01);
155 SETAXES(TauElecDiscriminant,
"PFTau-Electron Discriminant",
"Entries");
159 BOOK1D(pfcand_deltaEta,
"PFCand cluster dEta",100, 0., 0.8);
160 SETAXES(pfcand_deltaEta,
"PFCand cluster #Delta(#eta)",
"Entries");
162 BOOK1D(pfcand_deltaEta_weightE,
"PFCand cluster dEta, energy weighted",100, 0., 0.8);
163 SETAXES(pfcand_deltaEta_weightE,
"PFCand cluster #Delta(#eta)",
"Entries");
165 BOOK1D(pfcand_deltaPhiOverQ,
"PFCand cluster dPhi/q",100, -0.8, 0.8);
166 SETAXES(pfcand_deltaPhiOverQ,
"PFCand cluster #Delta(#phi)/q",
"Entries");
168 BOOK1D(pfcand_deltaPhiOverQ_weightE,
"PFCand cluster dEta/q, energy weighted",100, -0.8, 0.8);
169 SETAXES(pfcand_deltaPhiOverQ_weightE,
"PFCand cluster #Delta(#phi)/q",
"Entries");
173 BOOK1D(leadTk_pt,
"leading KF track pt",100, 0., 80.);
174 SETAXES(leadTk_pt,
"leading KF track p_{T} (GeV)",
"Entries");
176 BOOK1D(leadTk_eta,
"leading KF track eta",100, -4., 4.);
177 SETAXES(leadTk_eta,
"leading KF track #eta",
"Entries");
179 BOOK1D(leadTk_phi,
"leading KF track phi",100, -3.2, 3.2);
180 SETAXES(leadTk_phi,
"leading KF track #phi",
"Entries");
183 BOOK1D(leadGsfTk_pt,
"leading Gsf track pt",100, 0., 80.);
184 SETAXES(leadGsfTk_pt,
"leading Gsf track p_{T} (GeV)",
"Entries");
186 BOOK1D(leadGsfTk_eta,
"leading Gsf track eta",100, -4., 4.);
187 SETAXES(leadGsfTk_eta,
"leading Gsf track #eta",
"Entries");
189 BOOK1D(leadGsfTk_phi,
"leading Gsf track phi",100, -3.2, 3.2);
190 SETAXES(leadGsfTk_phi,
"leading Gsf track #phi",
"Entries");
194 BOOK2D(HoPvsEoP,
"H/p vs. E/p",100, 0., 2., 100, 0., 2.);
195 SETAXES(HoPvsEoP,
"E/p",
"H/p");
197 BOOK2D(HoPvsEoP_preid0,
"H/p vs. E/p (preid=0)",100, 0., 2., 100, 0., 2.);
198 SETAXES(HoPvsEoP_preid0,
"E/p",
"H/p");
200 BOOK2D(HoPvsEoP_preid1,
"H/p vs. E/p (preid=0)",100, 0., 2., 100, 0., 2.);
201 SETAXES(HoPvsEoP_preid1,
"E/p",
"H/p");
204 BOOK2D(EmfracvsEoP,
"emfrac vs. E/p",100, 0., 2., 100, 0., 1.01);
205 SETAXES(EmfracvsEoP,
"E/p",
"em fraction");
207 BOOK2D(EmfracvsEoP_preid0,
"emfrac vs. E/p (preid=0)",100, 0., 2., 100, 0., 1.01);
208 SETAXES(EmfracvsEoP_preid0,
"E/p",
"em fraction");
210 BOOK2D(EmfracvsEoP_preid1,
"emfrac vs. E/p (preid=0)",100, 0., 2., 100, 0., 1.01);
211 SETAXES(EmfracvsEoP_preid1,
"E/p",
"em fraction");
226 TLorentzVector taunet;
227 HepMC::GenEvent::particle_iterator
p;
228 for (p = generated_event->particles_begin(); p != generated_event->particles_end(); p++) {
229 if(
std::abs((*p)->pdg_id()) == 15&&(*p)->status()==2) {
230 bool lept_decay =
false;
231 TLorentzVector
tau((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
232 HepMC::GenVertex::particle_iterator
z = (*p)->end_vertex()->particles_begin(HepMC::descendants);
233 for(; z != (*p)->end_vertex()->particles_end(HepMC::descendants); z++) {
234 if(
std::abs((*z)->pdg_id()) == 11 ||
std::abs((*z)->pdg_id()) == 13) lept_decay=
true;
236 taunet.SetPxPyPzE((*z)->momentum().px(),(*z)->momentum().py(),(*z)->momentum().pz(),(*z)->momentum().e());
239 if(lept_decay==
false) {
240 TLorentzVector jetMom=
tau-taunet;
243 }
else if(
std::abs((*p)->pdg_id()) == 11&&(*p)->status()==1) {
244 TLorentzVector elec((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
256 if ((*pfTauIsoDiscr)[thePFTau] == 1) {
274 TLorentzVector pftau((*thePFTau).px(),(*thePFTau).py(),(*thePFTau).pz(),(*thePFTau).energy());
282 hEoverP->Fill((*thePFTau).ecalStripSumEOverPLead());
283 hHoverP->Fill((*thePFTau).hcal3x3OverPLead());
284 hEmfrac->Fill((*thePFTau).emFraction());
286 if (
std::abs(myleadTk->eta())<1.5) {
290 }
else if (
std::abs(myleadTk->eta())>1.5 &&
std::abs(myleadTk->eta())<2.5) {
297 if ((*thePFTau).electronPreIDOutput()<-1)
300 hElecMVA->Fill((*thePFTau).electronPreIDOutput());
304 hHoPvsEoP->Fill((*thePFTau).ecalStripSumEOverPLead(),(*thePFTau).hcal3x3OverPLead());
305 hEmfracvsEoP->Fill((*thePFTau).emFraction(),(*thePFTau).hcal3x3OverPLead());
307 if ((*thePFTau).electronPreIDDecision()==1) {
311 hHoPvsEoP_preid1->Fill((*thePFTau).ecalStripSumEOverPLead(),(*thePFTau).hcal3x3OverPLead());
317 hHoPvsEoP_preid0->Fill((*thePFTau).ecalStripSumEOverPLead(),(*thePFTau).hcal3x3OverPLead());
326 std::vector<CandidatePtr> myPFCands=(*thePFTau).pfTauTagInfoRef()->PFCands();
327 for(
int i=0;
i<(
int)myPFCands.size();
i++){
329 if (pfCand ==
nullptr)
341 double deltaPhiOverQ = deltaPhi/(double)myleadTk->charge();
363 return (eta < 0.018 ||
364 (eta>0.423 && eta<0.461) ||
365 (eta>0.770 && eta<0.806) ||
366 (eta>1.127 && eta<1.163) ||
367 (eta>1.460 && eta<1.558));
double ecalEnergy() const
return corrected Ecal energy
int pdgId() const final
PDG identifier.
TH1F * hTauElecDiscriminant
bool isNonnull() const
Checks for non-null.
TH1F * hpfcand_deltaPhiOverQ
TH2F * hEmfracvsEoP_preid1
TH2F * hEmfracvsEoP_preid0
TH1F * hpfcand_deltaEta_weightE
double px() const final
x coordinate of momentum vector
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
bool isInEcalCrack(double eta) const
#define BOOK1D(name, title, nbinsx, lowx, highx)
const math::XYZPointF & positionAtECALEntrance() const
static const double deltaEta
reco::TrackRef trackRef() const
PFTauElecRejectionBenchmark()
std::vector< TLorentzVector > _GenObjects
double pz() const final
z coordinate of momentum vector
Abs< T >::type abs(const T &t)
bool isNonnull() const
Checks for non-null.
#define BOOK2D(name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)
#define SETAXES(name, xtitle, ytitle)
virtual ~PFTauElecRejectionBenchmark()
const HepMC::GenEvent * GetEvent() const
double py() const final
y coordinate of momentum vector
std::string sGenMatchObjectLabel_
Particle reconstructed by the particle flow algorithm.
std::string benchmarkLabel_
void process(edm::Handle< edm::HepMCProduct > mcevt, edm::Handle< reco::PFTauCollection > pfTaus, edm::Handle< reco::PFTauDiscriminator > pfTauIsoDiscr, edm::Handle< reco::PFTauDiscriminator > pfTauElecDiscr)
void setup(std::string Filename, std::string benchmarkLabel, double maxDeltaR, double minRecoPt, double maxRecoAbsEta, double minMCPt, double maxMCAbsEta, std::string sGenMatchObjectLabel, bool applyEcalCrackCut, DQMStore *db_store)
TH1F * hpfcand_deltaPhiOverQ_weightE