Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

#include "DQM/HcalCommon/interface/DetectorQuantity.h"

namespace hcaldqm {
  namespace quantity {
    int getValue_iphi(HcalDetId const &did) { return did.iphi(); }

    int getValue_ieta(HcalDetId const &did) {
      int x = did.ieta();
      if (x < 0)
        x = did.subdet() == HcalForward ? x + 41 : x + 42;
      else
        x = did.subdet() == HcalForward ? x + 42 : x + 41;
      return x;
    }

    int getValue_depth(HcalDetId const &did) { return did.depth(); }

    int getValue_Subdet(HcalDetId const &did) { return did.subdet() - 1; }

    int getValue_SubdetPM(HcalDetId const &did) {
      return did.ieta() < 0 ? 2 * (did.subdet() - 1) : 2 * (did.subdet() - 1) + 1;
    }

    uint32_t getBin_iphi(HcalDetId const &did) { return (uint32_t)(did.iphi()); }

    uint32_t getBin_ieta(HcalDetId const &did) { return (uint32_t)(getValue_ieta(did) + 1); }

    uint32_t getBin_depth(HcalDetId const &did) {  //return (uint32_t)(did.depth());}
      return (uint32_t)(did.subdet() == HcalOuter ? 7 : did.depth());
    }

    uint32_t getBin_Subdet(HcalDetId const &did) { return (uint32_t)(did.subdet()); }

    uint32_t getBin_SubdetPM(HcalDetId const &did) { return (uint32_t)(getValue_SubdetPM(did) + 1); }

    HcalDetId getDid_iphi(int v) { return HcalDetId(HcalBarrel, v, 1, 1); }

    HcalDetId getDid_ieta(int v) {
      return HcalDetId(HcalBarrel, v <= 41 ? (v <= 12 ? v - 41 : v - 42) : (v >= 71 ? v - 42 : v - 41), 1, 1);
    }

    HcalDetId getDid_depth(int v) { return HcalDetId(HcalBarrel, 1, 1, v); }

    HcalDetId getDid_Subdet(int v) { return HcalDetId((HcalSubdetector)(v + 1), 1, 1, 1); }

    HcalDetId getDid_SubdetPM(int v) { return HcalDetId((HcalSubdetector)(v / 2 + 1), v % 2 == 0 ? 1 : -1, 1, 1); }

    std::vector<std::string> getLabels_iphi() { return std::vector<std::string>(); }

    std::vector<std::string> getLabels_ieta() {
      std::vector<std::string> labels;
      char name[10];
      for (int i = 0; i < 84; i++) {
        sprintf(name, "%d", getDid_ieta(i).ieta());
        labels.push_back(std::string(name));
      }
      return labels;
    }

    std::vector<std::string> getLabels_depth() { return std::vector<std::string>(); }

    std::vector<std::string> getLabels_Subdet() {
      std::vector<std::string> labels;
      labels.reserve(4);
      for (int i = 0; i < 4; i++)
        labels.push_back(constants::SUBDET_NAME[i]);
      return labels;
    }

    std::vector<std::string> getLabels_SubdetPM() {
      std::vector<std::string> labels;
      labels.reserve(8);
      for (int i = 0; i < 8; i++)
        labels.push_back(constants::SUBDETPM_NAME[i]);
      return labels;
    }
  }  // namespace quantity
}  // namespace hcaldqm