CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Attributes
CTPPSDiamondDetId Class Reference

Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits [17:18] : 2 bits for diamond plane 0,1,2,3 Bits [12:16] : 5 bits for Diamond channel numbers 1,2,3,..16 Bits [0:11] : unspecified yet. More...

#include <CTPPSDiamondDetId.h>

Inheritance diagram for CTPPSDiamondDetId:
CTPPSDetId DetId

Public Member Functions

uint32_t channel () const
 
void channelName (std::string &name, NameFlag flag=nFull) const
 
 CTPPSDiamondDetId (uint32_t id)
 Construct from a raw id. More...
 
 CTPPSDiamondDetId (const CTPPSDetId &id)
 
 CTPPSDiamondDetId (uint32_t Arm, uint32_t Station, uint32_t RomanPot=0, uint32_t Plane=0, uint32_t Channel=0)
 Construct from hierarchy indeces. More...
 
CTPPSDiamondDetId getPlaneId () const
 
uint32_t plane () const
 
void planeName (std::string &name, NameFlag flag=nFull) const
 
void setChannel (uint32_t channel)
 
void setPlane (uint32_t channel)
 
- Public Member Functions inherited from CTPPSDetId
uint32_t arm () const
 
void armName (std::string &name, NameFlag flag=nFull) const
 
 CTPPSDetId (uint32_t id)
 Construct from a raw id. More...
 
 CTPPSDetId (uint32_t SubDet, uint32_t Arm, uint32_t Station, uint32_t RomanPot=0)
 Construct from hierarchy indeces. More...
 
CTPPSDetId getArmId () const
 
CTPPSDetId getRPId () const
 
CTPPSDetId getStationId () const
 
uint32_t rp () const
 
void rpName (std::string &name, NameFlag flag=nFull) const
 
void setArm (uint32_t arm)
 
void setRP (uint32_t rp)
 
void setStation (uint32_t station)
 
uint32_t station () const
 
void stationName (std::string &name, NameFlag flag=nFull) const
 
void subDetectorName (std::string &name, NameFlag flag=nFull) const
 
- Public Member Functions inherited from DetId
Detector det () const
 get the detector field from this detid More...
 
 DetId ()
 Create an empty or null id (also for persistence) More...
 
 DetId (uint32_t id)
 Create an id from a raw number. More...
 
 DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
bool null () const
 is this a null id ? More...
 
 operator uint32_t () const
 
bool operator!= (DetId id) const
 inequality More...
 
uint32_t operator() () const
 
bool operator< (DetId id) const
 comparison More...
 
bool operator== (DetId id) const
 equality More...
 
uint32_t rawId () const
 get the raw id More...
 
int subdetId () const
 get the contents of the subdetector field (not cast into any detector's numbering enum) More...
 

Static Public Member Functions

static bool check (unsigned int raw)
 returns true if the raw ID is a PPS-timing one More...
 

Static Public Attributes

static const uint32_t lowMaskChannel = 0xFFF
 
static const uint32_t lowMaskPlane = 0x1FFFF
 
static const uint32_t maskChannel = 0x1F
 
static const uint32_t maskPlane = 0x3
 
static const uint32_t maxChannel = 11
 
static const uint32_t maxPlane = 3
 
static const uint32_t startDetBit = 12
 
static const uint32_t startPlaneBit = 17
 
- Static Public Attributes inherited from CTPPSDetId
static const uint32_t lowMaskArm = 0xFFFFFF
 
static const uint32_t lowMaskRP = 0x7FFFF
 
static const uint32_t lowMaskStation = 0x3FFFFF
 
static const uint32_t maskArm = 0x1
 
static const uint32_t maskRP = 0x7
 
static const uint32_t maskStation = 0x3
 
static const uint32_t maxArm = 1
 
static const uint32_t maxRP = 6
 
static const uint32_t maxStation = 2
 
static const uint32_t startArmBit = 24
 
static const uint32_t startRPBit = 19
 
static const uint32_t startStationBit = 22
 
- Static Public Attributes inherited from DetId
static const int kDetOffset = 28
 
static const int kSubdetOffset = 25
 

Static Private Attributes

static const std::string channelNames [] = { "0", "1", "2", "3", "4", "05", "06", "07", "08", "09", "10", "11" }
 
static const std::string planeNames [] = { "0", "1", "2", "3" }
 

Additional Inherited Members

- Public Types inherited from CTPPSDetId
enum  NameFlag { nShort, nFull, nPath }
 type of name returned by *Name functions More...
 
enum  SubDetector { sdTrackingStrip = 3, sdTrackingPixel = 4, sdTimingDiamond = 5, sdTimingFastSilicon = 6 }
 CTPPS sub-detectors. More...
 
- Public Types inherited from DetId
enum  Detector {
  Tracker =1, Muon =2, Ecal =3, Hcal =4,
  Calo =5, Forward =6, VeryForward =7
}
 
- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits [17:18] : 2 bits for diamond plane 0,1,2,3 Bits [12:16] : 5 bits for Diamond channel numbers 1,2,3,..16 Bits [0:11] : unspecified yet.

Definition at line 25 of file CTPPSDiamondDetId.h.

Constructor & Destructor Documentation

CTPPSDiamondDetId::CTPPSDiamondDetId ( uint32_t  id)
explicit

Construct from a raw id.

Definition at line 23 of file CTPPSDiamondDetId.cc.

References channel(), check(), Exception, and DetId::subdetId().

Referenced by getPlaneId().

23  : CTPPSDetId(id)
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 }
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
uint32_t channel() const
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:31
CTPPSDiamondDetId::CTPPSDiamondDetId ( const CTPPSDetId id)
inline

