CMS 3D CMS Logo

CTPPSDetId.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of TOTEM offline software.
4  * Authors:
5  * Jan Kašpar (jan.kaspar@gmail.com)
6  *
7  ****************************************************************************/
8 
9 #ifndef DataFormats_CTPPSDetId_CTPPSDetId
10 #define DataFormats_CTPPSDetId_CTPPSDetId
11 
13 
15 
16 #include <iosfwd>
17 #include <iostream>
18 #include <string>
19 
32 class CTPPSDetId : public DetId {
33 public:
36 
38  explicit CTPPSDetId(uint32_t id);
39 
41  CTPPSDetId(uint32_t SubDet, uint32_t Arm, uint32_t Station, uint32_t RomanPot = 0);
42 
43  //-------------------- bit assignment --------------------
44 
45  static const uint32_t startArmBit, maskArm, maxArm, lowMaskArm;
46  static const uint32_t startStationBit, maskStation, maxStation, lowMaskStation;
47  static const uint32_t startRPBit, maskRP, maxRP, lowMaskRP;
48 
49  //-------------------- component getters and setters --------------------
50 
51  uint32_t arm() const { return ((id_ >> startArmBit) & maskArm); }
52 
53  void setArm(uint32_t arm) {
54  id_ &= ~(maskArm << startArmBit);
55  id_ |= ((arm & maskArm) << startArmBit);
56  }
57 
58  uint32_t station() const { return ((id_ >> startStationBit) & maskStation); }
59 
60  void setStation(uint32_t station) {
63  }
64 
65  uint32_t rp() const { return ((id_ >> startRPBit) & maskRP); }
66 
67  void setRP(uint32_t rp) {
68  id_ &= ~(maskRP << startRPBit);
69  id_ |= ((rp & maskRP) << startRPBit);
70  }
71 
72  //-------------------- id getters for higher-level objects --------------------
73 
74  CTPPSDetId armId() const { return CTPPSDetId(rawId() & (~lowMaskArm)); }
75 
76  CTPPSDetId stationId() const { return CTPPSDetId(rawId() & (~lowMaskStation)); }
77 
78  CTPPSDetId rpId() const { return CTPPSDetId(rawId() & (~lowMaskRP)); }
79 
80  //-------------------- name methods --------------------
81 
83  enum NameFlag { nShort, nFull, nPath };
84 
85  inline void subDetectorName(std::string &name, NameFlag flag = nFull) const {
86  if (flag == nPath)
88  else
90  }
91 
92  inline void armName(std::string &name, NameFlag flag = nFull) const {
93  switch (flag) {
94  case nShort:
95  name = "";
96  break;
97  case nFull:
99  name += "_";
100  break;
101  case nPath:
103  name += "/sector ";
104  break;
105  }
106 
107  name += armNames[arm()];
108  }
109 
110  inline void stationName(std::string &name, NameFlag flag = nFull) const {
111  switch (flag) {
112  case nShort:
113  name = "";
114  break;
115  case nFull:
116  armName(name, flag);
117  name += "_";
118  break;
119  case nPath:
120  armName(name, flag);
121  name += "/station ";
122  break;
123  }
124 
125  name += stationNames[station()];
126  }
127 
128  inline void rpName(std::string &name, NameFlag flag = nFull) const {
129  switch (flag) {
130  case nShort:
131  name = "";
132  break;
133  case nFull:
135  name += "_";
136  break;
137  case nPath:
139  name += "/";
140  break;
141  }
142 
143  name += rpNames[rp()];
144  }
145 
146 private:
147  static const std::string subDetectorNames[];
148  static const std::string subDetectorPaths[];
149  static const std::string armNames[];
150  static const std::string stationNames[];
151  static const std::string rpNames[];
152 };
153 
154 std::ostream &operator<<(std::ostream &os, const CTPPSDetId &id);
155 
156 #endif
CTPPSDetId::subDetectorPaths
static const std::string subDetectorPaths[]
Definition: CTPPSDetId.h:152
CTPPSDetId::rp
uint32_t rp() const
Definition: CTPPSDetId.h:69
CTPPSDetId::maxRP
static const uint32_t maxRP
Definition: CTPPSDetId.h:51
CTPPSDetId::subDetectorNames
static const std::string subDetectorNames[]
Definition: CTPPSDetId.h:151
CTPPSDetId::CTPPSDetId
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:34
CTPPSDetId::stationName
void stationName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:114
CTPPSDetId::rpNames
static const std::string rpNames[]
Definition: CTPPSDetId.h:155
CTPPSDetId::maxArm
static const uint32_t maxArm
Definition: CTPPSDetId.h:49
CTPPSDetId::sdTimingFastSilicon
Definition: CTPPSDetId.h:44
CTPPSDetId::nShort
Definition: CTPPSDetId.h:87
CTPPSDetId::lowMaskArm
static const uint32_t lowMaskArm
Definition: CTPPSDetId.h:49
CTPPSDetId::startArmBit
static const uint32_t startArmBit
Definition: CTPPSDetId.h:49
CTPPSDetId::setStation
void setStation(uint32_t station)
Definition: CTPPSDetId.h:64
CTPPSDetId::nPath
Definition: CTPPSDetId.h:87
CTPPSDetId::subDetectorName
void subDetectorName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:89
CTPPSDetId::armId
CTPPSDetId armId() const
Definition: CTPPSDetId.h:78
DetId
Definition: DetId.h:17
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
CTPPSDetId::station
uint32_t station() const
Definition: CTPPSDetId.h:62
CTPPSDetId::startStationBit
static const uint32_t startStationBit
Definition: CTPPSDetId.h:50
CTPPSDetId::lowMaskRP
static const uint32_t lowMaskRP
Definition: CTPPSDetId.h:51
ntupleEnum.SubDet
SubDet
Definition: ntupleEnum.py:15
CTPPSDetId::sdTimingDiamond
Definition: CTPPSDetId.h:44
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSDetId::stationNames
static const std::string stationNames[]
Definition: CTPPSDetId.h:154
CTPPSDetId::arm
uint32_t arm() const
Definition: CTPPSDetId.h:55
CTPPSDetId::NameFlag
NameFlag
type of name returned by *Name functions
Definition: CTPPSDetId.h:87
DetId::id_
uint32_t id_
Definition: DetId.h:69
CTPPSDetId::nFull
Definition: CTPPSDetId.h:87
CTPPSDetId::SubDetector
SubDetector
CTPPS sub-detectors.
Definition: CTPPSDetId.h:39
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
operator<<
std::ostream & operator<<(std::ostream &os, const CTPPSDetId &id)
Definition: CTPPSDetId.cc:69
CTPPSDetId::maskStation
static const uint32_t maskStation
Definition: CTPPSDetId.h:50
CTPPSDetId::maxStation
static const uint32_t maxStation
Definition: CTPPSDetId.h:50
CTPPSDetId::stationId
CTPPSDetId stationId() const
Definition: CTPPSDetId.h:80
CTPPSDetId::setArm
void setArm(uint32_t arm)
Definition: CTPPSDetId.h:57
CTPPSDetId::startRPBit
static const uint32_t startRPBit
Definition: CTPPSDetId.h:51
CTPPSDetId::setRP
void setRP(uint32_t rp)
Definition: CTPPSDetId.h:71
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
DetId.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Exception.h
CTPPSDetId::lowMaskStation
static const uint32_t lowMaskStation
Definition: CTPPSDetId.h:50
CTPPSDetId::rpId
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:82
CTPPSDetId::armNames
static const std::string armNames[]
Definition: CTPPSDetId.h:153
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
CTPPSDetId::maskArm
static const uint32_t maskArm
Definition: CTPPSDetId.h:49
CTPPSDetId::armName
void armName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:96
CTPPSDetId::rpName
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:132
CTPPSDetId::maskRP
static const uint32_t maskRP
Definition: CTPPSDetId.h:51