CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/Physics/src/EwkTauDQM.h

Go to the documentation of this file.
00001 #ifndef DQM_Physics_EwkTauDQM_h
00002 #define DQM_Physics_EwkTauDQM_h
00003 
00022 #include "FWCore/Framework/interface/EDAnalyzer.h"
00023 
00024 #include "DQMServices/Core/interface/DQMStore.h"
00025 
00026 #include <string>
00027 #include <Math/VectorUtil.h>
00028 class EwkElecTauHistManager;
00029 class EwkMuTauHistManager;
00030 
00031 class EwkTauDQM : public edm::EDAnalyzer 
00032 {
00033  public:
00034   EwkTauDQM(const edm::ParameterSet&);
00035   ~EwkTauDQM();
00036 
00037   void beginJob();
00038   void analyze(const edm::Event&, const edm::EventSetup&);
00039   void endJob();
00040   
00041  private:
00042   DQMStore* dqmStore_;
00043   std::string dqmDirectory_;
00044   int dqmError_;
00045   int maxNumWarnings_;
00046 
00047   EwkElecTauHistManager* elecTauHistManager_;
00048   EwkMuTauHistManager* muTauHistManager_;
00049 };
00050 
00051 //-------------------------------------------------------------------------------
00052 // code specific to Z --> e + tau-jet channel
00053 //-------------------------------------------------------------------------------
00054 
00069 #include "FWCore/Framework/interface/Event.h"
00070 #include "FWCore/Framework/interface/EventSetup.h"
00071 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00072 #include "FWCore/Utilities/interface/InputTag.h"
00073 
00074 #include "DQMServices/Core/interface/MonitorElement.h"
00075 
00076 #include <string>
00077 
00078 class EwkElecTauHistManager
00079 {
00080  public:
00081   EwkElecTauHistManager(const edm::ParameterSet&, DQMStore*);
00082 
00083   void bookHistograms();
00084   void fillHistograms(const edm::Event&, const edm::EventSetup&);
00085   void finalizeHistograms(); 
00086 
00087  private:
00088 
00089 //--- labels of electron, tau-jet and MEt collections being used
00090 //    in event selection and when filling histograms
00091   edm::InputTag triggerResultsSource_;
00092   edm::InputTag vertexSource_;
00093   edm::InputTag beamSpotSource_;
00094   edm::InputTag electronSource_;
00095   edm::InputTag tauJetSource_;
00096   edm::InputTag caloMEtSource_;
00097   edm::InputTag pfMEtSource_;
00098 
00099   edm::InputTag tauDiscrByLeadTrackFinding_;
00100   edm::InputTag tauDiscrByLeadTrackPtCut_;
00101   edm::InputTag tauDiscrByTrackIso_;
00102   edm::InputTag tauDiscrByEcalIso_;
00103   edm::InputTag tauDiscrAgainstElectrons_;
00104   edm::InputTag tauDiscrAgainstMuons_;
00105 
00106 //--- event selection criteria
00107   typedef std::vector<std::string> vstring;
00108   vstring hltPaths_;
00109 
00110   double electronEtaCut_;
00111   double electronPtCut_;
00112   double electronTrackIsoCut_;
00113   double electronEcalIsoCut_;
00114   int electronIsoMode_;
00115 
00116   double tauJetEtaCut_;
00117   double tauJetPtCut_;
00118 
00119   double visMassCut_;
00120 
00121 //--- pointer to DQM histogram management service
00122   DQMStore* dqmStore_;
00123 
00124 //--- name of DQM directory in which histograms for Z --> electron + tau-jet channel get stored
00125   std::string dqmDirectory_;
00126   
00127 //--- histograms  
00128   //MonitorElement* hNumIdElectrons_;
00129   MonitorElement* hElectronPt_;
00130   MonitorElement* hElectronEta_;
00131   MonitorElement* hElectronPhi_;
00132   MonitorElement* hElectronTrackIsoPt_;
00133   MonitorElement* hElectronEcalIsoPt_;
00134   //MonitorElement* hElectronHcalIsoPt_;
00135 
00136   MonitorElement* hTauJetPt_;
00137   MonitorElement* hTauJetEta_;
00138   //MonitorElement* hTauJetPhi_;
00139   //MonitorElement* hTauLeadTrackPt_;
00140   //MonitorElement* hTauTrackIsoPt_;
00141   //MonitorElement* hTauEcalIsoPt_;
00142   //MonitorElement* hTauDiscrAgainstElectrons_;
00143   //MonitorElement* hTauDiscrAgainstMuons_;
00144   //MonitorElement* hTauJetCharge_;
00145   //MonitorElement* hTauJetNumSignalTracks_;
00146   //MonitorElement* hTauJetNumIsoTracks_;
00147   
00148   MonitorElement* hVisMass_;
00149   //MonitorElement* hMtElecCaloMEt_;
00150   MonitorElement* hMtElecPFMEt_;
00151   //MonitorElement* hPzetaCaloMEt_;
00152   //MonitorElement* hPzetaPFMEt_;
00153   MonitorElement* hElecTauAcoplanarity_;
00154   MonitorElement* hElecTauCharge_;
00155 
00156   //MonitorElement* hVertexChi2_;
00157   MonitorElement* hVertexZ_;
00158   //MonitorElement* hVertexD0_;
00159 
00160   MonitorElement* hCaloMEtPt_;
00161   //MonitorElement* hCaloMEtPhi_;
00162 
00163   MonitorElement* hPFMEtPt_;
00164   //MonitorElement* hPFMEtPhi_;
00165 
00166   MonitorElement* hCutFlowSummary_;
00167   enum { kPassedPreselection = 1, kPassedTrigger = 2, kPassedElectronId = 3, kPassedElectronTrackIso = 4, kPassedElectronEcalIso = 5,
00168          kPassedTauLeadTrack = 6, kPassedTauLeadTrackPt = 7, kPassedTauDiscrAgainstElectrons = 8, kPassedTauDiscrAgainstMuons = 9,
00169          kPassedTauTrackIso = 10, kPassedTauEcalIso = 11 
00170        }; 
00171 
00172 //--- counters for filter-statistics output
00173   unsigned numEventsAnalyzed_;
00174   unsigned numEventsSelected_;
00175 
00176   int cfgError_;
00177 
00178   int maxNumWarnings_;
00179 
00180   long numWarningsTriggerResults_;
00181   long numWarningsHLTpath_;
00182   long numWarningsVertex_;
00183   long numWarningsBeamSpot_;
00184   long numWarningsElectron_;
00185   long numWarningsTauJet_;
00186   long numWarningsTauDiscrByLeadTrackFinding_;
00187   long numWarningsTauDiscrByLeadTrackPtCut_;
00188   long numWarningsTauDiscrByTrackIso_;
00189   long numWarningsTauDiscrByEcalIso_;
00190   long numWarningsTauDiscrAgainstElectrons_;
00191   long numWarningsTauDiscrAgainstMuons_;
00192   long numWarningsCaloMEt_;
00193   long numWarningsPFMEt_;
00194 };
00195 
00196 
00197 
00198 //-------------------------------------------------------------------------------
00199 // code specific to Z --> mu + tau-jet channel
00200 //-------------------------------------------------------------------------------
00201 
00216 #include "FWCore/Framework/interface/Event.h"
00217 #include "FWCore/Framework/interface/EventSetup.h"
00218 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00219 #include "FWCore/Utilities/interface/InputTag.h"
00220 
00221 #include "DQMServices/Core/interface/MonitorElement.h"
00222 
00223 #include <string>
00224 
00225 class EwkMuTauHistManager
00226 {
00227  public:
00228   EwkMuTauHistManager(const edm::ParameterSet&, DQMStore*);
00229 
00230   void bookHistograms();
00231   void fillHistograms(const edm::Event&, const edm::EventSetup&);
00232   void finalizeHistograms();
00233 
00234  private:
00235 
00236 //--- labels of muon, tau-jet and MEt collections being used
00237 //    in event selection and when filling histograms
00238   edm::InputTag triggerResultsSource_;
00239   edm::InputTag vertexSource_;
00240   edm::InputTag beamSpotSource_;
00241   edm::InputTag muonSource_;
00242   edm::InputTag tauJetSource_;
00243   edm::InputTag caloMEtSource_;
00244   edm::InputTag pfMEtSource_;
00245 
00246   edm::InputTag tauDiscrByLeadTrackFinding_;
00247   edm::InputTag tauDiscrByLeadTrackPtCut_;
00248   edm::InputTag tauDiscrByTrackIso_;
00249   edm::InputTag tauDiscrByEcalIso_;
00250   edm::InputTag tauDiscrAgainstMuons_;
00251   
00252 //--- event selection criteria
00253   typedef std::vector<std::string> vstring;
00254   vstring hltPaths_;
00255 
00256   double muonEtaCut_;
00257   double muonPtCut_;
00258   double muonTrackIsoCut_;
00259   double muonEcalIsoCut_;
00260 double muonCombIsoCut_;
00261   int muonIsoMode_;
00262 
00263   double tauJetEtaCut_;
00264   double tauJetPtCut_;
00265 
00266   double visMassCut_;
00267   double deltaRCut_;
00268 //--- pointer to DQM histogram management service
00269   DQMStore* dqmStore_;
00270 
00271 //--- name of DQM directory in which histograms for Z --> muon + tau-jet channel get stored
00272   std::string dqmDirectory_;
00273 
00274 //--- histograms  
00275   //MonitorElement* hNumGlobalMuons_;
00276   MonitorElement* hMuonPt_;
00277   MonitorElement* hMuonEta_;
00278   MonitorElement* hMuonPhi_;
00279   MonitorElement* hMuonTrackIsoPt_;
00280   MonitorElement* hMuonEcalIsoPt_;
00281   MonitorElement* hMuonCombIsoPt_;
00282 
00283   MonitorElement* hTauJetPt_;
00284   MonitorElement* hTauJetEta_;
00285   MonitorElement* hTauJetPhi_;
00286   MonitorElement* hTauLeadTrackPt_;
00287   MonitorElement* hTauTrackIsoPt_;
00288   MonitorElement* hTauEcalIsoPt_;
00289   MonitorElement* hTauDiscrAgainstMuons_;
00290   MonitorElement* hTauJetCharge_;
00291   MonitorElement* hTauJetNumSignalTracks_;
00292   MonitorElement* hTauJetNumIsoTracks_;
00293   
00294   MonitorElement* hVisMass_;
00295 MonitorElement* hMuTauDeltaR_;
00296 MonitorElement* hVisMassFinal_;
00297   //MonitorElement* hMtMuCaloMEt_;
00298   MonitorElement* hMtMuPFMEt_;
00299   //MonitorElement* hPzetaCmaxNumWarnings_aloMEt_;
00300   //MonitorElement* hPzetaPFMEt_;
00301   MonitorElement* hMuTauAcoplanarity_;
00302   //MonitorElement* hMuTauCharge_;
00303 
00304   //MonitorElement* hVertexChi2_;
00305   MonitorElement* hVertexZ_;
00306   //MonitorElement* hVertexD0_;
00307 
00308   MonitorElement* hCaloMEtPt_;
00309   //MonitorElement* hCaloMEtPhi_;
00310 
00311   MonitorElement* hPFMEtPt_;
00312   //MonitorElement* hPFMEtPhi_;
00313 
00314   MonitorElement* hCutFlowSummary_;
00315   enum { kPassedPreselection = 1, kPassedTrigger = 2, kPassedMuonId = 3, kPassedTauLeadTrack = 4, kPassedTauLeadTrackPt = 5, kPassedTauDiscrAgainstMuons = 6, kPassedDeltaR = 7, kPassedMuonTrackIso = 8, kPassedMuonEcalIso = 9, kPassedTauTrackIso = 10, kPassedTauEcalIso = 11}; 
00316 
00317 //--- counters for filter-statistics output
00318   unsigned numEventsAnalyzed_;
00319   unsigned numEventsSelected_;
00320 
00321   int cfgError_;
00322 
00323   int maxNumWarnings_;
00324 
00325   long numWarningsTriggerResults_;
00326   long numWarningsHLTpath_;
00327   long numWarningsVertex_;
00328   long numWarningsBeamSpot_;
00329   long numWarningsMuon_;
00330   long numWarningsTauJet_;
00331   long numWarningsTauDiscrByLeadTrackFinding_;
00332   long numWarningsTauDiscrByLeadTrackPtCut_;
00333   long numWarningsTauDiscrByTrackIso_;
00334   long numWarningsTauDiscrByEcalIso_;
00335   long numWarningsTauDiscrAgainstMuons_;
00336   long numWarningsCaloMEt_;
00337   long numWarningsPFMEt_;
00338 };
00339 
00340 //-------------------------------------------------------------------------------
00341 // common auxiliary functions used by different channels
00342 //-------------------------------------------------------------------------------
00343 
00358 #include "DataFormats/Candidate/interface/Candidate.h"
00359 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00360 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00361 #include "DataFormats/MuonReco/interface/Muon.h"
00362 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00363 #include "DataFormats/TauReco/interface/PFTau.h"
00364 #include "DataFormats/TauReco/interface/PFTauFwd.h"
00365 #include "DataFormats/VertexReco/interface/Vertex.h"
00366 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00367 
00368 #include <string>
00369 
00370 enum { kAbsoluteIso, kRelativeIso, kUndefinedIso };
00371 
00372 template<typename T>
00373 void readEventData(const edm::Event& evt, const edm::InputTag& src, edm::Handle<T>& handle, long& numWarnings, int maxNumWarnings, 
00374                    bool& error, const char* errorMessage)
00375 {
00376   if ( !evt.getByLabel(src, handle) ) {
00377     if ( numWarnings < maxNumWarnings || maxNumWarnings == -1 )
00378       edm::LogWarning ("readEventData") << errorMessage << " !!";
00379     ++numWarnings;
00380     error = true;
00381   }
00382 }
00383 
00384 int getIsoMode(const std::string&, int&);
00385 
00386 double calcDeltaPhi(double, double);
00387 double calcMt(double, double, double, double);
00388 double calcPzeta(const reco::Candidate::LorentzVector&, const reco::Candidate::LorentzVector&, double, double);
00389 
00390 bool passesElectronPreId(const reco::GsfElectron&);
00391 bool passesElectronId(const reco::GsfElectron&);
00392 
00393 const reco::GsfElectron* getTheElectron(const reco::GsfElectronCollection&, double, double);
00394 const reco::Muon* getTheMuon(const reco::MuonCollection&, double, double);
00395 const reco::PFTau* getTheTauJet(const reco::PFTauCollection&, double, double, int&);
00396 
00397 double getVertexD0(const reco::Vertex&, const reco::BeamSpot&);
00398 
00399 #endif