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 
15  if (! check(id))
16  {
17  throw cms::Exception("InvalidDetId") << "CTPPSPixelDetId ctor:"
18  << " det: " << det()
19  << " subdet: " << subdetId()
20  << " is not a valid CTPPS Pixel id";
21  }
22 }
23 
24 
25 
26 CTPPSPixelDetId::CTPPSPixelDetId(unsigned int Arm, unsigned int Station, unsigned int RP, unsigned int Plane):
27  CTPPSDetId(sdTrackingPixel,Arm,Station,RP)
28 {
29  this->init(Arm,Station,RP,Plane);
30 }
31 
32 void CTPPSPixelDetId::init(unsigned int Arm, unsigned int Station, unsigned int RP, unsigned int Plane)
33 {
34  if (
35  Arm > maxArm || Station > maxStation || RP > maxRP || Plane > maxPlane
36  ) {
37  throw cms::Exception("InvalidDetId") << "CTPPSPixelDetId ctor:"
38  << " Invalid parameterss: "
39  << " Arm "<<Arm
40  << " Station "<<Station
41  << " RP "<<RP
42  << " Plane "<<Plane
43  << std::endl;
44  }
45 
46  uint32_t ok=0xfe000000;
47  id_ &= ok;
48 
49  id_ |= ((Arm & maskArm) << startArmBit);
50  id_ |= ((Station & maskStation) << startStationBit);
51  id_ |= ((RP & maskRP) << startRPBit);
52  id_ |= ((Plane & maskPlane) << startPlaneBit);
53 
54 }
55 
56 std::ostream& operator<<( std::ostream& os, const CTPPSPixelDetId& id ){
57  os << " Arm "<<id.arm()
58  << " Station " << id.station()
59  << " RP "<<id.rp()
60  << " Plane "<<id.plane();
61 
62  return os;
63 }
64 
65 
std::ostream & operator<<(std::ostream &os, const CTPPSPixelDetId &id)
static const uint32_t maxStation
Definition: CTPPSDetId.h:47
static bool check(unsigned int raw)
static const uint32_t maskPlane
static const uint32_t startRPBit
Definition: CTPPSDetId.h:48
Definition: Plane.h:17
static const uint32_t maskStation
Definition: CTPPSDetId.h:47
static const uint32_t maxPlane
static const uint32_t maskRP
Definition: CTPPSDetId.h:48
static const uint32_t startPlaneBit
static const uint32_t maskArm
Definition: CTPPSDetId.h:46
static const uint32_t maxArm
Definition: CTPPSDetId.h:46
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static const uint32_t maxRP
Definition: CTPPSDetId.h:48
uint32_t id_
Definition: DetId.h:55
static const uint32_t startStationBit
Definition: CTPPSDetId.h:47
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:31
void init(uint32_t Arm, uint32_t Station, uint32_t RP, uint32_t Plane)
static const uint32_t startArmBit
Definition: CTPPSDetId.h:46
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
CTPPSPixelDetId(uint32_t id)
Construct from a packed id.