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  CTPPSDetId( id )
13 {
14  if ( !check( id ) ) {
15  throw cms::Exception( "InvalidDetId" )
16  << "TotemTimingDetId ctor:"
17  << " channel: " << channel()
18  << " subdet: " << subdetId()
19  << " is not a valid Totem Timing id";
20  }
21 }
22 
23 //----------------------------------------------------------------------------------------------------
24 
25 TotemTimingDetId::TotemTimingDetId( uint32_t arm, uint32_t station, uint32_t romanPot, uint32_t plane, uint32_t channel ) :
26  CTPPSDetId( sdTimingFastSilicon, arm, station, romanPot )
27 {
28  if ( arm > maxArm || station > maxStation || romanPot > maxRP || plane > maxPlane || channel > maxChannel ) {
29  throw cms::Exception( "InvalidDetId" )
30  << "TotemTimingDetId ctor:"
31  << " Invalid parameters:"
32  << " arm=" << arm
33  << " station=" << station
34  << " rp=" << romanPot
35  << " plane=" << plane
36  << " detector=" << channel
37  << std::endl;
38  }
39 
40  uint32_t ok = 0xfe000000;
41  id_ &= ok;
42 
43  id_ |= ( ( arm & maskArm ) << startArmBit );
44  id_ |= ( ( station & maskStation ) << startStationBit );
45  id_ |= ( ( romanPot & maskRP ) << startRPBit );
46  id_ |= ( ( plane & maskPlane ) << startPlaneBit );
47  id_ |= ( ( channel & maskChannel ) << startDetBit );
48 }
49 
50 //----------------------------------------------------------------------------------------------------
51 
52 std::ostream& operator<<( std::ostream& os, const TotemTimingDetId& id )
53 {
54  return os
55  << "arm=" << id.arm()
56  << " station=" << id.station()
57  << " rp=" << id.rp()
58  << " plane=" << id.plane()
59  << " Detector=" << id.channel();
60 }
uint32_t station() const
Definition: CTPPSDetId.h:63
static uint32_t startPlaneBit
static const uint32_t maxStation
Definition: CTPPSDetId.h:47
uint32_t channel() const
static const uint32_t startRPBit
Definition: CTPPSDetId.h:48
static uint32_t maskPlane
static const uint32_t maskStation
Definition: CTPPSDetId.h:47
static const uint32_t maskRP
Definition: CTPPSDetId.h:48
static const uint32_t maskArm
Definition: CTPPSDetId.h:46
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:46
static uint32_t maxChannel
uint32_t arm() const
Definition: CTPPSDetId.h:52
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
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:48
static uint32_t maxPlane
uint32_t plane() const
static uint32_t startDetBit
uint32_t id_
Definition: DetId.h:56
static uint32_t maskChannel
static const uint32_t startStationBit
Definition: CTPPSDetId.h:47
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
static const uint32_t startArmBit
Definition: CTPPSDetId.h:46
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...