Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GENWEIGHTVALIDATION_H
0002 #define GENWEIGHTVALIDATION_H
0003 
0004 // framework & common header files
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/Run.h"
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 
0009 #include "DataFormats/Common/interface/Handle.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/Utilities/interface/InputTag.h"
0012 
0013 //DQM services
0014 #include "DQMServices/Core/interface/DQMStore.h"
0015 #include "FWCore/ServiceRegistry/interface/Service.h"
0016 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0017 
0018 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0019 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
0020 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0021 #include "DataFormats/JetReco/interface/GenJetCollection.h"
0022 
0023 #include "Validation/EventGenerator/interface/WeightManager.h"
0024 #include "Validation/EventGenerator/interface/DQMHelper.h"
0025 
0026 class GenWeightValidation : public DQMEDAnalyzer {
0027 public:
0028   explicit GenWeightValidation(const edm::ParameterSet &);
0029   ~GenWeightValidation() override = default;
0030   void analyze(const edm::Event &, const edm::EventSetup &) override;
0031   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0032   void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
0033 
0034 private:
0035   void bookTemplates(DQMHelper &aDqmHelper,
0036                      std::vector<MonitorElement *> &tmps,
0037                      const std::string &name,
0038                      const std::string &title,
0039                      int nbin,
0040                      float low,
0041                      float high,
0042                      const std::string &xtitle,
0043                      const std::string &ytitle);
0044   void fillTemplates(std::vector<MonitorElement *> &tmps, float obs);
0045   WeightManager wmanager_;
0046 
0047   double weight_;
0048   std::vector<std::vector<double>> weights_;
0049 
0050   MonitorElement *nEvt_;
0051   MonitorElement *nlogWgt_;
0052   MonitorElement *wgtVal_;
0053   std::vector<MonitorElement *> leadLepPtTemp_;
0054   std::vector<MonitorElement *> leadLepEtaTemp_;
0055   std::vector<MonitorElement *> jetMultTemp_;
0056   std::vector<MonitorElement *> leadJetPtTemp_;
0057   std::vector<MonitorElement *> leadJetEtaTemp_;
0058 
0059   const edm::EDGetTokenT<reco::GenParticleCollection> genParticleToken_;
0060   const edm::EDGetTokenT<reco::GenJetCollection> genJetToken_;
0061 
0062   const int idxGenEvtInfo_, idxFSRup_, idxFSRdown_, idxISRup_, idxISRdown_, leadLepPtNbin_, rapidityNbin_;
0063   const double leadLepPtRange_, leadLepPtCut_, lepEtaCut_, rapidityRange_;
0064   const int nJetsNbin_, jetPtNbin_;
0065   const double jetPtCut_, jetEtaCut_, jetPtRange_;
0066   int idxMax_;
0067 };
0068 
0069 #endif