CMS 3D CMS Logo

TotemRPDetId.h
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 #ifndef DataFormats_CTPPSDetId_TotemRPDetId
11 #define DataFormats_CTPPSDetId_TotemRPDetId
12 
14 
16 
17 #include <iosfwd>
18 #include <iostream>
19 #include <string>
20 
30 class TotemRPDetId : public CTPPSDetId {
31 public:
34  explicit TotemRPDetId(uint32_t id);
35 
36  TotemRPDetId(const CTPPSDetId& id) : CTPPSDetId(id) {}
37 
39  TotemRPDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot = 0, uint32_t Plane = 0, uint32_t Chip = 0);
40 
41  static const uint32_t startPlaneBit, maskPlane, maxPlane, lowMaskPlane;
42  static const uint32_t startChipBit, maskChip, maxChip, lowMaskChip;
43 
44  //-------------------- component getters and setters --------------------
45 
46  uint32_t plane() const { return ((id_ >> startPlaneBit) & maskPlane); }
47 
48  void setPlane(uint32_t det) {
49  id_ &= ~(maskPlane << startPlaneBit);
50  id_ |= ((det & maskPlane) << startPlaneBit);
51  }
52 
53  uint32_t chip() const { return ((id_ >> startChipBit) & maskChip); }
54 
55  void setChip(uint32_t chip) {
56  id_ &= ~(maskChip << startChipBit);
57  id_ |= ((chip & maskChip) << startChipBit);
58  }
59 
60  //-------------------- id getters for higher-level objects --------------------
61 
62  TotemRPDetId planeId() const { return TotemRPDetId(rawId() & (~lowMaskPlane)); }
63 
64  //-------------------- strip orientation methods --------------------
65 
66  bool isStripsCoordinateUDirection() const { return plane() % 2; }
67 
69 
70  //-------------------- conversions to the obsolete decimal representation --------------------
71  // NOTE: only for backward compatibility, do not use otherwise!
72 
73  inline uint32_t rpDecimalId() const { return rp() + station() * 10 + arm() * 100; }
74 
75  inline uint32_t planeDecimalId() const { return plane() + rpDecimalId() * 10; }
76 
77  //-------------------- name methods --------------------
78 
79  inline void planeName(std::string& name, NameFlag flag = nFull) const {
80  switch (flag) {
81  case nShort:
82  name = "";
83  break;
84  case nFull:
85  rpName(name, flag);
86  name += "_";
87  break;
88  case nPath:
89  rpName(name, flag);
90  name += "/plane ";
91  break;
92  }
93 
94  name += planeNames[plane()];
95  }
96 
97  inline void chipName(std::string& name, NameFlag flag = nFull) const {
98  switch (flag) {
99  case nShort:
100  name = "";
101  break;
102  case nFull:
103  planeName(name, flag);
104  name += "_";
105  break;
106  case nPath:
107  planeName(name, flag);
108  name += "/chip ";
109  break;
110  }
111 
112  name += chipNames[chip()];
113  }
114 
115 private:
116  static const std::string planeNames[];
117  static const std::string chipNames[];
118 };
119 
120 std::ostream& operator<<(std::ostream& os, const TotemRPDetId& id);
121 
122 #endif
TotemRPDetId::lowMaskPlane
static const uint32_t lowMaskPlane
Definition: TotemRPDetId.h:46
CTPPSDetId::rp
uint32_t rp() const
Definition: CTPPSDetId.h:69
TotemRPDetId::maskChip
static const uint32_t maskChip
Definition: TotemRPDetId.h:47
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
TotemRPDetId::planeId
TotemRPDetId planeId() const
Definition: TotemRPDetId.h:67
CTPPSDetId::nShort
Definition: CTPPSDetId.h:87
TotemRPDetId::plane
uint32_t plane() const
Definition: TotemRPDetId.h:51
CTPPSDetId::nPath
Definition: CTPPSDetId.h:87
TotemRPDetId::setPlane
void setPlane(uint32_t det)
Definition: TotemRPDetId.h:53
TotemRPDetId::isStripsCoordinateUDirection
bool isStripsCoordinateUDirection() const
Definition: TotemRPDetId.h:71
TotemRPDetId::planeName
void planeName(std::string &name, NameFlag flag=nFull) const
Definition: TotemRPDetId.h:84
TotemRPDetId::startPlaneBit
static const uint32_t startPlaneBit
Definition: TotemRPDetId.h:46
CTPPSDetId::station
uint32_t station() const
Definition: CTPPSDetId.h:62
TotemRPDetId::isStripsCoordinateVDirection
bool isStripsCoordinateVDirection() const
Definition: TotemRPDetId.h:73
TotemRPDetId::maxPlane
static const uint32_t maxPlane
Definition: TotemRPDetId.h:46
TotemRPDetId::startChipBit
static const uint32_t startChipBit
Definition: TotemRPDetId.h:47
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TotemRPDetId::chipNames
static const std::string chipNames[]
Definition: TotemRPDetId.h:122
CTPPSDetId::arm
uint32_t arm() const
Definition: CTPPSDetId.h:55
CTPPSDetId::NameFlag
NameFlag
type of name returned by *Name functions
Definition: CTPPSDetId.h:87
TotemRPDetId::chip
uint32_t chip() const
Definition: TotemRPDetId.h:58
DetId::id_
uint32_t id_
Definition: DetId.h:69
TotemRPDetId::lowMaskChip
static const uint32_t lowMaskChip
Definition: TotemRPDetId.h:47
TotemRPDetId::planeNames
static const std::string planeNames[]
Definition: TotemRPDetId.h:121
CTPPSDetId::nFull
Definition: CTPPSDetId.h:87
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
TotemRPDetId::maxChip
static const uint32_t maxChip
Definition: TotemRPDetId.h:47
TotemRPDetId::planeDecimalId
uint32_t planeDecimalId() const
Definition: TotemRPDetId.h:80
TotemRPDetId::setChip
void setChip(uint32_t chip)
Definition: TotemRPDetId.h:60
TotemRPDetId::TotemRPDetId
TotemRPDetId(uint32_t id)
Definition: TotemRPDetId.cc:27
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Plane
Definition: Plane.h:16
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CTPPSDetId.h
Exception.h
TotemRPDetId::rpDecimalId
uint32_t rpDecimalId() const
Definition: TotemRPDetId.h:78
TotemRPDetId::chipName
void chipName(std::string &name, NameFlag flag=nFull) const
Definition: TotemRPDetId.h:102
operator<<
std::ostream & operator<<(std::ostream &os, const TotemRPDetId &id)
Definition: TotemRPDetId.cc:60
TotemRPDetId
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:29
TotemRPDetId::maskPlane
static const uint32_t maskPlane
Definition: TotemRPDetId.h:46
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
CTPPSDetId::rpName
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:132