CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Attributes
HcalElectronicsId Class Reference

Readout chain identification for Hcal. More...

#include <HcalElectronicsId.h>

Public Member Functions

constexpr int32_t crateId () const
 get the readout VME crate number More...
 
constexpr int32_t dccid () const
 get the (Hcal local) DCC id for VME, crate number for uTCA More...
 
constexpr int32_t fiberChanId () const
 get the fiber channel id (which of channels on a fiber) More...
 
constexpr int32_t fiberIndex () const
 get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zero-based More...
 
constexpr HcalElectronicsId ()
 
constexpr HcalElectronicsId (uint32_t id)
 
constexpr HcalElectronicsId (int fiberChan, int fiberIndex, int spigot, int dccid)
 
constexpr HcalElectronicsId (int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb)
 
constexpr HcalElectronicsId (int crate, int slot, int fiber, int fc, bool isTrigger)
 
constexpr int32_t htrChanId () const
 get the HTR channel id (1-24) More...
 
constexpr int32_t htrSlot () const
 get the htr slot More...
 
constexpr int32_t htrTopBottom () const
 get the htr top/bottom (1=top/0=bottom), valid for VME More...
 
constexpr bool isTriggerChainId () const
 
constexpr bool isUTCAid () const
 
constexpr bool isVMEid () const
 
constexpr int32_t linearIndex () const
 get a fast, compact, unique index for linear lookups More...
 
constexpr int operator!= (const HcalElectronicsId &id) const
 
constexpr uint32_t operator() ()
 
constexpr int operator< (const HcalElectronicsId &id) const
 Compare the id to another id for use in a map. More...
 
constexpr int operator== (const HcalElectronicsId &id) const
 
constexpr uint32_t rawId () const
 
constexpr int32_t readoutVMECrateId () const
 get the readout VME crate number More...
 
constexpr void setHTR (int crate, int slot, int tb)
 
std::string slbChannelCode () const
 get the HTR-wide slb channel code (letter plus number) More...
 
constexpr int32_t slbChannelIndex () const
 get the SLB channel index (valid only for VME trigger-chain ids) More...
 
constexpr int32_t slbSiteNumber () const
 get the SLB site number (valid only for VME trigger-chain ids) More...
 
constexpr int32_t slot () const
 get the htr or uHTR slot More...
 
constexpr int32_t spigot () const
 get the spigot (input number on DCC, AMC card number for uTCA) More...
 
constexpr int32_t subtype () const
 get subtype for this channel (valid for uTCA only) More...
 

Static Public Attributes

static const int maxDCCId = 31
 
static const int maxLinearIndex = 0x7FFFF
 

Private Attributes

uint32_t hcalElectronicsId_
 

Detailed Description

Readout chain identification for Hcal.

[31:27] Unused (so far) [26] VME (0), uTCA (1)

For VME Electronics: [25] Trigger-chain id flag [24:20] Readout Crate Id [19] HTR FPGA selector [t/b] [18:14] HTR Slot [13:9] DCC id [8:5] Spigot [4:2] FiberIndex or SLB site [1:0] FiberChanId or SLB channel

For uTCA Electronics:

[25] Is Trigger Id [18:13] Readout Crate Id [12:9] Slot [8:4] Fiber [3:0] FiberChanId

Definition at line 32 of file HcalElectronicsId.h.

Constructor & Destructor Documentation

◆ HcalElectronicsId() [1/5]

constexpr HcalElectronicsId::HcalElectronicsId ( )
inline

Default constructor – invalid value

Definition at line 35 of file HcalElectronicsId.h.

35 : hcalElectronicsId_{0xffffffffu} {}

◆ HcalElectronicsId() [2/5]

constexpr HcalElectronicsId::HcalElectronicsId ( uint32_t  id)
inline

from raw

Definition at line 37 of file HcalElectronicsId.h.

37 : hcalElectronicsId_{id} {}

◆ HcalElectronicsId() [3/5]

