CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
static const uint32_t maxStation
Definition: CTPPSDetId.h:46
static constexpr uint32_t maskPlane
uint32_t channel() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
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
static constexpr uint32_t maxPlane
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
static const uint32_t maxArm
Definition: CTPPSDetId.h:45
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
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 ...