Namespaces | |
namespace | __init__ |
namespace | CalibAlgEx |
Functions | |
CalibAlg (const std::string &name, ISvcLocator *pSvcLocator) | |
~CalibAlg () | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
CalibAlg::CalibAlg | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 9 of file CalibAlg.cc.
00010 : DybAlgorithm<DayaBay::CalibReadoutHeader>(name,pSvcLocator) 00011 , m_calibRpcTool(0) 00012 , m_calibPmtTool(0) 00013 { 00014 declareProperty("ReadoutLocation", 00015 m_roLocation=DayaBay::ReadoutHeaderLocation::Default, 00016 "ReadoutHeader location in the TES."); 00017 00018 declareProperty("CalibReadoutLocation", 00019 m_calibRoLocation=DayaBay::CalibReadoutHeaderLocation::Default, 00020 "CalibHeader location in the TES."); 00021 00022 declareProperty("RpcCalibTool", m_calibRpcToolName="SimpRpcCalibTool", 00023 "Tool to calibrate RPC readouts"); 00024 00025 declareProperty("PmtCalibTool", m_calibPmtToolName="SimpPmtCalibTool", 00026 "Tool to calibrate PMT readouts"); 00027 }
CalibAlg::~CalibAlg | ( | ) |
StatusCode CalibAlg::initialize | ( | ) |
Definition at line 33 of file CalibAlg.cc.
00034 { 00035 // Get RPC calibration Tool 00036 try { 00037 m_calibRpcTool = tool<ICalibTool>(m_calibRpcToolName); 00038 } 00039 catch(const GaudiException& exg) { 00040 fatal() << "Failed to get Calib Tool: \"" << m_calibRpcToolName << "\"" << endreq; 00041 return StatusCode::FAILURE; 00042 } 00043 info () << "Added calib tool " << m_calibRpcToolName << endreq; 00044 00045 try { 00046 m_calibPmtTool = tool<ICalibTool>(m_calibPmtToolName); 00047 } 00048 catch(const GaudiException& exg) { 00049 fatal() << "Failed to get Calib Tool: \"" << m_calibPmtToolName << "\"" << endreq; 00050 return StatusCode::FAILURE; 00051 } 00052 info () << "Added calib tool " << m_calibPmtToolName << endreq; 00053 00054 return StatusCode::SUCCESS; 00055 }
StatusCode CalibAlg::execute | ( | ) |
Definition at line 57 of file CalibAlg.cc.
00058 { 00059 StatusCode sc; 00060 00061 // Create output calib header 00062 DayaBay::CalibReadoutHeader* calibHeader = MakeHeaderObject(); 00063 00064 // Get ReadoutHeader 00065 DayaBay::ReadoutHeader* roHeader 00066 = getTES<DayaBay::ReadoutHeader>(m_roLocation); 00067 if(!roHeader) { 00068 error() << "Get no ReadoutHeader from TES!!" << endreq; 00069 return StatusCode::FAILURE; 00070 } 00071 00072 Context context = roHeader->context(); 00073 calibHeader->setContext(context); 00074 calibHeader->setEarliest(roHeader->earliest()); 00075 calibHeader->setLatest(roHeader->latest()); 00076 00077 // Get Readout 00078 const DayaBay::DaqCrate* readout = roHeader->daqCrate(); 00079 if(!readout){ 00080 info() << "No Readouts retrieved this cycle." << endreq; 00081 calibHeader->setCalibReadout(0); 00082 return StatusCode::SUCCESS; 00083 } 00084 00085 const DayaBay::Detector& detector = readout->detector(); 00086 unsigned int eventNumber = readout->eventNumber(); 00087 const TimeStamp& triggerTime = readout->triggerTime(); 00088 const DayaBay::Trigger::TriggerType_t& triggerType = readout->triggerType(); 00089 00090 debug() << "detector " << detector << endreq; 00091 debug() << "eventNumber " << eventNumber << endreq; 00092 debug() << "triggerTime " << triggerTime << endreq; 00093 debug() << "triggerType " << triggerType << endreq; 00094 00095 if(detector.isAD() || detector.isWaterShield()){ 00096 // Pmt based detectors calibration 00097 debug() << "create CalibReadoutPmtCrate " << endreq; 00098 DayaBay::CalibReadoutPmtCrate* calibReadout = 00099 new DayaBay::CalibReadoutPmtCrate(detector, eventNumber, 00100 triggerTime, triggerType); 00101 calibHeader->setCalibReadout(calibReadout); 00102 calibReadout->setHeader(calibHeader); 00103 debug() << "start calibration readout " << endreq; 00104 sc = m_calibPmtTool->calibration(readout, calibReadout); 00105 debug() << "finish calibration readout " << endreq; 00106 00107 }else if(detector.detectorId() == DetectorId::kRPC){ 00108 // RPC Based detectors Calibration 00109 DayaBay::CalibReadoutRpcCrate* calibReadout = 00110 new DayaBay::CalibReadoutRpcCrate(detector,eventNumber, 00111 triggerTime, triggerType); 00112 calibHeader->setCalibReadout(calibReadout); 00113 calibReadout->setHeader(calibHeader); 00114 sc = m_calibRpcTool->calibration(readout, calibReadout); 00115 00116 }else { 00117 error() << "Unknown detector " << detector << endreq; 00118 return StatusCode::FAILURE; 00119 } 00120 00121 return StatusCode::SUCCESS; 00122 }
StatusCode CalibAlg::finalize | ( | ) |
Definition at line 124 of file CalibAlg.cc.
00125 { 00126 return this->GaudiAlgorithm::finalize(); 00127 }