/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
DayaBay::FecChannelId Class Reference

Uniquely identify a RPC electronics channel in DAQ simulation and output. More...

#include <Electronics.h>

Inheritance diagram for DayaBay::FecChannelId:
Inheritance graph
[legend]
Collaboration diagram for DayaBay::FecChannelId:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FecChannelId ()
 FecChannelId (int board, int connector, Site::Site_t site, DetectorId::DetectorId_t det)
 FecChannelId (unsigned int cfId, unsigned int fecId, int connector, Site::Site_t site, DetectorId::DetectorId_t det)
 FecChannelId (const FecChannelId &channel)
 FecChannelId (int data)
virtual ~FecChannelId ()
FecChannelIdoperator= (const FecChannelId &id)
FecChannelId boardId () const
 Return the electronics identifier of the entire board.
unsigned int cfId () const
 Return ROM's Control FPGA (CF) number of the board.
unsigned int fecId () const
 Return ordinal number of the board in the CF.
unsigned int rtmCfId () const
 Return RTM's Control FPGA (CF) number of the board.
unsigned int rtmRotId () const
 Return ROT ordinal number of the board in the RTM's CF.
unsigned int fecHit () const
 Return hit bit to be used in hit map creation.
virtual bool bogus () const
 Return true if data is not consistent with type.
int board () const
 Return the board index in the crate.
int connector () const
 Return the connector number on the board, starting from 1.
void set (Site::Site_t site, DetectorId::DetectorId_t det)
 Set values after construction.
std::string asString () const
 Return string representation of the data.
std::string detName () const
 Return the detector name = SiteDetectorId (eg. NearAD1, FarIWS).
DetectorId::DetectorId_t detectorId () const
 Return the detector ID.
Site::Site_t site () const
 Return the site.
int fullPackedData () const
 Return the full, raw packed integer.
short int siteDetPackedData () const
 Return the part of the packing just for the site+detector part.
bool isAD () const
 Is this an AD?
bool isWaterShield () const
 Is this a Water Shield (Inner or Outer)?
bool isRPC () const
 Is this an RPC?
bool operator== (const Detector &rhs) const
bool operator!= (const Detector &rhs) const

Static Public Member Functions

static unsigned int connectorToHit (unsigned int connector)
 converts connector to hit map with corresponding bit set
static unsigned int hitToConnector (unsigned int hit)
static Detector from_short (short int sitedet)
 Return a detector built from a short int.
static short int siteDetPackedFromString (const std::string str)

Protected Attributes

unsigned int m_data

Private Member Functions

int convertToBoard (unsigned int cfId, unsigned int fecId) const
unsigned int convertToCfId (int board) const
unsigned int convertToFecId (int board) const

Detailed Description

Uniquely identify a RPC electronics channel in DAQ simulation and output.

Channels are identified by a Front-end Card (FEC) board index and the connector number on the board. A single FEC board is required for each RPC panel. The boards are indexed starting with 1. The RPCs require the following number of boards:

Near Site: 54 Far Site: 81

