Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-05 04:09:41

0001 #ifndef SiStripMonitorSummary_SiStripBaseCondObjDQM_h
0002 #define SiStripMonitorSummary_SiStripBaseCondObjDQM_h
0003 
0004 #include "FWCore/Framework/interface/ESWatcher.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ServiceRegistry/interface/Service.h"
0009 
0010 #include "DataFormats/DetId/interface/DetId.h"
0011 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
0012 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0013 
0014 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
0015 #include "DQM/SiStripCommon/interface/SiStripHistoId.h"
0016 
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018 
0019 #include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h"
0020 
0021 #include "CommonTools/TrackerMap/interface/TrackerMap.h"
0022 #include "DQM/SiStripCommon/interface/TkHistoMap.h"  /// ADDITON OF TK_HISTO_MAP
0023 
0024 #include "CommonTools/UtilAlgos/interface/DetIdSelector.h"
0025 
0026 #include <map>
0027 #include <sstream>
0028 #include <string>
0029 #include <vector>
0030 
0031 class TrackerTopology;
0032 class SiStripBaseCondObjDQM {
0033 public:
0034   typedef dqm::legacy::DQMStore DQMStore;
0035   typedef dqm::legacy::MonitorElement MonitorElement;
0036 
0037   SiStripBaseCondObjDQM(edm::RunNumber_t iRun,
0038                         edm::ParameterSet const &hPSet,
0039                         edm::ParameterSet const &fPSet,
0040                         const TrackerTopology *tTopo);
0041 
0042   virtual ~SiStripBaseCondObjDQM(){};
0043 
0044   virtual void getActiveDetIds(const edm::EventSetup &eSetup) = 0;
0045 
0046   void analysis(const edm::EventSetup &eSetup_);
0047   void analysisOnDemand(const edm::EventSetup &eSetup_, uint32_t detIdOnDemand);
0048   void analysisOnDemand(const edm::EventSetup &eSetup_, const std::vector<uint32_t> &detIdsOnDemand);
0049   void analysisOnDemand(const edm::EventSetup &eSetup_,
0050                         std::string requestedSubDetector,
0051                         uint32_t requestedSide,
0052                         uint32_t requestedLayer);
0053 
0054   void selectModules(std::vector<uint32_t> &detIds_);
0055 
0056   //    virtual void fillTopSummaryMEs()=0;
0057 
0058   virtual void getConditionObject(const edm::EventSetup &eSetup_) = 0;
0059   virtual bool checkChanged(const edm::EventSetup &eSetup) = 0;
0060 
0061   virtual void end();
0062 
0063 protected:
0064   struct ModMEs {
0065     ModMEs()
0066         : ProfileDistr(nullptr),
0067           CumulDistr(nullptr),
0068           SummaryOfProfileDistr(nullptr),
0069           SummaryOfCumulDistr(nullptr),
0070           SummaryDistr(nullptr) {
0071       ;
0072     }
0073     MonitorElement *ProfileDistr;
0074     MonitorElement *CumulDistr;
0075     MonitorElement *SummaryOfProfileDistr;
0076     MonitorElement *SummaryOfCumulDistr;
0077     MonitorElement *SummaryDistr;
0078   };
0079 
0080   void getModMEs(ModMEs &CondObj_ME, const uint32_t &detId_);
0081   void getSummaryMEs(ModMEs &CondObj_ME, const uint32_t &detId_);
0082   std::pair<std::string, uint32_t> getLayerNameAndId(const uint32_t &detId_);
0083   std::pair<std::string, uint32_t> getStringNameAndId(const uint32_t &detId_);
0084   std::vector<uint32_t> GetSameLayerDetId(const std::vector<uint32_t> &activeDetIds, uint32_t selDetId);
0085 
0086   virtual void fillModMEs(const std::vector<uint32_t> &selectedDetIds);
0087   virtual void fillSummaryMEs(const std::vector<uint32_t> &selectedDetIds);
0088   virtual void fillMEsForDet(const ModMEs &selModME_, uint32_t selDetId_) = 0;
0089   virtual void fillMEsForLayer(
0090       /*std::map<uint32_t, ModMEs> selModMEsMap_, */ uint32_t selDetId_) = 0;
0091 
0092   void fillTkMap(const uint32_t &detid, const float &value);
0093 
0094   SiStripDetInfo detInfo_;
0095 
0096   edm::ParameterSet hPSet_;
0097   edm::ParameterSet fPSet_;
0098 
0099   bool Mod_On_;
0100   bool HistoMaps_On_;
0101   bool SummaryOnLayerLevel_On_;
0102   bool SummaryOnStringLevel_On_;
0103   bool GrandSummary_On_;
0104   double minValue, maxValue;
0105   std::vector<int> tkMapScaler;
0106 
0107   // bool ActiveDetIds_On_;
0108 
0109   std::string CondObj_fillId_;
0110   std::string CondObj_name_;
0111 
0112   std::map<uint32_t, ModMEs> ModMEsMap_;
0113   std::map<uint32_t, ModMEs> SummaryMEsMap_;
0114   std::vector<uint32_t> activeDetIds;
0115   std::vector<uint32_t> all_DetIds;
0116 
0117   std::unique_ptr<TkHistoMap> Tk_HM_;
0118   std::unique_ptr<TkHistoMap> Tk_HM_H;
0119   std::unique_ptr<TkHistoMap> Tk_HM_L;
0120   TrackerMap *tkMap;
0121 
0122   const TrackerTopology *tTopo_;
0123 
0124 private:
0125   void bookProfileMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_);
0126   void bookCumulMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_);
0127   void bookSummaryProfileMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_);
0128   void bookSummaryCumulMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_);
0129   void bookSummaryMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_);
0130 
0131   void bookTkMap(const std::string &TkMapname);
0132 
0133   void saveTkMap(const std::string &TkMapname, double minValue, double maxValue);
0134 
0135   std::vector<uint32_t> ModulesToBeExcluded_;
0136   std::vector<uint32_t> ModulesToBeIncluded_;
0137   std::vector<std::string> SubDetectorsToBeExcluded_;
0138 
0139   std::string condDataMonitoringMode_;
0140 
0141   SiStripHistoId hidmanager;
0142   SiStripFolderOrganizer folder_organizer;
0143   DQMStore *dqmStore_;
0144   edm::RunNumber_t runNumber_;
0145 };
0146 
0147 template <typename CondObj, typename Record>
0148 class SiStripBaseCondObjDQMGet : public SiStripBaseCondObjDQM {
0149 public:
0150   using tokentype = typename edm::ESGetToken<CondObj, Record>;
0151   SiStripBaseCondObjDQMGet(tokentype token,
0152                            edm::RunNumber_t iRun,
0153                            edm::ParameterSet const &hPSet,
0154                            edm::ParameterSet const &fPSet,
0155                            const TrackerTopology *tTopo)
0156       : SiStripBaseCondObjDQM{iRun, hPSet, fPSet, tTopo}, token_{token} {}
0157   ~SiStripBaseCondObjDQMGet() override {}
0158 
0159   void getConditionObject(const edm::EventSetup &eSetup) override { condObj_ = &eSetup.getData(token_); }
0160   bool checkChanged(const edm::EventSetup &eSetup) override { return watcher_.check(eSetup); }
0161 
0162 protected:
0163   const CondObj *condObj_;
0164 
0165 private:
0166   tokentype token_;
0167   edm::ESWatcher<Record> watcher_;
0168 };
0169 
0170 #endif