Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:38

0001 // -*- C++ -*-
0002 // MuonIsolationDQM.h
0003 // Package:    Muon Isolation DQM
0004 // Class:      MuonIsolationDQM
0005 //
0006 /*
0007   
0008 Description: Muon Isolation DQM class
0009 
0010 NOTE: The static member variable declarations *should* include the key word "static", but 
0011 I haven't found an elegant way to initalize the vectors.  Static primatives (e.g. int, 
0012 float, ...) and simple static objects are easy to initialze.  Outside of the class 
0013 decleration, you would write
0014     
0015 int MuonIsolationDQM::CONST_INT = 5;
0016 FooType MuonIsolationDQM::CONST_FOOT = Foo(constructor_argument);
0017     
0018 but you can't do this if you want to, say, initalize a std::vector with a bunch of 
0019 different values.  So, you can't make them static and you have to initialize them using 
0020 a member method.  To keep it consistent, I've just initialized them all in the same 
0021 method, even the simple types.
0022 */
0023 
0024 //
0025 // Original Author:  "C. Jess Riedel", UC Santa Barbara
0026 //         Created:  Tue Jul 17 15:58:24 CDT 2007
0027 //
0028 
0029 //Base class
0030 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0031 
0032 //Member types
0033 #include "FWCore/Utilities/interface/InputTag.h"
0034 #include "DQMServices/Core/interface/DQMStore.h"
0035 #include "FWCore/ServiceRegistry/interface/Service.h"
0036 
0037 //Other include files
0038 #include "DataFormats/MuonReco/interface/Muon.h"
0039 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0040 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
0041 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
0042 #include "DataFormats/TrackReco/interface/Track.h"
0043 
0044 #include "DataFormats/VertexReco/interface/Vertex.h"
0045 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0046 
0047 //----------------------------------------
0048 
0049 //Forward declarations
0050 class TH1;
0051 class TH1I;
0052 class TH1D;
0053 class TH2;
0054 class TProfile;
0055 
0056 //------------------------------------------
0057 //  Class Declaration: MuonIsolationDQM
0058 //--------------------------------------
0059 class MuonIsolationDQM : public DQMEDAnalyzer {
0060   //---------namespace and typedefs--------------
0061   typedef edm::View<reco::Muon>::const_iterator MuonIterator;
0062   typedef edm::RefToBase<reco::Muon> MuonBaseRef;
0063   typedef edm::Handle<reco::IsoDepositMap> MuIsoDepHandle;
0064   typedef const reco::IsoDeposit MuIsoDepRef;
0065 
0066 public:
0067   //---------methods----------------------------
0068   explicit MuonIsolationDQM(const edm::ParameterSet&);
0069   ~MuonIsolationDQM() override;
0070 
0071   void analyze(const edm::Event&, const edm::EventSetup&) override;
0072   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0073 
0074 private:
0075   //---------methods----------------------------
0076   void InitStatics();
0077   void RecordData(const reco::Muon& muon);  //Fills Histograms with info from single muo
0078   //  void doPFIsoPlots(MuonIterator muon); //Fills Histograms with PF info from single muo (only for GLB)
0079   void InitHistos();     //adds title, bin information to member histograms
0080   void FillHistos(int);  //Fills histograms with data
0081   void FillNVtxHistos(int);
0082   void NormalizeHistos();  //Normalize to number of muons
0083 
0084   //----- helper methods
0085   int GetNVtxBin(int);
0086   TH1* GetTH1FromMonitorElement(MonitorElement* me);
0087 
0088   //----------Static Variables---------------
0089 
0090   int vtxBin_;
0091   double vtxMin_;
0092   double vtxMax_;
0093 
0094   //Collection labels
0095   edm::EDGetTokenT<reco::VertexCollection> theVertexCollectionLabel_;
0096   edm::EDGetTokenT<edm::View<reco::Muon> > theMuonCollectionLabel_;
0097 
0098   //root file name
0099   std::string rootfilename;
0100   // Directories within the rootfile
0101   std::string dirName;
0102 
0103   //Histogram parameters
0104   static const int NUM_VARS = 48;     // looking at R03 and R05.  Total of 54 histos.
0105   static const int NUM_VARS_2D = 10;  // looking only at R03.  Total of 8 TH2F.
0106   static const int NUM_VARS_NVTX = 6;
0107 
0108   double L_BIN_WIDTH;       //large bins
0109   double S_BIN_WIDTH;       //small bins
0110   int LOG_BINNING_ENABLED;  //pseudo log binning for profile plots
0111   int NUM_LOG_BINS;
0112   double LOG_BINNING_RATIO;
0113   bool requireGLBMuon;
0114   bool requireSTAMuon;
0115   bool requireTRKMuon;
0116 
0117   std::string title_sam;
0118   std::string title_cone;
0119   //  std::string title_cd;
0120 
0121   std::vector<std::string> main_titles;     //[NUM_VARS]
0122   std::vector<std::string> axis_titles;     //[NUM_VARS]
0123   std::vector<std::string> names;           //[NUM_VARS]
0124   std::vector<std::vector<double> > param;  //[NUM_VARS][3]
0125   std::vector<int> isContinuous;            //[NUM_VARS]
0126 
0127   std::vector<std::string> titles_2D;  //[NUM_VARS]
0128   std::vector<std::string> names_2D;   //[NUM_VARS]
0129 
0130   std::vector<std::string> main_titles_NVtxs;
0131   std::vector<std::string> names_NVtxs;
0132   std::vector<std::string> axis_titles_NVtxs;
0133   //---------------Dynamic Variables---------------------
0134 
0135   //The Data
0136   double theData[NUM_VARS];
0137   double theData2D[NUM_VARS_2D];
0138   double theDataNVtx[NUM_VARS_NVTX];
0139 
0140   //Histograms
0141   MonitorElement* h_nMuons;
0142   std::vector<MonitorElement*> h_1D;       //[NUM_VARS]
0143   std::vector<MonitorElement*> h_2D;       //[NUM_VARS_2D]
0144   std::vector<MonitorElement*> h_1D_NVTX;  //[NUM_VARS_NVTX]
0145 
0146   //  std::vector<MonitorElement*> cd_plots;//[NUM_VARS]
0147 
0148   //Counters
0149   int nEvents;
0150   int nSTAMuons;
0151   int nGLBMuons;
0152   int nTRKMuons;
0153 
0154   //enums for monitorElement
0155   enum { NOAXIS, XAXIS, YAXIS, ZAXIS };
0156 };