CMS 3D CMS Logo

TotemT2DetId.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of TOTEM offline software.
4  * Authors:
5  * Laurent Forthomme (laurent.forthomme@cern.ch)
6  *
7  ****************************************************************************/
8 
11 
12 //----------------------------------------------------------------------------------------------------
13 
15  if (!check(id))
16  throw cms::Exception("InvalidDetId") << "TotemT2DetId ctor:"
17  << " channel: " << channel() << " subdet: " << subdetId()
18  << " is not a valid Totem nT2 id";
19 }
20 
21 //----------------------------------------------------------------------------------------------------
22 
23 TotemT2DetId::TotemT2DetId(uint32_t arm, uint32_t plane, uint32_t channel) : CTPPSDetId(sdTotemT2, arm, 0, 0) {
24  if (arm > maxArm || plane > maxPlane || channel > maxChannel)
25  throw cms::Exception("InvalidDetId") << "TotemT2DetId ctor:"
26  << " Invalid parameters:"
27  << " arm=" << arm << " plane=" << plane << " detector=" << channel;
28 
29  uint32_t ok = 0xfe000000;
30  id_ &= ok;
31 
32  id_ |= ((arm & maskArm) << startArmBit);
33  id_ |= ((plane & maskPlane) << startPlaneBit);
35 }
36 
37 //----------------------------------------------------------------------------------------------------
38 
40  switch (flag) {
41  case nShort:
42  name = "";
43  break;
44  case nFull:
45  armName(name, flag);
46  name += "_";
47  break;
48  case nPath:
49  armName(name, flag);
50  name += "/plane ";
51  break;
52  }
54 }
55 
56 //----------------------------------------------------------------------------------------------------
57 
59  switch (flag) {
60  case nShort:
61  name = "";
62  break;
63  case nFull:
65  name += "_";
66  break;
67  case nPath:
69  name += "/channel ";
70  break;
71  }
73 }
74 
75 //----------------------------------------------------------------------------------------------------
76 
77 std::ostream& operator<<(std::ostream& os, const TotemT2DetId& id) {
78  return os << "arm=" << id.arm() << " plane=" << id.plane() << " channel=" << id.channel();
79 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
uint32_t arm() const
Definition: CTPPSDetId.h:57
NameFlag
type of name returned by *Name functions
Definition: CTPPSDetId.h:89
std::ostream & operator<<(std::ostream &os, const TotemT2DetId &id)
Definition: TotemT2DetId.cc:77
static constexpr uint32_t startChannelBit
Definition: TotemT2DetId.h:35
static constexpr uint32_t maxChannel
Definition: TotemT2DetId.h:35
std::string to_string(const V &value)
Definition: OMSAccess.h:71
static constexpr uint32_t maskChannel
Definition: TotemT2DetId.h:35
static constexpr uint32_t maxPlane
Definition: TotemT2DetId.h:34
uint32_t plane() const
Definition: TotemT2DetId.h:44
static const uint32_t maskArm
Definition: CTPPSDetId.h:51
static const uint32_t maxArm
Definition: CTPPSDetId.h:51
static constexpr uint32_t maskPlane
Definition: TotemT2DetId.h:34
void planeName(std::string &name, NameFlag flag=nFull) const
Definition: TotemT2DetId.cc:39
void armName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:98
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
TotemT2DetId(uint32_t id)
Construct from a raw id.
Definition: TotemT2DetId.cc:14
uint32_t id_
Definition: DetId.h:69
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
static const uint32_t startArmBit
Definition: CTPPSDetId.h:51
void channelName(std::string &name, NameFlag flag=nFull) const
Definition: TotemT2DetId.cc:58
static constexpr uint32_t startPlaneBit
Definition: TotemT2DetId.h:34
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
Definition: TotemT2DetId.h:38
uint32_t channel() const
Definition: TotemT2DetId.h:51