CMS 3D CMS Logo

HodoscopeDetId.cc
Go to the documentation of this file.
3 
4 #include <iostream>
6 
7 HodoscopeDetId::HodoscopeDetId(uint32_t rawid) : EBDetId(rawid) {}
8 
9 int HodoscopeDetId::planeId() const { return ieta(); }
10 
11 int HodoscopeDetId::fibrId() const { return iphi(); }
12 
13 HodoscopeDetId::HodoscopeDetId(int iPlane, int iFibr) : EBDetId(iPlane, iFibr) {
14  if (!validDetId(iPlane, iFibr)) {
15  throw cms::Exception("InvalidDetId") << "HodoscopeDetId: Cannot create object. Indices out of bounds.";
16  }
17 }
18 
20  if (!validDetId(planeId(), fibrId())) {
21  throw cms::Exception("InvalidDetId") << "HodoscopeDetId: Cannot create object. Indices out of bounds.";
22  }
23 }
24 
25 bool HodoscopeDetId::validDetId(int iPlane, int iFibr) {
26  return !(iPlane < MIN_PLANE || iPlane > MAX_PLANE || iFibr < MIN_FIBR || iFibr > MAX_FIBR);
27 }
28 
29 std::ostream& operator<<(std::ostream& s, const HodoscopeDetId& id) {
30  return s << "(Plane " << id.planeId() << ", fiber " << id.fibrId() << ')';
31 }
static bool validDetId(int iPlane, int iFibr)
std::ostream & operator<<(std::ostream &s, const HodoscopeDetId &id)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
static const int MAX_FIBR
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
Definition: DetId.h:18
int fibrId() const
static const int MAX_PLANE
int planeId() const