| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DayaBay::FadcChannelId Class Reference

Uniquely identify a fadc channel in DAQ simulation and output. More...

#include <Electronics.h>

Inheritance diagram for DayaBay::FadcChannelId:

[legend]
Collaboration diagram for DayaBay::FadcChannelId:
[legend]
List of all members.

Public Member Functions

 FadcChannelId ()
 FadcChannelId (int connector, Site::Site_t site, DetectorId::DetectorId_t det)
 FadcChannelId (int board, int connector, Site::Site_t site, DetectorId::DetectorId_t det)
 FadcChannelId (const FeeChannelId &channel)
 FadcChannelId (int data)
virtual ~FadcChannelId ()
FadcChannelIdoperator= (const FadcChannelId &id)
FadcChannelId boardId () const
int outputId () const
int firstInputId () const
int secondInputId () const
int board () const
int connector () const
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)?
virtual bool bogus () const
 Returns true if the combination of site & detector are not consistent (does not include 'unknown' parts).
bool operator== (const Detector &rhs) const
bool operator!= (const Detector &rhs) const

Static Public Member Functions

static short int siteDetPackedFromString (const std::string str)

Protected Attributes

unsigned int m_data

Detailed Description

Uniquely identify a fadc channel in DAQ simulation and output.

Channels are identified by a FADC board index and the connector number on the board.

Definition at line 91 of file Electronics.h.


Constructor & Destructor Documentation

DayaBay::FadcChannelId::FadcChannelId (  )  [inline]

Definition at line 93 of file Electronics.h.

00093 : ElecChannelId(0) {}

DayaBay::FadcChannelId::FadcChannelId ( int  connector,
Site::Site_t  site,
DetectorId::DetectorId_t  det 
) [inline]

Definition at line 94 of file Electronics.h.

00095                                                             : 
00096                ElecChannelId(20, connector, site, det) {}

DayaBay::FadcChannelId::FadcChannelId ( int  board,
int  connector,
Site::Site_t  site,
DetectorId::DetectorId_t  det 
) [inline]

Definition at line 97 of file Electronics.h.

00098                                                             : 
00099                ElecChannelId(board, connector, site, det) {}

DayaBay::FadcChannelId::FadcChannelId ( const FeeChannelId channel  )  [inline]

Definition at line 100 of file Electronics.h.

00100 : ElecChannelId(channel) {}

DayaBay::FadcChannelId::FadcChannelId ( int  data  )  [inline]

Definition at line 101 of file Electronics.h.

00101 : ElecChannelId(data) {}

DayaBay::FadcChannelId::~FadcChannelId (  )  [virtual]

Definition at line 34 of file Electronics.cc.

00035 {
00036 }


Member Function Documentation

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

Definition at line 104 of file Electronics.h.

00105       { m_data = id.m_data; return *this; }

DayaBay::FadcChannelId DayaBay::FadcChannelId::boardId (  )  const

Definition at line 38 of file Electronics.cc.

00039 {
00040   return DayaBay::FeeChannelId(m_data & 0xffffff00);
00041 }

int DayaBay::FadcChannelId::outputId (  )  const

Definition at line 43 of file Electronics.cc.

00044 {
00045     if (connector()>16) return 0;
00046     int board = m_data & 0xffffff00;
00047     int connector = m_data & 0x000000ff;
00048     return ( board | ( 16 + (connector+1)/2) );
00049 }

int DayaBay::FadcChannelId::firstInputId (  )  const

Definition at line 51 of file Electronics.cc.

00052 {
00053     if (connector()<=16) return 0;
00054     int board = m_data & 0xffffff00;
00055     int connector = m_data & 0x000000ff;
00056     return ( board | ((connector-16)*2-1) );
00057 }

int DayaBay::FadcChannelId::secondInputId (  )  const

Definition at line 59 of file Electronics.cc.

00060 {
00061     if (connector()<=16) return 0;
00062     int board = m_data & 0xffffff00;
00063     int connector = m_data & 0x000000ff;
00064     return ( board | ((connector-16)*2) );
00065 }

int DayaBay::ElecChannelId::board (  )  const [inherited]

Definition at line 15 of file Electronics.cc.

00016 {
00017   return (m_data & 0x0000ff00)>>8;
00018 }

int DayaBay::ElecChannelId::connector (  )  const [inherited]

Definition at line 20 of file Electronics.cc.

00021 {
00022   return (m_data & 0x000000ff);
00023 }

void DayaBay::Detector::set ( Site::Site_t  site,
DetectorId::DetectorId_t  det 
) [inherited]

Set values after construction.

Definition at line 48 of file Detectors.cc.

00049 {
00050     m_data = (site << 24) | (det << 16);
00051 }

std::string DayaBay::Detector::asString (  )  const [inherited]

