CMS 3D CMS Logo

CTPPSDiamondDetId.cc
Go to the documentation of this file.
1 /****************************************************************************
2  * Author: Seyed Mohsen Etesami
3  * Spetember 2016
4  ****************************************************************************/
5 
7 
9 
10 using namespace std;
11 
12 //----------------------------------------------------------------------------------------------------
13 
18 
19 //----------------------------------------------------------------------------------------------------
20 
22  if (!check(id)) {
23  throw cms::Exception("InvalidDetId") << "CTPPSDiamondDetId ctor:"
24  << " channel: " << channel() << " subdet: " << subdetId()
25  << " is not a valid CTPPS Timing Diamond id";
26  }
27 }
28 
29 //----------------------------------------------------------------------------------------------------
30 
31 CTPPSDiamondDetId::CTPPSDiamondDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Channel)
32  : CTPPSDetId(sdTimingDiamond, Arm, Station, RomanPot) {
33  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Channel > maxChannel) {
34  throw cms::Exception("InvalidDetId") << "CTPPSDiamondDetId ctor:"
35  << " Invalid parameters:"
36  << " arm=" << Arm << " station=" << Station << " rp=" << RomanPot
37  << " plane=" << Plane << " detector=" << Channel << 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 CTPPSDiamondDetId& id) {
53  os << "arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp() << " plane=" << id.plane()
54  << " Detector=" << id.channel();
55 
56  return os;
57 }
static const uint32_t lowMaskChannel
static const uint32_t maxStation
Definition: CTPPSDetId.h:52
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:53
static const uint32_t maskChannel
Definition: Plane.h:16
static const uint32_t maskStation
Definition: CTPPSDetId.h:52
static const uint32_t maskRP
Definition: CTPPSDetId.h:53
static const uint32_t maskArm
Definition: CTPPSDetId.h:51
uint32_t channel() const
static const uint32_t maxArm
Definition: CTPPSDetId.h:51
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 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:53
static const uint32_t startPlaneBit
uint32_t id_
Definition: DetId.h:69
static const uint32_t startStationBit
Definition: CTPPSDetId.h:52
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
static const uint32_t lowMaskPlane
static const uint32_t startArmBit
Definition: CTPPSDetId.h:51
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