File indexing completed on 2024-04-06 12:03:47
0001 #ifndef DataFormats_CaloRecHit_CaloID_h
0002 #define DataFormats_CaloRecHit_CaloID_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <iosfwd>
0014
0015 namespace reco {
0016
0017 class CaloID {
0018 public:
0019 enum Detectors {
0020 DET_ECAL_BARREL = 0,
0021 DET_ECAL_ENDCAP,
0022 DET_PS1,
0023 DET_PS2,
0024 DET_HCAL_BARREL,
0025 DET_HCAL_ENDCAP,
0026 DET_HF,
0027 DET_HF_EM,
0028 DET_HF_HAD,
0029 DET_HO,
0030 DET_HGCAL_ENDCAP,
0031 DET_NONE
0032 };
0033
0034
0035 CaloID() : detectors_(0) {}
0036
0037 CaloID(Detectors det) : detectors_(0) { setDetector(det, true); }
0038
0039
0040 virtual ~CaloID() {}
0041
0042
0043 void setDetector(CaloID::Detectors theDetector, bool value);
0044
0045
0046 unsigned detectors() const { return detectors_; }
0047
0048
0049 bool detector(CaloID::Detectors theDetector) const;
0050
0051
0052 bool isSingleDetector() const {
0053
0054 return static_cast<bool>(detectors_ && !((detectors_ - 1) & detectors_));
0055 }
0056
0057
0058
0059 Detectors detector() const;
0060
0061 friend std::ostream& operator<<(std::ostream& out, const CaloID& id);
0062
0063 private:
0064
0065 int leastSignificantBitPosition(unsigned n) const;
0066
0067
0068
0069 unsigned detectors_;
0070 };
0071
0072 std::ostream& operator<<(std::ostream& out, const CaloID& id);
0073
0074 }
0075
0076 #endif