CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TauAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TauAnalyzer
4 // Class: L1TauAnalyzer
5 //
13 //
14 // Original Author: Chi Nhan Nguyen
15 // Created: Fri Feb 22 09:20:55 CST 2008
16 // $Id: L1TauAnalyzer.cc,v 1.7 2011/10/31 13:05:55 olzem Exp $
17 //
18 //
19 
21 
22 
23 //
24 // constructors and destructor
25 //
27 
28 {
29  _GenParticleSource = iConfig.getParameter<edm::InputTag>("GenParticleSource");
30  _PFTauSource = iConfig.getParameter<edm::InputTag>("PFTauSource");
31  _PFTauDiscriminatorSource = iConfig.getParameter<edm::InputTag>("PFTauDiscriminatorSource");
32 
33  _L1extraTauJetSource = iConfig.getParameter<edm::InputTag>("L1extraTauJetSource");
34  _L1extraCenJetSource = iConfig.getParameter<edm::InputTag>("L1extraCenJetSource");
35  _L1extraForJetSource = iConfig.getParameter<edm::InputTag>("L1extraForJetSource");
36  _L1extraMuonSource = iConfig.getParameter<edm::InputTag>("L1extraMuonSource");
37  _L1extraMETSource = iConfig.getParameter<edm::InputTag>("L1extraMETSource");
38  _L1extraNonIsoEgammaSource = iConfig.getParameter<edm::InputTag>("L1extraNonIsoEgammaSource");
39  _L1extraIsoEgammaSource = iConfig.getParameter<edm::InputTag>("L1extraIsoEgammaSource");
40 
41  _DoMCMatching = iConfig.getParameter<bool>("DoMCMatching");
42  _DoPFTauMatching = iConfig.getParameter<bool>("DoPFTauMatching");
43 
44  _L1MCTauMinDeltaR = iConfig.getParameter<double>("L1MCTauMinDeltaR");
45  _MCTauHadMinEt = iConfig.getParameter<double>("MCTauHadMinEt");
46  _MCTauHadMaxAbsEta = iConfig.getParameter<double>("MCTauHadMaxAbsEta");
47 
48  _PFMCTauMinDeltaR = iConfig.getParameter<double>("PFMCTauMinDeltaR");
49  _PFTauMinEt = iConfig.getParameter<double>("PFTauMinEt");
50  _PFTauMaxAbsEta = iConfig.getParameter<double>("PFTauMaxAbsEta");
51 
52  _SingleTauThreshold = iConfig.getParameter<double>("SingleTauThreshold");
53  _DoubleTauThreshold = iConfig.getParameter<double>("DoubleTauThreshold");
54  _SingleTauMETThresholds = iConfig.getParameter< std::vector<double> >("SingleTauMETThresholds");
55  _MuTauThresholds = iConfig.getParameter< std::vector<double> >("MuTauThresholds");
56  _IsoEgTauThresholds = iConfig.getParameter< std::vector<double> >("IsoEgTauThresholds");
57 
58  _L1GtReadoutRecord = iConfig.getParameter<edm::InputTag>("L1GtReadoutRecord");
59  _L1GtObjectMap = iConfig.getParameter<edm::InputTag>("L1GtObjectMap");
60 
61  _L1SingleTauName = iConfig.getParameter<std::string>("L1SingleTauName");
62  _L1DoubleTauName = iConfig.getParameter<std::string>("L1DoubleTauName");
63  _L1TauMETName = iConfig.getParameter<std::string>("L1TauMETName");
64  _L1MuonTauName = iConfig.getParameter<std::string>("L1MuonTauName");
65  _L1IsoEgTauName = iConfig.getParameter<std::string>("L1IsoEGTauName");
66 
67  _BosonPID = iConfig.getParameter<int>("BosonPID");
68 }
69 
70 
72 {
73 
74  // do anything here that needs to be done at desctruction time
75  // (e.g. close files, deallocate resources etc.)
76 
77 }
78 
79 
80 //
81 // member functions
82 //
83 
84 // ------------ method called to for each event ------------
85 void
87 {
88  using namespace edm;
89 
90  _nEvents++;
91 
92  // get object
93  getL1extraObjects(iEvent,iSetup);
94  if (_DoMCMatching)
95  getGenObjects(iEvent,iSetup);
96  if (_DoPFTauMatching)
97  getPFTauObjects(iEvent,iSetup);
98 
99  evalL1Decisions(iEvent);
101 
102  // fill simple histograms
104  if (_DoMCMatching)
106  if (_DoPFTauMatching)
108 
109  if (_DoMCMatching)
113 
114 }
115 
116 
117 // ------------ method called once each job just before starting event loop ------------
118 void
120 {
122  TFileDirectory dir = fs->mkdir("histos");
123 
124  //
125  h_L1TauEt = dir.make<TH1F>("L1TauEt","L1TauEt",50,0.,100.);
126  h_L1TauEt->Sumw2();
127  h_L1TauEta = dir.make<TH1F>("L1TauEta","L1TauEt",60,-4.,4.);
128  h_L1TauEta->Sumw2();
129  h_L1TauPhi = dir.make<TH1F>("L1TauPhi","L1TauPhi",50,-3.2,3.2);
130  h_L1TauPhi->Sumw2();
131 
132  h_L1Tau1Et = dir.make<TH1F>("L1Tau1Et","L1Tau1Et",50,0.,100.);
133  h_L1Tau1Et->Sumw2();
134  h_L1Tau1Eta = dir.make<TH1F>("L1Tau1Eta","L1Tau1Et",60,-4.,4.);
135  h_L1Tau1Eta->Sumw2();
136  h_L1Tau1Phi = dir.make<TH1F>("L1Tau1Phi","L1Tau1Phi",50,-3.2,3.2);
137  h_L1Tau1Phi->Sumw2();
138 
139  h_L1Tau2Et = dir.make<TH1F>("L1Tau2Et","L1Tau2Et",50,0.,100.);
140  h_L1Tau2Et->Sumw2();
141  h_L1Tau2Eta = dir.make<TH1F>("L1Tau2Eta","L1Tau2Et",60,-4.,4.);
142  h_L1Tau2Eta->Sumw2();
143  h_L1Tau2Phi = dir.make<TH1F>("L1Tau2Phi","L1Tau2Phi",50,-3.2,3.2);
144  h_L1Tau2Phi->Sumw2();
145 
146  //
147  h_GenTauHadEt = dir.make<TH1F>("GenTauHadEt","GenTauHadEt",50,0.,100.);
148  h_GenTauHadEt->Sumw2();
149  h_GenTauHadEta = dir.make<TH1F>("GenTauHadEta","GenTauHadEt",60,-4.,4.);
150  h_GenTauHadEta->Sumw2();
151  h_GenTauHadPhi = dir.make<TH1F>("GenTauHadPhi","GenTauHadPhi",50,-3.2,3.2);
152  h_GenTauHadPhi->Sumw2();
153 
154  //
155  h_PFTauEt = dir.make<TH1F>("PFTauEt","PFTauEt",50,0.,100.);
156  h_PFTauEt->Sumw2();
157  h_PFTauEta = dir.make<TH1F>("PFTauEta","PFTauEt",60,-4.,4.);
158  h_PFTauEta->Sumw2();
159  h_PFTauPhi = dir.make<TH1F>("PFTauPhi","PFTauPhi",50,-3.2,3.2);
160  h_PFTauPhi->Sumw2();
161 
162  // L1 response
163  h_L1MCTauDeltaR = dir.make<TH1F>("L1MCTauDeltaR","L1MCTauDeltaR",60,0.,6.);
164  h_L1MCTauDeltaR->Sumw2();
165  h_L1minusMCTauEt = dir.make<TH1F>("L1minusMCTauEt","L1minusMCTauEt",50,-50.,50.);
166  h_L1minusMCTauEt->Sumw2();
167  h_L1minusMCoverMCTauEt = dir.make<TH1F>("L1minusMCoverMCTauEt","L1minusMCoverMCTauEt",40,-1.2,1.2);
168  h_L1minusMCoverMCTauEt->Sumw2();
169 
170  // MC matching efficiencies
171  h_MCTauHadEt = dir.make<TH1F>("MCTauHadEt","MCTauHadEt",50,0.,100.);
172  h_MCTauHadEt->Sumw2();
173  h_MCTauHadEta = dir.make<TH1F>("MCTauHadEta","MCTauHadEt",60,-4.,4.);
174  h_MCTauHadEta->Sumw2();
175  h_MCTauHadPhi = dir.make<TH1F>("MCTauHadPhi","MCTauHadPhi",50,-3.2,3.2);
176  h_MCTauHadPhi->Sumw2();
177 
178  h_L1MCMatchedTauEt = dir.make<TH1F>("L1MCMatchedTauEt","L1MCMatchedTauEt",50,0.,100.);
179  h_L1MCMatchedTauEt->Sumw2();
180  h_L1MCMatchedTauEta = dir.make<TH1F>("L1MCMatchedTauEta","L1MCMatchedTauEt",60,-4.,4.);
181  h_L1MCMatchedTauEta->Sumw2();
182  h_L1MCMatchedTauPhi = dir.make<TH1F>("L1MCMatchedTauPhi","L1MCMatchedTauPhi",50,-3.2,3.2);
183  h_L1MCMatchedTauPhi->Sumw2();
184 
185  h_EffMCTauEt = dir.make<TH1F>("EffMCTauEt","EffMCTauEt",50,0.,100.);
186  h_EffMCTauEt->Sumw2();
187  h_EffMCTauEta = dir.make<TH1F>("EffMCTauEta","EffMCTauEt",60,-4.,4.);
188  h_EffMCTauEta->Sumw2();
189  h_EffMCTauPhi = dir.make<TH1F>("EffMCTauPhi","EffMCTauPhi",50,-3.2,3.2);
190  h_EffMCTauPhi->Sumw2();
191 
192  // PFTau-MC matching efficiencies
193  h_MCPFTauHadEt = dir.make<TH1F>("MCPFTauHadEt","MCPFTauHadEt",50,0.,100.);
194  h_MCPFTauHadEt->Sumw2();
195  h_MCPFTauHadEta = dir.make<TH1F>("MCPFTauHadEta","MCPFTauHadEt",60,-4.,4.);
196  h_MCPFTauHadEta->Sumw2();
197  h_MCPFTauHadPhi = dir.make<TH1F>("MCPFTauHadPhi","MCPFTauHadPhi",50,-3.2,3.2);
198  h_MCPFTauHadPhi->Sumw2();
199 
200  h_L1MCPFMatchedTauEt = dir.make<TH1F>("L1MCPFMatchedTauEt","L1MCPFMatchedTauEt",50,0.,100.);
201  h_L1MCPFMatchedTauEt->Sumw2();
202  h_L1MCPFMatchedTauEta = dir.make<TH1F>("L1MCPFMatchedTauEta","L1MCPFMatchedTauEt",60,-4.,4.);
203  h_L1MCPFMatchedTauEta->Sumw2();
204  h_L1MCPFMatchedTauPhi = dir.make<TH1F>("L1MCPFMatchedTauPhi","L1MCPFMatchedTauPhi",50,-3.2,3.2);
205  h_L1MCPFMatchedTauPhi->Sumw2();
206 
207  h_EffMCPFTauEt = dir.make<TH1F>("EffMCPFTauEt","EffMCPFTauEt",50,0.,100.);
208  h_EffMCPFTauEt->Sumw2();
209  h_EffMCPFTauEta = dir.make<TH1F>("EffMCPFTauEta","EffMCPFTauEt",60,-4.,4.);
210  h_EffMCPFTauEta->Sumw2();
211  h_EffMCPFTauPhi = dir.make<TH1F>("EffMCPFTauPhi","EffMCPFTauPhi",50,-3.2,3.2);
212  h_EffMCPFTauPhi->Sumw2();
213 
214  h_PFMCTauDeltaR = dir.make<TH1F>("PFMCTauDeltaR","PFMCTauDeltaR",60,0.,6.);
215  h_PFMCTauDeltaR->Sumw2();
216 
217 
218  h_L1SingleTauEffEt = dir.make<TH1F>("L1SingleTauEffEt","L1SingleTauEffEt",
219  50,0.,100.);
220  h_L1SingleTauEffEt->Sumw2();
221  h_L1DoubleTauEffEt = dir.make<TH1F>("L1DoubleTauEffEt","L1DoubleTauEffEt",
222  40,0.,80.);
223  h_L1DoubleTauEffEt->Sumw2();
224  h_L1SingleTauEffMCMatchEt = dir.make<TH1F>("L1SingleTauEffMCMatchEt","L1SingleTauEffMCMatchEt",
225  50,0.,100.);
226  h_L1SingleTauEffMCMatchEt->Sumw2();
227  h_L1DoubleTauEffMCMatchEt = dir.make<TH1F>("L1DoubleTauEffMCMatchEt","L1DoubleTauEffMCMatchEt",
228  40,0.,80.);
229  h_L1DoubleTauEffMCMatchEt->Sumw2();
230  h_L1SingleTauEffPFMCMatchEt = dir.make<TH1F>("L1SingleTauEffPFMCMatchEt","L1SingleTauEffPFMCMatchEt",
231  50,0.,100.);
233  h_L1DoubleTauEffPFMCMatchEt = dir.make<TH1F>("L1DoubleTauEffPFMCMatchEt","L1DoubleTauEffPFMCMatchEt",
234  40,0.,80.);
236 
237  // Init counters for event based efficiencies
238  _nEvents = 0; // all events processed
239 
240  _nEventsGenTauHad = 0;
244 
249 
254 
258 
262 
266 
270 
274 
275  // from GT bit info
281 
282 }
283 
284 // ------------ method called once each job just after ending the event loop ------------
285 void
287 
288  // MC matching efficiencies
289  h_EffMCTauEt->Divide(h_MCTauHadEt);
290  h_EffMCTauEta->Divide(h_MCTauHadEta);
291  h_EffMCTauPhi->Divide(h_MCTauHadPhi);
292 
293  // MC-PFTau matching efficiencies
297 
298  //
300  convertToIntegratedEff(h_L1DoubleTauEffEt,(double)_nEvents);
305 
306  //printTrigReport();
307 }
308 
309 void
311 {
312  using namespace edm;
313  using namespace l1extra;
314 
315  //
316  _L1Taus.clear();
318  iEvent.getByLabel(_L1extraTauJetSource,l1TauHandle);
319  for( L1JetParticleCollection::const_iterator itr = l1TauHandle->begin() ;
320  itr != l1TauHandle->end() ; ++itr ) {
321  TLorentzVector p(itr->px(),itr->py(),itr->pz(),itr->energy());
322  _L1Taus.push_back(p);
323  }
324 
325  //
326  _L1CenJets.clear();
327  Handle<L1JetParticleCollection> l1CenJetHandle;
328  iEvent.getByLabel(_L1extraCenJetSource,l1CenJetHandle);
329  for( L1JetParticleCollection::const_iterator itr = l1CenJetHandle->begin() ;
330  itr != l1CenJetHandle->end() ; ++itr ) {
331  TLorentzVector p(itr->px(),itr->py(),itr->pz(),itr->energy());
332  _L1CenJets.push_back(p);
333  }
334 
335  //
336  _L1ForJets.clear();
337  Handle<L1JetParticleCollection> l1ForJetHandle;
338  iEvent.getByLabel(_L1extraForJetSource,l1ForJetHandle);
339  for( L1JetParticleCollection::const_iterator itr = l1ForJetHandle->begin() ;
340  itr != l1ForJetHandle->end() ; ++itr ) {
341  TLorentzVector p(itr->px(),itr->py(),itr->pz(),itr->energy());
342  _L1ForJets.push_back(p);
343  }
344 
345  //
346  _L1IsoEgammas.clear();
347  Handle<L1EmParticleCollection> l1IsoEgammaHandle;
348  iEvent.getByLabel(_L1extraIsoEgammaSource,l1IsoEgammaHandle);
349  for( L1EmParticleCollection::const_iterator itr = l1IsoEgammaHandle->begin() ;
350  itr != l1IsoEgammaHandle->end() ; ++itr ) {
351  TLorentzVector p(itr->px(),itr->py(),itr->pz(),itr->energy());
352  _L1IsoEgammas.push_back(p);
353  }
354 
355  //
356  _L1NonIsoEgammas.clear();
357  Handle<L1EmParticleCollection> l1NonIsoEgammaHandle;
358  iEvent.getByLabel(_L1extraNonIsoEgammaSource,l1NonIsoEgammaHandle);
359  for( L1EmParticleCollection::const_iterator itr = l1NonIsoEgammaHandle->begin() ;
360  itr != l1NonIsoEgammaHandle->end() ; ++itr ) {
361  TLorentzVector p(itr->px(),itr->py(),itr->pz(),itr->energy());
362  _L1NonIsoEgammas.push_back(p);
363  }
364 
365  //
366  _L1Muons.clear();
367  _L1MuQuals.clear();
369  iEvent.getByLabel(_L1extraMuonSource,l1MuonHandle);
370  for( L1MuonParticleCollection::const_iterator itr = l1MuonHandle->begin() ;
371  itr != l1MuonHandle->end() ; ++itr ) {
372  TLorentzVector p(itr->px(),itr->py(),itr->pz(),itr->energy());
373  _L1Muons.push_back(p);
374  L1MuGMTExtendedCand gmtCand = itr->gmtMuonCand();
375  _L1MuQuals.push_back(gmtCand.quality());// Muon quality as defined in the GT
376  }
377 
378  //
379  _L1METs.clear();
381  iEvent.getByLabel(_L1extraMETSource,l1MetHandle);
382  for( L1EtMissParticleCollection::const_iterator itr = l1MetHandle->begin() ;
383  itr != l1MetHandle->end() ; ++itr ) {
384  TLorentzVector p(itr->px(),itr->py(),itr->pz(),itr->energy());
385  _L1METs.push_back(p);
386  }
387 
388 }
389 
390 void
392  using namespace edm;
393  using namespace reco;
394 
395  _PFTaus.clear();
396  Handle<PFTauCollection> thePFTauHandle;
397  iEvent.getByLabel(_PFTauSource,thePFTauHandle);
398  Handle<PFTauDiscriminatorByIsolation> thePFTauDiscriminatorByIsolation;
399  iEvent.getByLabel(_PFTauDiscriminatorSource,thePFTauDiscriminatorByIsolation);
400  for (PFTauCollection::size_type iPFTau=0;iPFTau<thePFTauHandle->size();iPFTau++) {
401  PFTauRef thePFTau(thePFTauHandle,iPFTau);
402  if ((*thePFTauDiscriminatorByIsolation)[thePFTau] == 1) {
403  TLorentzVector pftau((*thePFTau).px(),(*thePFTau).py(),(*thePFTau).pz(),(*thePFTau).energy());
404  _PFTaus.push_back(pftau);
405  }
406  }
407 }
408 
409 void
411  using namespace edm;
412  using namespace HepMC;
413 
415  // MC Truth based on RecoTauTag/HLTAnalyzers/src/TauJetMCFilter.cc
417  iEvent.getByLabel(_GenParticleSource, evt);
418  GenEvent * generated_event = new GenEvent(*(evt->GetEvent()));
419 
420  //init
421  _GenTauHads.clear();
422  _GenTauMuons.clear();
423  _GenTauElecs.clear();
424 
425  unsigned int nTauHads = 0; int nTauMuons = 0;int nTauElecs = 0; //
426  unsigned int nfidTauHads = 0; int nfidTauMuons = 0;int nfidTauElecs = 0; // count in fiducial region
427  TLorentzVector taunu,tauelec,taumuon;
428  GenEvent::particle_iterator p;
429 
430  for (p = generated_event->particles_begin(); p != generated_event->particles_end(); ++p) {
431  if(abs((*p)->pdg_id()) == _BosonPID && (*p)->end_vertex()) {
432  HepMC::GenVertex::particle_iterator z = (*p)->end_vertex()->particles_begin(HepMC::descendants);
433  for(; z != (*p)->end_vertex()->particles_end(HepMC::descendants); z++) {
434  if(abs((*z)->pdg_id()) == 15 && (*z)->status()==2) {
435  bool lept_decay = false;
436  TLorentzVector tau((*z)->momentum().px(),(*z)->momentum().py(),(*z)->momentum().pz(),(*z)->momentum().e());
437  HepMC::GenVertex::particle_iterator t = (*z)->end_vertex()->particles_begin(HepMC::descendants);
438  for(; t != (*z)->end_vertex()->particles_end(HepMC::descendants); t++) {
439  if(abs((*t)->pdg_id()) == 11 || abs((*t)->pdg_id()) == 13) lept_decay=true;
440  if(abs((*t)->pdg_id()) == 11) {
441  tauelec.SetPxPyPzE((*t)->momentum().px(),(*t)->momentum().py(),(*t)->momentum().pz(),(*t)->momentum().e());
442  _GenTauElecs.push_back(tauelec);
443  nTauElecs++;
444  if (tauelec.Et()>=_MCTauHadMinEt && tauelec.Eta()<=_MCTauHadMaxAbsEta )
445  nfidTauElecs++;
446  }
447  if(abs((*t)->pdg_id()) == 13) {
448  taumuon.SetPxPyPzE((*t)->momentum().px(),(*t)->momentum().py(),(*t)->momentum().pz(),(*t)->momentum().e());
449  _GenTauMuons.push_back(taumuon);
450  nTauMuons++;
451  if (taumuon.Et()>=_MCTauHadMinEt && taumuon.Eta()<=_MCTauHadMaxAbsEta )
452  nfidTauMuons++;
453  }
454  if(abs((*t)->pdg_id()) == 16)
455  taunu.SetPxPyPzE((*t)->momentum().px(),(*t)->momentum().py(),(*t)->momentum().pz(),(*t)->momentum().e());
456  }
457  if(lept_decay==false) {
458  TLorentzVector jetMom=tau-taunu;
459  _GenTauHads.push_back(jetMom);
460  nTauHads++;
461  if (jetMom.Et()>=_MCTauHadMinEt && jetMom.Eta()<=_MCTauHadMaxAbsEta )
462  nfidTauHads++;
463  }
464  }
465  }
466  }
467  }
468  delete generated_event;
469 
470  // Counters
471  if (nTauHads >= 1) _nEventsGenTauHad++;
472  if (nTauHads >= 2) _nEventsDoubleGenTauHads++;
473  if (nTauHads >= 1 && nTauMuons >= 1) _nEventsGenTauMuonTauHad++;
474  if (nTauHads >= 1 && nTauElecs >= 1) _nEventsGenTauElecTauHad++;
475 
477  if (nfidTauHads >= 1) _nfidEventsGenTauHad++;
478  if (nfidTauHads >= 2) _nfidEventsDoubleGenTauHads++;
479  if (nfidTauHads >= 1 && nfidTauMuons >= 1) _nfidEventsGenTauMuonTauHad++;
480  if (nfidTauHads >= 1 && nfidTauElecs >= 1) _nfidEventsGenTauElecTauHad++;
481 
482 }
483 
484 
485 void
487  for (int i=0; i<(int)_L1Taus.size(); i++) {
488  h_L1TauEt->Fill(_L1Taus[i].Et());
489  h_L1TauEta->Fill(_L1Taus[i].Eta());
490  h_L1TauPhi->Fill(_L1Taus[i].Phi());
491  if (i==0) {
492  h_L1Tau1Et->Fill(_L1Taus[i].Et());
493  h_L1Tau1Eta->Fill(_L1Taus[i].Eta());
494  h_L1Tau1Phi->Fill(_L1Taus[i].Phi());
495  }
496  if (i==1) {
497  h_L1Tau2Et->Fill(_L1Taus[i].Et());
498  h_L1Tau2Eta->Fill(_L1Taus[i].Eta());
499  h_L1Tau2Phi->Fill(_L1Taus[i].Phi());
500  }
501  }
502 
503 }
504 
505 void
507  for (int i=0; i<(int)_GenTauHads.size(); i++) {
508  h_GenTauHadEt->Fill(_GenTauHads[i].Et());
509  h_GenTauHadEta->Fill(_GenTauHads[i].Eta());
510  h_GenTauHadPhi->Fill(_GenTauHads[i].Phi());
511  }
512  // Denominators for MC matching efficiencies
513  for (int i=0; i<(int)_GenTauHads.size(); i++) {
515  h_MCTauHadEt->Fill(_GenTauHads[i].Et());
516  if (_GenTauHads[i].Et()>=_MCTauHadMinEt)
517  h_MCTauHadEta->Fill(_GenTauHads[i].Eta());
519  h_MCTauHadPhi->Fill(_GenTauHads[i].Phi());
520  }
521 }
522 
523 void
525  for (int i=0; i<(int)_PFTaus.size(); i++) {
526  h_PFTauEt->Fill(_PFTaus[i].Et());
527  h_PFTauEta->Fill(_PFTaus[i].Eta());
528  h_PFTauPhi->Fill(_PFTaus[i].Phi());
529  }
530 }
531 
532 
533 
534 void
536  using namespace edm;
537  using namespace std;
538 
540  iEvent.getByLabel(_L1GtReadoutRecord,l1GtRR);
542  iEvent.getByLabel(_L1GtObjectMap,l1GtOMRec);
543 
544  L1GlobalTriggerReadoutRecord L1GTRR = *l1GtRR.product();
545  L1GlobalTriggerObjectMapRecord L1GTOMRec = *l1GtOMRec.product();
546 
547  DecisionWord gtDecisionWord = L1GTRR.decisionWord();
548  string l1BitName;
549  int l1Accept;
550  // get ObjectMaps from ObjectMapRecord
551  const vector<L1GlobalTriggerObjectMap>& objMapVec = L1GTOMRec.gtObjectMap();
552  for (vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
553  itMap != objMapVec.end(); ++itMap) {
554  int iBit = (*itMap).algoBitNumber();
555  l1BitName = string( (*itMap).algoName() );
556  l1Accept = gtDecisionWord[iBit];
557  //cout<<l1BitName<<" "<<l1Accept<<endl;
558  if (l1BitName.compare(_L1SingleTauName)==0) {
559  //cout<<l1BitName<<" "<<l1Accept<<endl;
560  if (l1Accept) _nEventsL1GTSingleTauPassed++;
561  }
562  if (l1BitName.compare(_L1DoubleTauName)==0) {
563  if (l1Accept) _nEventsL1GTDoubleTauPassed++;
564  }
565  if (l1BitName.compare(_L1TauMETName)==0) {
566  if (l1Accept) _nEventsL1GTSingleTauMETPassed++;
567  }
568  if (l1BitName.compare(_L1MuonTauName)==0) {
569  if (l1Accept) _nEventsL1GTMuonTauPassed++;
570  }
571  if (l1BitName.compare(_L1IsoEgTauName)==0) {
572  if (l1Accept) _nEventsL1GTIsoEgTauPassed++;
573  }
574  }
575 }
576 
577 void
579  bool singleTauPassed = false;
580  bool doubleTauPassed = false;
581  bool muTauPassed = false;
582  bool isoEgTauPassed = false;
583  bool singleTauMETPassed = false;
584 
585  int nL1Taus = _L1Taus.size();
586  int nL1Muons = _L1Muons.size();
587  int nL1IsoEgammas = _L1IsoEgammas.size();
588 
589 
590  if (nL1Taus>=1) {
591  h_L1SingleTauEffEt->Fill(_L1Taus[0].Et());
592  if (_L1Taus[0].Et()>=_SingleTauThreshold)
593  singleTauPassed = true;
594  }
595  if (nL1Taus>=2 ) {
596  h_L1DoubleTauEffEt->Fill(_L1Taus[1].Et());
597  if (_L1Taus[1].Et()>=_DoubleTauThreshold)
598  doubleTauPassed = true;
599  }
600 
601  if (nL1Taus>=1 && _L1Taus[0].Et()>=_SingleTauMETThresholds[0] &&
602  _L1METs[0].Et()>=_SingleTauMETThresholds[1])
603  singleTauMETPassed = true;
604 
605  if (nL1Taus>=1 && _L1Taus[0].Et()>=_MuTauThresholds[1] &&
606  nL1Muons>=1 && _L1Muons[0].Pt()>=_MuTauThresholds[0]) {
607  //if ( _L1MuQuals[0]==4 || _L1MuQuals[0]==5 || _L1MuQuals[0]==6 || _L1MuQuals[0]==7 ) {
608  //if ( _L1MuQuals[0]==3 || _L1MuQuals[0]==5 || _L1MuQuals[0]==6 || _L1MuQuals[0]==7 ) {
609  if ( _L1MuQuals[0]>=0) {
610  muTauPassed = true;
611  }
612  }
613 
614  for (int i=0;i<nL1Taus;i++) {
615  for (int j=0;j<nL1IsoEgammas;j++) {
616  if (_L1Taus[i].Et()>=_IsoEgTauThresholds[1] &&
617  _L1IsoEgammas[j].Et()>=_IsoEgTauThresholds[0]) {
618  //double deltaR = ROOT::Math::VectorUtil::DeltaR(_L1Taus[i],_GenTauHads[j]);
619  double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(_L1Taus[i],_L1IsoEgammas[j]);
620  double deltaEta = std::abs(_L1Taus[i].Eta()-_L1IsoEgammas[j].Eta());
621  // Non-collinearity check
622  if (deltaPhi>0.348 && deltaEta>0.348) {
623  isoEgTauPassed = true;
624  break;
625  }
626  }
627  }
628  }
629 
630  if (singleTauPassed) _nEventsL1SingleTauPassed++;
631  if (doubleTauPassed) _nEventsL1DoubleTauPassed++;
632  if (singleTauMETPassed) _nEventsL1SingleTauMETPassed++;
633  if (muTauPassed) _nEventsL1MuonTauPassed++;
634  if (isoEgTauPassed) _nEventsL1IsoEgTauPassed++;
635 }
636 
637 
638 void
640  bool singleTauPassed = false;
641  bool doubleTauPassed = false;
642  bool muTauPassed = false;
643  bool isoEgTauPassed = false;
644  bool singleTauMETPassed = false;
645 
646  bool singleMatch = false; // for doubletau match
647  bool doubleMatch = false;
648  int iSingle = -1;
649  int iDouble = -1;
650 
651  for (unsigned int i = 0; i<_L1Taus.size();i++) {
652  for (unsigned int j = 0; j<_GenTauHads.size();j++) {
653  double deltaR = ROOT::Math::VectorUtil::DeltaR(_L1Taus[i],_GenTauHads[j]);
654  h_L1MCTauDeltaR->Fill(deltaR);
655  if (deltaR < _L1MCTauMinDeltaR) {
656  if (_GenTauHads[j].Et()>=_MCTauHadMinEt) {
657  //if (std::abs(_GenTauHads[j].Eta())<=_MCTauHadMaxAbsEta) {
658  h_L1minusMCTauEt->Fill(_L1Taus[i].Et() - _GenTauHads[j].Et());
659  h_L1minusMCoverMCTauEt->Fill( (_L1Taus[i].Et() - _GenTauHads[j].Et()) / _GenTauHads[j].Et());
660  // For event efficiencies
661  if (singleMatch) {
662  doubleMatch = true;
663  iDouble = i;
664  }
665  singleMatch = true;
666  if (singleMatch && !doubleMatch)
667  iSingle = i;
668  }
669  // Numerators for MC matching efficiencies
671  h_L1MCMatchedTauEt->Fill(_GenTauHads[j].Et());
672  h_EffMCTauEt->Fill(_GenTauHads[j].Et());
673  }
674  if (_GenTauHads[j].Et()>=_MCTauHadMinEt) {
675  h_L1MCMatchedTauEta->Fill(_GenTauHads[j].Eta());
676  h_EffMCTauEta->Fill(_GenTauHads[j].Eta());
677  }
679  h_L1MCMatchedTauPhi->Fill(_GenTauHads[j].Phi());
680  h_EffMCTauPhi->Fill(_GenTauHads[j].Phi());
681  }
682  //break;
683  }
684  }
685  }
686  if (singleMatch && iSingle>=0) {
687  h_L1SingleTauEffMCMatchEt->Fill(_L1Taus[iSingle].Et());
688  if (_L1Taus[iSingle].Et()>=_SingleTauThreshold)
689  singleTauPassed = true;
690 
691  /*
692  // Ask for only one L1Tau to be matched with PFTau!!!
693  if (_L1Taus.size()>=2) {
694  h_L1DoubleTauEffPFMCMatchEt->Fill(_L1Taus[1].Et());
695  if (_L1Taus[1].Et()>=_DoubleTauThreshold)
696  doubleTauPassed = true;
697  }
698  */
699 
700  if (_L1Taus[iSingle].Et()>=_SingleTauMETThresholds[0] &&
701  _L1METs[0].Et()>=_SingleTauMETThresholds[1])
702  singleTauMETPassed = true;
703 
704  if (_L1Taus[iSingle].Et()>=_MuTauThresholds[1]) {
705  for (int i=0;i<(int)_L1Muons.size();i++) {
706  if (_L1Muons[i].Pt()>=_MuTauThresholds[0]) {
707  //if ( _L1MuQuals[0]==4 || _L1MuQuals[0]==5 || _L1MuQuals[0]==6 || _L1MuQuals[0]==7 ) {
708  //if ( _L1MuQuals[0]==3 || _L1MuQuals[0]==5 || _L1MuQuals[0]==6 || _L1MuQuals[0]==7 ) {
709  if ( _L1MuQuals[i]>=0) {
710  for (int j=0;j<(int)_GenTauMuons.size();j++) {
711  double deltaR = ROOT::Math::VectorUtil::DeltaR(_GenTauMuons[j],_L1Muons[i]);
712  if (deltaR<0.3) {
713  muTauPassed = true;
714  }
715  }
716  }
717  }
718  }
719  }
720 
721  for (int j=0;j<(int)_L1IsoEgammas.size();j++) {
722  if (_L1Taus[iSingle].Et()>=_IsoEgTauThresholds[1] &&
723  _L1IsoEgammas[j].Et()>=_IsoEgTauThresholds[0]) {
724  double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(_L1Taus[iSingle],_L1IsoEgammas[j]);
725  double deltaEta = std::abs(_L1Taus[iSingle].Eta()-_L1IsoEgammas[j].Eta());
726  // Non-collinearity check
727  if (deltaPhi>0.348 && deltaEta>0.348) {
728  for (int k=0;k<(int)_GenTauElecs.size();k++) {
729  double deltaR = ROOT::Math::VectorUtil::DeltaR(_GenTauElecs[k],_L1IsoEgammas[j]);
730  if (deltaR<0.3) {
731  isoEgTauPassed = true;
732  break;
733  }
734  }
735  }
736  }
737  }
738  }
739 
740  if (doubleMatch && iDouble>=0) {
741  h_L1DoubleTauEffMCMatchEt->Fill(_L1Taus[iDouble].Et());
742  if (_L1Taus[iDouble].Et()>=_DoubleTauThreshold)
743  doubleTauPassed = true;
744  for (int j=0;j<(int)_L1IsoEgammas.size();j++) {
745  if (_L1Taus[iDouble].Et()>=_IsoEgTauThresholds[1] &&
746  _L1IsoEgammas[j].Et()>=_IsoEgTauThresholds[0]) {
747  double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(_L1Taus[iDouble],_L1IsoEgammas[j]);
748  double deltaEta = std::abs(_L1Taus[iDouble].Eta()-_L1IsoEgammas[j].Eta());
749  // Non-collinearity check
750  if (deltaPhi>0.348 && deltaEta>0.348) {
751  for (int k=0;k<(int)_GenTauElecs.size();k++) {
752  double deltaR = ROOT::Math::VectorUtil::DeltaR(_GenTauElecs[k],_L1IsoEgammas[j]);
753  if (deltaR<0.3) {
754  isoEgTauPassed = true;
755  break;
756  }
757  }
758  }
759  }
760  }
761  }
762 
763  if (singleTauPassed) _nEventsL1SingleTauPassedMCMatched++;
764  if (doubleTauPassed) _nEventsL1DoubleTauPassedMCMatched++;
765  if (singleTauMETPassed) _nEventsL1SingleTauMETPassedMCMatched++;
766  if (muTauPassed) _nEventsL1MuonTauPassedMCMatched++;
767  if (isoEgTauPassed) _nEventsL1IsoEgTauPassedMCMatched++;
768 
769 }
770 
771 void
773  bool singleTauPassed = false;
774  bool doubleTauPassed = false;
775  bool muTauPassed = false;
776  bool isoEgTauPassed = false;
777  bool singleTauMETPassed = false;
778 
779  bool singleMatch = false; // for doubletau match
780  bool doubleMatch = false;
781  int iSingle = -1;
782  int iDouble = -1;
783 
784  unsigned int nPFMatchGenTauHad = 0;
785 
786  std::vector<TLorentzVector> PFMatchedGenTauHads;
787  PFMatchedGenTauHads.clear();// store PFTau matched gentaus
788  for (unsigned int j = 0; j<_GenTauHads.size();j++) {
789  for (unsigned int k = 0; k<_PFTaus.size();k++) {
790  double deltaR = ROOT::Math::VectorUtil::DeltaR(_PFTaus[k],_GenTauHads[j]);
791  h_PFMCTauDeltaR->Fill(deltaR);
792  if (_PFTaus[k].Et()>=_PFTauMinEt && _PFTaus[k].Eta()<=_PFTauMaxAbsEta) {
793  if (deltaR < _PFMCTauMinDeltaR) {
794  // Denominators for PF-MC matching efficiencies
796  h_MCPFTauHadEt->Fill(_GenTauHads[j].Et());
797  if (_GenTauHads[j].Et()>=_MCTauHadMinEt)
798  h_MCPFTauHadEta->Fill(_GenTauHads[j].Eta());
799  if (_GenTauHads[j].Et()>=_MCTauHadMinEt &&
801  h_MCPFTauHadPhi->Fill(_GenTauHads[j].Phi());
802  nPFMatchGenTauHad++; // For denominator
803  PFMatchedGenTauHads.push_back(_GenTauHads[j]);// store PFTau matched gentaus
804  }
805  break;
806  }
807  }
808  }
809  }
810  // now loop over only PFTau matched gentaus
811  for (unsigned int i = 0; i<_L1Taus.size();i++) {
812  for (unsigned int j = 0; j<PFMatchedGenTauHads.size();j++) {
813  double deltaR = ROOT::Math::VectorUtil::DeltaR(_L1Taus[i],PFMatchedGenTauHads[j]);
814  if (deltaR < _L1MCTauMinDeltaR) {
815  // For event efficiencies
816  if (singleMatch) {
817  doubleMatch = true;
818  iDouble = i;
819  }
820  singleMatch = true;
821  if (singleMatch && !doubleMatch)
822  iSingle = i;
823 
824  // Numerators for PF-MC matching efficiencies
825  h_L1MCPFMatchedTauEt->Fill(PFMatchedGenTauHads[j].Et());
826  h_EffMCPFTauEt->Fill(PFMatchedGenTauHads[j].Et());
827  h_L1MCPFMatchedTauEta->Fill(PFMatchedGenTauHads[j].Eta());
828  h_EffMCPFTauEta->Fill(PFMatchedGenTauHads[j].Eta());
829  h_L1MCPFMatchedTauPhi->Fill(PFMatchedGenTauHads[j].Phi());
830  h_EffMCPFTauPhi->Fill(PFMatchedGenTauHads[j].Phi());
831  }
832  //break;
833  }
834  }
835 
836  if (singleMatch && iSingle>=0) {
837  h_L1SingleTauEffPFMCMatchEt->Fill(_L1Taus[iSingle].Et());
838  if (_L1Taus[iSingle].Et()>=_SingleTauThreshold)
839  singleTauPassed = true;
840 
841  /*
842  // Ask for only one L1Tau to be matched with PFTau!!!
843  if (_L1Taus.size()>=2) {
844  h_L1DoubleTauEffPFMCMatchEt->Fill(_L1Taus[1].Et());
845  if (_L1Taus[1].Et()>=_DoubleTauThreshold)
846  doubleTauPassed = true;
847  }
848  */
849 
850  if (_L1Taus[iSingle].Et()>=_SingleTauMETThresholds[0] &&
851  _L1METs[0].Et()>=_SingleTauMETThresholds[1])
852  singleTauMETPassed = true;
853 
854  if (_L1Taus[iSingle].Et()>=_MuTauThresholds[1]) {
855  for (int i=0;i<(int)_L1Muons.size();i++) {
856  if (_L1Muons[i].Pt()>=_MuTauThresholds[0]) {
857  //if ( _L1MuQuals[0]==4 || _L1MuQuals[0]==5 || _L1MuQuals[0]==6 || _L1MuQuals[0]==7 ) {
858  //if ( _L1MuQuals[0]==3 || _L1MuQuals[0]==5 || _L1MuQuals[0]==6 || _L1MuQuals[0]==7 ) {
859  if ( _L1MuQuals[i]>=0) {
860  for (int j=0;j<(int)_GenTauMuons.size();j++) {
861  double deltaR = ROOT::Math::VectorUtil::DeltaR(_GenTauMuons[j],_L1Muons[i]);
862  if (deltaR<0.3) {
863  muTauPassed = true;
864  }
865  }
866  }
867  }
868  }
869  }
870  for (int j=0;j<(int)_L1IsoEgammas.size();j++) {
871  if (_L1Taus[iSingle].Et()>=_IsoEgTauThresholds[1] &&
872  _L1IsoEgammas[j].Et()>=_IsoEgTauThresholds[0]) {
873  double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(_L1Taus[iSingle],_L1IsoEgammas[j]);
874  double deltaEta = std::abs(_L1Taus[iSingle].Eta()-_L1IsoEgammas[j].Eta());
875  // Non-collinearity check
876  if (deltaPhi>0.348 && deltaEta>0.348) {
877  for (int k=0;k<(int)_GenTauElecs.size();k++) {
878  double deltaR = ROOT::Math::VectorUtil::DeltaR(_GenTauElecs[k],_L1IsoEgammas[j]);
879  if (deltaR<0.3) {
880  isoEgTauPassed = true;
881  break;
882  }
883  }
884  }
885  }
886  }
887  }
888  if (doubleMatch && iDouble>=0) {
889  h_L1DoubleTauEffPFMCMatchEt->Fill(_L1Taus[iDouble].Et());
890  if (_L1Taus[iDouble].Et()>=_DoubleTauThreshold)
891  doubleTauPassed = true;
892 
893  for (int j=0;j<(int)_L1IsoEgammas.size();j++) {
894  if (_L1Taus[iDouble].Et()>=_IsoEgTauThresholds[1] &&
895  _L1IsoEgammas[j].Et()>=_IsoEgTauThresholds[0]) {
896  double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(_L1Taus[iDouble],_L1IsoEgammas[j]);
897  double deltaEta = std::abs(_L1Taus[iDouble].Eta()-_L1IsoEgammas[j].Eta());
898  // Non-collinearity check
899  if (deltaPhi>0.348 && deltaEta>0.348) {
900  for (int k=0;k<(int)_GenTauElecs.size();k++) {
901  double deltaR = ROOT::Math::VectorUtil::DeltaR(_GenTauElecs[k],_L1IsoEgammas[j]);
902  if (deltaR<0.3) {
903  isoEgTauPassed = true;
904  break;
905  }
906  }
907  }
908  }
909  }
910  }
911 
912  unsigned int nfidMCGenTauMuon = 0;
913  unsigned int nfidMCGenTauElec = 0;
914  for (int i = 0; i<(int)_GenTauMuons.size();i++) {
916  nfidMCGenTauMuon++;
917  }
918  }
919  for (int i = 0; i<(int)_GenTauElecs.size();i++) {
921  nfidMCGenTauElec++;
922  }
923  }
924 
925  if (nPFMatchGenTauHad>=1) _nEventsPFMatchGenTauHad++;
926  if (nPFMatchGenTauHad>=2) _nEventsPFMatchDoubleGenTauHads++;
927 
928  if (nPFMatchGenTauHad>=1 && nfidMCGenTauMuon>=1) _nEventsPFMatchGenTauMuonTauHad++;
929  if (nPFMatchGenTauHad>=1 && nfidMCGenTauElec>=1) _nEventsPFMatchGenTauElecTauHad++;
930 
931  if (singleTauPassed) _nEventsL1SingleTauPassedPFMCMatched++;
932  if (doubleTauPassed) _nEventsL1DoubleTauPassedPFMCMatched++;
933  if (singleTauMETPassed) _nEventsL1SingleTauMETPassedPFMCMatched++;
934  if (muTauPassed) _nEventsL1MuonTauPassedPFMCMatched++;
935  if (isoEgTauPassed) _nEventsL1IsoEgTauPassedPFMCMatched++;
936 
937 }
938 
939 void
941 {
942  // Convert the histogram to efficiency
943  // Assuming that the histogram is incremented with weight=1 for each event
944  // this function integrates the histogram contents above every bin and stores it
945  // in that bin. The result is plot of integral rate versus threshold plot.
946  int nbins = histo->GetNbinsX();
947  double integral = histo->GetBinContent(nbins+1); // Initialize to overflow
948  if (nGenerated<=0) {
949  std::cerr << "***** L1TauAnalyzer::convertToIntegratedEff() Error: nGenerated = " << nGenerated << std::endl;
950  nGenerated=1;
951  }
952  for(int i = nbins; i >= 1; i--)
953  {
954  double thisBin = histo->GetBinContent(i);
955  integral += thisBin;
956  double integralEff;
957  double integralError;
958  integralEff = (integral / nGenerated);
959  histo->SetBinContent(i, integralEff);
960  // error
961  integralError = (sqrt(integral) / nGenerated);
962  histo->SetBinError(i, integralError);
963  }
964 }
965 
966 void
968  using namespace std;
969 
970  cout<<"****************************************"<<endl;
971  cout<<"* L1extra Efficiency Report"<<endl;
972  cout<<"****************************************"<<endl;
973  cout<<"Total number of Events: "<<_nEvents<<endl;
974  cout<<"---------------------------------------------------------------------------------------------"<<endl;
975  cout<<" #PassL1 GlobEff GlEff/BR(fid.) MCMatchEff PFMCMatchEff BR(fid.) BR"<<endl;
976  cout<<"---------------------------------------------------------------------------------------------"<<endl;
977  cout<<" SingleTau ("<<_SingleTauThreshold<<"): "
978  <<setw(6)<<_nEventsL1SingleTauPassed<<" "
979  <<setprecision(2)<<setw(7)<<(double)_nEventsL1SingleTauPassed/(double)_nEvents<<" "
980  <<setprecision(2)<<setw(13)<<(double)_nEventsL1SingleTauPassed/(double)_nfidEventsGenTauHad<<" "
981  <<setprecision(2)<<setw(10)<<(double)_nEventsL1SingleTauPassedMCMatched/(double)_nfidEventsGenTauHad<<" "
982  <<setprecision(2)<<setw(12)<<(double)_nEventsL1SingleTauPassedPFMCMatched/(double)_nEventsPFMatchGenTauHad<<" "
983  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauHad/(double)_nEvents<<" "
984  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauHad/(double)_nEvents<<" "
985  <<endl;
986  cout<<" DoubleTau ("<<_DoubleTauThreshold<<"): "
987  <<setw(6)<<_nEventsL1DoubleTauPassed<<" "
988  <<setprecision(2)<<setw(7)<<(double)_nEventsL1DoubleTauPassed/(double)_nEvents<<" "
989  <<setprecision(2)<<setw(13)<<(double)_nEventsL1DoubleTauPassed/(double)_nfidEventsDoubleGenTauHads<<" "
990  <<setprecision(2)<<setw(10)<<(double)_nEventsL1DoubleTauPassedMCMatched/(double)_nfidEventsDoubleGenTauHads<<" "
991  <<setprecision(2)<<setw(12)<<(double)_nEventsL1DoubleTauPassedPFMCMatched/(double)_nEventsPFMatchDoubleGenTauHads<<" "
992  <<setprecision(2)<<setw(8)<<(double)_nfidEventsDoubleGenTauHads/(double)_nEvents<<" "
993  <<setprecision(2)<<setw(7)<<(double)_nEventsDoubleGenTauHads/(double)_nEvents<<" "
994  <<endl;
995  cout<<" TauMET ("<<_SingleTauMETThresholds[0]<<","<<_SingleTauMETThresholds[1]<<"): "
996  <<setw(6)<<_nEventsL1SingleTauMETPassed<<" "
997  <<setprecision(2)<<setw(7)<<(double)_nEventsL1SingleTauMETPassed/(double)_nEvents<<" "
998  <<setprecision(2)<<setw(13)<<(double)_nEventsL1SingleTauMETPassed/(double)_nfidEventsGenTauHad<<" "
999  <<setprecision(2)<<setw(10)<<(double)_nEventsL1SingleTauMETPassedMCMatched/(double)_nfidEventsGenTauHad<<" "
1000  <<setprecision(2)<<setw(12)<<(double)_nEventsL1SingleTauMETPassedPFMCMatched/(double)_nEventsPFMatchGenTauHad<<" "
1001  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauHad/(double)_nEvents<<" "
1002  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauHad/(double)_nEvents<<" "
1003  <<endl;
1004  cout<<" MuTau ("<<_MuTauThresholds[0]<<","<<_MuTauThresholds[1]<<"): "
1005  <<setw(6)<<_nEventsL1MuonTauPassed<<" "
1006  <<setprecision(2)<<setw(7)<<(double)_nEventsL1MuonTauPassed/(double)_nEvents<<" "
1007  <<setprecision(2)<<setw(13)<<(double)_nEventsL1MuonTauPassed/(double)_nfidEventsGenTauMuonTauHad<<" "
1008  <<setprecision(2)<<setw(10)<<(double)_nEventsL1MuonTauPassedMCMatched/(double)_nfidEventsGenTauMuonTauHad<<" "
1009  <<setprecision(2)<<setw(12)<<(double)_nEventsL1MuonTauPassedPFMCMatched/(double)_nEventsPFMatchGenTauMuonTauHad<<" "
1010  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauMuonTauHad/(double)_nEvents<<" "
1011  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauMuonTauHad/(double)_nEvents<<" "
1012  <<endl;
1013  cout<<"IsoEgTau ("<<_IsoEgTauThresholds[0]<<","<<_IsoEgTauThresholds[1]<<"): "
1014  <<setw(6)<<_nEventsL1IsoEgTauPassed<<" "
1015  <<setprecision(2)<<setw(7)<<(double)_nEventsL1IsoEgTauPassed/(double)_nEvents<<" "
1016  <<setprecision(2)<<setw(13)<<(double)_nEventsL1IsoEgTauPassed/(double)_nfidEventsGenTauElecTauHad<<" "
1017  <<setprecision(2)<<setw(10)<<(double)_nEventsL1IsoEgTauPassedMCMatched/(double)_nfidEventsGenTauElecTauHad<<" "
1018  <<setprecision(2)<<setw(12)<<(double)_nEventsL1IsoEgTauPassedPFMCMatched/(double)_nEventsPFMatchGenTauElecTauHad<<" "
1019  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauElecTauHad/(double)_nEvents<<" "
1020  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauElecTauHad/(double)_nEvents<<" "
1021  <<endl;
1022 
1023  cout<<endl;
1024 
1025  cout<<"****************************************"<<endl;
1026  cout<<"* L1 GT Efficiency Report"<<endl;
1027  cout<<"****************************************"<<endl;
1028  cout<<"Total number of Events: "<<_nEvents<<endl;
1029  cout<<"---------------------------------------------------------------------------------------"<<endl;
1030  cout<<" #PassL1 GlobEff GlobEff/BR(fid.) BR(fid.) BR"<<endl;
1031  cout<<"---------------------------------------------------------------------------------------"<<endl;
1032  cout<<setw(20)<<_L1SingleTauName<<": "
1033  <<setw(7)<<_nEventsL1GTSingleTauPassed<<" "
1034  <<setprecision(2)<<setw(7)<<setw(7)<<(double)_nEventsL1GTSingleTauPassed/(double)_nEvents<<" "
1035  <<setprecision(2)<<setw(16)<<(double)_nEventsL1GTSingleTauPassed/(double)_nfidEventsGenTauHad<<" "
1036  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauHad/(double)_nEvents<<" "
1037  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauHad/(double)_nEvents<<" "
1038  <<endl;
1039  cout<<setw(20)<<_L1DoubleTauName<<": "
1040  <<setw(7)<<_nEventsL1GTDoubleTauPassed<<" "
1041  <<setprecision(2)<<setw(7)<<(double)_nEventsL1GTDoubleTauPassed/(double)_nEvents<<" "
1042  <<setprecision(2)<<setw(16)<<(double)_nEventsL1GTDoubleTauPassed/(double)_nfidEventsDoubleGenTauHads<<" "
1043  <<setprecision(2)<<setw(8)<<(double)_nfidEventsDoubleGenTauHads/(double)_nEvents<<" "
1044  <<setprecision(2)<<setw(7)<<(double)_nEventsDoubleGenTauHads/(double)_nEvents<<" "
1045  <<endl;
1046  cout<<setw(20)<<_L1TauMETName<<": "
1047  <<setw(7)<<_nEventsL1GTSingleTauMETPassed<<" "
1048  <<setprecision(2)<<setw(7)<<(double)_nEventsL1GTSingleTauMETPassed/(double)_nEvents<<" "
1049  <<setprecision(2)<<setw(16)<<(double)_nEventsL1GTSingleTauMETPassed/(double)_nfidEventsGenTauHad<<" "
1050  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauHad/(double)_nEvents<<" "
1051  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauHad/(double)_nEvents<<" "
1052  <<endl;
1053  cout<<setw(20)<<_L1MuonTauName<<": "
1054  <<setw(7)<<_nEventsL1GTMuonTauPassed<<" "
1055  <<setprecision(2)<<setw(7)<<(double)_nEventsL1GTMuonTauPassed/(double)_nEvents<<" "
1056  <<setprecision(2)<<setw(16)<<(double)_nEventsL1GTMuonTauPassed/(double)_nfidEventsGenTauMuonTauHad<<" "
1057  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauMuonTauHad/(double)_nEvents<<" "
1058  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauMuonTauHad/(double)_nEvents<<" "
1059  <<endl;
1060  cout<<setw(20)<<_L1IsoEgTauName<<": "
1061  <<setw(7)<<_nEventsL1GTIsoEgTauPassed<<" "
1062  <<setprecision(2)<<setw(7)<<(double)_nEventsL1GTIsoEgTauPassed/(double)_nEvents<<" "
1063  <<setprecision(2)<<setw(16)<<(double)_nEventsL1GTIsoEgTauPassed/(double)_nfidEventsGenTauElecTauHad<<" "
1064  <<setprecision(2)<<setw(8)<<(double)_nfidEventsGenTauElecTauHad/(double)_nEvents<<" "
1065  <<setprecision(2)<<setw(7)<<(double)_nEventsGenTauElecTauHad/(double)_nEvents<<" "
1066  <<endl;
1067 
1068  cout<<endl;
1069 
1070 }
1071 
1072 //define this as a plug-in
1073 //DEFINE_FWK_MODULE(L1TauAnalyzer);
double _PFMCTauMinDeltaR
TH1 * h_MCPFTauHadEta
TH1 * h_L1MCMatchedTauEta
TH1 * h_L1DoubleTauEffPFMCMatchEt
T getParameter(std::string const &) const
void evalL1Decisions(const edm::Event &iEvent)
int _nfidEventsDoubleGenTauHads
int i
Definition: DBlmapReader.cc:9
int _nEventsL1GTIsoEgTauPassed
double _L1MCTauMinDeltaR
TH1 * h_EffMCPFTauEt
int _nEventsPFMatchGenTauElecTauHad
int _nEventsL1IsoEgTauPassedMCMatched
double _SingleTauThreshold
TH1 * h_L1SingleTauEffEt
std::vector< double > _MuTauThresholds
TH1 * h_L1MCPFMatchedTauEt
int _nEventsL1GTDoubleTauPassed
std::vector< TLorentzVector > _GenTauElecs
edm::InputTag _L1extraIsoEgammaSource
void calcL1MCPFTauMatching()
TH1 * h_L1DoubleTauEffMCMatchEt
TH1 * h_MCPFTauHadEt
edm::InputTag _PFTauSource
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< TLorentzVector > _L1ForJets
void getL1extraObjects(const edm::Event &, const edm::EventSetup &)
edm::InputTag _PFTauDiscriminatorSource
TH1 * h_PFMCTauDeltaR
std::string _L1SingleTauName
TH1 * h_L1MCPFMatchedTauPhi
#define abs(x)
Definition: mlp_lapack.h:159
edm::InputTag _GenParticleSource
int _nEventsL1SingleTauPassedPFMCMatched
std::vector< TLorentzVector > _GenTauMuons
int _nEventsPFMatchGenTauHad
int _nfidEventsGenTauHad
edm::InputTag _L1extraCenJetSource
uint16_t size_type
std::vector< TLorentzVector > _PFTaus
float float float z
TH1 * h_L1MCPFMatchedTauEta
edm::InputTag _L1extraTauJetSource
int _nEventsGenTauMuonTauHad
const std::vector< L1GlobalTriggerObjectMap > & gtObjectMap() const
get / set the vector of object maps
TH1 * h_L1MCMatchedTauPhi
int _nEventsL1SingleTauPassed
double _PFTauMinEt
TH1 * h_MCPFTauHadPhi
edm::InputTag _L1GtReadoutRecord
std::vector< TLorentzVector > _L1IsoEgammas
int _nEventsL1GTSingleTauPassed
std::vector< TLorentzVector > _GenTauHads
int iEvent
Definition: GenABIO.cc:243
std::vector< TLorentzVector > _L1CenJets
int _nEventsL1GTSingleTauMETPassed
TH1 * h_L1DoubleTauEffEt
void fillL1Histograms()
edm::InputTag _L1extraMuonSource
std::vector< bool > DecisionWord
typedefs
TH1 * h_L1minusMCoverMCTauEt
void convertToIntegratedEff(TH1 *, double)
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< int > _L1MuQuals
int _nEventsL1IsoEgTauPassedPFMCMatched
void fillPFTauHistograms()
double _MCTauHadMaxAbsEta
int _nEventsL1SingleTauMETPassedPFMCMatched
std::vector< TLorentzVector > _L1METs
int _nEventsL1IsoEgTauPassed
int j
Definition: DBlmapReader.cc:9
int _nEventsGenTauElecTauHad
TH1 * h_L1MCMatchedTauEt
TH1 * h_L1SingleTauEffPFMCMatchEt
virtual void endJob()
double _PFTauMaxAbsEta
std::vector< TLorentzVector > _L1Muons
int _nfidEventsGenTauElecTauHad
int _nEventsL1DoubleTauPassedMCMatched
int _nEventsL1DoubleTauPassed
TH1 * h_L1minusMCTauEt
TH1 * h_EffMCPFTauPhi
virtual void beginJob()
int _nEventsL1MuonTauPassedPFMCMatched
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:69
void getPFTauObjects(const edm::Event &, const edm::EventSetup &)
int k[5][pyjets_maxn]
std::vector< double > _IsoEgTauThresholds
int _nEventsL1SingleTauMETPassed
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
TH1 * h_L1MCTauDeltaR
void getGenObjects(const edm::Event &, const edm::EventSetup &)
std::vector< TLorentzVector > _L1NonIsoEgammas
int _nEventsPFMatchGenTauMuonTauHad
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:95
std::vector< TLorentzVector > _L1Taus
std::string _L1TauMETName
int _nEventsL1SingleTauMETPassedMCMatched
int _nEventsL1DoubleTauPassedPFMCMatched
std::string _L1MuonTauName
std::string _L1IsoEgTauName
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
edm::InputTag _L1extraForJetSource
int _nEventsL1MuonTauPassedMCMatched
void printTrigReport()
int _nfidEventsGenTauMuonTauHad
double _MCTauHadMinEt
edm::InputTag _L1extraNonIsoEgammaSource
void fillGenHistograms()
int _nEventsDoubleGenTauHads
T * make() const
make new ROOT object
TH1 * h_GenTauHadEta
tuple cout
Definition: gather_cfg.py:121
double _DoubleTauThreshold
int _nEventsL1MuonTauPassed
TH1 * h_GenTauHadPhi
dbl *** dir
Definition: mlp_gen.cc:35
L1TauAnalyzer(const edm::ParameterSet &)
int _nEventsPFMatchDoubleGenTauHads
int _nEventsL1SingleTauPassedMCMatched
std::string _L1DoubleTauName
std::vector< double > _SingleTauMETThresholds
void calcL1MCTauMatching()
edm::InputTag _L1extraMETSource
void evalL1extraDecisions()
edm::InputTag _L1GtObjectMap
TH1 * h_L1SingleTauEffMCMatchEt
TH1 * h_EffMCPFTauEta
int _nEventsL1GTMuonTauPassed