CMS 3D CMS Logo

TotemTimingDetId.cc
Go to the documentation of this file.
1 /****************************************************************************
2  * Author: Nicola Minafra
3  * March 2018
4  ****************************************************************************/
5 
8 
9 //----------------------------------------------------------------------------------------------------
10 
12  if (!check(id)) {
13  throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:"
14  << " channel: " << channel() << " subdet: " << subdetId()
15  << " is not a valid Totem Timing id";
16  }
17 }
18 
19 //----------------------------------------------------------------------------------------------------
20 
22  uint32_t arm, uint32_t station, uint32_t romanPot, uint32_t plane, uint32_t channel, uint32_t subdet)
23  : CTPPSDetId(subdet, arm, station, romanPot) {
24  if (arm > maxArm || station > maxStation || romanPot > maxRP || plane > maxPlane || channel > maxChannel) {
25  throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:"
26  << " Invalid parameters:"
27  << " arm=" << arm << " station=" << station << " rp=" << romanPot
28  << " plane=" << plane << " detector=" << channel << std::endl;
29  }
30 
31  uint32_t ok = 0xfe000000;
32  id_ &= ok;
33 
34  id_ |= ((arm & maskArm) << startArmBit);
36  id_ |= ((romanPot & maskRP) << startRPBit);
37  id_ |= ((plane & maskPlane) << startPlaneBit);
38  id_ |= ((channel & maskChannel) << startDetBit);
39 }
40 
41 //----------------------------------------------------------------------------------------------------
42 
43 std::ostream& operator<<(std::ostream& os, const TotemTimingDetId& id) {
44  return os << "arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp() << " plane=" << id.plane()
45  << " Detector=" << id.channel();
46 }
static const uint32_t maxStation
Definition: CTPPSDetId.h:46
uint32_t arm() const
Definition: CTPPSDetId.h:51
static constexpr uint32_t maskPlane
static const uint32_t startRPBit
Definition: CTPPSDetId.h:47
static const uint32_t maskStation
Definition: CTPPSDetId.h:46
static const uint32_t maskRP
Definition: CTPPSDetId.h:47
static constexpr uint32_t maskChannel
static const uint32_t maskArm
Definition: CTPPSDetId.h:45
static constexpr uint32_t startDetBit
uint32_t channel() const
static constexpr uint32_t maxPlane
TotemTimingDetId(uint32_t id)
Construct from a raw id.
std::ostream & operator<<(std::ostream &os, const TotemTimingDetId &id)
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 constexpr uint32_t maxChannel
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
static constexpr uint32_t startPlaneBit
static const uint32_t maxRP
Definition: CTPPSDetId.h:47
uint32_t id_
Definition: DetId.h:69
uint32_t station() const
Definition: CTPPSDetId.h:58
static const uint32_t startStationBit
Definition: CTPPSDetId.h:46
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
uint32_t plane() const
static const uint32_t startArmBit
Definition: CTPPSDetId.h:45
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...