Definition at line 31 of file CTPPSDiamondDetId.h.

31  : CTPPSDetId(id)
32  {
33  }
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:31
CTPPSDiamondDetId::CTPPSDiamondDetId ( uint32_t  Arm,
uint32_t  Station,
uint32_t  RomanPot = 0,
uint32_t  Plane = 0,
uint32_t  Channel = 0 
)

Construct from hierarchy indeces.

Definition at line 36 of file CTPPSDiamondDetId.cc.

References Exception, DetId::id_, CTPPSDetId::maskArm, maskChannel, maskPlane, CTPPSDetId::maskRP, CTPPSDetId::maskStation, CTPPSDetId::maxArm, maxChannel, maxPlane, CTPPSDetId::maxRP, CTPPSDetId::maxStation, convertSQLiteXML::ok, CTPPSDetId::startArmBit, startDetBit, startPlaneBit, CTPPSDetId::startRPBit, and CTPPSDetId::startStationBit.

36  :
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 }
static const uint32_t maxStation
Definition: CTPPSDetId.h:47
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
static const uint32_t maxPlane
static const uint32_t maxRP
Definition: CTPPSDetId.h:48
static const uint32_t startPlaneBit
uint32_t id_
Definition: DetId.h:55
static const uint32_t startStationBit
Definition: CTPPSDetId.h:47
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:31
static const uint32_t startArmBit
Definition: CTPPSDetId.h:46
static const uint32_t startDetBit
DQMChannel Channel
static const uint32_t maskPlane

Member Function Documentation

uint32_t CTPPSDiamondDetId::channel ( ) const
inline

Definition at line 60 of file CTPPSDiamondDetId.h.

References DetId::id_, maskChannel, and startDetBit.

Referenced by channelName(), and CTPPSDiamondDetId().

61  {
62  return ((id_>>startDetBit) & maskChannel);
63  }
static const uint32_t maskChannel
uint32_t id_
Definition: DetId.h:55
static const uint32_t startDetBit
void CTPPSDiamondDetId::channelName ( std::string &  name,
NameFlag  flag = nFull 
) const
inline

Definition at line 92 of file CTPPSDiamondDetId.h.

References channel(), channelNames, CTPPSDetId::nFull, CTPPSDetId::nPath, CTPPSDetId::nShort, and planeName().

93  {
94  switch (flag)
95  {
96  case nShort: name = ""; break;
97  case nFull: planeName(name, flag); name += "_"; break;
98  case nPath: planeName(name, flag); name += "/channel "; break;
99  }
100 
101  name += channelNames[channel()];
102  }
uint32_t channel() const
void planeName(std::string &name, NameFlag flag=nFull) const
static const std::string channelNames[]
static bool CTPPSDiamondDetId::check ( unsigned int  raw)
inlinestatic

returns true if the raw ID is a PPS-timing one

Definition at line 42 of file CTPPSDiamondDetId.h.

References DetId::kDetOffset, DetId::kSubdetOffset, CTPPSDetId::sdTimingDiamond, and DetId::VeryForward.

Referenced by CTPPSDiamondDetId().

43  {
44  return (((raw >>DetId::kDetOffset) & 0xF) == DetId::VeryForward &&
45  ((raw >> DetId::kSubdetOffset) & 0x7) == sdTimingDiamond);
46  }
static const int kSubdetOffset
Definition: DetId.h:21
static const int kDetOffset
Definition: DetId.h:20
CTPPSDiamondDetId CTPPSDiamondDetId::getPlaneId ( ) const
inline

