CMS 3D CMS Logo

CTPPSDiamondDetId.cc
Go to the documentation of this file.
1 /****************************************************************************
2  * Author: Seyed Mohsen Etesami
3  * Spetember 2016
4  ****************************************************************************/
5 
6 
8 
10 
11 using namespace std;
12 
13 //----------------------------------------------------------------------------------------------------
14 
17 
18 //----------------------------------------------------------------------------------------------------
19 
21 {
22  if (! check(id))
23  {
24  throw cms::Exception("InvalidDetId") << "CTPPSDiamondDetId ctor:"
25  << " channel: " << channel()
26  << " subdet: " << subdetId()
27  << " is not a valid CTPPS Timing Diamond id";
28  }
29 }
30 
31 //----------------------------------------------------------------------------------------------------
32 
33 CTPPSDiamondDetId::CTPPSDiamondDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Channel) :
34  CTPPSDetId(sdTimingDiamond, Arm, Station, RomanPot)
35 {
36  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Channel > maxChannel)
37  {
38  throw cms::Exception("InvalidDetId") << "CTPPSDiamondDetId ctor:"
39  << " Invalid parameters:"
40  << " arm=" << Arm
41  << " station=" << Station
42  << " rp=" << RomanPot
43  << " plane=" << Plane
44  << " detector=" << Channel
45  << std::endl;
46  }
47 
48  uint32_t ok=0xfe000000;
49  id_ &= ok;
50 
51  id_ |= ((Arm & maskArm) << startArmBit);
52  id_ |= ((Station & maskStation) << startStationBit);
53  id_ |= ((RomanPot & maskRP) << startRPBit);
54  id_ |= ((Plane & maskPlane) << startPlaneBit);
55  id_ |= ((Channel & maskChannel) << startDetBit);
56 }
57 
58 //----------------------------------------------------------------------------------------------------
59 
60 std::ostream& operator << (std::ostream& os, const CTPPSDiamondDetId& id)
61 {
62  os << "arm=" << id.arm()
63  << " station=" << id.station()
64  << " rp=" << id.rp()
65  << " plane=" << id.plane()
66  << " Detector=" << id.channel();
67 
68  return os;
69 }
static const uint32_t lowMaskChannel
static const uint32_t maxStation
Definition: CTPPSDetId.h:47
CTPPSDiamondDetId(uint32_t id)
Construct from a raw id.
std::ostream & operator<<(std::ostream &os, const CTPPSDiamondDetId &id)
static const uint32_t maxChannel
static const uint32_t startRPBit
Definition: CTPPSDetId.h:48
static const uint32_t maskChannel
Definition: Plane.h:17
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
static const uint32_t maxArm
Definition: CTPPSDetId.h:46
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
static const uint32_t maxPlane
static const uint32_t maxRP
Definition: CTPPSDetId.h:48
static const uint32_t startPlaneBit
uint32_t channel() const
uint32_t id_
Definition: DetId.h:55
static const uint32_t startStationBit
Definition: CTPPSDetId.h:47
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
static const uint32_t lowMaskPlane
static const uint32_t startArmBit
Definition: CTPPSDetId.h:46
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
static const uint32_t startDetBit
static const uint32_t maskPlane
DQMChannel Channel