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 
11 
13 
14 using namespace std;
15 
16 //----------------------------------------------------------------------------------------------------
17 
22 
23 const string TotemRPDetId::planeNames[] = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10"};
24 const string TotemRPDetId::chipNames[] = {"1", "2", "3", "4"};
25 
26 //----------------------------------------------------------------------------------------------------
27 
29  bool inputOK = (det() == DetId::VeryForward && subdetId() == sdTrackingStrip);
30 
31  if (!inputOK) {
32  throw cms::Exception("InvalidDetId") << "TotemRPDetId ctor:"
33  << " det: " << det() << " subdet: " << subdetId()
34  << " is not a valid TotemRP id.";
35  }
36 }
37 
38 //----------------------------------------------------------------------------------------------------
39 
40 TotemRPDetId::TotemRPDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Chip)
41  : CTPPSDetId(sdTrackingStrip, Arm, Station, RomanPot) {
42  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Chip > maxChip) {
43  throw cms::Exception("InvalidDetId") << "TotemRPDetId ctor:"
44  << " Invalid parameters:"
45  << " arm=" << Arm << " station=" << Station << " rp=" << RomanPot
46  << " plane=" << Plane << " chip=" << Chip << std::endl;
47  }
48 
49  uint32_t ok = 0xfe000000;
50  id_ &= ok;
51 
52  id_ |= ((Arm & maskArm) << startArmBit);
53  id_ |= ((Station & maskStation) << startStationBit);
54  id_ |= ((RomanPot & maskRP) << startRPBit);
55  id_ |= ((Plane & maskPlane) << startPlaneBit);
56  id_ |= ((Chip & maskChip) << startChipBit);
57 }
58 
59 //----------------------------------------------------------------------------------------------------
60 
61 std::ostream& operator<<(std::ostream& os, const TotemRPDetId& id) {
62  os << "arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp() << " plane=" << id.plane()
63  << " chip=" << id.chip();
64 
65  return os;
66 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
static const uint32_t maskChip
Definition: TotemRPDetId.h:42
static const uint32_t startChipBit
Definition: TotemRPDetId.h:42
static const uint32_t maxStation
Definition: CTPPSDetId.h:46
static const uint32_t startRPBit
Definition: CTPPSDetId.h:47
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
TotemRPDetId(uint32_t id)
Definition: TotemRPDetId.cc:28
Definition: Plane.h:16
static const uint32_t maskStation
Definition: CTPPSDetId.h:46
std::ostream & operator<<(std::ostream &os, const TotemRPDetId &id)
Definition: TotemRPDetId.cc:61
static const uint32_t maskRP
Definition: CTPPSDetId.h:47
static const uint32_t lowMaskChip
Definition: TotemRPDetId.h:42
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
static const std::string planeNames[]
Definition: TotemRPDetId.h:116
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
static const uint32_t lowMaskPlane
Definition: TotemRPDetId.h:41
static const uint32_t startPlaneBit
Definition: TotemRPDetId.h:41
static const uint32_t startArmBit
Definition: CTPPSDetId.h:45
static const uint32_t maxChip
Definition: TotemRPDetId.h:42
static const uint32_t maskPlane
Definition: TotemRPDetId.h:41
static const uint32_t maxPlane
Definition: TotemRPDetId.h:41
static const std::string chipNames[]
Definition: TotemRPDetId.h:117