Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /* 
0002  * File:   HcalDigisClient.h
0003  * Author: fahim
0004  *
0005  * Created on June 11, 2011, 6:38 PM
0006  */
0007 
0008 #ifndef HCALDIGISCLIENT_H
0009 #define HCALDIGISCLIENT_H
0010 
0011 #include <memory>
0012 
0013 // user include files
0014 #include "FWCore/Framework/interface/Frameworkfwd.h"
0015 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0016 #include "FWCore/ServiceRegistry/interface/Service.h"
0017 #include "FWCore/Framework/interface/MakerMacros.h"
0018 
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/MakerMacros.h"
0021 
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023 
0024 #include "DQMServices/Core/interface/DQMStore.h"
0025 
0026 class HcalDigisClient : public DQMEDHarvester {
0027 public:
0028   explicit HcalDigisClient(const edm::ParameterSet &);
0029 
0030   ~HcalDigisClient() override;
0031 
0032 private:
0033   void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override {
0034     igetter.setCurrentFolder(dirName_);  // This sets the DQMStore (should apply to ibooker as well
0035     runClient(ibooker, igetter);
0036   }
0037 
0038   struct HistLim {
0039     HistLim(int nbin, double mini, double maxi) : n(nbin), min(mini), max(maxi) {}
0040     int n;
0041     double min;
0042     double max;
0043   };
0044 
0045   virtual void runClient(DQMStore::IBooker &ib, DQMStore::IGetter &ig);
0046   int HcalDigisEndjob(const std::vector<MonitorElement *> &hcalMEs, std::string subdet_, DQMStore::IBooker &ib);
0047 
0048   MonitorElement *monitor(std::string name);
0049 
0050   void book1D(DQMStore::IBooker &ib, std::string name, int n, double min, double max) {
0051     if (!msm_->count(name))
0052       (*msm_)[name] = ib.book1D(name.c_str(), name.c_str(), n, min, max);
0053   }
0054 
0055   void book1D(DQMStore::IBooker &ib, std::string name, const HistLim &limX) {
0056     if (!msm_->count(name))
0057       (*msm_)[name] = ib.book1D(name.c_str(), name.c_str(), limX.n, limX.min, limX.max);
0058   }
0059 
0060   void fill1D(std::string name, double X, double weight = 1) { msm_->find(name)->second->Fill(X, weight); }
0061 
0062   void book2D(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY) {
0063     if (!msm_->count(name))
0064       (*msm_)[name] = ib.book2D(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max);
0065   }
0066 
0067   void fill2D(std::string name, double X, double Y, double weight = 1) { msm_->find(name)->second->Fill(X, Y, weight); }
0068 
0069   void bookPf(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY) {
0070     if (!msm_->count(name))
0071       (*msm_)[name] =
0072           ib.bookProfile(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max);
0073   }
0074 
0075   void bookPf(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY, const char *option) {
0076     if (!msm_->count(name))
0077       (*msm_)[name] =
0078           ib.bookProfile(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max, option);
0079   }
0080 
0081   void fillPf(std::string name, double X, double Y) { msm_->find(name)->second->Fill(X, Y); }
0082 
0083   std::string str(int x);
0084 
0085   double integralMETH2D(MonitorElement *ME, int i0, int i1, int j0, int j1);
0086   void scaleMETH2D(MonitorElement *ME, double s);
0087   std::map<std::string, MonitorElement *> *msm_;
0088   std::string outputFile_;
0089   std::string dirName_;
0090 };
0091 
0092 #endif /* HCALDIGISCLIENT_H */