constexpr HcalElectronicsId::HcalElectronicsId ( int  fiberChan,
int  fiberIndex,
int  spigot,
int  dccid 
)
inline

VME Constructor from fiberchan,fiber index,spigot,dccid

Definition at line 39 of file HcalElectronicsId.h.

40  : hcalElectronicsId_((uint32_t)((fiberChan & 0x3) | (((fiberIndex - 1) & 0x7) << 2) | ((spigot & 0xF) << 5) |
41  ((dccid & 0x1F) << 9))) {}
constexpr int32_t spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
constexpr int32_t fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
constexpr int32_t dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA

◆ HcalElectronicsId() [4/5]

constexpr HcalElectronicsId::HcalElectronicsId ( int  slbChan,
int  slbSite,
int  spigot,
int  dccid,
int  crate,
int  slot,
int  tb 
)
inline

VME Constructor from slb channel,slb site,spigot,dccid

Definition at line 43 of file HcalElectronicsId.h.

References FCDTask_cfi::crate, hcalElectronicsId_, and slot().

45  (uint32_t)((slbChan & 0x3) | (((slbSite) & 0x7) << 2) | ((spigot & 0xF) << 5) | ((dccid & 0x1F) << 9))) {
46  hcalElectronicsId_ |= ((tb & 0x1) << 19) | ((slot & 0x1f) << 14) | ((crate & 0x3f) << 20);
47  hcalElectronicsId_ |= 0x02000000;
48  }
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
constexpr int32_t spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
constexpr int32_t slot() const
get the htr or uHTR slot
constexpr int32_t dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA

◆ HcalElectronicsId() [5/5]

constexpr HcalElectronicsId::HcalElectronicsId ( int  crate,
int  slot,
int  fiber,
int  fc,
bool  isTrigger 
)
inline

uTCA constructor

Definition at line 50 of file HcalElectronicsId.h.

References hcalElectronicsId_.

51  : hcalElectronicsId_((int)((fc & 0xF) | (((fiber) & 0x1F) << 4) | ((slot & 0xF) << 9) | ((crate & 0x3F) << 13))) {
52  if (isTrigger)
53  hcalElectronicsId_ |= 0x02000000;
54  hcalElectronicsId_ |= 0x04000000;
55  }
constexpr int32_t slot() const
get the htr or uHTR slot

Member Function Documentation

◆ crateId()

constexpr int32_t HcalElectronicsId::crateId ( ) const
inline

get the readout VME crate number

Definition at line 113 of file HcalElectronicsId.h.

References hcalElectronicsId_, and isVMEid().

Referenced by dccid(), hcaldqm::quantity::getEid_FEDuTCASlot(), and readoutVMECrateId().

113  {
114  return (isVMEid()) ? ((hcalElectronicsId_ >> 20) & 0x1F) : ((hcalElectronicsId_ >> 13) & 0x3F);
115  }
constexpr bool isVMEid() const

◆ dccid()

constexpr int32_t HcalElectronicsId::dccid ( ) const
inline

◆ fiberChanId()

constexpr int32_t HcalElectronicsId::fiberChanId ( ) const
inline

◆ fiberIndex()

constexpr int32_t HcalElectronicsId::fiberIndex ( ) const
inline

◆ htrChanId()

constexpr int32_t HcalElectronicsId::htrChanId ( ) const
inline

get the HTR channel id (1-24)

Definition at line 91 of file HcalElectronicsId.h.

References fiberChanId(), fiberIndex(), and isVMEid().

Referenced by HtrXmlPatternTool::Fill().

91 { return isVMEid() ? ((fiberChanId() + 1) + ((fiberIndex() - 1) * 3)) : (0); }
constexpr bool isVMEid() const
constexpr int32_t fiberChanId() const
get the fiber channel id (which of channels on a fiber)
constexpr int32_t fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...

◆ htrSlot()

constexpr int32_t HcalElectronicsId::htrSlot ( ) const
inline

