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