#include <Calibration.h>
Inheritance diagram for DayaBay::CalibSourceId:
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 () |
CalibSourceId & | operator= (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)? | |
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 |
Definition at line 74 of file Calibration.h.
DayaBay::CalibSourceId::CalibSourceId | ( | ) | [inline] |
DayaBay::CalibSourceId::CalibSourceId | ( | Calibration::SourceType::SourceType_t | type, | |
Calibration::Location::Location_t | location, | |||
Site::Site_t | site, | |||
DetectorId::DetectorId_t | det | |||
) |
DayaBay::CalibSourceId::CalibSourceId | ( | const std::string & | name | ) |
Definition at line 76 of file Calibration.cc.
00077 { 00078 short int siteDetId = DayaBay::Detector::siteDetPackedFromString(name); 00079 Location::Location_t location = Location::kUnknown; 00080 SourceType::SourceType_t type = SourceType::kUnknown; 00081 00082 // Find location 00083 for(int id=0; id<kLocationNames; id++){ 00084 if( name.find(locationNames[id]) != std::string::npos ) 00085 location=Location::FromString(locationNames[id]); 00086 } 00087 // Find Source Type 00088 for(int id=0; id<kSourceNames; id++){ 00089 if( name.find(sourceNames[id]) != std::string::npos ) 00090 type=SourceType::FromString(sourceNames[id]); 00091 } 00092 m_data = (siteDetId << 16) | (0x000000ff & location)<<8 | (0x000000ff & type); 00093 }
DayaBay::CalibSourceId::CalibSourceId | ( | const CalibSourceId & | source | ) | [inline] |
DayaBay::CalibSourceId::CalibSourceId | ( | int | data | ) | [inline] |
DayaBay::CalibSourceId::~CalibSourceId | ( | ) | [virtual] |
CalibSourceId& DayaBay::CalibSourceId::operator= | ( | const CalibSourceId & | id | ) | [inline] |
SourceType::SourceType_t DayaBay::CalibSourceId::type | ( | ) | const |
Definition at line 98 of file Calibration.cc.
00099 { 00100 return SourceType::SourceType_t(m_data & 0x000000ff); 00101 }
Location::Location_t DayaBay::CalibSourceId::location | ( | ) | const |
Definition at line 103 of file Calibration.cc.
00104 { 00105 return Location::Location_t((m_data & 0x0000ff00)>>8); 00106 }
bool DayaBay::CalibSourceId::isWallMounted | ( | ) | const |
Definition at line 108 of file Calibration.cc.
00109 { 00110 return (location() == Location::kAdWallUpper 00111 || location() == Location::kAdWallCenter 00112 || location() == Location::kAdWallLower); 00113 }
string DayaBay::CalibSourceId::name | ( | ) | const |
Definition at line 115 of file Calibration.cc.
00116 { 00117 ostringstream name; 00118 name << this->detName() 00119 << "_" << Location::AsString(this->location()) 00120 << "_" << SourceType::AsString(this->type()); 00121 return name.str(); 00122 }
double DayaBay::CalibSourceId::nominalX | ( | ) | const |
Definition at line 124 of file Calibration.cc.
00125 { 00126 // Nominal calibration source X position 00127 switch (this->location()) { 00128 case Location::kAcuA_Center: 00129 return AD_AxisA_r * cos( AD_AxisA_phi ); 00130 case Location::kAcuB_GdlsEdge: 00131 return AD_AxisB_r * cos( AD_AxisB_phi ); 00132 case Location::kAcuC_GammaCatcher: 00133 return AD_AxisC_r * cos( AD_AxisC_phi ); 00134 case Location::kAdWallUpper: 00135 case Location::kAdWallCenter: 00136 case Location::kAdWallLower: 00137 return AD_Wall_r * cos( AD_Wall_phi ); 00138 default: 00139 return 0.0; 00140 } 00141 }
double DayaBay::CalibSourceId::nominalY | ( | ) | const |
Definition at line 143 of file Calibration.cc.
00144 { 00145 // Nominal calibration source Y position 00146 switch (this->location()) { 00147 case Location::kAcuA_Center: 00148 return AD_AxisA_r * sin( AD_AxisA_phi ); 00149 case Location::kAcuB_GdlsEdge: 00150 return AD_AxisB_r * sin( AD_AxisB_phi ); 00151 case Location::kAcuC_GammaCatcher: 00152 return AD_AxisC_r * sin( AD_AxisC_phi ); 00153 case Location::kAdWallUpper: 00154 case Location::kAdWallCenter: 00155 case Location::kAdWallLower: 00156 return AD_Wall_r * sin( AD_Wall_phi ); 00157 default: 00158 return 0.0; 00159 } 00160 }
double DayaBay::CalibSourceId::nominalZ | ( | ) | const |
Definition at line 162 of file Calibration.cc.
00163 { 00164 // Nominal calibration source Z position 00165 switch (this->location()) { 00166 case Location::kAdWallUpper: 00167 return AD_WallUpper_z; 00168 case Location::kAdWallCenter: 00169 return AD_WallCenter_z; 00170 case Location::kAdWallLower: 00171 return AD_WallLower_z; 00172 default: 00173 return 0.0; 00174 } 00175 }
void DayaBay::Detector::set | ( | Site::Site_t | site, | |
DetectorId::DetectorId_t | det | |||
) | [inherited] |
std::string DayaBay::Detector::asString | ( | ) | const [inherited] |
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] |
bool DayaBay::Detector::operator!= | ( | const Detector & | rhs | ) | const [inline, inherited] |
unsigned int DayaBay::Detector::m_data [protected, inherited] |
Definition at line 85 of file Detectors.h.