CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQMOffline/JetMET/interface/CaloMETAnalyzer.h

Go to the documentation of this file.
00001 #ifndef CaloMETAnalyzer_H
00002 #define CaloMETAnalyzer_H
00003 
00014 #include <memory>
00015 #include <fstream>
00016 #include "FWCore/Framework/interface/Frameworkfwd.h"
00017 #include "DQMOffline/JetMET/interface/CaloMETAnalyzerBase.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 #include "FWCore/Framework/interface/MakerMacros.h"
00020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00021 #include "FWCore/ServiceRegistry/interface/Service.h"
00022 #include "DQMServices/Core/interface/DQMStore.h"
00023 #include "DQMServices/Core/interface/MonitorElement.h"
00024 //
00025 #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
00026 //
00027 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00028 #include "DataFormats/Common/interface/TriggerResults.h"
00029 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00030 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00031 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00032 
00033 #include "RecoMET/METAlgorithms/interface/HcalNoiseRBXArray.h"
00034 #include "DataFormats/METReco/interface/BeamHaloSummary.h"
00035 #include "RecoJets/JetProducers/interface/JetIDHelper.h"
00036 
00037 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00038 #include "DataFormats/Common/interface/ValueMap.h"  
00039 #include "DataFormats/MuonReco/interface/Muon.h"
00040 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00041 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00042 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00043 
00044 #include "DataFormats/VertexReco/interface/Vertex.h"
00045 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00046 
00047 #include "DQMOffline/JetMET/interface/JetMETDQMDCSFilter.h"
00048 
00049 
00050 #include "GlobalVariables.h"
00051 
00052 
00053 class CaloMETAnalyzer : public CaloMETAnalyzerBase {
00054  public:
00055 
00057   CaloMETAnalyzer(const edm::ParameterSet&);
00058   
00060   virtual ~CaloMETAnalyzer();
00061 
00063   void beginJob(DQMStore * dbe);
00064 
00066   void endJob();
00067 
00069   void analyze(const edm::Event&, const edm::EventSetup&, 
00070                const edm::TriggerResults&);
00071 
00073   void beginRun(const edm::Run&,  const edm::EventSetup&);
00074 
00076   void endRun(const edm::Run& iRun, const edm::EventSetup& iSetup, DQMStore *dbe);
00077 
00078   // Book MonitorElements
00079   void bookMESet(std::string);
00080   void bookMonitorElement(std::string, bool);
00081   void bookMonitorElementTriggered(std::string, bool);
00082 
00083   // Fill MonitorElements
00084   void fillMESet(const edm::Event&, std::string, const reco::CaloMET&, const reco::CaloMET&);
00085   void fillMESubSet(const edm::Event&, std::string, const reco::CaloMET&, const reco::CaloMET&);
00086   void fillMonitorElement(const edm::Event&, std::string, std::string, const reco::CaloMET&, const reco::CaloMET&, bool);
00087   void fillMonitorElementTriggered(const edm::Event&, std::string, std::string, const reco::CaloMET&, const reco::CaloMET&, bool);
00088   void makeRatePlot(std::string, double);
00089 
00090   void validateMET(const reco::CaloMET&, edm::Handle<edm::View<reco::Candidate> >);
00091   void computeEmHaMET(edm::Handle<edm::View<reco::Candidate> >);
00092 
00093   bool selectHighPtJetEvent(const edm::Event&);
00094   bool selectLowPtJetEvent(const edm::Event&);
00095   bool selectWElectronEvent(const edm::Event&);
00096   bool selectWMuonEvent(const edm::Event&);
00097 
00098   int evtCounter;
00099 
00100  private:
00101   // ----------member data ---------------------------
00102   
00103   edm::ParameterSet parameters;
00104   // Switch for verbosity
00105   int _verbose;
00106   int _print;
00107 
00108   std::string metname;
00109   std::string _source; // HLT? FU?
00110   
00111   edm::InputTag theCaloMETCollectionLabel;
00112 
00113   edm::InputTag theCaloTowersLabel;
00114   edm::InputTag theJetCollectionLabel;
00115   edm::InputTag HcalNoiseRBXCollectionTag;
00116   edm::InputTag BeamHaloSummaryTag;
00117   edm::InputTag HBHENoiseFilterResultTag;
00118   edm::InputTag vertexTag;
00119   edm::InputTag gtTag;
00120 
00121   edm::InputTag inputMuonLabel;
00122   edm::InputTag inputBeamSpotLabel;
00123 
00124   // list of Jet or MB HLT triggers
00125   std::vector<std::string > HLTPathsJetMBByName_;
00126 
00127   GenericTriggerEventFlag * _HighPtJetEventFlag;
00128   GenericTriggerEventFlag * _LowPtJetEventFlag;
00129   GenericTriggerEventFlag * _MinBiasEventFlag;
00130   GenericTriggerEventFlag * _HighMETEventFlag;
00131   //  GenericTriggerEventFlag * _LowMETEventFlag;
00132   GenericTriggerEventFlag * _EleEventFlag;
00133   GenericTriggerEventFlag * _MuonEventFlag;
00134 
00135   std::vector<std::string> highPtJetExpr_;
00136   std::vector<std::string> lowPtJetExpr_;
00137   std::vector<std::string> highMETExpr_;
00138   //  std::vector<std::string> lowMETExpr_;
00139   std::vector<std::string> muonExpr_;
00140   std::vector<std::string> elecExpr_;
00141   std::vector<std::string> minbiasExpr_;
00142 
00143   edm::ParameterSet theCleaningParameters;
00144   std::string _hlt_PhysDec;
00145 
00146   std::vector<unsigned > _techTrigsAND;
00147   std::vector<unsigned > _techTrigsOR;
00148   std::vector<unsigned > _techTrigsNOT;
00149 
00150   bool _doPVCheck;
00151   bool _doHLTPhysicsOn;
00152 
00153   bool     _tightBHFiltering;
00154   int      _tightJetIDFiltering;
00155 
00156   int _nvtx_min;
00157   int _nvtxtrks_min;
00158   int _vtxndof_min;
00159   double _vtxchi2_max;
00160   double _vtxz_max;
00161 
00162   int _trig_JetMB;
00163   int _trig_HighPtJet;
00164   int _trig_LowPtJet;
00165   int _trig_MinBias;
00166   int _trig_HighMET;
00167   //  int _trig_LowMET;
00168   int _trig_Ele;
00169   int _trig_Muon;
00170   int _trig_PhysDec;
00171 
00172   double _highPtJetThreshold;
00173   double _lowPtJetThreshold;
00174   double _highMETThreshold;
00175   //  double _lowMETThreshold;
00176 
00177   // Et threshold for MET plots
00178   double _etThreshold;
00179 
00180   // JetID helper
00181   reco::helper::JetIDHelper *jetID;
00182 
00183   // DCS filter
00184   JetMETDQMDCSFilter *DCSFilter;
00185 
00186   //
00187   bool _allhist;
00188   bool _allSelection;
00189   bool _cleanupSelection;
00190 
00191   //
00192   std::vector<std::string> _FolderNames;
00193 
00194   int _numPV;
00195   //
00196   double _EmMEx;
00197   double _EmMEy;
00198   double _EmMET;
00199   double _EmCaloEz;
00200   double _EmSumEt;
00201   double _EmMetPhi;
00202   //
00203   double _HaMEx;
00204   double _HaMEy;
00205   double _HaMET;
00206   double _HaCaloEz;
00207   double _HaSumEt;
00208   double _HaMetPhi;
00209 
00210   //
00211   math::XYZPoint bspot;
00212 
00213   edm::Handle< edm::ValueMap<reco::MuonMETCorrectionData> > corMetGlobalMuons_ValueMap_Handle;
00214   edm::Handle< reco::MuonCollection > muon_h;
00215   edm::Handle< reco::BeamSpot > beamSpot_h;
00216 
00217   //
00218   DQMStore *_dbe;
00219 
00220   //trigger histos
00221   MonitorElement* hTriggerName_HighPtJet;
00222   MonitorElement* hTriggerName_LowPtJet;
00223   MonitorElement* hTriggerName_MinBias;
00224   MonitorElement* hTriggerName_HighMET;
00225   //  MonitorElement* hTriggerName_LowMET;
00226   MonitorElement* hTriggerName_Ele;
00227   MonitorElement* hTriggerName_Muon;
00228 
00229   //the histos
00230   // lines commented out have been removed to improve the bin usage of JetMET DQM
00231   MonitorElement* hCaloMETRate;
00232 
00233   MonitorElement* hmetME;
00234   //MonitorElement* hNevents;
00235   MonitorElement* hCaloMEx;
00236   MonitorElement* hCaloMEy;
00237   //MonitorElement* hCaloEz;
00238   MonitorElement* hCaloMETSig;
00239   MonitorElement* hCaloMET;
00240   MonitorElement* hCaloMET1;
00241   MonitorElement* hCaloMETPhi;
00242   MonitorElement* hCaloSumET;
00243   MonitorElement* hCaloMETNoHF;
00244   //MonitorElement* hCaloMETNoHFPhi;
00245 
00246 
00247   // NPV profiles
00248   //----------------------------------------------------------------------------
00249   MonitorElement* hCaloMEx_profile;
00250   MonitorElement* hCaloMEy_profile;
00251   MonitorElement* hCaloMET_profile;
00252   MonitorElement* hCaloMETNoHF_profile;
00253   MonitorElement* hCaloSumET_profile;
00254 
00255   
00256   MonitorElement* hCaloMET_logx;
00257   MonitorElement* hCaloSumET_logx;
00258   
00259   //MonitorElement* hCaloMETIonFeedbck;
00260   //MonitorElement* hCaloMETHPDNoise;
00261   //MonitorElement* hCaloMETRBXNoise;
00262   
00263   //MonitorElement* hCaloMETPhi002;
00264   //MonitorElement* hCaloMETPhi010;
00265   MonitorElement* hCaloMETPhi020;
00266   
00267   MonitorElement* hCaloMExLS;
00268   MonitorElement* hCaloMEyLS;
00269   
00270   MonitorElement* hCaloMaxEtInEmTowers;
00271   MonitorElement* hCaloMaxEtInHadTowers;
00272   MonitorElement* hCaloEtFractionHadronic;
00273   MonitorElement* hCaloEmEtFraction;
00274   
00275   //MonitorElement* hCaloEmEtFraction002;
00276   //MonitorElement* hCaloEmEtFraction010;
00277   MonitorElement* hCaloEmEtFraction020;
00278   
00279   MonitorElement* hCaloHadEtInHB;
00280   MonitorElement* hCaloHadEtInHO;
00281   MonitorElement* hCaloHadEtInHE;
00282   MonitorElement* hCaloHadEtInHF;
00283   MonitorElement* hCaloEmEtInHF;
00284   MonitorElement* hCaloEmEtInEE;
00285   MonitorElement* hCaloEmEtInEB;
00286   
00287   MonitorElement* hCaloEmMEx;
00288   MonitorElement* hCaloEmMEy;
00289   //MonitorElement* hCaloEmEz;
00290   MonitorElement* hCaloEmMET;
00291   MonitorElement* hCaloEmMETPhi;
00292   //MonitorElement* hCaloEmSumET;
00293   
00294   MonitorElement* hCaloHaMEx;
00295   MonitorElement* hCaloHaMEy;
00296   //MonitorElement* hCaloHaEz;
00297   MonitorElement* hCaloHaMET;
00298   MonitorElement* hCaloHaMETPhi;
00299   //MonitorElement* hCaloHaSumET;
00300   
00301   MonitorElement* hCalomuPt;
00302   MonitorElement* hCalomuEta;
00303   MonitorElement* hCalomuNhits;
00304   MonitorElement* hCalomuChi2;
00305   MonitorElement* hCalomuD0;
00306   MonitorElement* hCaloMExCorrection;
00307   MonitorElement* hCaloMEyCorrection;
00308   MonitorElement* hCaloMuonCorrectionFlag;
00309   
00310 };
00311 #endif