CMS 3D CMS Logo

CTPPSPixelDetId.cc
Go to the documentation of this file.
1 /*
2  Author: F.Ferro INFN Genova
3  October 2016
4 */
5 
8 
9 // VeryForward =7, Tracker = 4
10 
12 
14  if (!check(id)) {
15  throw cms::Exception("InvalidDetId") << "CTPPSPixelDetId ctor:"
16  << " det: " << det() << " subdet: " << subdetId()
17  << " is not a valid CTPPS Pixel id";
18  }
19 }
20 
21 CTPPSPixelDetId::CTPPSPixelDetId(unsigned int Arm, unsigned int Station, unsigned int RP, unsigned int Plane)
22  : CTPPSDetId(sdTrackingPixel, Arm, Station, RP) {
23  this->init(Arm, Station, RP, Plane);
24 }
25 
26 void CTPPSPixelDetId::init(unsigned int Arm, unsigned int Station, unsigned int RP, unsigned int Plane) {
27  if (Arm > maxArm || Station > maxStation || RP > maxRP || Plane > maxPlane) {
28  throw cms::Exception("InvalidDetId") << "CTPPSPixelDetId ctor:"
29  << " Invalid parameterss: "
30  << " Arm " << Arm << " Station " << Station << " RP " << RP << " Plane "
31  << Plane << std::endl;
32  }
33 
34  uint32_t ok = 0xfe000000;
35  id_ &= ok;
36 
37  id_ |= ((Arm & maskArm) << startArmBit);
38  id_ |= ((Station & maskStation) << startStationBit);
39  id_ |= ((RP & maskRP) << startRPBit);
40  id_ |= ((Plane & maskPlane) << startPlaneBit);
41 }
42 
43 std::ostream& operator<<(std::ostream& os, const CTPPSPixelDetId& id) {
44  os << " Arm " << id.arm() << " Station " << id.station() << " RP " << id.rp() << " Plane " << id.plane();
45 
46  return os;
47 }
std::ostream & operator<<(std::ostream &os, const CTPPSPixelDetId &id)
static const uint32_t maxStation
Definition: CTPPSDetId.h:46
static bool check(unsigned int raw)
static const uint32_t maskPlane
static const uint32_t startRPBit
Definition: CTPPSDetId.h:47
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
Definition: Plane.h:16
static const uint32_t maskStation
Definition: CTPPSDetId.h:46
static const uint32_t maxPlane
static const uint32_t maskRP
Definition: CTPPSDetId.h:47
static const uint32_t startPlaneBit
static const uint32_t maskArm
Definition: CTPPSDetId.h:45
static const uint32_t maxArm
Definition: CTPPSDetId.h:45
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static const uint32_t maxRP
Definition: CTPPSDetId.h:47
uint32_t id_
Definition: DetId.h:69
static const uint32_t startStationBit
Definition: CTPPSDetId.h:46
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
void init(uint32_t Arm, uint32_t Station, uint32_t RP, uint32_t Plane)
static const uint32_t startArmBit
Definition: CTPPSDetId.h:45
CTPPSPixelDetId(uint32_t id)
Construct from a packed id.