Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:28

0001 #ifndef Quantity_h
0002 #define Quantity_h
0003 
0004 /**
0005  *  file:       Quantity.h
0006  *  Author:     Viktor Khristenko
0007  */
0008 
0009 #include "DQM/HcalCommon/interface/Constants.h"
0010 #include "DQM/HcalCommon/interface/HcalCommonHeaders.h"
0011 #include "DQM/HcalCommon/interface/Utilities.h"
0012 
0013 namespace hcaldqm {
0014   namespace quantity {
0015     enum QuantityType {
0016       fDetectorQuantity = 0,
0017       fElectronicsQuantity = 1,
0018       fTrigTowerQuantity = 2,
0019       fValueQuantity = 3,
0020       fFlagQuantity = 4,
0021       fNone = 5,
0022       nQuantityType = 6
0023     };
0024 
0025     enum AxisType { fXAxis = 0, fYAxis = 1, fZAxis = 2, nAxisType = 3 };
0026 
0027     class Quantity {
0028     public:
0029       Quantity() : _name("Quantity"), _isLog(false), _showOverflow(false) {}
0030       Quantity(std::string const &name, bool isLog) : _name(name), _isLog(isLog), _showOverflow(false) {}
0031       virtual ~Quantity() {}
0032 
0033       virtual QuantityType type() { return fNone; }
0034       virtual std::string name() { return _name; }
0035       virtual bool isLog() { return _isLog; }
0036       virtual void setAxisType(AxisType at) { _axistype = at; }
0037       virtual Quantity *makeCopy() { return new Quantity(_name, _isLog); }
0038 
0039       virtual uint32_t getBin(HcalDetId const &) { return 1; }
0040       virtual uint32_t getBin(HcalElectronicsId const &) { return 1; }
0041       virtual uint32_t getBin(HcalTrigTowerDetId const &) { return 1; }
0042       virtual uint32_t getBin(int) { return 1; }
0043       virtual uint32_t getBin(double) { return 1; }
0044 
0045       virtual int getValue(HcalDetId const &) { return 0; }
0046       virtual int getValue(HcalElectronicsId const &) { return 0; }
0047       virtual int getValue(HcalTrigTowerDetId const &) { return 0; }
0048       virtual int getValue(int x) { return x; }
0049       virtual double getValue(double x) { return x; }
0050 
0051       virtual void setBits(TH1 *o) { setLog(o); }
0052       virtual void setLog(TH1 *o) {
0053         if (_isLog)
0054           o->SetBit(BIT(constants::BIT_OFFSET + _axistype));
0055       }
0056 
0057       virtual int nbins() { return 1; }
0058       virtual int wofnbins() { return nbins() + 2; }
0059       virtual double min() { return 0; }
0060       virtual double max() { return 1; }
0061       virtual bool isCoordinate() { return false; }
0062       virtual std::vector<std::string> getLabels() { return std::vector<std::string>(); }
0063 
0064       virtual void setMax(double) {}
0065       virtual void setMin(double) {}
0066       virtual void setNbins(int) {}
0067 
0068       virtual void showOverflow(bool showOverflow) { _showOverflow = showOverflow; }
0069 
0070     protected:
0071       std::string _name;
0072       bool _isLog;
0073       AxisType _axistype;
0074       bool _showOverflow;
0075     };
0076   }  // namespace quantity
0077 }  // namespace hcaldqm
0078 
0079 #endif