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 (int crate, int slot, int fiber, int fc, bool isTrigger)
 
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 (uint32_t id)
 
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 ( )
inlineconstexpr

Default constructor – invalid value

Definition at line 35 of file HcalElectronicsId.h.

35 : hcalElectronicsId_{0xffffffffu} {}

◆ HcalElectronicsId() [2/5]

constexpr HcalElectronicsId::HcalElectronicsId ( uint32_t  id)
inlineconstexpr

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 
)
inlineconstexpr

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))) {}

◆ HcalElectronicsId() [4/5]

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

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

Definition at line 43 of file HcalElectronicsId.h.

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  }

References hcalElectronicsId_, and slot().

◆ HcalElectronicsId() [5/5]

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

uTCA constructor

Definition at line 50 of file HcalElectronicsId.h.

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

References hcalElectronicsId_.

Member Function Documentation

◆ crateId()

constexpr int HcalElectronicsId::crateId ( ) const
inlineconstexpr

get the readout VME crate number

Definition at line 107 of file HcalElectronicsId.h.

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

References hcalElectronicsId_, and isVMEid().

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

◆ dccid()

constexpr int HcalElectronicsId::dccid ( ) const
inlineconstexpr

◆ fiberChanId()

constexpr int HcalElectronicsId::fiberChanId ( ) const
inlineconstexpr

◆ fiberIndex()

constexpr int HcalElectronicsId::fiberIndex ( ) const
inlineconstexpr

◆ htrChanId()

constexpr int HcalElectronicsId::htrChanId ( ) const
inlineconstexpr

get the HTR channel id (1-24)

Definition at line 87 of file HcalElectronicsId.h.

87 { return isVMEid() ? ((fiberChanId() + 1) + ((fiberIndex() - 1) * 3)) : (0); }

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

Referenced by HtrXmlPatternTool::Fill().

◆ htrSlot()

constexpr int HcalElectronicsId::htrSlot ( ) const
inlineconstexpr

◆ htrTopBottom()

constexpr int HcalElectronicsId::htrTopBottom ( ) const
inlineconstexpr

◆ isTriggerChainId()

constexpr bool HcalElectronicsId::isTriggerChainId ( ) const
inlineconstexpr

Definition at line 63 of file HcalElectronicsId.h.

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

References hcalElectronicsId_.

Referenced by slbChannelCode().

◆ isUTCAid()

constexpr bool HcalElectronicsId::isUTCAid ( ) const
inlineconstexpr

Definition at line 62 of file HcalElectronicsId.h.

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

References hcalElectronicsId_.

Referenced by setHTR(), and subtype().

◆ isVMEid()

constexpr bool HcalElectronicsId::isVMEid ( ) const
inlineconstexpr

Definition at line 61 of file HcalElectronicsId.h.

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

References hcalElectronicsId_.

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

◆ linearIndex()

constexpr int HcalElectronicsId::linearIndex ( ) const
inlineconstexpr

◆ operator!=()

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

Non-Equality operator

Definition at line 121 of file HcalElectronicsId.h.

121 { return id.hcalElectronicsId_ != hcalElectronicsId_; }

References hcalElectronicsId_.

◆ operator()()

constexpr uint32_t HcalElectronicsId::operator() ( )
inlineconstexpr

Definition at line 57 of file HcalElectronicsId.h.

57 { return hcalElectronicsId_; }

References hcalElectronicsId_.

◆ operator<()

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

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

Definition at line 123 of file HcalElectronicsId.h.

123 { return hcalElectronicsId_ < id.hcalElectronicsId_; }

References hcalElectronicsId_.

◆ operator==()

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

Equality operator

Definition at line 119 of file HcalElectronicsId.h.

119 { return id.hcalElectronicsId_ == hcalElectronicsId_; }

References hcalElectronicsId_.

◆ rawId()

constexpr uint32_t HcalElectronicsId::rawId ( ) const
inlineconstexpr

◆ readoutVMECrateId()

constexpr int HcalElectronicsId::readoutVMECrateId ( ) const
inlineconstexpr

◆ setHTR()

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

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

Definition at line 66 of file HcalElectronicsId.h.

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  }

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().

◆ slbChannelCode()

std::string HcalElectronicsId::slbChannelCode ( ) const

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

Definition at line 3 of file HcalElectronicsId.cc.

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 }

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

◆ slbChannelIndex()

constexpr int HcalElectronicsId::slbChannelIndex ( ) const
inlineconstexpr

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

Definition at line 82 of file HcalElectronicsId.h.

82 { return hcalElectronicsId_ & 0x3; }

References hcalElectronicsId_.

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

◆ slbSiteNumber()

constexpr int HcalElectronicsId::slbSiteNumber ( ) const
inlineconstexpr

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

Definition at line 84 of file HcalElectronicsId.h.

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

References hcalElectronicsId_.

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

◆ slot()

constexpr int HcalElectronicsId::slot ( ) const
inlineconstexpr

get the htr or uHTR slot

Definition at line 99 of file HcalElectronicsId.h.

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

References hcalElectronicsId_, and isVMEid().

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

◆ spigot()

constexpr int HcalElectronicsId::spigot ( ) const
inlineconstexpr

◆ subtype()

constexpr int HcalElectronicsId::subtype ( ) const
inlineconstexpr

get subtype for this channel (valid for uTCA only)

Definition at line 74 of file HcalElectronicsId.h.

74 { return (isUTCAid()) ? ((hcalElectronicsId_ >> 21) & 0x1F) : (-1); }

References hcalElectronicsId_, and isUTCAid().

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().

HcalElectronicsId::slot
constexpr int slot() const
get the htr or uHTR slot
Definition: HcalElectronicsId.h:99
slbChan
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
Definition: CastorUnpacker.cc:72
HcalElectronicsId::fiberIndex
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...
Definition: HcalElectronicsId.h:78
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
HcalElectronicsId::isVMEid
constexpr bool isVMEid() const
Definition: HcalElectronicsId.h:61
benchmark_cfg.fc
fc
Definition: benchmark_cfg.py:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalElectronicsId::isUTCAid
constexpr bool isUTCAid() const
Definition: HcalElectronicsId.h:62
HcalElectronicsId::isTriggerChainId
constexpr bool isTriggerChainId() const
Definition: HcalElectronicsId.h:63
HcalElectronicsId::htrTopBottom
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
Definition: HcalElectronicsId.h:103
HcalElectronicsId::crateId
constexpr int crateId() const
get the readout VME crate number
Definition: HcalElectronicsId.h:107
HcalElectronicsId::spigot
constexpr int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
Definition: HcalElectronicsId.h:93
HcalElectronicsId::dccid
constexpr int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
Definition: HcalElectronicsId.h:95
HcalElectronicsId::hcalElectronicsId_
uint32_t hcalElectronicsId_
Definition: HcalElectronicsId.h:126
HcalElectronicsId::fiberChanId
constexpr int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
Definition: HcalElectronicsId.h:76
HcalElectronicsId::slbChannelIndex
constexpr int slbChannelIndex() const
get the SLB channel index (valid only for VME trigger-chain ids)
Definition: HcalElectronicsId.h:82