Definition at line 73 of file CTPPSDiamondDetId.h.

References CTPPSDiamondDetId(), lowMaskPlane, and DetId::rawId().

74  {
75  return CTPPSDiamondDetId( rawId() & (~lowMaskPlane) );
76  }
CTPPSDiamondDetId(uint32_t id)
Construct from a raw id.
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const uint32_t lowMaskPlane
uint32_t CTPPSDiamondDetId::plane ( ) const
inline

Definition at line 49 of file CTPPSDiamondDetId.h.

References DetId::id_, maskPlane, and startPlaneBit.

Referenced by planeName().

50  {
51  return ((id_>>startPlaneBit) & maskPlane);
52  }
static const uint32_t startPlaneBit
uint32_t id_
Definition: DetId.h:55
static const uint32_t maskPlane
void CTPPSDiamondDetId::planeName ( std::string &  name,
NameFlag  flag = nFull 
) const
inline

Definition at line 80 of file CTPPSDiamondDetId.h.

References CTPPSDetId::nFull, CTPPSDetId::nPath, CTPPSDetId::nShort, plane(), planeNames, and CTPPSDetId::rpName().

Referenced by channelName().

81  {
82  switch (flag)
83  {
84  case nShort: name = ""; break;
85  case nFull: rpName(name, flag); name += "_"; break;
86  case nPath: rpName(name, flag); name += "/plane "; break;
87  }
88 
89  name += planeNames[plane()];
90  }
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:139
uint32_t plane() const
static const std::string planeNames[]
void CTPPSDiamondDetId::setChannel ( uint32_t  channel)
inline

Definition at line 65 of file CTPPSDiamondDetId.h.

References DetId::id_, maskChannel, and startDetBit.

66  {
67  id_ &= ~(maskChannel << startDetBit);
68  id_ |= ((channel & maskChannel) << startDetBit);
69  }
static const uint32_t maskChannel
uint32_t channel() const
uint32_t id_
Definition: DetId.h:55
static const uint32_t startDetBit
void CTPPSDiamondDetId::setPlane ( uint32_t  channel)
inline

Definition at line 54 of file CTPPSDiamondDetId.h.

References DetId::id_, maskPlane, and startPlaneBit.

55  {
56  id_ &= ~(maskPlane << startPlaneBit);
57  id_ |= ((channel & maskPlane) << startPlaneBit);
58  }
static const uint32_t startPlaneBit
uint32_t channel() const
uint32_t id_
Definition: DetId.h:55
static const uint32_t maskPlane

Member Data Documentation

const string CTPPSDiamondDetId::channelNames = { "0", "1", "2", "3", "4", "05", "06", "07", "08", "09", "10", "11" }
staticprivate

Definition at line 106 of file CTPPSDiamondDetId.h.

Referenced by channelName().

const uint32_t CTPPSDiamondDetId::lowMaskChannel = 0xFFF
static

Definition at line 39 of file CTPPSDiamondDetId.h.

const uint32_t CTPPSDiamondDetId::lowMaskPlane = 0x1FFFF
static

Definition at line 38 of file CTPPSDiamondDetId.h.

Referenced by getPlaneId().

const uint32_t CTPPSDiamondDetId::maskChannel = 0x1F
static

Definition at line 39 of file CTPPSDiamondDetId.h.

Referenced by channel(), CTPPSDiamondDetId(), and setChannel().

const uint32_t CTPPSDiamondDetId::maskPlane = 0x3
static

Definition at line 38 of file CTPPSDiamondDetId.h.

Referenced by CTPPSDiamondDetId(), plane(), and setPlane().

const uint32_t CTPPSDiamondDetId::maxChannel = 11
static

Definition at line 39 of file CTPPSDiamondDetId.h.

Referenced by CTPPSDiamondDetId().

const uint32_t CTPPSDiamondDetId::maxPlane = 3
static

Definition at line 38 of file CTPPSDiamondDetId.h.

Referenced by CTPPSDiamondDetId().

const string CTPPSDiamondDetId::planeNames = { "0", "1", "2", "3" }
staticprivate

Definition at line 105 of file CTPPSDiamondDetId.h.

Referenced by planeName().

const uint32_t CTPPSDiamondDetId::startDetBit = 12
static

Definition at line 39 of file CTPPSDiamondDetId.h.

Referenced by channel(), CTPPSDiamondDetId(), and setChannel().

const uint32_t CTPPSDiamondDetId::startPlaneBit = 17
static

Definition at line 38 of file CTPPSDiamondDetId.h.

Referenced by CTPPSDiamondDetId(), plane(), and setPlane().