◆ htrTopBottom()

constexpr int32_t HcalElectronicsId::htrTopBottom ( ) const
inline

◆ isTriggerChainId()

constexpr bool HcalElectronicsId::isTriggerChainId ( ) const
inline

Definition at line 63 of file HcalElectronicsId.h.

References hcalElectronicsId_.

Referenced by slbChannelCode().

63 { return (hcalElectronicsId_ & 0x02000000) != 0; }

◆ isUTCAid()

constexpr bool HcalElectronicsId::isUTCAid ( ) const
inline

Definition at line 62 of file HcalElectronicsId.h.

References hcalElectronicsId_.

Referenced by setHTR(), and subtype().

62 { return (hcalElectronicsId_ & 0x04000000) != 0; }

◆ isVMEid()

constexpr bool HcalElectronicsId::isVMEid ( ) const
inline

Definition at line 61 of file HcalElectronicsId.h.

References hcalElectronicsId_.

Referenced by crateId(), dccid(), fiberChanId(), fiberIndex(), htrChanId(), htrTopBottom(), linearIndex(), slbChannelCode(), slot(), and spigot().

61 { return (hcalElectronicsId_ & 0x04000000) == 0; }

◆ linearIndex()

constexpr int32_t HcalElectronicsId::linearIndex ( ) const
inline

◆ operator!=()

constexpr int HcalElectronicsId::operator!= ( const HcalElectronicsId id) const
inline

Non-Equality operator

Definition at line 127 of file HcalElectronicsId.h.

References hcalElectronicsId_.

127 { return id.hcalElectronicsId_ != hcalElectronicsId_; }

◆ operator()()

constexpr uint32_t HcalElectronicsId::operator() ( )
inline

Definition at line 57 of file HcalElectronicsId.h.

References hcalElectronicsId_.

57 { return hcalElectronicsId_; }

◆ operator<()

constexpr int HcalElectronicsId::operator< ( const HcalElectronicsId id) const
inline

Compare the id to another id for use in a map.

Definition at line 129 of file HcalElectronicsId.h.

References hcalElectronicsId_.

129 { return hcalElectronicsId_ < id.hcalElectronicsId_; }

◆ operator==()

constexpr int HcalElectronicsId::operator== ( const HcalElectronicsId id) const
inline

Equality operator

Definition at line 125 of file HcalElectronicsId.h.

References hcalElectronicsId_.

125 { return id.hcalElectronicsId_ == hcalElectronicsId_; }

◆ rawId()

constexpr uint32_t HcalElectronicsId::rawId ( ) const
inline

◆ readoutVMECrateId()

constexpr int32_t HcalElectronicsId::readoutVMECrateId ( ) const
inline

◆ setHTR()

constexpr void HcalElectronicsId::setHTR ( int  crate,
int  slot,
int  tb 
)
inline

Set the VME htr-related information 1=top, 0=bottom

Definition at line 66 of file HcalElectronicsId.h.

References FCDTask_cfi::crate, hcalElectronicsId_, isUTCAid(), and slot().

Referenced by CALIBLogicalMapEntry::CALIBLogicalMapEntry(), HcalDbASCIIIO::createObject< HcalElectronicsMap >(), ChannelPattern::Fill_by_hand(), HcalFiberPattern::getId(), HBHEHFLogicalMapEntry::HBHEHFLogicalMapEntry(), HOHXLogicalMapEntry::HOHXLogicalMapEntry(), and ZDCLogicalMapEntry::ZDCLogicalMapEntry().

66  {
67  if (isUTCAid())
68  return; // cannot do this for uTCA
69  hcalElectronicsId_ &= 0x3FFF; // keep the readout chain info
70  hcalElectronicsId_ |= ((tb & 0x1) << 19) | ((slot & 0x1f) << 14) | ((crate & 0x3f) << 20);
71  }
constexpr bool isUTCAid() const
constexpr int32_t slot() const
get the htr or uHTR slot

