CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/DQMOffline/JetMET/interface/METAnalyzer.h

Go to the documentation of this file.
00001 #ifndef METAnalyzer_H
00002 #define METAnalyzer_H
00003 
00004 
00015 #include <memory>
00016 #include <fstream>
00017 #include "TMath.h"
00018 #include "FWCore/Framework/interface/Frameworkfwd.h"
00019 #include "DQMOffline/JetMET/interface/METAnalyzerBase.h"
00020 #include "FWCore/Framework/interface/Event.h"
00021 #include "FWCore/Framework/interface/MakerMacros.h"
00022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00023 #include "FWCore/ServiceRegistry/interface/Service.h"
00024 #include "DQMServices/Core/interface/DQMStore.h"
00025 #include "DQMServices/Core/interface/MonitorElement.h"
00026 //
00027 #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
00028 //
00029 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00030 #include "DataFormats/Common/interface/TriggerResults.h"
00031 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00032 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00033 
00034 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00035 
00036 #include "RecoMET/METAlgorithms/interface/HcalNoiseRBXArray.h"
00037 #include "DataFormats/METReco/interface/HcalNoiseSummary.h"
00038 #include "DataFormats/METReco/interface/BeamHaloSummary.h"
00039 #include "RecoJets/JetProducers/interface/JetIDHelper.h"
00040 
00041 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00042 #include "DataFormats/Common/interface/ValueMap.h"  
00043 #include "DataFormats/MuonReco/interface/Muon.h"
00044 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00045 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00046 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00047 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00048 #include "DataFormats/TrackReco/interface/Track.h"
00049 
00050 #include "DataFormats/VertexReco/interface/Vertex.h"
00051 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00052 
00053 #include "DQMOffline/JetMET/interface/JetMETDQMDCSFilter.h"
00054 
00055 class METAnalyzer : public METAnalyzerBase {
00056  public:
00057 
00059   METAnalyzer(const edm::ParameterSet&);
00060   
00062   virtual ~METAnalyzer();
00063 
00065   void beginJob(DQMStore * dbe);
00066 
00068   void endJob();
00069 
00070   // Book MonitorElements
00071   void bookMESet(std::string);
00072   void bookMonitorElement(std::string, bool);
00073 
00075   void analyze(const edm::Event&, const edm::EventSetup&, 
00076                const edm::TriggerResults&);
00077 
00079   void beginRun(const edm::Run&,  const edm::EventSetup&);
00080 
00082   void endRun(const edm::Run& iRun, const edm::EventSetup& iSetup, DQMStore *dbe);
00083 
00084   // Fill MonitorElements
00085   void fillMESet(const edm::Event&, std::string, const reco::MET&);
00086   void fillMonitorElement(const edm::Event&, std::string, std::string, const reco::MET&, bool);
00087   void makeRatePlot(std::string, double);
00088 
00089   bool selectHighPtJetEvent(const edm::Event&);
00090   bool selectLowPtJetEvent(const edm::Event&);
00091   bool selectWElectronEvent(const edm::Event&);
00092   bool selectWMuonEvent(const edm::Event&);
00093 
00094   void setSource(std::string source) {
00095     _source = source;
00096   }
00097 
00098   int evtCounter;
00099 
00100  private:
00101   // ----------member data ---------------------------
00102   
00103   edm::ParameterSet parameters;
00104   // Switch for verbosity
00105   int _verbose;
00106 
00107   std::string metname;
00108   std::string _source;
00109 
00110   std::string _FolderName;
00111 
00112   edm::InputTag theMETCollectionLabel;
00113   edm::InputTag HcalNoiseRBXCollectionTag;
00114   edm::InputTag HcalNoiseSummaryTag;
00115   edm::InputTag theJetCollectionLabel;
00116   edm::InputTag thePfJetCollectionLabel;
00117   edm::InputTag TcCandidatesTag;
00118   edm::InputTag BeamHaloSummaryTag;
00119   edm::InputTag vertexTag;
00120   edm::InputTag gtTag;
00121 
00122   edm::InputTag inputTrackLabel;
00123   edm::InputTag inputMuonLabel;
00124   edm::InputTag inputElectronLabel;
00125   edm::InputTag inputBeamSpotLabel;
00126 
00127 
00128   // list of Jet or MB HLT triggers
00129   std::vector<std::string > HLTPathsJetMBByName_;
00130 
00131   GenericTriggerEventFlag * _HighPtJetEventFlag;
00132   GenericTriggerEventFlag * _LowPtJetEventFlag;
00133   GenericTriggerEventFlag * _MinBiasEventFlag;
00134   GenericTriggerEventFlag * _HighMETEventFlag;
00135   GenericTriggerEventFlag * _LowMETEventFlag;
00136   GenericTriggerEventFlag * _EleEventFlag;
00137   GenericTriggerEventFlag * _MuonEventFlag;
00138 
00139   std::string _hlt_HighPtJet;
00140   std::string _hlt_LowPtJet;
00141   std::string _hlt_MinBias;
00142   std::string _hlt_HighMET;
00143   std::string _hlt_LowMET;
00144   std::string _hlt_Ele;
00145   std::string _hlt_Muon;
00146 
00147   edm::ParameterSet theCleaningParameters;
00148   std::string _hlt_PhysDec;
00149 
00150   std::vector<unsigned > _techTrigsAND;
00151   std::vector<unsigned > _techTrigsOR;
00152   std::vector<unsigned > _techTrigsNOT;
00153 
00154   bool _doPVCheck;
00155   bool _doHLTPhysicsOn;
00156 
00157   bool     _tightBHFiltering;
00158   int      _tightJetIDFiltering;
00159   bool     _tightHcalFiltering;
00160 
00161   int _nvtx_min;
00162   int _nvtxtrks_min;
00163   int _vtxndof_min;
00164   double _vtxchi2_max;
00165   double _vtxz_max;
00166   
00167   int _trig_JetMB;
00168   int _trig_HighPtJet;
00169   int _trig_LowPtJet;
00170   int _trig_MinBias;
00171   int _trig_HighMET;
00172   int _trig_LowMET;
00173   int _trig_Ele;
00174   int _trig_Muon;
00175   int _trig_PhysDec;
00176 
00177 
00178   double _highPtJetThreshold;
00179   double _lowPtJetThreshold;
00180   double _highMETThreshold;
00181   double _lowMETThreshold;
00182 
00183   // Et threshold for MET plots
00184   double _etThreshold;
00185 
00186   // HF calibration factor (in 31X applied by TcProducer)
00187   double hfCalibFactor_;  //
00188 
00189   // JetID helper
00190   reco::helper::JetIDHelper *jetID;
00191 
00192 
00193   // DCS filter
00194   JetMETDQMDCSFilter *DCSFilter;
00195 
00196   //
00197   bool _allhist;
00198   bool _allSelection;
00199   bool _cleanupSelection;
00200 
00201   //
00202   std::vector<std::string> _FolderNames;
00203 
00204   //
00205   math::XYZPoint bspot;
00206 
00207   edm::Handle< edm::ValueMap<reco::MuonMETCorrectionData> > tcMet_ValueMap_Handle;
00208   edm::Handle< reco::MuonCollection > muon_h;
00209   edm::Handle< edm::View<reco::Track> > track_h;
00210   edm::Handle< edm::View<reco::GsfElectron > > electron_h;
00211   edm::Handle< reco::BeamSpot > beamSpot_h;
00212 
00213   //
00214   DQMStore *_dbe;
00215 
00216   //trigger histos
00217   MonitorElement* hTriggerName_HighPtJet;
00218   MonitorElement* hTriggerName_LowPtJet;
00219   MonitorElement* hTriggerName_MinBias;
00220   MonitorElement* hTriggerName_HighMET;
00221   MonitorElement* hTriggerName_LowMET;
00222   MonitorElement* hTriggerName_Ele;
00223   MonitorElement* hTriggerName_Muon;
00224 
00225   //the histos
00226   MonitorElement* hMETRate;
00227 
00228   MonitorElement* hmetME;
00229   MonitorElement* hNevents;
00230   MonitorElement* hMEx;
00231   MonitorElement* hMEy;
00232   MonitorElement* hEz;
00233   MonitorElement* hMETSig;
00234   MonitorElement* hMET;
00235   MonitorElement* hMETPhi;
00236   MonitorElement* hSumET;
00237 
00238   MonitorElement* hMET_logx;
00239   MonitorElement* hSumET_logx;
00240 
00241   MonitorElement* hMETIonFeedbck;
00242   MonitorElement* hMETHPDNoise;
00243   MonitorElement* hMETRBXNoise;
00244 
00245   MonitorElement* hMExLS;
00246   MonitorElement* hMEyLS;
00247 
00248   MonitorElement* htrkPt;
00249   MonitorElement* htrkEta;
00250   MonitorElement* htrkNhits;
00251   MonitorElement* htrkChi2;
00252   MonitorElement* htrkD0;
00253   MonitorElement* helePt;
00254   MonitorElement* heleEta;
00255   MonitorElement* heleHoE;
00256   MonitorElement* hmuPt;
00257   MonitorElement* hmuEta;
00258   MonitorElement* hmuNhits;
00259   MonitorElement* hmuChi2;
00260   MonitorElement* hmuD0;
00261   
00262   MonitorElement* hMExCorrection;
00263   MonitorElement* hMEyCorrection;
00264   MonitorElement* hMuonCorrectionFlag;
00265 
00266 
00267 };
00268 #endif