Return string representation of the data.

Definition at line 54 of file Detectors.cc.

00055 {
00056     std::stringstream ss;
00057     ss << *this; 
00058     return ss.str();
00059 }

std::string DayaBay::Detector::detName (  )  const [inherited]

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

Definition at line 61 of file Detectors.cc.

00062 {
00063     std::string ret = Site::AsString(site());
00064     ret += DetectorId::AsString(detectorId());
00065 
00066     return ret;
00067 }

DetectorId::DetectorId_t DayaBay::Detector::detectorId (  )  const [inherited]

Return the detector ID.

Definition at line 69 of file Detectors.cc.

00070 {
00071     return (DetectorId::DetectorId_t)((m_data&0x00ff0000)>>16);
00072 }

Site::Site_t DayaBay::Detector::site (  )  const [inherited]

Return the site.

Definition at line 74 of file Detectors.cc.

00075 {
00076     return (Site::Site_t)((m_data&0xff000000)>>24);
00077 }

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 79 of file Detectors.cc.

00080 {
00081     return m_data;
00082 }

short int DayaBay::Detector::siteDetPackedData (  )  const [inherited]

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

Definition at line 84 of file Detectors.cc.

00085 {
00086     return (short int)(m_data>>16);
00087 }

short int DayaBay::Detector::siteDetPackedFromString ( const std::string  str  )  [static, inherited]

Definition at line 107 of file Detectors.cc.

00107                                                                      {
00108   DetectorId::DetectorId_t detId = DetectorId::FromString("Unknown");
00109   Site::Site_t site = Site::FromString("Unknown");
00110   
00111   //find site
00112   
00113   if (str.find("DayaBay")!=std::string::npos) site=Site::FromString("DayaBay");
00114   if (str.find("LingAo")!=std::string::npos) site=Site::FromString("LingAo");
00115   if (str.find("Mid")!=std::string::npos) site=Site::FromString("Mid");
00116   if (str.find("Far")!=std::string::npos) site=Site::FromString("Far");
00117   if (str.find("Aberdeen")!=std::string::npos) site=Site::FromString("Aberdeen");
00118   if (str.find("SAB")!=std::string::npos) site=Site::FromString("SAB");
00119 
00120   //find detector
00121   
00122   if (str.find("AD1")!=std::string::npos) detId=DetectorId::FromString("AD1");
00123   if (str.find("AD2")!=std::string::npos) detId=DetectorId::FromString("AD2");
00124   if (str.find("AD3")!=std::string::npos) detId=DetectorId::FromString("AD3");
00125   if (str.find("AD4")!=std::string::npos) detId=DetectorId::FromString("AD4");
00126   if (str.find("IWS")!=std::string::npos) detId=DetectorId::FromString("IWS");
00127   if (str.find("OWS")!=std::string::npos) detId=DetectorId::FromString("OWS");
00128   if (str.find("RPC")!=std::string::npos) detId=DetectorId::FromString("RPC");
00129   
00130   return DayaBay::Detector(site,detId).siteDetPackedData();
00131 }

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

Is this an AD?

Definition at line 71 of file Detectors.h.

00071 { return DetectorId::isAD(this->detectorId()); }

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

Is this a Water Shield (Inner or Outer)?

Definition at line 74 of file Detectors.h.

00074 { return DetectorId::isWaterShield(this->detectorId()); }

bool DayaBay::Detector::bogus (  )  const [virtual, inherited]

Returns true if the combination of site & detector are not consistent (does not include 'unknown' parts).

Subclasses may override to include more detailed bogosity checks.

Reimplemented in DayaBay::DetectorSensor, DayaBay::AdPmtSensor, DayaBay::PoolPmtSensor, and DayaBay::RpcSensor.

Definition at line 89 of file Detectors.cc.

00090 {
00091     Site::Site_t site = this->site();
00092     DetectorId::DetectorId_t det = this->detectorId();
00093 
00094     return 
00095         // Only far site has AD #3 and #4
00096         ((site != Site::kFar)
00097          &&
00098          (det == DetectorId::kAD3 || det == DetectorId::kAD4))
00099         ||
00100         // Only near & far sites have known detectors
00101         ((site == Site::kMid || site == Site::kAberdeen)
00102          &&
00103          (det != DetectorId::kUnknown))
00104         ;
00105 }

bool DayaBay::Detector::operator== ( const Detector rhs  )  const [inline, inherited]

Definition at line 81 of file Detectors.h.

00081 { return this->m_data == rhs.m_data; }

bool DayaBay::Detector::operator!= ( const Detector rhs  )  const [inline, inherited]

Definition at line 82 of file Detectors.h.

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


Member Data Documentation

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

Definition at line 85 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 Mon Apr 11 20:14:49 2011 for Conventions by doxygen 1.4.7