CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/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/BeamHaloSummary.h"
00038 #include "RecoJets/JetProducers/interface/JetIDHelper.h"
00039 
00040 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00041 #include "DataFormats/Common/interface/ValueMap.h"  
00042 #include "DataFormats/MuonReco/interface/Muon.h"
00043 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00044 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00045 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00046 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00047 #include "DataFormats/TrackReco/interface/Track.h"
00048 
00049 #include "DataFormats/VertexReco/interface/Vertex.h"
00050 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00051 
00052 #include "DQMOffline/JetMET/interface/JetMETDQMDCSFilter.h"
00053 
00054 class METAnalyzer : public METAnalyzerBase {
00055  public:
00056 
00058   METAnalyzer(const edm::ParameterSet&);
00059   
00061   virtual ~METAnalyzer();
00062 
00064   void beginJob(DQMStore * dbe);
00065 
00067   void endJob();
00068 
00069   // Book MonitorElements
00070   void bookMESet(std::string);
00071   void bookMonitorElement(std::string, bool);
00072 
00074   void analyze(const edm::Event&, const edm::EventSetup&, 
00075                const edm::TriggerResults&);
00076 
00078   void beginRun(const edm::Run&,  const edm::EventSetup&);
00079 
00081   void endRun(const edm::Run& iRun, const edm::EventSetup& iSetup, DQMStore *dbe);
00082 
00083   // Fill MonitorElements
00084   void fillMESet(const edm::Event&, std::string, const reco::MET&);
00085   void fillMonitorElement(const edm::Event&, std::string, std::string, const reco::MET&, bool);
00086   void makeRatePlot(std::string, double);
00087 
00088   bool selectHighPtJetEvent(const edm::Event&);
00089   bool selectLowPtJetEvent(const edm::Event&);
00090   bool selectWElectronEvent(const edm::Event&);
00091   bool selectWMuonEvent(const edm::Event&);
00092 
00093   void setSource(std::string source) {
00094     _source = source;
00095   }
00096 
00097   int evtCounter;
00098 
00099  private:
00100   // ----------member data ---------------------------
00101   
00102   edm::ParameterSet parameters;
00103   // Switch for verbosity
00104   int _verbose;
00105 
00106   std::string metname;
00107   std::string _source;
00108 
00109   std::string _FolderName;
00110 
00111   edm::InputTag theMETCollectionLabel;
00112   edm::InputTag HcalNoiseRBXCollectionTag;
00113   edm::InputTag theJetCollectionLabel;
00114   edm::InputTag thePfJetCollectionLabel;
00115   edm::InputTag TcCandidatesTag;
00116   edm::InputTag BeamHaloSummaryTag;
00117   edm::InputTag HBHENoiseFilterResultTag;
00118   edm::InputTag vertexTag;
00119   edm::InputTag gtTag;
00120 
00121   edm::InputTag inputTrackLabel;
00122   edm::InputTag inputMuonLabel;
00123   edm::InputTag inputElectronLabel;
00124   edm::InputTag inputBeamSpotLabel;
00125 
00126 
00127   // list of Jet or MB HLT triggers
00128   std::vector<std::string > HLTPathsJetMBByName_;
00129 
00130   GenericTriggerEventFlag * _HighPtJetEventFlag;
00131   GenericTriggerEventFlag * _LowPtJetEventFlag;
00132   GenericTriggerEventFlag * _MinBiasEventFlag;
00133   GenericTriggerEventFlag * _HighMETEventFlag;
00134   //  GenericTriggerEventFlag * _LowMETEventFlag;
00135   GenericTriggerEventFlag * _EleEventFlag;
00136   GenericTriggerEventFlag * _MuonEventFlag;
00137 
00138   std::vector<std::string> highPtJetExpr_;
00139   std::vector<std::string> lowPtJetExpr_;
00140   std::vector<std::string> highMETExpr_;
00141   //  std::vector<std::string> lowMETExpr_;
00142   std::vector<std::string> muonExpr_;
00143   std::vector<std::string> elecExpr_;
00144   std::vector<std::string> minbiasExpr_;
00145 
00146   edm::ParameterSet theCleaningParameters;
00147   std::string _hlt_PhysDec;
00148 
00149   std::vector<unsigned > _techTrigsAND;
00150   std::vector<unsigned > _techTrigsOR;
00151   std::vector<unsigned > _techTrigsNOT;
00152 
00153   bool _doPVCheck;
00154   bool _doHLTPhysicsOn;
00155 
00156   bool     _tightBHFiltering;
00157   int      _tightJetIDFiltering;
00158 
00159   int _nvtx_min;
00160   int _nvtxtrks_min;
00161   int _vtxndof_min;
00162   double _vtxchi2_max;
00163   double _vtxz_max;
00164   
00165   int _trig_JetMB;
00166   int _trig_HighPtJet;
00167   int _trig_LowPtJet;
00168   int _trig_MinBias;
00169   int _trig_HighMET;
00170   //  int _trig_LowMET;
00171   int _trig_Ele;
00172   int _trig_Muon;
00173   int _trig_PhysDec;
00174 
00175 
00176   double _highPtJetThreshold;
00177   double _lowPtJetThreshold;
00178   double _highMETThreshold;
00179   //  double _lowMETThreshold;
00180 
00181   // Et threshold for MET plots
00182   double _etThreshold;
00183 
00184   // HF calibration factor (in 31X applied by TcProducer)
00185   double hfCalibFactor_;  //
00186 
00187   // JetID helper
00188   reco::helper::JetIDHelper *jetID;
00189 
00190 
00191   // DCS filter
00192   JetMETDQMDCSFilter *DCSFilter;
00193 
00194   //
00195   bool _allhist;
00196   bool _allSelection;
00197   bool _cleanupSelection;
00198 
00199   //
00200   std::vector<std::string> _FolderNames;
00201 
00202   //
00203   math::XYZPoint bspot;
00204 
00205   edm::Handle< edm::ValueMap<reco::MuonMETCorrectionData> > tcMet_ValueMap_Handle;
00206   edm::Handle< reco::MuonCollection > muon_h;
00207   edm::Handle< edm::View<reco::Track> > track_h;
00208   edm::Handle< edm::View<reco::GsfElectron > > electron_h;
00209   edm::Handle< reco::BeamSpot > beamSpot_h;
00210 
00211   //
00212   DQMStore *_dbe;
00213 
00214   //trigger histos
00215   // lines commented out have been removed to improve the bin usage of JetMET DQM
00216   MonitorElement* hTriggerName_HighPtJet;
00217   MonitorElement* hTriggerName_LowPtJet;
00218   MonitorElement* hTriggerName_MinBias;
00219   MonitorElement* hTriggerName_HighMET;
00220   //  MonitorElement* hTriggerName_LowMET;
00221   MonitorElement* hTriggerName_Ele;
00222   MonitorElement* hTriggerName_Muon;
00223 
00224   //the histos
00225   MonitorElement* hMETRate;
00226 
00227   MonitorElement* hmetME;
00228   //MonitorElement* hNevents;
00229   MonitorElement* hMEx;
00230   MonitorElement* hMEy;
00231   //MonitorElement* hEz;
00232   MonitorElement* hMETSig;
00233   MonitorElement* hMET;
00234   MonitorElement* hMETPhi;
00235   MonitorElement* hSumET;
00236 
00237   MonitorElement* hMET_logx;
00238   MonitorElement* hSumET_logx;
00239 
00240   //MonitorElement* hMETIonFeedbck;
00241   //MonitorElement* hMETHPDNoise;
00242   //MonitorElement* hMETRBXNoise;
00243 
00244   MonitorElement* hMExLS;
00245   MonitorElement* hMEyLS;
00246 
00247   MonitorElement* htrkPt;
00248   MonitorElement* htrkEta;
00249   MonitorElement* htrkNhits;
00250   MonitorElement* htrkChi2;
00251   MonitorElement* htrkD0;
00252   MonitorElement* helePt;
00253   MonitorElement* heleEta;
00254   MonitorElement* heleHoE;
00255   MonitorElement* hmuPt;
00256   MonitorElement* hmuEta;
00257   MonitorElement* hmuNhits;
00258   MonitorElement* hmuChi2;
00259   MonitorElement* hmuD0;
00260   
00261   MonitorElement* hMExCorrection;
00262   MonitorElement* hMEyCorrection;
00263   MonitorElement* hMuonCorrectionFlag;
00264 
00265 
00266 };
00267 #endif