#ifdef USE_CDFEDM2 ////////////////////////////////////////////////////////////////////////// // // Component: CalibL1.cc // Purpose: This class contains the calorimetry ADMEM calibration // constants. // Usage: 1) bool initializeDB() initializes DB -- at begin run // 2) bool loadCalibConsts() loads constants -- at begin run // Author: W.K. Sakumoto 20Jan2004 // ////////////////////////////////////////////////////////////////////////// #include "CalorObjects/CalibL1.hh" #include "ErrorLogger_i/gERRLOG.hh" CalibL1::CalibL1(): _calibCem(0.0), _calibCha(0.0), _calibWha(0.0), _calibPem(0.0), _calibPha(0.0), _pedCem(50), _pedCha(50), _pedWha(50), _pedPem(50), _pedPha(50) { } CalibL1::~CalibL1() { } bool CalibL1::initializeDB() { // Connect to the required calibration tables via the DB manager. // If any calibration table is not found, return false (initOK = false). bool initOK( true ); // Calibration: ADMEM ADC->GeV and pedestals. The default key setup // by the Calibration manager is used calDB_mgr = CALDigiToGeV3_mgr("CALDigiToGeV3"); pedDB_mgr = CALL1Peds3_mgr("CALL1Peds3"); Result rccal( Result::failure ); Result rcped( Result::failure ); if( calDB_mgr.isValid() ) rccal = calDB_mgr.get(calDB_data); if( pedDB_mgr.isValid() ) rcped = pedDB_mgr.get(pedDB_data); // Check if DB connnection worked if ( rccal != Result::success || rcped != Result::success ) { ERRLOG(ELwarning,"calor::CalibL1: SCL error ") << calDB_mgr.lastResult(); ERRLOG(ELwarning,"calor::CalibL1: PED error ") << pedDB_mgr.lastResult(); initOK = false; } return initOK; } bool CalibL1::loadCalibConsts( ) { if(calDB_data->size() == 0) return false; if(pedDB_data->size() == 0) return false; _calibCem = (calDB_data->at(CalorComponent::CEM)).calib(); _calibCha = (calDB_data->at(CalorComponent::CHA)).calib(); _calibWha = (calDB_data->at(CalorComponent::WHA)).calib(); _calibPem = (calDB_data->at(CalorComponent::PEM)).calib(); _calibPha = (calDB_data->at(CalorComponent::PHA)).calib(); _pedCem = (pedDB_data->at(CalorComponent::CEM)).ped(); _pedCha = (pedDB_data->at(CalorComponent::CHA)).ped(); _pedWha = (pedDB_data->at(CalorComponent::WHA)).ped(); _pedPem = (pedDB_data->at(CalorComponent::PEM)).ped(); _pedPha = (pedDB_data->at(CalorComponent::PHA)).ped(); ERRLOG(ELinfo,"calor::CalibL1: ") << "Calor ADMEM calibrations loaded" << endmsg; return true; } // // Printing // void CalibL1::print(std::ostream& os) const{ os << *this;} std::ostream& operator<<(std::ostream& os, const CalibL1& calib) { os << "Calorimeter ADMEM SCLs: " << std::endl; os << " CEM = " << calib._calibCem << std::endl; os << " CHA = " << calib._calibCha << std::endl; os << " WHA = " << calib._calibWha << std::endl; os << " PEM = " << calib._calibPem << std::endl; os << " PHA = " << calib._calibPha << std::endl; os << " " << std::endl; os << "Calorimeter ADMEM PEDs: " << std::endl; os << " CEM = " << calib._pedCem << std::endl; os << " CHA = " << calib._pedCha << std::endl; os << " WHA = " << calib._pedWha << std::endl; os << " PEM = " << calib._pedPem << std::endl; os << " PHA = " << calib._pedPha << std::endl; return os; } #endif // USE_CDFEDM2