CMS 3D CMS Logo

CTPPSDiamondDetId.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Author: Seyed Mohsen Etesami
3  * September 2016
4  ****************************************************************************/
5 
6 #ifndef DataFormats_CTPPSDetId_CTPPSDiamondDetId
7 #define DataFormats_CTPPSDetId_CTPPSDiamondDetId
8 
10 
12 
13 #include <iosfwd>
14 #include <iostream>
15 #include <string>
16 
25 class CTPPSDiamondDetId : public CTPPSDetId {
26 public:
28  explicit CTPPSDiamondDetId(uint32_t id);
29 
30  CTPPSDiamondDetId(const CTPPSDetId& id) : CTPPSDetId(id) {}
31 
33  CTPPSDiamondDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot = 0, uint32_t Plane = 0, uint32_t Channel = 0);
34 
35  static const uint32_t startPlaneBit, maskPlane, maxPlane, lowMaskPlane;
37 
39  static bool check(unsigned int raw) {
40  return (((raw >> DetId::kDetOffset) & 0xF) == DetId::VeryForward &&
41  ((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingDiamond);
42  }
43  //-------------------- getting and setting methods --------------------
44 
45  uint32_t plane() const { return ((id_ >> startPlaneBit) & maskPlane); }
46 
47  void setPlane(uint32_t channel) {
49  id_ |= ((channel & maskPlane) << startPlaneBit);
50  }
51 
52  uint32_t channel() const { return ((id_ >> startDetBit) & maskChannel); }
53 
54  void setChannel(uint32_t channel) {
56  id_ |= ((channel & maskChannel) << startDetBit);
57  }
58 
59  //-------------------- id getters for higher-level objects --------------------
60 
62 
63  //-------------------- name methods --------------------
64 
65  inline void planeName(std::string& name, NameFlag flag = nFull) const {
66  switch (flag) {
67  case nShort:
68  name = "";
69  break;
70  case nFull:
71  rpName(name, flag);
72  name += "_";
73  break;
74  case nPath:
75  rpName(name, flag);
76  name += "/plane ";
77  break;
78  }
79 
80  name += std::to_string(plane());
81  }
82 
83  inline void channelName(std::string& name, NameFlag flag = nFull) const {
84  switch (flag) {
85  case nShort:
86  name = "";
87  break;
88  case nFull:
90  name += "_";
91  break;
92  case nPath:
94  name += "/channel ";
95  break;
96  }
97 
98  name += std::to_string(channel());
99  }
100 };
101 
102 std::ostream& operator<<(std::ostream& os, const CTPPSDiamondDetId& id);
103 
104 #endif
CTPPSDiamondDetId::startDetBit
static const uint32_t startDetBit
Definition: CTPPSDiamondDetId.h:37
dqm::me_util::Channel
DQMChannel Channel
Definition: MonitorElement.h:58
CTPPSDiamondDetId::lowMaskChannel
static const uint32_t lowMaskChannel
Definition: CTPPSDiamondDetId.h:37
CTPPSDiamondDetId::maskChannel
static const uint32_t maskChannel
Definition: CTPPSDiamondDetId.h:37
CTPPSDiamondDetId::maxChannel
static const uint32_t maxChannel
Definition: CTPPSDiamondDetId.h:37
CTPPSDiamondDetId::setPlane
void setPlane(uint32_t channel)
Definition: CTPPSDiamondDetId.h:48
CTPPSDiamondDetId::CTPPSDiamondDetId
CTPPSDiamondDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDiamondDetId.cc:20
CTPPSDetId::nShort
Definition: CTPPSDetId.h:87
CTPPSDiamondDetId::setChannel
void setChannel(uint32_t channel)
Definition: CTPPSDiamondDetId.h:55
DetId::VeryForward
Definition: DetId.h:31
CTPPSDetId::nPath
Definition: CTPPSDetId.h:87
DetId::kSubdetOffset
static const int kSubdetOffset
Definition: DetId.h:22
CTPPSDiamondDetId::plane
uint32_t plane() const
Definition: CTPPSDiamondDetId.h:46
CTPPSDiamondDetId::channel
uint32_t channel() const
Definition: CTPPSDiamondDetId.h:53
CTPPSDiamondDetId::planeName
void planeName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDiamondDetId.h:66
CTPPSDetId::sdTimingDiamond
Definition: CTPPSDetId.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSDetId::NameFlag
NameFlag
type of name returned by *Name functions
Definition: CTPPSDetId.h:87
CTPPSDiamondDetId
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: CTPPSDiamondDetId.h:24
DetId::id_
uint32_t id_
Definition: DetId.h:69
CTPPSDetId::nFull
Definition: CTPPSDetId.h:87
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
CTPPSDiamondDetId::lowMaskPlane
static const uint32_t lowMaskPlane
Definition: CTPPSDiamondDetId.h:36
CTPPSDiamondDetId::check
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
Definition: CTPPSDiamondDetId.h:40
CTPPSDiamondDetId::maxPlane
static const uint32_t maxPlane
Definition: CTPPSDiamondDetId.h:36
CTPPSDiamondDetId::startPlaneBit
static const uint32_t startPlaneBit
Definition: CTPPSDiamondDetId.h:36
CTPPSDiamondDetId::channelName
void channelName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDiamondDetId.h:84
DetId::kDetOffset
static const int kDetOffset
Definition: DetId.h:21
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
operator<<
std::ostream & operator<<(std::ostream &os, const CTPPSDiamondDetId &id)
Definition: CTPPSDiamondDetId.cc:51
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
CTPPSDiamondDetId::maskPlane
static const uint32_t maskPlane
Definition: CTPPSDiamondDetId.h:36
CTPPSDiamondDetId::planeId
CTPPSDiamondDetId planeId() const
Definition: CTPPSDiamondDetId.h:62
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
CTPPSDetId::rpName
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:132