Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:41

0001 #include "SimDataFormats/EcalTestBeam/interface/HodoscopeDetId.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 
0004 #include <iostream>
0005 HodoscopeDetId::HodoscopeDetId() : EBDetId() {}
0006 
0007 HodoscopeDetId::HodoscopeDetId(uint32_t rawid) : EBDetId(rawid) {}
0008 
0009 int HodoscopeDetId::planeId() const { return ieta(); }
0010 
0011 int HodoscopeDetId::fibrId() const { return iphi(); }
0012 
0013 HodoscopeDetId::HodoscopeDetId(int iPlane, int iFibr) : EBDetId(iPlane, iFibr) {
0014   if (!validDetId(iPlane, iFibr)) {
0015     throw cms::Exception("InvalidDetId") << "HodoscopeDetId:  Cannot create object.  Indices out of bounds.";
0016   }
0017 }
0018 
0019 HodoscopeDetId::HodoscopeDetId(const DetId& gen) : EBDetId(gen) {
0020   if (!validDetId(planeId(), fibrId())) {
0021     throw cms::Exception("InvalidDetId") << "HodoscopeDetId:  Cannot create object.  Indices out of bounds.";
0022   }
0023 }
0024 
0025 bool HodoscopeDetId::validDetId(int iPlane, int iFibr) {
0026   return !(iPlane < MIN_PLANE || iPlane > MAX_PLANE || iFibr < MIN_FIBR || iFibr > MAX_FIBR);
0027 }
0028 
0029 std::ostream& operator<<(std::ostream& s, const HodoscopeDetId& id) {
0030   return s << "(Plane " << id.planeId() << ", fiber " << id.fibrId() << ')';
0031 }