CMS 3D CMS Logo

TotemRPDetId.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of TOTEM offline software.
4  * Authors:
5  * Hubert Niewiadomski
6  * Jan Kašpar (jan.kaspar@gmail.com)
7  *
8  ****************************************************************************/
9 
10 
12 
14 
15 using namespace std;
16 
17 //----------------------------------------------------------------------------------------------------
18 
21 
22 const string TotemRPDetId::planeNames[] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10" };
23 const string TotemRPDetId::chipNames[] = { "1", "2", "3", "4" };
24 
25 //----------------------------------------------------------------------------------------------------
26 
28 {
29  bool inputOK = (det() == DetId::VeryForward && subdetId() == sdTrackingStrip);
30 
31  if (!inputOK)
32  {
33  throw cms::Exception("InvalidDetId") << "TotemRPDetId ctor:"
34  << " det: " << det()
35  << " subdet: " << subdetId()
36  << " is not a valid TotemRP id.";
37  }
38 }
39 
40 //----------------------------------------------------------------------------------------------------
41 
42 TotemRPDetId::TotemRPDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Chip) :
43  CTPPSDetId(sdTrackingStrip, Arm, Station, RomanPot)
44 {
45  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Chip > maxChip)
46  {
47  throw cms::Exception("InvalidDetId") << "TotemRPDetId ctor:"
48  << " Invalid parameters:"
49  << " arm=" << Arm
50  << " station=" << Station
51  << " rp=" << RomanPot
52  << " plane=" << Plane
53  << " chip=" << Chip
54  << std::endl;
55  }
56 
57  uint32_t ok=0xfe000000;
58  id_ &= ok;
59 
60  id_ |= ((Arm & maskArm) << startArmBit);
61  id_ |= ((Station & maskStation) << startStationBit);
62  id_ |= ((RomanPot & maskRP) << startRPBit);
63  id_ |= ((Plane & maskPlane) << startPlaneBit);
64  id_ |= ((Chip & maskChip) << startChipBit);
65 }
66 
67 //----------------------------------------------------------------------------------------------------
68 
69 std::ostream& operator << (std::ostream& os, const TotemRPDetId& id)
70 {
71  os << "arm=" << id.arm()
72  << " station=" << id.station()
73  << " rp=" << id.rp()
74  << " plane=" << id.plane()
75  << " chip=" << id.chip();
76 
77  return os;
78 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
static const uint32_t maskChip
Definition: TotemRPDetId.h:45
static const uint32_t startChipBit
Definition: TotemRPDetId.h:45
static const uint32_t maxStation
Definition: CTPPSDetId.h:47
static const uint32_t startRPBit
Definition: CTPPSDetId.h:48
TotemRPDetId(uint32_t id)
Definition: TotemRPDetId.cc:27
Definition: Plane.h:17
static const uint32_t maskStation
Definition: CTPPSDetId.h:47
std::ostream & operator<<(std::ostream &os, const TotemRPDetId &id)
Definition: TotemRPDetId.cc:69
static const uint32_t maskRP
Definition: CTPPSDetId.h:48
static const uint32_t lowMaskChip
Definition: TotemRPDetId.h:45
static const uint32_t maskArm
Definition: CTPPSDetId.h:46
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
static const uint32_t maxArm
Definition: CTPPSDetId.h:46
static const uint32_t maxRP
Definition: CTPPSDetId.h:48
uint32_t id_
Definition: DetId.h:62
static const uint32_t startStationBit
Definition: CTPPSDetId.h:47
static const std::string planeNames[]
Definition: TotemRPDetId.h:130
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
static const uint32_t lowMaskPlane
Definition: TotemRPDetId.h:44
static const uint32_t startPlaneBit
Definition: TotemRPDetId.h:44
static const uint32_t startArmBit
Definition: CTPPSDetId.h:46
static const uint32_t maxChip
Definition: TotemRPDetId.h:45
static const uint32_t maskPlane
Definition: TotemRPDetId.h:44
static const uint32_t maxPlane
Definition: TotemRPDetId.h:44
static const std::string chipNames[]
Definition: TotemRPDetId.h:131
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39