Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:53

0001 // -*- C++ -*-
0002 // MuIsoValidation.h
0003 // Package:    Muon Isolation Validation
0004 // Class:      MuIsoValidation
0005 //
0006 /*
0007 
0008  Description: Muon Isolation Validation class
0009 
0010  NOTE: The static member variable declerations *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 MuIsoValidation::CONST_INT = 5;
0016         FooType MuIsoValidation::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 //Member types
0030 #include "FWCore/Utilities/interface/InputTag.h"
0031 #include "DQMServices/Core/interface/DQMStore.h"
0032 #include "FWCore/ServiceRegistry/interface/Service.h"
0033 
0034 //Other include files
0035 #include "DataFormats/MuonReco/interface/Muon.h"
0036 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0037 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
0038 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
0039 
0040 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0041 
0042 //----------------------------------------
0043 
0044 //Forward declarations
0045 class TH1;
0046 class TH1I;
0047 class TH1D;
0048 class TH2;
0049 class TProfile;
0050 
0051 //------------------------------------------
0052 //  Class Declaration: MuIsoValidation
0053 //--------------------------------------
0054 
0055 class MuIsoValidation : public DQMEDAnalyzer {
0056   //---------namespace and typedefs--------------
0057   typedef edm::View<reco::Muon>::const_iterator MuonIterator;
0058   typedef edm::RefToBase<reco::Muon> MuonBaseRef;
0059   typedef edm::Handle<reco::IsoDepositMap> MuIsoDepHandle;
0060   typedef const reco::IsoDeposit MuIsoDepRef;
0061 
0062 public:
0063   //---------methods----------------------------
0064   explicit MuIsoValidation(const edm::ParameterSet&);
0065   ~MuIsoValidation() override;
0066 
0067 private:
0068   //---------methods----------------------------
0069   void analyze(const edm::Event&, const edm::EventSetup&) override;
0070   void InitStatics();
0071   void RecordData(MuonIterator muon);  //Fills Histograms with info from single muon
0072   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0073 
0074   void MakeLogBinsForProfile(Double_t* bin_edges, const double min, const double max);
0075   void FillHistos();  //Fills histograms with data
0076 
0077   //----------Static Variables---------------
0078 
0079   //Collection labels
0080   edm::InputTag Muon_Tag;
0081   edm::EDGetTokenT<edm::View<reco::Muon> > Muon_Token;
0082   edm::InputTag tkIsoDeposit_Tag;
0083   edm::InputTag hcalIsoDeposit_Tag;
0084   edm::InputTag ecalIsoDeposit_Tag;
0085   edm::InputTag hoIsoDeposit_Tag;
0086 
0087   //root file name
0088   std::string rootfilename;
0089   // Directories within the rootfile
0090   std::string dirName;
0091   std::string subDirName;
0092 
0093   std::string subsystemname_;
0094 
0095   //Histogram parameters
0096   static const int NUM_VARS = 21;
0097   double L_BIN_WIDTH;       //large bins
0098   double S_BIN_WIDTH;       //small bins
0099   int LOG_BINNING_ENABLED;  //pseudo log binning for profile plots
0100   int NUM_LOG_BINS;
0101   double LOG_BINNING_RATIO;
0102   bool requireCombinedMuon;
0103 
0104   std::string title_sam;
0105   std::string title_cone;
0106   std::string title_cd;
0107 
0108   std::vector<std::string> main_titles;     //[NUM_VARS]
0109   std::vector<std::string> axis_titles;     //[NUM_VARS]
0110   std::vector<std::string> names;           //[NUM_VARS]
0111   std::vector<std::vector<double> > param;  //[NUM_VARS][3]
0112   std::vector<int> isContinuous;            //[NUM_VARS]
0113   std::vector<int> cdCompNeeded;            //[NUM_VARS]
0114 
0115   //---------------Dynamic Variables---------------------
0116 
0117   //MonitorElement
0118 
0119   edm::ParameterSet iConfig;
0120   //The Data
0121   int theMuonData;  //[number of muons]
0122   double theData[NUM_VARS];
0123 
0124   //Histograms
0125   MonitorElement* h_nMuons;
0126   std::vector<MonitorElement*> h_1D;      //[NUM_VARS]
0127   std::vector<MonitorElement*> cd_plots;  //[NUM_VARS]
0128   //  std::vector< std::vector<MonitorElement*> > h_2D;//[NUM_VARS][NUM_VARS]
0129   std::vector<std::vector<MonitorElement*> > p_2D;  //[NUM_VARS][NUM_VARS]
0130 
0131   //Counters
0132   int nEvents;
0133   int nIncMuons;
0134   //  int nCombinedMuons;
0135 
0136   //enums for monitorElement
0137   enum { NOAXIS, XAXIS, YAXIS, ZAXIS };
0138 };