Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:30

0001 #ifndef DQM_SiStripCommissioningClients_CommissioningHistograms_H
0002 #define DQM_SiStripCommissioningClients_CommissioningHistograms_H
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0007 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
0008 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
0009 #include "DQM/SiStripCommissioningSummary/interface/CommissioningSummaryFactory.h"
0010 #include "DQM/SiStripCommon/interface/ExtractTObject.h"
0011 #include "DQMServices/Core/interface/DQMStore.h"
0012 #include "TProfile.h"
0013 #include "TH1.h"
0014 #include <iostream>
0015 #include <sstream>
0016 #include <string>
0017 #include <vector>
0018 #include <map>
0019 #include <cstdint>
0020 
0021 class CommissioningAnalysis;
0022 
0023 class CommissioningHistograms {
0024 public:
0025   // not used here but some uses in derived classes
0026   typedef dqm::harvesting::MonitorElement MonitorElement;
0027   typedef dqm::harvesting::DQMStore DQMStore;
0028   // ---------- con(de)structors ----------
0029 
0030   CommissioningHistograms(const edm::ParameterSet& pset, DQMStore* const, const sistrip::RunType&);
0031 
0032   // MAKE PRIVATE
0033   CommissioningHistograms();  // private constructor
0034 
0035   virtual ~CommissioningHistograms();
0036 
0037   virtual void configure(const edm::ParameterSet&, const edm::EventSetup&) {}
0038 
0039   // ---------- histogram container class ----------
0040 
0041   class Histo {
0042   public:
0043     Histo(const std::string& title, MonitorElement* const me, MonitorElement* const cme)
0044         : title_(title), me_(me), cme_(cme) {
0045       ;
0046     }
0047     Histo() : title_(""), me_(nullptr), cme_(nullptr) { ; }
0048     void print(std::stringstream&) const;
0049     std::string title_;
0050     MonitorElement* me_;
0051     MonitorElement* cme_;
0052   };
0053 
0054   // ---------- typedefs ----------
0055 
0056   typedef std::map<uint32_t, CommissioningAnalysis*> Analyses;
0057 
0058   typedef Analyses::iterator Analysis;
0059 
0060   typedef SummaryPlotFactory<CommissioningAnalysis*> Factory;
0061 
0062   typedef std::vector<Histo*> Histos;
0063 
0064   typedef std::map<uint32_t, Histos> HistosMap;
0065 
0066   typedef std::map<uint32_t, uint32_t> FedToFecMap;
0067 
0068   // ---------- histogram "actions" ----------
0069 
0070   static uint32_t runNumber(DQMStore* const, const std::vector<std::string>&);
0071 
0072   static sistrip::RunType runType(DQMStore* const, const std::vector<std::string>&);
0073 
0074   /** Extracts custom information from list of MonitorElements. */
0075   static void copyCustomInformation(DQMStore* const, const std::vector<std::string>&);
0076 
0077   void extractHistograms(const std::vector<std::string>&);
0078 
0079   // DEPRECATE
0080   void createCollations(const std::vector<std::string>&);
0081 
0082   virtual void histoAnalysis(bool debug);
0083 
0084   virtual void printAnalyses();
0085 
0086   virtual void printSummary();
0087 
0088   virtual void createSummaryHisto(const sistrip::Monitorable&,
0089                                   const sistrip::Presentation&,
0090                                   const std::string& top_level_dir,
0091                                   const sistrip::Granularity&);
0092 
0093   void remove(std::string pattern = "");
0094 
0095   void save(std::string& filename, uint32_t run_number = 0, std::string partitionName = "");
0096 
0097   // ---------- protected methods ----------
0098 
0099 protected:
0100   inline const sistrip::RunType& task() const;
0101 
0102   inline DQMStore* const bei() const;
0103 
0104   Analyses& data(bool getMaskedData = false);
0105 
0106   inline Factory* const factory();
0107 
0108   inline const HistosMap& histos() const;
0109 
0110   inline const FedToFecMap& mapping() const;
0111 
0112   inline const edm::ParameterSet& pset() const;
0113 
0114   TH1* histogram(const sistrip::Monitorable&,
0115                  const sistrip::Presentation&,
0116                  const sistrip::View&,
0117                  const std::string& directory,
0118                  const uint32_t& xbins,
0119                  const float& xlow = 1. * sistrip::invalid_,
0120                  const float& xhigh = 1. * sistrip::invalid_);
0121 
0122   void printHistosMap();
0123 
0124   void clearHistosMap();
0125 
0126   // ---------- private member data ----------
0127 
0128 protected:
0129   std::unique_ptr<Factory> factory_;
0130 
0131 private:
0132   sistrip::RunType task_;
0133 
0134   DQMStore* bei_;
0135 
0136   Analyses data_;
0137 
0138   HistosMap histos_;
0139 
0140   FedToFecMap mapping_;
0141 
0142   edm::ParameterSet pset_;
0143 
0144   bool mask_;
0145   std::vector<uint32_t> fedMaskVector_;
0146   std::vector<uint32_t> fecMaskVector_;
0147   std::vector<uint32_t> ringVector_;
0148   std::vector<uint32_t> ccuVector_;
0149   std::vector<uint32_t> i2cChanVector_;
0150   std::vector<uint32_t> lldChanVector_;
0151 
0152   Analyses dataWithMask_;
0153   bool dataWithMaskCached_;
0154 };
0155 
0156 // ---------- inline methods ----------
0157 
0158 const sistrip::RunType& CommissioningHistograms::task() const { return task_; }
0159 CommissioningHistograms::DQMStore* const CommissioningHistograms::bei() const { return bei_; }
0160 CommissioningHistograms::Factory* const CommissioningHistograms::factory() { return factory_.get(); }
0161 const CommissioningHistograms::HistosMap& CommissioningHistograms::histos() const { return histos_; }
0162 const CommissioningHistograms::FedToFecMap& CommissioningHistograms::mapping() const { return mapping_; }
0163 const edm::ParameterSet& CommissioningHistograms::pset() const { return pset_; }
0164 
0165 #endif  // DQM_SiStripCommissioningClients_CommissioningHistograms_H