Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DetectorQuantity_h
0002 #define DetectorQuantity_h
0003 
0004 /**
0005  *  file:       DetectorQuantity.h
0006  *  Author:     Viktor Khristenko
0007  */
0008 
0009 #include "DQM/HcalCommon/interface/Quantity.h"
0010 
0011 namespace hcaldqm {
0012   namespace quantity {
0013     enum DetectorQuantityType {
0014       fiphi = 0,
0015       fieta = 1,
0016       fdepth = 2,
0017       fSubdet = 3,
0018       fSubdetPM = 4,
0019       nDetectorQuantityType = 5
0020     };
0021     int getValue_iphi(HcalDetId const &);
0022     int getValue_ieta(HcalDetId const &);
0023     int getValue_depth(HcalDetId const &);
0024     int getValue_Subdet(HcalDetId const &);
0025     int getValue_SubdetPM(HcalDetId const &);
0026     uint32_t getBin_iphi(HcalDetId const &);
0027     uint32_t getBin_ieta(HcalDetId const &);
0028     uint32_t getBin_depth(HcalDetId const &);
0029     uint32_t getBin_Subdet(HcalDetId const &);
0030     uint32_t getBin_SubdetPM(HcalDetId const &);
0031     HcalDetId getDid_iphi(int);
0032     HcalDetId getDid_ieta(int);
0033     HcalDetId getDid_depth(int);
0034     HcalDetId getDid_Subdet(int);
0035     HcalDetId getDid_SubdetPM(int);
0036     std::vector<std::string> getLabels_iphi();
0037     std::vector<std::string> getLabels_ieta();
0038     std::vector<std::string> getLabels_depth();
0039     std::vector<std::string> getLabels_Subdet();
0040     std::vector<std::string> getLabels_SubdetPM();
0041 
0042     typedef int (*getValueType_did)(HcalDetId const &);
0043     typedef uint32_t (*getBinType_did)(HcalDetId const &);
0044     typedef HcalDetId (*getDid_did)(int);
0045     typedef std::vector<std::string> (*getLabels_did)();
0046     getValueType_did const getValue_functions_did[nDetectorQuantityType] = {
0047         getValue_iphi, getValue_ieta, getValue_depth, getValue_Subdet, getValue_SubdetPM};
0048     getBinType_did const getBin_functions_did[nDetectorQuantityType] = {
0049         getBin_iphi, getBin_ieta, getBin_depth, getBin_Subdet, getBin_SubdetPM};
0050     getDid_did const getDid_functions_did[nDetectorQuantityType] = {
0051         getDid_iphi, getDid_ieta, getDid_depth, getDid_Subdet, getDid_SubdetPM};
0052     getLabels_did const getLabels_functions_did[nDetectorQuantityType] = {
0053         getLabels_iphi, getLabels_ieta, getLabels_depth, getLabels_Subdet, getLabels_SubdetPM};
0054     std::string const name_did[nDetectorQuantityType] = {"iphi", "ieta", "depth", "Subdet", "SubdetPM"};
0055     double const min_did[nDetectorQuantityType] = {0.5, 0, 0.5, 0, 0};
0056     double const max_did[nDetectorQuantityType] = {72.5, 84, 4.5, 4, 8};
0057     int const nbins_did[nDetectorQuantityType] = {72, 84, 4, 4, 8};
0058 
0059     class DetectorQuantity : public Quantity {
0060     public:
0061       DetectorQuantity() {}
0062       DetectorQuantity(DetectorQuantityType type, bool isLog = false) : Quantity(name_did[type], isLog), _type(type) {}
0063       ~DetectorQuantity() override {}
0064       DetectorQuantity *makeCopy() override { return new DetectorQuantity(_type, _isLog); }
0065 
0066       int getValue(HcalDetId const &did) override { return getValue_functions_did[_type](did); }
0067       uint32_t getBin(HcalDetId const &did) override { return getBin_functions_did[_type](did); }
0068 
0069       QuantityType type() override { return fDetectorQuantity; }
0070       int nbins() override { return nbins_did[_type]; }
0071       double min() override { return min_did[_type]; }
0072       double max() override { return max_did[_type]; }
0073       bool isCoordinate() override { return true; }
0074       std::vector<std::string> getLabels() override { return getLabels_functions_did[_type](); }
0075 
0076     protected:
0077       DetectorQuantityType _type;
0078     };
0079   }  // namespace quantity
0080 }  // namespace hcaldqm
0081 
0082 #endif