Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-11 04:32:40

0001 // -*- C++ -*-
0002 //
0003 // Package:    DQM/SiStripMonitorHardware
0004 // Class:      HistogramBase
0005 //
0006 /**\class HistogramBase DQM/SiStripMonitorHardware/interface/HistogramBase.hh
0007 
0008  Description: DQM source application to produce data integrety histograms for SiStrip data
0009 */
0010 //
0011 // Original Author:  Nicholas Cripps in plugin file
0012 //         Created:  2008/09/16
0013 // Modified by    :  Anne-Marie Magnan, code copied from plugin to this class
0014 //
0015 
0016 #ifndef DQM_SiStripMonitorHardware_HistogramBase_HH
0017 #define DQM_SiStripMonitorHardware_HistogramBase_HH
0018 
0019 #include <sstream>
0020 
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 
0023 #include "DQM/SiStripCommon/interface/TkHistoMap.h"
0024 
0025 #include "DQMServices/Core/interface/DQMStore.h"
0026 
0027 class HistogramBase {
0028 public:
0029   typedef dqm::legacy::DQMStore DQMStore;
0030   typedef dqm::legacy::MonitorElement MonitorElement;
0031 
0032   struct HistogramConfig {
0033     HistogramConfig() : globalswitchon(true) {}
0034     MonitorElement* monitorEle;
0035     bool enabled;
0036     unsigned int nBins;
0037     double min;
0038     double max;
0039     bool globalswitchon;
0040   };
0041 
0042   virtual ~HistogramBase() {}
0043 
0044   //initialise histograms
0045   //make it pure abstract: implementation in derived class.
0046   virtual void initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) = 0;
0047 
0048   //fill a histogram if the pointer is not NULL (ie if it has been booked)
0049   static void fillHistogram(HistogramConfig& histogram, double value, double weight = 1.);
0050 
0051   //fill a histogram if the pointer is not NULL (ie if it has been booked)
0052   static void fillHistogram(MonitorElement* histogram, double value, double weight = 1.);
0053   //fill a 2D profile trend histogram if the pointer is not NULL (ie if it has been booked)
0054   static void fillHistogram2D(HistogramConfig& histogram, double value, double trendVar, double weight = 1.);
0055   //fill tkHistoMap of percentage of bad channels per module
0056   static void fillTkHistoMap(TkHistoMap* aMap, uint32_t& detid, float value);
0057 
0058   //if one of more histo map, return name and pointer
0059   virtual bool tkHistoMapEnabled(unsigned int aIndex = 0) = 0;
0060 
0061   virtual TkHistoMap* tkHistoMapPointer(unsigned int aIndex = 0) = 0;
0062 
0063   //load the config for a histogram from PSet called <configName>HistogramConfig (writes a debug message to stream if pointer is non-NULL)
0064   void getConfigForHistogram(HistogramConfig& aConfig,
0065                              const std::string& configName,
0066                              const edm::ParameterSet& psetContainingConfigPSet,
0067                              std::ostringstream* pDebugStream);
0068 
0069   //book an individual hiostogram if enabled in config
0070   void bookHistogram(DQMStore::IBooker&,
0071                      HistogramConfig& aConfig,
0072                      const std::string& name,
0073                      const std::string& title,
0074                      const unsigned int nBins,
0075                      const double min,
0076                      const double max,
0077                      const std::string& xAxisTitle);
0078 
0079   //book an individual hiostogram if enabled in config
0080   void bookHistogram(DQMStore::IBooker&,
0081                      HistogramConfig& aConfig,
0082                      MonitorElement*& aHist,
0083                      const std::string& name,
0084                      const std::string& title,
0085                      const unsigned int nBins,
0086                      const double min,
0087                      const double max,
0088                      const std::string& xAxisTitle);
0089 
0090   //book an individual hiostogram if enabled in config
0091   void book2DHistogram(DQMStore::IBooker&,
0092                        HistogramConfig& aConfig,
0093                        const std::string& name,
0094                        const std::string& title,
0095                        const unsigned int nBins,
0096                        const double min,
0097                        const double max,
0098                        const unsigned int nBinsY,
0099                        const double minY,
0100                        const double maxY,
0101                        const std::string& xAxisTitle,
0102                        const std::string& yAxisTitle);
0103 
0104   //book an individual hiostogram if enabled in config
0105   void book2DHistogram(DQMStore::IBooker&,
0106                        HistogramConfig& aConfig,
0107                        MonitorElement*& aHist,
0108                        const std::string& name,
0109                        const std::string& title,
0110                        const unsigned int nBins,
0111                        const double min,
0112                        const double max,
0113                        const unsigned int nBinsY,
0114                        const double minY,
0115                        const double maxY,
0116                        const std::string& xAxisTitle,
0117                        const std::string& yAxisTitle);
0118 
0119   //same but using binning from config
0120   void bookHistogram(DQMStore::IBooker&,
0121                      HistogramConfig& aConfig,
0122                      const std::string& name,
0123                      const std::string& title,
0124                      const std::string& xAxisTitle);
0125 
0126   void bookProfile(DQMStore::IBooker&,
0127                    HistogramConfig& aConfig,
0128                    const std::string& name,
0129                    const std::string& title,
0130                    const unsigned int nBins,
0131                    const double min,
0132                    const double max,
0133                    const double minY,
0134                    const double maxY,
0135                    const std::string& xAxisTitle,
0136                    const std::string& yAxisTitle);
0137 
0138   void bookProfile(DQMStore::IBooker&,
0139                    HistogramConfig& aConfig,
0140                    const std::string& name,
0141                    const std::string& title,
0142                    const double minY,
0143                    const double maxY,
0144                    const std::string& xAxisTitle,
0145                    const std::string& yAxisTitle);
0146   void bookProfile2D(DQMStore::IBooker&,
0147                      HistogramConfig& aConfig,
0148                      const std::string& name,
0149                      const std::string& title,
0150                      const unsigned int nBinsx,
0151                      const double xmin,
0152                      const double xmax,
0153                      const unsigned int nBinsy,
0154                      const double ymin,
0155                      const double ymax,
0156                      const std::string& xAxisTitle,
0157                      const std::string& yAxisTitle);
0158 
0159   void bookProfile2D(DQMStore::IBooker&,
0160                      HistogramConfig& aConfig,
0161                      const std::string& name,
0162                      const std::string& title,
0163                      const unsigned int nBinsy,
0164                      const double ymin,
0165                      const double ymax,
0166                      const std::string& xAxisTitle,
0167                      const std::string& yAxisTitle);
0168 
0169 protected:
0170 private:
0171 };  //class
0172 
0173 #endif  //DQM_SiStripMonitorHardware_HistogramBase_HH