CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 const string CTPPSDiamondDetId::planeNames[] = { "0", "1", "2", "3" };
19 const string CTPPSDiamondDetId::channelNames[] = { "0", "1", "2", "3", "4", "05", "06", "07", "08", "09", "10", "11" };
20 
21 //----------------------------------------------------------------------------------------------------
22 
24 {
25  if (! check(id))
26  {
27  throw cms::Exception("InvalidDetId") << "CTPPSDiamondDetId ctor:"
28  << " channel: " << channel()
29  << " subdet: " << subdetId()
30  << " is not a valid CTPPS Timing Diamond id";
31  }
32 }
33 
34 //----------------------------------------------------------------------------------------------------
35 
36 CTPPSDiamondDetId::CTPPSDiamondDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Channel) :
37  CTPPSDetId(sdTimingDiamond, Arm, Station, RomanPot)
38 {
39  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Channel > maxChannel)
40  {
41  throw cms::Exception("InvalidDetId") << "CTPPSDiamondDetId ctor:"
42  << " Invalid parameters:"
43  << " arm=" << Arm
44  << " station=" << Station
45  << " rp=" << RomanPot
46  << " plane=" << Plane
47  << " detector=" << Channel
48  << std::endl;
49  }
50 
51  uint32_t ok=0xfe000000;
52  id_ &= ok;
53 
54  id_ |= ((Arm & maskArm) << startArmBit);
55  id_ |= ((Station & maskStation) << startStationBit);
56  id_ |= ((RomanPot & maskRP) << startRPBit);
57  id_ |= ((Plane & maskPlane) << startPlaneBit);
58  id_ |= ((Channel & maskChannel) << startDetBit);
59 }
60 
61 //----------------------------------------------------------------------------------------------------
62 
63 std::ostream& operator << (std::ostream& os, const CTPPSDiamondDetId& id)
64 {
65  os << "arm=" << id.arm()
66  << " station=" << id.station()
67  << " rp=" << id.rp()
68  << " plane=" << id.plane()
69  << " Detector=" << id.channel();
70 
71  return os;
72 }
static const uint32_t lowMaskChannel
static const uint32_t maxStation
Definition: CTPPSDetId.h:47
CTPPSDiamondDetId(uint32_t id)
Construct from a raw id.
static const uint32_t maxChannel
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
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
DQMChannel Channel
static const uint32_t maskPlane
static const std::string planeNames[]
static const std::string channelNames[]