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 
21 TotemTimingDetId::TotemTimingDetId(uint32_t arm, uint32_t station, uint32_t romanPot, uint32_t plane, uint32_t channel)
22  : CTPPSDetId(sdTimingFastSilicon, arm, station, romanPot) {
23  if (arm > maxArm || station > maxStation || romanPot > maxRP || plane > maxPlane || channel > maxChannel) {
24  throw cms::Exception("InvalidDetId") << "TotemTimingDetId ctor:"
25  << " Invalid parameters:"
26  << " arm=" << arm << " station=" << station << " rp=" << romanPot
27  << " plane=" << plane << " detector=" << channel << std::endl;
28  }
29 
30  uint32_t ok = 0xfe000000;
31  id_ &= ok;
32 
33  id_ |= ((arm & maskArm) << startArmBit);
34  id_ |= ((station & maskStation) << startStationBit);
35  id_ |= ((romanPot & maskRP) << startRPBit);
36  id_ |= ((plane & maskPlane) << startPlaneBit);
37  id_ |= ((channel & maskChannel) << startDetBit);
38 }
39 
40 //----------------------------------------------------------------------------------------------------
41 
42 std::ostream& operator<<(std::ostream& os, const TotemTimingDetId& id) {
43  return os << "arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp() << " plane=" << id.plane()
44  << " Detector=" << id.channel();
45 }
uint32_t station() const
Definition: CTPPSDetId.h:58
static uint32_t startPlaneBit
static const uint32_t maxStation
Definition: CTPPSDetId.h:46
uint32_t channel() const
static const uint32_t startRPBit
Definition: CTPPSDetId.h:47
static uint32_t maskPlane
static const uint32_t maskStation
Definition: CTPPSDetId.h:46
static const uint32_t maskRP
Definition: CTPPSDetId.h:47
static const uint32_t maskArm
Definition: CTPPSDetId.h:45
TotemTimingDetId(uint32_t id)
Construct from a raw id.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
std::ostream & operator<<(std::ostream &os, const TotemTimingDetId &id)
static const uint32_t maxArm
Definition: CTPPSDetId.h:45
static uint32_t maxChannel
uint32_t arm() const
Definition: CTPPSDetId.h:51
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
static const uint32_t maxRP
Definition: CTPPSDetId.h:47
static uint32_t maxPlane
uint32_t plane() const
static uint32_t startDetBit
uint32_t id_
Definition: DetId.h:69
static uint32_t maskChannel
static const uint32_t startStationBit
Definition: CTPPSDetId.h:46
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
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 ...