◆ slbChannelCode()

std::string HcalElectronicsId::slbChannelCode ( ) const

get the HTR-wide slb channel code (letter plus number)

Definition at line 3 of file HcalElectronicsId.cc.

References htrTopBottom(), isTriggerChainId(), isVMEid(), slbChannelIndex(), and AlCaHLTBitMon_QueryRunRegistry::string.

3  {
4  std::string retval;
5  if (isTriggerChainId() && isVMEid()) {
6  if (htrTopBottom()) { // top
7  switch (slbChannelIndex()) {
8  case (0):
9  retval = "A0";
10  break;
11  case (1):
12  retval = "A1";
13  break;
14  case (2):
15  retval = "C0";
16  break;
17  case (3):
18  retval = "C1";
19  break;
20  }
21  } else {
22  switch (slbChannelIndex()) {
23  case (0):
24  retval = "B0";
25  break;
26  case (1):
27  retval = "B1";
28  break;
29  case (2):
30  retval = "D0";
31  break;
32  case (3):
33  retval = "D1";
34  break;
35  }
36  }
37  }
38  return retval;
39 }
constexpr int32_t htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
constexpr bool isVMEid() const
constexpr bool isTriggerChainId() const
constexpr int32_t slbChannelIndex() const
get the SLB channel index (valid only for VME trigger-chain ids)

◆ slbChannelIndex()

constexpr int32_t HcalElectronicsId::slbChannelIndex ( ) const
inline

get the SLB channel index (valid only for VME trigger-chain ids)

Definition at line 86 of file HcalElectronicsId.h.

References hcalElectronicsId_.

Referenced by hcaldqm::quantity::getEid_SLBSLBCh(), HTLogicalMapEntry::printLMapLine(), and slbChannelCode().

86 { return hcalElectronicsId_ & 0x3; }

◆ slbSiteNumber()

constexpr int32_t HcalElectronicsId::slbSiteNumber ( ) const
inline

get the SLB site number (valid only for VME trigger-chain ids)

Definition at line 88 of file HcalElectronicsId.h.

References hcalElectronicsId_.

Referenced by hcaldqm::quantity::getEid_SLBSLBCh(), and HTLogicalMapEntry::printLMapLine().

88 { return ((hcalElectronicsId_ >> 2) & 0x7); }

◆ slot()

constexpr int32_t HcalElectronicsId::slot ( ) const
inline

get the htr or uHTR slot

Definition at line 103 of file HcalElectronicsId.h.

References hcalElectronicsId_, and isVMEid().

Referenced by hcaldqm::quantity::getEid_FEDuTCASlot(), HcalElectronicsId(), htrSlot(), setHTR(), and spigot().

103  {
104  return (isVMEid()) ? ((hcalElectronicsId_ >> 14) & 0x1F) : ((hcalElectronicsId_ >> 9) & 0xF);
105  }
constexpr bool isVMEid() const

◆ spigot()

constexpr int32_t HcalElectronicsId::spigot ( ) const
inline

◆ subtype()

constexpr int32_t HcalElectronicsId::subtype ( ) const
inline

get subtype for this channel (valid for uTCA only)

Definition at line 74 of file HcalElectronicsId.h.

References hcalElectronicsId_, and isUTCAid().

74  {
75  return (isUTCAid()) ? static_cast<int32_t>((hcalElectronicsId_ >> 21) & 0x1F) : (-1);
76  }
constexpr bool isUTCAid() const

Member Data Documentation

◆ hcalElectronicsId_

uint32_t HcalElectronicsId::hcalElectronicsId_
private

◆ maxDCCId

const int HcalElectronicsId::maxDCCId = 31
static

Definition at line 122 of file HcalElectronicsId.h.

◆ maxLinearIndex

const int HcalElectronicsId::maxLinearIndex = 0x7FFFF
static

Definition at line 121 of file HcalElectronicsId.h.

Referenced by HcalLogicalMapGenerator::createMap().