Each FEC board has 32 connectors, numbered 0 to 31 (used to be more convenient 1 to 32, needed to conform to Electronics/Qingming's convention).

Definition at line 147 of file Electronics.h.


Constructor & Destructor Documentation

DayaBay::FecChannelId::FecChannelId ( ) [inline]

Definition at line 149 of file Electronics.h.

: ElecChannelId(0) {}
DayaBay::FecChannelId::FecChannelId ( int  board,
int  connector,
Site::Site_t  site,
DetectorId::DetectorId_t  det 
) [inline]

Definition at line 150 of file Electronics.h.

DayaBay::FecChannelId::FecChannelId ( unsigned int  cfId,
unsigned int  fecId,
int  connector,
Site::Site_t  site,
DetectorId::DetectorId_t  det 
) [inline]

Definition at line 153 of file Electronics.h.

DayaBay::FecChannelId::FecChannelId ( const FecChannelId channel) [inline]

Definition at line 156 of file Electronics.h.

: ElecChannelId(channel) {}
DayaBay::FecChannelId::FecChannelId ( int  data) [inline]

Definition at line 157 of file Electronics.h.

: ElecChannelId(data) {}
DayaBay::FecChannelId::~FecChannelId ( ) [virtual]

Definition at line 91 of file Electronics.cc.

{
}

Member Function Documentation

FecChannelId& DayaBay::FecChannelId::operator= ( const FecChannelId id) [inline]

Definition at line 160 of file Electronics.h.

      { m_data = id.m_data; return *this; }
DayaBay::FecChannelId DayaBay::FecChannelId::boardId ( ) const

Return the electronics identifier of the entire board.

Definition at line 95 of file Electronics.cc.

{
  return DayaBay::FecChannelId(m_data & 0xffffff00);
}
unsigned int DayaBay::FecChannelId::cfId ( ) const

Return ROM's Control FPGA (CF) number of the board.

Definition at line 100 of file Electronics.cc.

{
    return convertToCfId((0xff00 & m_data) >> 8);
}
unsigned int DayaBay::FecChannelId::fecId ( ) const

Return ordinal number of the board in the CF.

Definition at line 105 of file Electronics.cc.

{
    return convertToFecId((0xff00 & m_data)>>8);
}
unsigned int DayaBay::FecChannelId::rtmCfId ( ) const

Return RTM's Control FPGA (CF) number of the board.

Definition at line 110 of file Electronics.cc.

{
    return cfId() >> 1;
}
unsigned int DayaBay::FecChannelId::rtmRotId ( ) const

Return ROT ordinal number of the board in the RTM's CF.

Definition at line 115 of file Electronics.cc.

{
    return cfId() & 1;
}
unsigned int DayaBay::FecChannelId::fecHit ( ) const

Return hit bit to be used in hit map creation.

Definition at line 120 of file Electronics.cc.

{
    return 1<<(0xff & m_data);
}
bool DayaBay::FecChannelId::bogus ( ) const [virtual]

Return true if data is not consistent with type.

Reimplemented from DayaBay::ElecChannelId.

Definition at line 151 of file Electronics.cc.

{
    if (this->Detector::bogus()) return true;

    if ((m_data & 0x000000ff) > 32) // too many connectors
        return true;

    Site::Site_t siteid = site();
    int cfid = (m_data & 0x0000f000) >> 12;
    int fecid = (m_data & 0x00000f00) >> 8;

    if (siteid == Site::kFar && cfid > 5) // too many CFs
        return true;

    if (siteid == Site::kDayaBay && cfid > 3) // too many CFs
        return true;

    if (siteid == Site::kLingAo && cfid > 3) // too many CFs
        return true;

    if (fecid > 14)
      return true;
  // FIXME: add FEC-channel bogosity testing
    return false;
}
static unsigned int DayaBay::FecChannelId::connectorToHit ( unsigned int  connector) [inline, static]

converts connector to hit map with corresponding bit set

Definition at line 182 of file Electronics.h.

{return 0x1<<connector;}
static unsigned int DayaBay::FecChannelId::hitToConnector ( unsigned int  hit) [inline, static]

Definition at line 183 of file Electronics.h.

                                                         {
        for (int i = 0; i < 32; i++, hit>>=1)
        if (0x1&hit) return i;
        return 0;
    }
int DayaBay::FecChannelId::convertToBoard ( unsigned int  cfId,
unsigned int  fecId 
) const [private]

Definition at line 125 of file Electronics.cc.

{
  return ((0x07 & cfId) << 4) | (0x0f &fecId);
}
unsigned int DayaBay::FecChannelId::convertToCfId ( int  board) const [private]

Definition at line 130 of file Electronics.cc.

{
  return (0x70 & board) >> 4;
}
unsigned int DayaBay::FecChannelId::convertToFecId ( int  board) const [private]

Definition at line 135 of file Electronics.cc.

{
  return (0x0f & board);
}
int DayaBay::ElecChannelId::board ( ) const [inherited]

Return the board index in the crate.

Definition at line 15 of file Electronics.cc.

{
  return (m_data & 0x0000ff00)>>8;
}
int DayaBay::ElecChannelId::connector ( ) const [inherited]

Return the connector number on the board, starting from 1.

(connector == 0 implies the entire board.)

Definition at line 20 of file Electronics.cc.

{
  return (m_data & 0x000000ff);
}
DayaBay::Detector DayaBay::Detector::from_short ( short int  sitedet) [static, inherited]

Return a detector built from a short int.

Definition at line 39 of file Detectors.cc.

{
    return Detector(sitedet); 
}
void DayaBay::Detector::set ( Site::Site_t  site,
DetectorId::DetectorId_t  det 
) [inherited]

Set values after construction.

Definition at line 65 of file Detectors.cc.

{
    m_data = (site << 24) | (det << 16);
}
std::string DayaBay::Detector::asString ( ) const [inherited]

Return string representation of the data.

Definition at line 71 of file Detectors.cc.

{
    std::stringstream ss;
    ss << *this;
    return ss.str();
}
std::string DayaBay::Detector::detName ( ) const [inherited]

Return the detector name = SiteDetectorId (eg. NearAD1, FarIWS).

Definition at line 78 of file Detectors.cc.

{
    std::string ret = Site::AsString(site());
    ret += DetectorId::AsString(detectorId());

    return ret;
}
DetectorId::DetectorId_t DayaBay::Detector::detectorId ( ) const [inherited]

Return the detector ID.

Definition at line 86 of file Detectors.cc.

{
    return (DetectorId::DetectorId_t)((m_data&0x00ff0000)>>16);
}
Site::Site_t DayaBay::Detector::site ( ) const [inherited]

Return the site.

Definition at line 91 of file Detectors.cc.

{
    return (Site::Site_t)((m_data&0xff000000)>>24);
}
int DayaBay::Detector::fullPackedData ( ) const [inherited]

Return the full, raw packed integer.

If created by subclass, this may include values in the lower two detector sensor bytes.

Definition at line 96 of file Detectors.cc.

{
    return m_data;
}
short int DayaBay::Detector::siteDetPackedData ( ) const [inherited]

Return the part of the packing just for the site+detector part.

Definition at line 101 of file Detectors.cc.

{
    return (short int)(m_data>>16);
}
short int DayaBay::Detector::siteDetPackedFromString ( const std::string  str) [static, inherited]

Definition at line 115 of file Detectors.cc.

                                                                     {
  DetectorId::DetectorId_t detId = DetectorId::FromString("Unknown");
  Site::Site_t site = Site::FromString("Unknown");

  //find site

  if (str.find("DayaBay")!=std::string::npos) site=Site::FromString("DayaBay");
  if (str.find("LingAo")!=std::string::npos) site=Site::FromString("LingAo");
  if (str.find("Mid")!=std::string::npos) site=Site::FromString("Mid");
  if (str.find("Far")!=std::string::npos) site=Site::FromString("Far");
  if (str.find("Aberdeen")!=std::string::npos) site=Site::FromString("Aberdeen");
  if (str.find("SAB")!=std::string::npos) site=Site::FromString("SAB");

  //find detector

  if (str.find("AD1")!=std::string::npos) detId=DetectorId::FromString("AD1");
  if (str.find("AD2")!=std::string::npos) detId=DetectorId::FromString("AD2");
  if (str.find("AD3")!=std::string::npos) detId=DetectorId::FromString("AD3");
  if (str.find("AD4")!=std::string::npos) detId=DetectorId::FromString("AD4");
  if (str.find("IWS")!=std::string::npos) detId=DetectorId::FromString("IWS");
  if (str.find("OWS")!=std::string::npos) detId=DetectorId::FromString("OWS");
  if (str.find("RPC")!=std::string::npos) detId=DetectorId::FromString("RPC");

  return DayaBay::Detector(site,detId).siteDetPackedData();
}
bool DayaBay::Detector::isAD ( ) const [inline, inherited]

Is this an AD?

Definition at line 74 of file Detectors.h.

{ return DetectorId::isAD(this->detectorId()); }
bool DayaBay::Detector::isWaterShield ( ) const [inline, inherited]

Is this a Water Shield (Inner or Outer)?

Definition at line 77 of file Detectors.h.

bool DayaBay::Detector::isRPC ( ) const [inline, inherited]

Is this an RPC?

Definition at line 80 of file Detectors.h.

{ return DetectorId::isRPC(this->detectorId()); }
bool DayaBay::Detector::operator== ( const Detector rhs) const [inline, inherited]

Definition at line 87 of file Detectors.h.

{ return this->m_data == rhs.m_data; }
bool DayaBay::Detector::operator!= ( const Detector rhs) const [inline, inherited]

Definition at line 88 of file Detectors.h.

{ return !(*this == rhs); }

Member Data Documentation

unsigned int DayaBay::Detector::m_data [protected, inherited]

Definition at line 91 of file Detectors.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:56:20 for Conventions by doxygen 1.7.4