CMS 3D CMS Logo

Public Member Functions | Static Public Attributes | Private Attributes

CastorElectronicsId Class Reference

Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] not used [25] [24:20] [19] [18:14] [13:9] [8:5] [4:2] [1:0]. More...

#include <CastorElectronicsId.h>

List of all members.

Public Member Functions

 CastorElectronicsId ()
 CastorElectronicsId (uint32_t)
 CastorElectronicsId (int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb)
 CastorElectronicsId (int fiberChan, int fiberIndex, int spigot, int dccid)
int dccid () const
int fiberChanId () const
int fiberIndex () const
int htrChanId () const
int htrSlot () const
int htrTopBottom () const
bool isTriggerChainId () const
int linearIndex () const
int operator!= (const CastorElectronicsId &id) const
uint32_t operator() ()
int operator< (const CastorElectronicsId &id) const
 Compare the id to another one for use in a map.
int operator== (const CastorElectronicsId &id) const
uint32_t rawId () const
int readoutVMECrateId () const
void setHTR (int crate, int slot, int tb)
std::string slbChannelCode () const
int slbChannelIndex () const
int slbSiteNumber () const
int spigot () const

Static Public Attributes

static const int maxDCCId = 15
static const int maxLinearIndex = 0x3FFF

Private Attributes

uint32_t castorElectronicsId_

Detailed Description

Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] not used [25] [24:20] [19] [18:14] [13:9] [8:5] [4:2] [1:0].

Definition at line 20 of file CastorElectronicsId.h.


Constructor & Destructor Documentation

CastorElectronicsId::CastorElectronicsId ( )

Constructors

Definition at line 4 of file CastorElectronicsId.cc.

References castorElectronicsId_.

                                         {
  castorElectronicsId_=0xffffffffu;
}
CastorElectronicsId::CastorElectronicsId ( uint32_t  id)
CastorElectronicsId::CastorElectronicsId ( int  fiberChan,
int  fiberIndex,
int  spigot,
int  dccid 
)

Definition at line 12 of file CastorElectronicsId.cc.

References castorElectronicsId_.

                                                                                             {
  castorElectronicsId_=(fiberChan&0x3) | (((fiberIndex-1)&0xf)<<2) |
    ((spigot&0xF)<<6) | ((dccid&0xF)<<10);
}
CastorElectronicsId::CastorElectronicsId ( int  slbChan,
int  slbSite,
int  spigot,
int  dccid,
int  crate,
int  slot,
int  tb 
)

Definition at line 17 of file CastorElectronicsId.cc.

References castorElectronicsId_.

                                                                                                                     {
  castorElectronicsId_=(slbChan&0x3) | (((slbSite-1)&0xf)<<2) |
    ((spigot&0xF)<<6) | ((dccid&0xF)<<10);
  castorElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
  castorElectronicsId_|=0x02000000;
}

Member Function Documentation

int CastorElectronicsId::dccid ( ) const [inline]

Definition at line 43 of file CastorElectronicsId.h.

References castorElectronicsId_.

{ return (castorElectronicsId_>>10)&0xF; }
int CastorElectronicsId::fiberChanId ( ) const [inline]
int CastorElectronicsId::fiberIndex ( ) const [inline]

Definition at line 35 of file CastorElectronicsId.h.

References castorElectronicsId_.

Referenced by htrChanId(), and CastorDbASCIIIO::CastorElectronicsIdLess::operator()().

{ return ((castorElectronicsId_>>2)&0xf)+1; }
int CastorElectronicsId::htrChanId ( ) const [inline]

Definition at line 41 of file CastorElectronicsId.h.

References fiberChanId(), and fiberIndex().

{ return (fiberChanId()+1)+((fiberIndex()-1)*3); }
int CastorElectronicsId::htrSlot ( ) const [inline]
int CastorElectronicsId::htrTopBottom ( ) const [inline]
bool CastorElectronicsId::isTriggerChainId ( ) const [inline]

Definition at line 31 of file CastorElectronicsId.h.

References castorElectronicsId_.

Referenced by slbChannelCode().

{ return (castorElectronicsId_&0x02000000)!=0; }
int CastorElectronicsId::linearIndex ( ) const [inline]
int CastorElectronicsId::operator!= ( const CastorElectronicsId id) const [inline]

Definition at line 54 of file CastorElectronicsId.h.

References castorElectronicsId_.

{ return id.castorElectronicsId_!=castorElectronicsId_; }
uint32_t CastorElectronicsId::operator() ( ) [inline]

Definition at line 27 of file CastorElectronicsId.h.

References castorElectronicsId_.

int CastorElectronicsId::operator< ( const CastorElectronicsId id) const [inline]

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

Definition at line 56 of file CastorElectronicsId.h.

References castorElectronicsId_.

{ return castorElectronicsId_<id.castorElectronicsId_; }
int CastorElectronicsId::operator== ( const CastorElectronicsId id) const [inline]

operators

Definition at line 53 of file CastorElectronicsId.h.

References castorElectronicsId_.

{ return id.castorElectronicsId_==castorElectronicsId_; }
uint32_t CastorElectronicsId::rawId ( ) const [inline]
int CastorElectronicsId::readoutVMECrateId ( ) const [inline]
void CastorElectronicsId::setHTR ( int  crate,
int  slot,
int  tb 
)

Definition at line 46 of file CastorElectronicsId.cc.

References castorElectronicsId_.

Referenced by CastorDbHardcode::makeHardcodeMap(), and CastorUnpacker::unpack().

                                                            {
  castorElectronicsId_&=0x3FFF; // keep the readout chain info
  castorElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
}
std::string CastorElectronicsId::slbChannelCode ( ) const

Definition at line 24 of file CastorElectronicsId.cc.

References htrTopBottom(), isTriggerChainId(), and slbChannelIndex().

                                                    {
  std::string retval;
  if (isTriggerChainId()) {
    if (htrTopBottom()) { // top
      switch (slbChannelIndex()) {
      case (0): retval="A0"; break;
      case (1): retval="A1"; break;
      case (2): retval="C0"; break;
      case (3): retval="C1"; break;
      }
    } else {
      switch (slbChannelIndex()) {
      case (0): retval="B0"; break;
      case (1): retval="B1"; break;
      case (2): retval="D0"; break;
      case (3): retval="D1"; break;
      }
    }
  }
  return retval;
}
int CastorElectronicsId::slbChannelIndex ( ) const [inline]

Definition at line 36 of file CastorElectronicsId.h.

References castorElectronicsId_.

Referenced by slbChannelCode().

{ return castorElectronicsId_&0x3; }
int CastorElectronicsId::slbSiteNumber ( ) const [inline]

Definition at line 37 of file CastorElectronicsId.h.

References castorElectronicsId_.

{ return ((castorElectronicsId_>>2)&0xf)+1; }
int CastorElectronicsId::spigot ( ) const [inline]

Definition at line 42 of file CastorElectronicsId.h.

References castorElectronicsId_.

{ return (castorElectronicsId_>>6)&0xF; }

Member Data Documentation

const int CastorElectronicsId::maxDCCId = 15 [static]

Definition at line 50 of file CastorElectronicsId.h.

const int CastorElectronicsId::maxLinearIndex = 0x3FFF [static]

Definition at line 49 of file CastorElectronicsId.h.