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 int crateId () const
 get the readout VME crate number More...
 
constexpr int dccid () const
 get the (Hcal local) DCC id for VME, crate number for uTCA More...
 
constexpr int fiberChanId () const
 get the fiber channel id (which of channels on a fiber) More...
 
constexpr int 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 int htrChanId () const
 get the HTR channel id (1-24) More...
 
constexpr int htrSlot () const
 get the htr slot More...
 
constexpr int 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 int 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 int 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 int slbChannelIndex () const
 get the SLB channel index (valid only for VME trigger-chain ids) More...
 
constexpr int slbSiteNumber () const
 get the SLB site number (valid only for VME trigger-chain ids) More...
 
constexpr int slot () const
 get the htr or uHTR slot More...
 
constexpr int spigot () const
 get the spigot (input number on DCC, AMC card number for uTCA) More...
 
constexpr int 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 int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
constexpr int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
constexpr int spigot() const
get the spigot (input number on DCC, AMC card 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 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  }
constexpr int slot() const
get the htr or uHTR slot
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
constexpr int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
constexpr int spigot() const
get the spigot (input number on DCC, AMC card 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 int slot() const
get the htr or uHTR slot

Member Function Documentation

◆ crateId()

constexpr int HcalElectronicsId::crateId ( ) const
inline

get the readout VME crate number

Definition at line 107 of file HcalElectronicsId.h.

References hcalElectronicsId_, and isVMEid().

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

107  {
108  return (isVMEid()) ? ((hcalElectronicsId_ >> 20) & 0x1F) : ((hcalElectronicsId_ >> 13) & 0x3F);
109  }
constexpr bool isVMEid() const

◆ dccid()

constexpr int HcalElectronicsId::dccid ( ) const
inline

◆ fiberChanId()

constexpr int HcalElectronicsId::fiberChanId ( ) const
inline

◆ fiberIndex()

constexpr int HcalElectronicsId::fiberIndex ( ) const
inline

◆ htrChanId()

constexpr int HcalElectronicsId::htrChanId ( ) const
inline

get the HTR channel id (1-24)

Definition at line 87 of file HcalElectronicsId.h.

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

Referenced by HtrXmlPatternTool::Fill().

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

◆ htrSlot()

constexpr int HcalElectronicsId::htrSlot ( ) const
inline

◆ htrTopBottom()

constexpr int 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 int HcalElectronicsId::linearIndex ( ) const
inline

◆ operator!=()

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

Non-Equality operator

Definition at line 121 of file HcalElectronicsId.h.

References hcalElectronicsId_.

121 { 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 123 of file HcalElectronicsId.h.

References hcalElectronicsId_.

123 { return hcalElectronicsId_ < id.hcalElectronicsId_; }

◆ operator==()

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

Equality operator

Definition at line 119 of file HcalElectronicsId.h.

References hcalElectronicsId_.

119 { return id.hcalElectronicsId_ == hcalElectronicsId_; }

◆ rawId()

constexpr uint32_t HcalElectronicsId::rawId ( ) const
inline

◆ readoutVMECrateId()

constexpr int 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 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 int slot() const
get the htr or uHTR slot
constexpr bool isUTCAid() const

◆ 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 bool isVMEid() const
constexpr bool isTriggerChainId() const
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
constexpr int slbChannelIndex() const
get the SLB channel index (valid only for VME trigger-chain ids)

◆ slbChannelIndex()

constexpr int HcalElectronicsId::slbChannelIndex ( ) const
inline

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

Definition at line 82 of file HcalElectronicsId.h.

References hcalElectronicsId_.

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

82 { return hcalElectronicsId_ & 0x3; }

◆ slbSiteNumber()

constexpr int HcalElectronicsId::slbSiteNumber ( ) const
inline

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

Definition at line 84 of file HcalElectronicsId.h.

References hcalElectronicsId_.

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

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

◆ slot()

constexpr int HcalElectronicsId::slot ( ) const
inline

get the htr or uHTR slot

Definition at line 99 of file HcalElectronicsId.h.

References hcalElectronicsId_, and isVMEid().

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

99  {
100  return (isVMEid()) ? ((hcalElectronicsId_ >> 14) & 0x1F) : ((hcalElectronicsId_ >> 9) & 0xF);
101  }
constexpr bool isVMEid() const

◆ spigot()

constexpr int HcalElectronicsId::spigot ( ) const
inline

◆ subtype()

constexpr int 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 { return (isUTCAid()) ? ((hcalElectronicsId_ >> 21) & 0x1F) : (-1); }
constexpr bool isUTCAid() const

Member Data Documentation

◆ hcalElectronicsId_

uint32_t HcalElectronicsId::hcalElectronicsId_
private

◆ maxDCCId

const int HcalElectronicsId::maxDCCId = 31
static

Definition at line 116 of file HcalElectronicsId.h.

◆ maxLinearIndex

const int HcalElectronicsId::maxLinearIndex = 0x7FFFF
static

Definition at line 115 of file HcalElectronicsId.h.

Referenced by HcalLogicalMapGenerator::createMap().