00001 // -*- C++ -*- 00002 // 00003 // Package: L1TauAnalyzer 00004 // Class: L1TauAnalyzer 00005 // 00013 // 00014 // Original Author: Chi Nhan Nguyen 00015 // Created: Fri Feb 22 09:20:55 CST 2008 00016 // $Id: L1TauAnalyzer.h,v 1.4 2010/01/12 06:38:12 hegner Exp $ 00017 // 00018 // 00019 00020 00021 // system include files 00022 #include <memory> 00023 #include <vector> 00024 #include <string> 00025 #include <iostream> 00026 #include <iomanip> 00027 00028 // user include files 00029 #include "FWCore/Framework/interface/Frameworkfwd.h" 00030 #include "FWCore/Framework/interface/EDAnalyzer.h" 00031 #include "FWCore/Framework/interface/Event.h" 00032 #include "FWCore/Framework/interface/MakerMacros.h" 00033 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00034 00035 #include "DataFormats/TauReco/interface/PFTau.h" 00036 #include "DataFormats/TauReco/interface/PFTauDiscriminatorByIsolation.h" 00037 00038 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" 00039 #include <Math/GenVector/VectorUtil.h> 00040 #include "TLorentzVector.h" 00041 00042 #include "FWCore/ServiceRegistry/interface/Service.h" // Framework services 00043 #include "CommonTools/UtilAlgos/interface/TFileService.h" // Framework service for histograms 00044 00045 #include "TH1.h" 00046 00047 // L1 Trigger data formats 00048 #include "DataFormats/L1Trigger/interface/L1EmParticle.h" 00049 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h" 00050 #include "DataFormats/L1Trigger/interface/L1JetParticle.h" 00051 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" 00052 #include "DataFormats/L1Trigger/interface/L1MuonParticle.h" 00053 #include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h" 00054 #include "DataFormats/L1Trigger/interface/L1EtMissParticle.h" 00055 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h" 00056 #include "DataFormats/L1Trigger/interface/L1ParticleMap.h" 00057 #include "DataFormats/L1Trigger/interface/L1ParticleMapFwd.h" 00058 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" 00059 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" 00060 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" 00061 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" 00062 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" 00063 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTExtendedCand.h" 00064 00065 // 00066 // class decleration 00067 // 00068 00069 class L1TauAnalyzer : public edm::EDAnalyzer { 00070 public: 00071 explicit L1TauAnalyzer(const edm::ParameterSet&); 00072 ~L1TauAnalyzer(); 00073 00074 00075 private: 00076 virtual void beginJob() ; 00077 virtual void analyze(const edm::Event&, const edm::EventSetup&); 00078 virtual void endJob() ; 00079 00080 00081 void getGenObjects(const edm::Event&, const edm::EventSetup&); 00082 void getPFTauObjects(const edm::Event&, const edm::EventSetup&); 00083 void getL1extraObjects(const edm::Event&, const edm::EventSetup&); 00084 00085 void fillL1Histograms(); 00086 void fillGenHistograms(); 00087 void fillPFTauHistograms(); 00088 00089 void evalL1Decisions(const edm::Event& iEvent); 00090 void evalL1extraDecisions(); 00091 00092 void calcL1MCTauMatching(); 00093 void calcL1MCPFTauMatching(); 00094 00095 void convertToIntegratedEff(TH1*,double); 00096 void printTrigReport(); 00097 00098 // ----------member data --------------------------- 00099 00100 edm::InputTag _PFTauSource; 00101 edm::InputTag _PFTauDiscriminatorSource; 00102 edm::InputTag _GenParticleSource; 00103 00104 edm::InputTag _L1extraTauJetSource; 00105 edm::InputTag _L1extraCenJetSource; 00106 edm::InputTag _L1extraForJetSource; 00107 edm::InputTag _L1extraNonIsoEgammaSource; 00108 edm::InputTag _L1extraIsoEgammaSource; 00109 edm::InputTag _L1extraMETSource; 00110 edm::InputTag _L1extraMuonSource; 00111 00112 edm::InputTag _L1GtReadoutRecord; 00113 edm::InputTag _L1GtObjectMap; 00114 00115 bool _DoMCMatching; 00116 bool _DoPFTauMatching; 00117 00118 // PDG id for 00119 int _BosonPID; 00120 00121 // Cuts 00122 double _L1MCTauMinDeltaR; 00123 double _MCTauHadMinEt; 00124 double _MCTauHadMaxAbsEta; 00125 00126 double _PFMCTauMinDeltaR; 00127 double _PFTauMinEt; 00128 double _PFTauMaxAbsEta; 00129 00130 // Thresholds of L1 menu 00131 double _SingleTauThreshold; 00132 double _DoubleTauThreshold; 00133 std::vector<double> _SingleTauMETThresholds; 00134 std::vector<double> _MuTauThresholds; 00135 std::vector<double> _IsoEgTauThresholds; 00136 00137 // L1 menu names 00138 std::string _L1SingleTauName; 00139 std::string _L1DoubleTauName; 00140 std::string _L1TauMETName; 00141 std::string _L1MuonTauName; 00142 std::string _L1IsoEgTauName; 00143 00144 // Gen Objects 00145 std::vector<TLorentzVector> _GenTauMuons; 00146 std::vector<TLorentzVector> _GenTauElecs; 00147 std::vector<TLorentzVector> _GenTauHads; 00148 00149 // Tagged PFTau Objects 00150 std::vector<TLorentzVector> _PFTaus; 00151 00152 // L1extra Objects 00153 std::vector<TLorentzVector> _L1Taus; 00154 std::vector<TLorentzVector> _L1CenJets; 00155 std::vector<TLorentzVector> _L1ForJets; 00156 std::vector<TLorentzVector> _L1NonIsoEgammas; 00157 std::vector<TLorentzVector> _L1IsoEgammas; 00158 std::vector<TLorentzVector> _L1METs; 00159 std::vector<TLorentzVector> _L1Muons; 00160 std::vector<int> _L1MuQuals; 00161 00162 00163 // histograms 00164 TH1* h_L1TauEt; 00165 TH1* h_L1TauEta; 00166 TH1* h_L1TauPhi; 00167 00168 TH1* h_L1Tau1Et; 00169 TH1* h_L1Tau1Eta; 00170 TH1* h_L1Tau1Phi; 00171 00172 TH1* h_L1Tau2Et; 00173 TH1* h_L1Tau2Eta; 00174 TH1* h_L1Tau2Phi; 00175 00176 // 00177 TH1* h_GenTauHadEt; 00178 TH1* h_GenTauHadEta; 00179 TH1* h_GenTauHadPhi; 00180 00181 // 00182 TH1* h_PFTauEt; 00183 TH1* h_PFTauEta; 00184 TH1* h_PFTauPhi; 00185 00186 // L1 response 00187 TH1* h_L1MCTauDeltaR; 00188 TH1* h_L1minusMCTauEt; 00189 TH1* h_L1minusMCoverMCTauEt; 00190 00191 // MC matching efficiencies 00192 TH1* h_EffMCTauEt; 00193 TH1* h_EffMCTauEta; 00194 TH1* h_EffMCTauPhi; 00195 // Numerators 00196 TH1* h_L1MCMatchedTauEt; 00197 TH1* h_L1MCMatchedTauEta; 00198 TH1* h_L1MCMatchedTauPhi; 00199 // Denominators 00200 TH1* h_MCTauHadEt; 00201 TH1* h_MCTauHadEta; 00202 TH1* h_MCTauHadPhi; 00203 00204 // MCPF matching efficiencies 00205 TH1* h_EffMCPFTauEt; 00206 TH1* h_EffMCPFTauEta; 00207 TH1* h_EffMCPFTauPhi; 00208 // Numerators 00209 TH1* h_L1MCPFMatchedTauEt; 00210 TH1* h_L1MCPFMatchedTauEta; 00211 TH1* h_L1MCPFMatchedTauPhi; 00212 // Denominators 00213 TH1* h_MCPFTauHadEt; 00214 TH1* h_MCPFTauHadEta; 00215 TH1* h_MCPFTauHadPhi; 00216 00217 TH1* h_PFMCTauDeltaR; 00218 00219 00220 // Event based efficiencies as a function of thresholds 00221 TH1* h_L1SingleTauEffEt; 00222 TH1* h_L1DoubleTauEffEt; 00223 TH1* h_L1SingleTauEffMCMatchEt; 00224 TH1* h_L1DoubleTauEffMCMatchEt; 00225 TH1* h_L1SingleTauEffPFMCMatchEt; 00226 TH1* h_L1DoubleTauEffPFMCMatchEt; 00227 00228 // Counters for event based efficiencies 00229 int _nEvents; // all events processed 00230 00231 int _nEventsGenTauHad; 00232 int _nEventsDoubleGenTauHads; 00233 int _nEventsGenTauMuonTauHad; 00234 int _nEventsGenTauElecTauHad; 00235 00236 int _nfidEventsGenTauHad; 00237 int _nfidEventsDoubleGenTauHads; 00238 int _nfidEventsGenTauMuonTauHad; 00239 int _nfidEventsGenTauElecTauHad; 00240 00241 int _nEventsPFMatchGenTauHad; 00242 int _nEventsPFMatchDoubleGenTauHads; 00243 int _nEventsPFMatchGenTauMuonTauHad; 00244 int _nEventsPFMatchGenTauElecTauHad; 00245 00246 int _nEventsL1SingleTauPassed; 00247 int _nEventsL1SingleTauPassedMCMatched; 00248 int _nEventsL1SingleTauPassedPFMCMatched; 00249 00250 int _nEventsL1DoubleTauPassed; 00251 int _nEventsL1DoubleTauPassedMCMatched; 00252 int _nEventsL1DoubleTauPassedPFMCMatched; 00253 00254 int _nEventsL1SingleTauMETPassed; 00255 int _nEventsL1SingleTauMETPassedMCMatched; 00256 int _nEventsL1SingleTauMETPassedPFMCMatched; 00257 00258 int _nEventsL1MuonTauPassed; 00259 int _nEventsL1MuonTauPassedMCMatched; 00260 int _nEventsL1MuonTauPassedPFMCMatched; 00261 00262 int _nEventsL1IsoEgTauPassed; 00263 int _nEventsL1IsoEgTauPassedMCMatched; 00264 int _nEventsL1IsoEgTauPassedPFMCMatched; 00265 00266 // from GT bit info 00267 int _nEventsL1GTSingleTauPassed; 00268 int _nEventsL1GTDoubleTauPassed; 00269 int _nEventsL1GTSingleTauMETPassed; 00270 int _nEventsL1GTMuonTauPassed; 00271 int _nEventsL1GTIsoEgTauPassed; 00272 00273 }; 00274 00275 // 00276 // constants, enums and typedefs 00277 // 00278 00279 // 00280 // static data member definitions 00281 // 00282