/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
DayaBay::CalibSourceId Class Reference

#include <Calibration.h>

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

List of all members.

Public Member Functions

 CalibSourceId ()
 CalibSourceId (Calibration::SourceType::SourceType_t type, Calibration::Location::Location_t location, Site::Site_t site, DetectorId::DetectorId_t det)
 CalibSourceId (const std::string &name)
 CalibSourceId (const CalibSourceId &source)
 CalibSourceId (int data)
virtual ~CalibSourceId ()
CalibSourceIdoperator= (const CalibSourceId &id)
Calibration::SourceType::SourceType_t type () const
Calibration::Location::Location_t location () const
bool isWallMounted () const
std::string name () const
double nominalX () const
double nominalY () const
double nominalZ () 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)?
bool isRPC () const
 Is this an RPC?
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 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

Detailed Description

Definition at line 88 of file Calibration.h.


Constructor & Destructor Documentation

DayaBay::CalibSourceId::CalibSourceId ( ) [inline]

Definition at line 90 of file Calibration.h.

: Detector(0) {}
DayaBay::CalibSourceId::CalibSourceId ( Calibration::SourceType::SourceType_t  type,
Calibration::Location::Location_t  location,
Site::Site_t  site,
DetectorId::DetectorId_t  det 
)

Definition at line 67 of file Calibration.cc.

  : Detector(site,det)
{
  m_data += (0x000000ff & type) | (0x000000ff & location)<<8;
}
DayaBay::CalibSourceId::CalibSourceId ( const std::string &  name)

Definition at line 76 of file Calibration.cc.

{
  short int siteDetId = DayaBay::Detector::siteDetPackedFromString(name); 
  Location::Location_t location = Location::kUnknown;
  SourceType::SourceType_t type = SourceType::kUnknown;
  
  // Find location
  for(int id=0; id<kLocationNames; id++){
    if( name.find(locationNames[id]) != std::string::npos ) 
      location=Location::FromString(locationNames[id]);
  }
  // Find Source Type
  for(int id=0; id<kSourceNames; id++){
    if( name.find(sourceNames[id]) != std::string::npos ) 
      type=SourceType::FromString(sourceNames[id]);
  }
  m_data = (siteDetId << 16) | (0x000000ff & location)<<8 | (0x000000ff & type);
}
DayaBay::CalibSourceId::CalibSourceId ( const CalibSourceId source) [inline]

Definition at line 96 of file Calibration.h.

: Detector(source) {}
DayaBay::CalibSourceId::CalibSourceId ( int  data) [inline]

Definition at line 97 of file Calibration.h.

: Detector(data) {}
DayaBay::CalibSourceId::~CalibSourceId ( ) [virtual]

Definition at line 95 of file Calibration.cc.

{}

Member Function Documentation

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

Definition at line 100 of file Calibration.h.

      { m_data = id.m_data; return *this; }
SourceType::SourceType_t DayaBay::CalibSourceId::type ( ) const

Definition at line 98 of file Calibration.cc.

{
  return SourceType::SourceType_t(m_data & 0x000000ff);
}
Location::Location_t DayaBay::CalibSourceId::location ( ) const

Definition at line 103 of file Calibration.cc.

{
  return Location::Location_t((m_data & 0x0000ff00)>>8);
}
bool DayaBay::CalibSourceId::isWallMounted ( ) const

Definition at line 108 of file Calibration.cc.

string DayaBay::CalibSourceId::name ( ) const

Definition at line 115 of file Calibration.cc.

{
  ostringstream name;
  name << this->detName()
       << "_" << Location::AsString(this->location())
       << "_" << SourceType::AsString(this->type());
  return name.str();
}
double DayaBay::CalibSourceId::nominalX ( ) const

Definition at line 124 of file Calibration.cc.

{
  // Nominal calibration source X position
  switch (this->location()) {
  case Location::kAcuA_Center:
    return AD_AxisA_r * cos( AD_AxisA_phi );
  case Location::kAcuB_GdlsEdge:
    return AD_AxisB_r * cos( AD_AxisB_phi );
  case Location::kAcuC_GammaCatcher:
    return AD_AxisC_r * cos( AD_AxisC_phi );
  case Location::kAdWallUpper:
  case Location::kAdWallCenter:
  case Location::kAdWallLower:
    return AD_Wall_r * cos( AD_Wall_phi );
  default:
    return 0.0;
  }
}
double DayaBay::CalibSourceId::nominalY ( ) const

Definition at line 143 of file Calibration.cc.

{
  // Nominal calibration source Y position
  switch (this->location()) {
  case Location::kAcuA_Center:
    return AD_AxisA_r * sin( AD_AxisA_phi );
  case Location::kAcuB_GdlsEdge:
    return AD_AxisB_r * sin( AD_AxisB_phi );
  case Location::kAcuC_GammaCatcher:
    return AD_AxisC_r * sin( AD_AxisC_phi );
  case Location::kAdWallUpper:
  case Location::kAdWallCenter:
  case Location::kAdWallLower:
    return AD_Wall_r * sin( AD_Wall_phi );
  default:
    return 0.0;
  }
}
double DayaBay::CalibSourceId::nominalZ ( ) const

Definition at line 162 of file Calibration.cc.

{
  // Nominal calibration source Z position
  switch (this->location()) {
  case Location::kAdWallUpper:
    return AD_WallUpper_z;
  case Location::kAdWallCenter:
    return AD_WallCenter_z;
  case Location::kAdWallLower:
    return AD_WallLower_z;
  default:
    return 0.0;
  }
}
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::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::AdFadcSensor, DayaBay::PoolPmtSensor, DayaBay::RpcSensor, DayaBay::ElecChannelId, DayaBay::FeeChannelId, DayaBay::FadcChannelId, DayaBay::FecChannelId, and DayaBay::HvChannelId.

Definition at line 106 of file Detectors.cc.

{
    Site::Site_t site = this->site();
    DetectorId::DetectorId_t det = this->detectorId();

    if ( (Site::kAll & site) && (det > DetectorId::kUnknown && det <= DetectorId::kAll) ) return false;
    return true;
}
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:19 for Conventions by doxygen 1.7.4