CMS 3D CMS Logo

CaloID.h
Go to the documentation of this file.
1 #ifndef DataFormats_CaloRecHit_CaloID_h
2 #define DataFormats_CaloRecHit_CaloID_h
3 
13 #include <iosfwd>
14 
15 namespace reco {
16 
17  class CaloID {
18  public:
19  enum Detectors {
32  };
33 
35  CaloID() : detectors_(0) {}
36 
37  CaloID(Detectors det) : detectors_(0) { setDetector(det, true); }
38 
40  virtual ~CaloID() {}
41 
43  void setDetector(CaloID::Detectors theDetector, bool value);
44 
46  unsigned detectors() const { return detectors_; }
47 
49  bool detector(CaloID::Detectors theDetector) const;
50 
52  bool isSingleDetector() const {
53  // check that detectors_ is a power of 2
54  return static_cast<bool>(detectors_ && !((detectors_ - 1) & detectors_));
55  }
56 
59  Detectors detector() const;
60 
61  CaloID& operator=(const CaloID& rhs) {
62  detectors_ = rhs.detectors_;
63  return *this;
64  }
65 
66  friend std::ostream& operator<<(std::ostream& out, const CaloID& id);
67 
68  private:
70  int leastSignificantBitPosition(unsigned n) const;
71 
74  unsigned detectors_;
75  };
76 
77  std::ostream& operator<<(std::ostream& out, const CaloID& id);
78 
79 } // namespace reco
80 
81 #endif
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
reco::CaloID::Detectors
Detectors
Definition: CaloID.h:19
reco::CaloID::DET_HGCAL_ENDCAP
Definition: CaloID.h:30
reco::CaloID::DET_ECAL_ENDCAP
Definition: CaloID.h:21
reco::CaloID::CaloID
CaloID()
default constructor. Sets energy and position to zero
Definition: CaloID.h:35
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::CaloID::DET_HF
Definition: CaloID.h:26
reco::CaloID::DET_PS2
Definition: CaloID.h:23
reco::CaloID::DET_HF_HAD
Definition: CaloID.h:28
reco::CaloID::operator=
CaloID & operator=(const CaloID &rhs)
Definition: CaloID.h:61
reco::CaloID::CaloID
CaloID(Detectors det)
Definition: CaloID.h:37
reco::CaloID::DET_HF_EM
Definition: CaloID.h:27
reco::CaloID::DET_HCAL_ENDCAP
Definition: CaloID.h:25
reco::CaloID::DET_PS1
Definition: CaloID.h:22
reco::CaloID::operator<<
friend std::ostream & operator<<(std::ostream &out, const CaloID &id)
reco::CaloID::leastSignificantBitPosition
int leastSignificantBitPosition(unsigned n) const
Definition: CaloID.cc:30
reco::CaloID::isSingleDetector
bool isSingleDetector() const
Definition: CaloID.h:52
reco::CaloID::detectors_
unsigned detectors_
Definition: CaloID.h:74
reco::CaloID::DET_HCAL_BARREL
Definition: CaloID.h:24
value
Definition: value.py:1
reco::CaloID::DET_NONE
Definition: CaloID.h:31
reco::operator<<
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
reco::CaloID
Definition: CaloID.h:17
reco::CaloID::setDetector
void setDetector(CaloID::Detectors theDetector, bool value)
tells the CaloID that it describes a given detector
Definition: CaloID.cc:7
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
reco::CaloID::~CaloID
virtual ~CaloID()
abstract class
Definition: CaloID.h:40
reco::CaloID::detectors
unsigned detectors() const
Definition: CaloID.h:46
reco::CaloID::DET_HO
Definition: CaloID.h:29
reco::CaloID::detector
Detectors detector() const
Definition: CaloID.cc:19
reco::CaloID::DET_ECAL_BARREL
Definition: CaloID.h:20