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;
49 string benchmarkLabel,
55 string sGenMatchObjectLabel,
56 bool applyEcalCrackCut,
72 cout<<
"PFTauElecRejectionBenchmark Setup parameters =============================================="<<endl;
73 cout <<
"Filename to write histograms " << Filename<<endl;
75 cout <<
"maxDeltaRMax " << maxDeltaR << endl;
93 cout <<
"Info: DQM is not available to provide data storage service. Using TFile to save histograms. "<<endl;
97 BOOK1D(EoverP,
"E/p",100, 0., 4.);
98 SETAXES(EoverP,
"E/p",
"Entries");
100 BOOK1D(EoverP_barrel,
"E/p barrel",100, 0., 4.);
101 SETAXES(EoverP_barrel,
"E/p barrel",
"Entries");
103 BOOK1D(EoverP_endcap,
"E/p endcap",100, 0., 4.);
104 SETAXES(EoverP_endcap,
"E/p endcap",
"Entries");
106 BOOK1D(EoverP_preid0,
"E/p (preid=0)",100, 0., 4.);
107 SETAXES(EoverP_preid0,
"E/p",
"Entries");
109 BOOK1D(EoverP_preid1,
"E/p (preid=1)",100, 0., 4.);
110 SETAXES(EoverP_preid1,
"E/p",
"Entries");
113 BOOK1D(HoverP,
"H/p",100, 0., 2.);
114 SETAXES(HoverP,
"H/p",
"Entries");
116 BOOK1D(HoverP_barrel,
"H/p barrel",100, 0., 2.);
117 SETAXES(HoverP_barrel,
"H/p barrel",
"Entries");
119 BOOK1D(HoverP_endcap,
"H/p endcap",100, 0., 2.);
120 SETAXES(HoverP_endcap,
"H/p endcap",
"Entries");
122 BOOK1D(HoverP_preid0,
"H/p (preid=0)",100, 0., 2.);
123 SETAXES(HoverP_preid0,
"H/p",
"Entries");
125 BOOK1D(HoverP_preid1,
"H/p (preid=1)",100, 0., 2.);
126 SETAXES(HoverP_preid1,
"H/p",
"Entries");
129 BOOK1D(Emfrac,
"EM fraction",100, 0., 1.01);
130 SETAXES(Emfrac,
"em fraction",
"Entries");
132 BOOK1D(Emfrac_barrel,
"EM fraction barrel",100, 0., 1.01);
133 SETAXES(Emfrac_barrel,
"em fraction barrel",
"Entries");
135 BOOK1D(Emfrac_endcap,
"EM fraction endcap",100, 0., 1.01);
136 SETAXES(Emfrac_endcap,
"em fraction endcap",
"Entries");
138 BOOK1D(Emfrac_preid0,
"EM fraction (preid=0)",100, 0., 1.01);
139 SETAXES(Emfrac_preid0,
"em fraction",
"Entries");
141 BOOK1D(Emfrac_preid1,
"EM fraction (preid=1)",100, 0., 1.01);
142 SETAXES(Emfrac_preid1,
"em fraction",
"Entries");
145 BOOK1D(ElecPreID,
"PFElectron PreID decision",6, 0., 1.01);
146 SETAXES(ElecPreID,
"PFElectron PreID decision",
"Entries");
149 BOOK1D(ElecMVA,
"PFElectron MVA",100, -1.01, 1.01);
150 SETAXES(ElecMVA,
"PFElectron MVA",
"Entries");
153 BOOK1D(TauElecDiscriminant,
"PFTau-Electron Discriminant",6, 0., 1.01);
154 SETAXES(TauElecDiscriminant,
"PFTau-Electron Discriminant",
"Entries");
158 BOOK1D(pfcand_deltaEta,
"PFCand cluster dEta",100, 0., 0.8);
159 SETAXES(pfcand_deltaEta,
"PFCand cluster #Delta(#eta)",
"Entries");
161 BOOK1D(pfcand_deltaEta_weightE,
"PFCand cluster dEta, energy weighted",100, 0., 0.8);
162 SETAXES(pfcand_deltaEta_weightE,
"PFCand cluster #Delta(#eta)",
"Entries");
164 BOOK1D(pfcand_deltaPhiOverQ,
"PFCand cluster dPhi/q",100, -0.8, 0.8);
165 SETAXES(pfcand_deltaPhiOverQ,
"PFCand cluster #Delta(#phi)/q",
"Entries");
167 BOOK1D(pfcand_deltaPhiOverQ_weightE,
"PFCand cluster dEta/q, energy weighted",100, -0.8, 0.8);
168 SETAXES(pfcand_deltaPhiOverQ_weightE,
"PFCand cluster #Delta(#phi)/q",
"Entries");
172 BOOK1D(leadTk_pt,
"leading KF track pt",100, 0., 80.);
173 SETAXES(leadTk_pt,
"leading KF track p_{T} (GeV)",
"Entries");
175 BOOK1D(leadTk_eta,
"leading KF track eta",100, -4., 4.);
176 SETAXES(leadTk_eta,
"leading KF track #eta",
"Entries");
178 BOOK1D(leadTk_phi,
"leading KF track phi",100, -3.2, 3.2);
179 SETAXES(leadTk_phi,
"leading KF track #phi",
"Entries");
182 BOOK1D(leadGsfTk_pt,
"leading Gsf track pt",100, 0., 80.);
183 SETAXES(leadGsfTk_pt,
"leading Gsf track p_{T} (GeV)",
"Entries");
185 BOOK1D(leadGsfTk_eta,
"leading Gsf track eta",100, -4., 4.);
186 SETAXES(leadGsfTk_eta,
"leading Gsf track #eta",
"Entries");
188 BOOK1D(leadGsfTk_phi,
"leading Gsf track phi",100, -3.2, 3.2);
189 SETAXES(leadGsfTk_phi,
"leading Gsf track #phi",
"Entries");
193 BOOK2D(HoPvsEoP,
"H/p vs. E/p",100, 0., 2., 100, 0., 2.);
194 SETAXES(HoPvsEoP,
"E/p",
"H/p");
196 BOOK2D(HoPvsEoP_preid0,
"H/p vs. E/p (preid=0)",100, 0., 2., 100, 0., 2.);
197 SETAXES(HoPvsEoP_preid0,
"E/p",
"H/p");
199 BOOK2D(HoPvsEoP_preid1,
"H/p vs. E/p (preid=0)",100, 0., 2., 100, 0., 2.);
200 SETAXES(HoPvsEoP_preid1,
"E/p",
"H/p");
203 BOOK2D(EmfracvsEoP,
"emfrac vs. E/p",100, 0., 2., 100, 0., 1.01);
204 SETAXES(EmfracvsEoP,
"E/p",
"em fraction");
206 BOOK2D(EmfracvsEoP_preid0,
"emfrac vs. E/p (preid=0)",100, 0., 2., 100, 0., 1.01);
207 SETAXES(EmfracvsEoP_preid0,
"E/p",
"em fraction");
209 BOOK2D(EmfracvsEoP_preid1,
"emfrac vs. E/p (preid=0)",100, 0., 2., 100, 0., 1.01);
210 SETAXES(EmfracvsEoP_preid1,
"E/p",
"em fraction");
222 HepMC::GenEvent * generated_event =
new HepMC::GenEvent(*(mcevt->GetEvent()));
225 TLorentzVector taunet;
226 HepMC::GenEvent::particle_iterator
p;
227 for (p = generated_event->particles_begin(); p != generated_event->particles_end(); p++) {
228 if(
std::abs((*p)->pdg_id()) == 15&&(*p)->status()==2) {
229 bool lept_decay =
false;
230 TLorentzVector
tau((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
231 HepMC::GenVertex::particle_iterator
z = (*p)->end_vertex()->particles_begin(HepMC::descendants);
232 for(; z != (*p)->end_vertex()->particles_end(HepMC::descendants); z++) {
233 if(
std::abs((*z)->pdg_id()) == 11 ||
std::abs((*z)->pdg_id()) == 13) lept_decay=
true;
235 taunet.SetPxPyPzE((*z)->momentum().px(),(*z)->momentum().py(),(*z)->momentum().pz(),(*z)->momentum().e());
238 if(lept_decay==
false) {
239 TLorentzVector jetMom=
tau-taunet;
242 }
else if(
std::abs((*p)->pdg_id()) == 11&&(*p)->status()==1) {
243 TLorentzVector elec((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
255 if ((*pfTauIsoDiscr)[thePFTau] == 1) {
260 if(thePFTau->leadPFChargedHadrCand().
isNonnull()){
261 myleadTk=thePFTau->leadPFChargedHadrCand()->trackRef();
262 myleadTkEcalPos = thePFTau->leadPFChargedHadrCand()->positionAtECALEntrance();
272 TLorentzVector pftau((*thePFTau).px(),(*thePFTau).py(),(*thePFTau).pz(),(*thePFTau).energy());
280 hEoverP->Fill((*thePFTau).ecalStripSumEOverPLead());
281 hHoverP->Fill((*thePFTau).hcal3x3OverPLead());
282 hEmfrac->Fill((*thePFTau).emFraction());
284 if (
std::abs(myleadTk->eta())<1.5) {
288 }
else if (
std::abs(myleadTk->eta())>1.5 &&
std::abs(myleadTk->eta())<2.5) {
295 if ((*thePFTau).electronPreIDOutput()<-1)
298 hElecMVA->Fill((*thePFTau).electronPreIDOutput());
302 hHoPvsEoP->Fill((*thePFTau).ecalStripSumEOverPLead(),(*thePFTau).hcal3x3OverPLead());
303 hEmfracvsEoP->Fill((*thePFTau).emFraction(),(*thePFTau).hcal3x3OverPLead());
305 if ((*thePFTau).electronPreIDDecision()==1) {
309 hHoPvsEoP_preid1->Fill((*thePFTau).ecalStripSumEOverPLead(),(*thePFTau).hcal3x3OverPLead());
315 hHoPvsEoP_preid0->Fill((*thePFTau).ecalStripSumEOverPLead(),(*thePFTau).hcal3x3OverPLead());
325 for(
int i=0;
i<(int)myPFCands.
size();
i++){
328 if (myPFCands[
i]->particleId()==1 || myPFCands[
i]->particleId()==2)
329 candPos = myPFCands[
i]->positionAtECALEntrance();
334 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myleadTkEcalPos,candPos);
336 double deltaPhiOverQ = deltaPhi/(double)myleadTk->charge();
358 return (eta < 0.018 ||
359 (eta>0.423 && eta<0.461) ||
360 (eta>0.770 && eta<0.806) ||
361 (eta>1.127 && eta<1.163) ||
362 (eta>1.460 && eta<1.558));
TH1F * hTauElecDiscriminant
TH1F * hpfcand_deltaPhiOverQ
TH2F * hEmfracvsEoP_preid1
TH2F * hEmfracvsEoP_preid0
TH1F * hpfcand_deltaEta_weightE
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
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)
bool isNonnull() const
Checks for non-null.
PFTauElecRejectionBenchmark()
std::vector< TLorentzVector > _GenObjects
#define BOOK2D(name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)
#define SETAXES(name, xtitle, ytitle)
virtual ~PFTauElecRejectionBenchmark()
std::string sGenMatchObjectLabel_
std::string benchmarkLabel_
size_type size() const
Size of the RefVector.
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)
void setCurrentFolder(const std::string &fullpath)
TH1F * hpfcand_deltaPhiOverQ_weightE