#include <StaticCalibDataSvc.h>
Inheritance diagram for StaticCalibDataSvc:
Definition at line 29 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::Detector, std::vector<DayaBay::PmtCalibData> > StaticCalibDataSvc::PmtData [private] |
Definition at line 83 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::Detector, std::vector<DayaBay::RpcCalibData> > StaticCalibDataSvc::RpcData [private] |
Definition at line 84 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::Detector, std::vector<DayaBay::FeeCalibData> > StaticCalibDataSvc::FeeData [private] |
Definition at line 85 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::Detector, std::vector<DayaBay::FecCalibData> > StaticCalibDataSvc::FecData [private] |
Definition at line 86 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData> StaticCalibDataSvc::PmtDataBySensor [private] |
Definition at line 89 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::RpcSensor, DayaBay::RpcCalibData> StaticCalibDataSvc::RpcDataBySensor [private] |
Definition at line 90 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData> StaticCalibDataSvc::FeeDataByChannel [private] |
Definition at line 93 of file StaticCalibDataSvc.h.
typedef std::map<DayaBay::FecChannelId, DayaBay::FecCalibData> StaticCalibDataSvc::FecDataByChannel [private] |
Definition at line 94 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, PmtData > StaticCalibDataSvc::PmtDataMap [private] |
Definition at line 98 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, RpcData > StaticCalibDataSvc::RpcDataMap [private] |
Definition at line 99 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, FeeData > StaticCalibDataSvc::FeeDataMap [private] |
Definition at line 100 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, FecData > StaticCalibDataSvc::FecDataMap [private] |
Definition at line 101 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, PmtDataBySensor > StaticCalibDataSvc::PmtDataBySensorMap [private] |
Definition at line 103 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, RpcDataBySensor > StaticCalibDataSvc::RpcDataBySensorMap [private] |
Definition at line 104 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, FeeDataByChannel > StaticCalibDataSvc::FeeDataByChannelMap [private] |
Definition at line 106 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, FecDataByChannel > StaticCalibDataSvc::FecDataByChannelMap [private] |
Definition at line 107 of file StaticCalibDataSvc.h.
typedef std::map< ContextRange, std::string > StaticCalibDataSvc::FileNameList [private] |
Definition at line 157 of file StaticCalibDataSvc.h.
StaticCalibDataSvc::StaticCalibDataSvc | ( | const std::string & | name, | |
ISvcLocator * | svc | |||
) |
Definition at line 12 of file StaticCalibDataSvc.cc.
00013 : Service(name,svc) 00014 { 00015 // User specified file. If not present, load the default ones from Master.CalibMap.txt 00016 declareProperty("PmtDataFile",m_pmtDataFileName="", 00017 "Filename for loading pmt simulation input data"); 00018 declareProperty("RpcDataFile",m_rpcDataFileName="", 00019 "Filename for loading rpc simulation input data"); 00020 declareProperty("FeeDataFile",m_feeDataFileName="", 00021 "Filename for loading FEE simulation input data"); 00022 declareProperty("FecDataFile",m_fecDataFileName="", 00023 "Filename for loading FEC simulation input data"); 00024 00025 m_masterPmtDataFileName = "Master.pmtCalibMap.txt"; 00026 m_masterFeeDataFileName = "Master.feeCalibMap.txt"; 00027 00028 m_pmtDataMap.clear(); 00029 m_rpcDataMap.clear(); 00030 m_feeDataMap.clear(); 00031 m_fecDataMap.clear(); 00032 00033 m_pmtDataBySensorMap.clear(); 00034 m_rpcDataBySensorMap.clear(); 00035 00036 m_feeDataByChannelMap.clear(); 00037 m_fecDataByChannelMap.clear(); 00038 }
StaticCalibDataSvc::~StaticCalibDataSvc | ( | ) |
StatusCode StaticCalibDataSvc::initialize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 44 of file StaticCalibDataSvc.cc.
00045 { 00046 this->Service::initialize(); 00047 00048 IMessageSvc* msg = msgSvc(); 00049 if( !msg ){ 00050 return StatusCode::FAILURE; 00051 } 00052 MsgStream log(msg,"StaticCalibSvc"); 00053 00054 // --------------- Here is a separator ------------------------------- 00056 if(m_pmtDataFileName!="") { 00057 msg->reportMessage( "StaticCalibSvc", MSG::INFO, ("Loading " + m_pmtDataFileName).c_str() ); 00058 readPmtDataFile( m_pmtDataFileName, 00059 m_pmtDataUser, 00060 m_pmtDataBySensorUser ); 00061 } 00062 00063 if(m_feeDataFileName!=""){ 00064 msg->reportMessage( "StaticCalibSvc", MSG::INFO, ("Loading " + m_feeDataFileName).c_str() ); 00065 readFeeDataFile( m_feeDataFileName, 00066 m_feeDataUser, 00067 m_feeDataByChannelUser ); 00068 } 00069 00070 if(m_rpcDataFileName!=""){ 00071 // FIXME: Add RPC data file 00072 std::ostringstream msgStr; 00073 msgStr << "RPC calibration data file not yet implemented!"; 00074 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00075 return StatusCode::FAILURE; 00076 } 00077 00078 if(m_fecDataFileName!=""){ 00079 // FIXME: Add FEC data file 00080 std::ostringstream msgStr; 00081 msgStr << "FEC calibration data file not yet implemented!"; 00082 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00083 return StatusCode::FAILURE; 00084 } 00085 00086 // --------------- Here is a separator ------------------------------- 00087 FileNameList::iterator it, itend; 00088 00090 msg->reportMessage( "StaticCalibSvc", MSG::INFO, ("Loading " + m_masterPmtDataFileName).c_str() ); 00091 FileNameList PmtDataFileList; 00092 readMasterFile( m_masterPmtDataFileName, PmtDataFileList ); 00093 00094 itend = PmtDataFileList.end(); 00095 for( it=PmtDataFileList.begin(); it!=itend; it++ ) { 00096 PmtData aPmtData; 00097 PmtDataBySensor aPmtDataBySensor; 00098 readPmtDataFile( it->second, // file name 00099 aPmtData, 00100 aPmtDataBySensor ); 00101 00102 m_pmtDataMap[ it->first ] = aPmtData; 00103 m_pmtDataBySensorMap[ it->first ] = aPmtDataBySensor; 00104 } 00105 00106 // use the first one to start 00107 m_currentPmtContextRange = PmtDataFileList.begin()->first; 00108 m_currentPmtData = &(m_pmtDataMap.begin()->second); 00109 m_currentPmtDataBySensor = &(m_pmtDataBySensorMap.begin()->second); 00110 00112 msg->reportMessage( "StaticCalibSvc", MSG::INFO, ("Loading " + m_masterFeeDataFileName).c_str() ); 00113 FileNameList FeeDataFileList; 00114 readMasterFile( m_masterFeeDataFileName, FeeDataFileList ); 00115 00116 itend = FeeDataFileList.end(); 00117 for( it=FeeDataFileList.begin(); it!=itend; it++ ) { 00118 FeeData aFeeData; 00119 FeeDataByChannel aFeeDataByChannel; 00120 readFeeDataFile( it->second, // file name 00121 aFeeData, 00122 aFeeDataByChannel ); 00123 00124 m_feeDataMap[ it->first ] = aFeeData; 00125 m_feeDataByChannelMap[ it->first ] = aFeeDataByChannel; 00126 } 00127 00128 // use the first one to start 00129 m_currentFeeContextRange = FeeDataFileList.begin()->first; 00130 m_currentFeeData = &(m_feeDataMap.begin()->second); 00131 m_currentFeeDataByChannel = &(m_feeDataByChannelMap.begin()->second); 00132 00137 00138 return StatusCode::SUCCESS; 00139 }
StatusCode StaticCalibDataSvc::finalize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 141 of file StaticCalibDataSvc.cc.
00142 { 00143 return this->Service::finalize(); 00144 }
StatusCode StaticCalibDataSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvInterface | |||
) | [virtual] |
Reimplemented from Service.
Definition at line 146 of file StaticCalibDataSvc.cc.
00148 { 00149 StatusCode sc = StatusCode::FAILURE; 00150 if (ppvInterface) { 00151 *ppvInterface = 0; 00152 00153 if (ICalibDataSvc::interfaceID().versionMatch(riid)) { 00154 *ppvInterface = static_cast<ICalibDataSvc*>(this); 00155 sc = StatusCode::SUCCESS; 00156 addRef(); 00157 } 00158 else sc = Service::queryInterface( riid, ppvInterface ); 00159 } 00160 return sc; 00161 }
const DayaBay::PmtCalibData * StaticCalibDataSvc::pmtCalibData | ( | const DayaBay::DetectorSensor & | pmtId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
For every query request, firstly check whether user supplied any file.
If they do, then use the user specified one. If not, check whether it can be found in Master map list. Secondly, compare the requested data's context with current context range, If compatible, then return. If not, find the right one with ContextRange indexed map until the end.
Search though whole map. The slowest process only happen a few times;
update m_currentPmtData simultaneously
error
error
Implements ICalibDataSvc.
Definition at line 173 of file StaticCalibDataSvc.cc.
00176 { 00177 /* 00178 cout<<svcMode.context()<<endl; 00179 cout<<m_currentPmtContextRange.GetTimeStart().AsString()<<endl; 00180 cout<<m_currentPmtContextRange.GetTimeEnd().AsString()<<endl; 00181 */ 00182 PmtDataBySensor* pPmtDataBySensor = 0; 00183 00184 if (m_pmtDataFileName.size() != 0) { 00185 pPmtDataBySensor = &m_pmtDataBySensorUser; 00186 } else { 00187 const Context &cont = svcMode.context(); 00188 if ( m_currentPmtContextRange.IsCompatible( cont ) ) { 00189 pPmtDataBySensor = m_currentPmtDataBySensor; 00190 } else { 00193 PmtDataBySensorMap::iterator it, itend=m_pmtDataBySensorMap.end(); 00194 for( it = m_pmtDataBySensorMap.begin(); it!=itend; it++ ) { 00195 if( it->first.IsCompatible( cont ) ) { 00196 m_currentPmtContextRange = it->first; 00197 m_currentPmtDataBySensor = &(it->second); 00198 pPmtDataBySensor = m_currentPmtDataBySensor; 00200 m_currentPmtData = &(m_pmtDataMap[m_currentPmtContextRange]); 00201 break; 00202 } 00203 } 00204 } 00205 } 00206 00207 if( pPmtDataBySensor!=0 ) { 00208 std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData>::iterator result = 00209 pPmtDataBySensor->find(pmtId); 00210 if(result != pPmtDataBySensor->end()){ 00211 return &(result->second); 00212 } 00214 return 0; 00215 } 00216 00218 return 0; 00219 }
const DayaBay::RpcCalibData * StaticCalibDataSvc::rpcCalibData | ( | const DayaBay::RpcSensor & | rpcId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
Implements ICalibDataSvc.
Definition at line 221 of file StaticCalibDataSvc.cc.
00224 { 00225 std::map<DayaBay::RpcSensor, DayaBay::RpcCalibData>::iterator result = 00226 m_rpcDataBySensorUser.find(rpcId); 00227 if(result != m_rpcDataBySensorUser.end()){ 00228 return &(result->second); 00229 } 00230 return 0; 00231 }
const DayaBay::FeeCalibData * StaticCalibDataSvc::feeCalibData | ( | const DayaBay::FeeChannelId & | channelId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
Implements ICalibDataSvc.
Definition at line 233 of file StaticCalibDataSvc.cc.
00236 { 00237 FeeDataByChannel * pFeeDataByChannel = 0; 00238 00239 if (m_feeDataFileName.size() != 0) { 00240 pFeeDataByChannel = &m_feeDataByChannelUser; 00241 } else { 00242 const Context &cont = svcMode.context(); 00243 if ( m_currentFeeContextRange.IsCompatible( cont ) ) { 00244 pFeeDataByChannel = m_currentFeeDataByChannel; 00245 } else { 00248 FeeDataByChannelMap::iterator it, itend=m_feeDataByChannelMap.end(); 00249 for( it = m_feeDataByChannelMap.begin(); it!=itend; it++ ) { 00250 if( it->first.IsCompatible( cont ) ) { 00251 m_currentFeeContextRange = it->first; 00252 m_currentFeeDataByChannel = &(it->second); 00253 pFeeDataByChannel = m_currentFeeDataByChannel; 00255 m_currentFeeData = &(m_feeDataMap[m_currentFeeContextRange]); 00256 break; 00257 } 00258 } 00259 } 00260 } 00261 00262 if( pFeeDataByChannel!=0 ) { 00263 std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData>::iterator result = 00264 pFeeDataByChannel->find(channelId); 00265 if(result != pFeeDataByChannel->end()){ 00266 return &(result->second); 00267 } 00269 return 0; 00270 } 00271 00273 return 0; 00274 }
const DayaBay::FecCalibData * StaticCalibDataSvc::fecCalibData | ( | const DayaBay::FecChannelId & | channelId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
Implements ICalibDataSvc.
Definition at line 276 of file StaticCalibDataSvc.cc.
00279 { 00280 std::map<DayaBay::FecChannelId, DayaBay::FecCalibData>::iterator result = 00281 m_fecDataByChannelUser.find(channelId); 00282 if(result != m_fecDataByChannelUser.end()){ 00283 return &(result->second); 00284 } 00285 return 0; 00286 }
const std::vector< DayaBay::PmtCalibData > & StaticCalibDataSvc::pmtCalibList | ( | const DayaBay::Detector & | detectorId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
Implements ICalibDataSvc.
Definition at line 288 of file StaticCalibDataSvc.cc.
00291 { 00292 PmtData* pPmtData = 0; 00293 00294 if (m_pmtDataFileName.size() != 0) { 00295 pPmtData = &m_pmtDataUser; 00296 } else { 00297 const Context &cont = svcMode.context(); 00298 if ( m_currentPmtContextRange.IsCompatible( cont ) ) { 00299 pPmtData = m_currentPmtData; 00300 } else { 00303 PmtDataMap::iterator it, itend=m_pmtDataMap.end(); 00304 for( it = m_pmtDataMap.begin(); it!=itend; it++ ) { 00305 if( it->first.IsCompatible( cont ) ) { 00306 m_currentPmtContextRange = it->first; 00307 m_currentPmtData = &(it->second); 00308 pPmtData = m_currentPmtData; 00310 m_currentPmtDataBySensor = &(m_pmtDataBySensorMap[m_currentPmtContextRange]); 00311 break; 00312 } 00313 } 00314 } 00315 } 00316 00317 if( pPmtData!=0 ) { 00318 return (*pPmtData)[detectorId]; 00319 } 00320 00322 cout<<"No available PmtCalibData found"<<endl; 00323 cout<<"No CalibData file specified, or wrong time range in Master.pmtCalibMap.txt, or no such data file at all"<<endl; 00324 abort(); 00325 }
const std::vector< DayaBay::RpcCalibData > & StaticCalibDataSvc::rpcCalibList | ( | const DayaBay::Detector & | detectorId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
Implements ICalibDataSvc.
Definition at line 327 of file StaticCalibDataSvc.cc.
00330 { 00331 return m_rpcDataUser[detectorId]; 00332 }
const std::vector< DayaBay::FeeCalibData > & StaticCalibDataSvc::feeCalibList | ( | const DayaBay::Detector & | detectorId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
Implements ICalibDataSvc.
Definition at line 334 of file StaticCalibDataSvc.cc.
00337 { 00338 FeeData * pFeeData = 0; 00339 00340 if (m_feeDataFileName.size() != 0) { 00341 pFeeData = &m_feeDataUser; 00342 } else { 00343 const Context &cont = svcMode.context(); 00344 if ( m_currentFeeContextRange.IsCompatible( cont ) ) { 00345 pFeeData = m_currentFeeData; 00346 } else { 00349 FeeDataMap::iterator it, itend=m_feeDataMap.end(); 00350 for( it = m_feeDataMap.begin(); it!=itend; it++ ) { 00351 if( it->first.IsCompatible( cont ) ) { 00352 m_currentFeeContextRange = it->first; 00353 m_currentFeeData = &(it->second); 00354 pFeeData = m_currentFeeData; 00356 m_currentFeeDataByChannel = &(m_feeDataByChannelMap[m_currentFeeContextRange]); 00357 break; 00358 } 00359 } 00360 } 00361 } 00362 00363 if( pFeeData!=0 ) { 00364 return (*pFeeData)[detectorId]; 00365 } 00366 00368 cout<<"No available FeeCalibData found"<<endl; 00369 cout<<"No CalibData file specified, or wrong time range in Master.feeCalibMap.txt, or no such data file at all"<<endl; 00370 abort(); 00371 }
const std::vector< DayaBay::FecCalibData > & StaticCalibDataSvc::fecCalibList | ( | const DayaBay::Detector & | detectorId, | |
const ServiceMode & | svcMode | |||
) | [virtual] |
Implements ICalibDataSvc.
Definition at line 373 of file StaticCalibDataSvc.cc.
00376 { 00377 return m_fecDataUser[detectorId]; 00378 }
StatusCode StaticCalibDataSvc::readMasterFile | ( | std::string | masterFileName, | |
FileNameList & | subFileNameList | |||
) | [private] |
Definition at line 502 of file StaticCalibDataSvc.cc.
00503 { 00504 IMessageSvc* msg = msgSvc(); 00505 if( !msg ){ 00506 return StatusCode::FAILURE; 00507 } 00508 MsgStream log(msg,"StaticCalibSvc"); 00509 00510 std::string Path = getenv ("DATASVCROOT"); 00511 std::ifstream masterFileStream( (Path+"/share/"+masterFileName).c_str() ); 00512 00513 if( !masterFileStream.is_open() ){ 00514 msg->reportMessage( "StaticCalibSvc", MSG::ERROR, ("Fail to open" + masterFileName).c_str() ); 00515 return StatusCode::FAILURE; 00516 } 00517 00518 int StartRun,EndRun; 00519 int Sites; 00520 int SimFlag, StartTimeSec, StartTimeNanoSec, EndTimeSec, EndTimeNanoSec; 00521 std::string MapFileName; 00522 00523 std::string line; 00524 00525 while( std::getline( masterFileStream, line ) ){ 00526 std::stringstream streamLine(line); 00527 if( streamLine.peek() == '#' ){ 00528 continue; 00529 } 00530 streamLine >>StartRun >>EndRun >>Sites 00531 >>SimFlag >>StartTimeSec>> StartTimeNanoSec >>EndTimeSec >>EndTimeNanoSec 00532 >>MapFileName; 00533 00534 ContextRange CRange( Sites, SimFlag, 00535 TimeStamp( StartTimeSec, StartTimeNanoSec ), 00536 TimeStamp( EndTimeSec, EndTimeNanoSec ) ); 00537 /* 00538 std::cout<<TimeStamp( StartTimeSec, StartTimeNanoSec ).AsString()<<std::endl; 00539 std::cout<<TimeStamp( EndTimeSec, EndTimeNanoSec ).AsString()<<std::endl; 00540 */ 00541 MapFileName = Path + "/share/" + MapFileName; 00542 subFileNameList[ CRange ] = MapFileName ; 00543 } 00544 00545 return StatusCode::SUCCESS; 00546 }
StatusCode StaticCalibDataSvc::readPmtDataFile | ( | std::string | pmtDataFileName, | |
PmtData & | pmtData, | |||
PmtDataBySensor & | pmtDataBySensor | |||
) | [private] |
Definition at line 382 of file StaticCalibDataSvc.cc.
00383 { 00384 IMessageSvc* msg = msgSvc(); 00385 if( !msg ){ 00386 return StatusCode::FAILURE; 00387 } 00388 MsgStream log(msg,"StaticCalibSvc"); 00389 00390 std::ifstream input( pmtDataFileName.c_str() ); 00391 std::ostringstream prtStr; 00392 prtStr<<"PmtCalibMap "<<pmtDataFileName; 00393 msg->reportMessage("StaticCalibDataSvc",MSG::DEBUG,prtStr.str()); 00394 if( !input.is_open() ){ 00395 std::ostringstream msgStr; 00396 msgStr << "Failed to open input file: " << pmtDataFileName; 00397 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00398 return StatusCode::FAILURE; 00399 } 00400 int sensorId; 00401 std::string description; 00402 int status; 00403 double speHigh, sigmaSpeHigh, speLow, timeOffset, timeSpread, efficiency; 00404 double prePulseProb, afterPulseProb, darkRate; 00405 std::string line; 00406 while( std::getline(input,line) ){ 00407 std::ostringstream msgStr; 00408 msgStr << "Got line: " << line; 00409 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00410 msgStr.str(""); 00411 std::stringstream streamLine(line); 00412 if( streamLine.peek() == '#' ){ 00413 continue; 00414 } 00415 streamLine >> sensorId >> description 00416 >> status >> speHigh >> sigmaSpeHigh >> speLow 00417 >> timeOffset >> timeSpread >> efficiency >> prePulseProb 00418 >> afterPulseProb >> darkRate; 00419 msgStr << "Adding PMT: " << description; 00420 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00421 00422 DayaBay::DetectorSensor pmtId(sensorId); 00423 DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() ); 00424 DayaBay::PmtCalibData pmt; 00425 pmt.m_pmtId = pmtId; 00426 pmt.m_status = (DayaBay::PmtCalibData::Status_t)status; 00427 pmt.m_speHigh = speHigh; 00428 pmt.m_sigmaSpeHigh = sigmaSpeHigh; 00429 pmt.m_speLow = speLow; 00430 pmt.m_timeOffset = timeOffset * Units::ns; 00431 pmt.m_timeSpread = timeSpread * Units::ns; 00432 pmt.m_efficiency = efficiency; 00433 pmt.m_prePulseProb = prePulseProb; 00434 pmt.m_afterPulseProb = afterPulseProb; 00435 pmt.m_darkRate = darkRate * Units::hertz; 00436 std::vector<DayaBay::PmtCalibData>& pmtList = pmtData[detector]; 00437 pmtList.push_back(pmt); 00438 // Add lookup by sensor ID 00439 pmtDataBySensor[pmtId] = pmtList[pmtList.size()-1]; 00440 } 00441 00442 return StatusCode::SUCCESS; 00443 00444 }
StatusCode StaticCalibDataSvc::readFeeDataFile | ( | std::string | feeDataFileName, | |
FeeData & | feeData, | |||
FeeDataByChannel & | feeDataByChannel | |||
) | [private] |
Definition at line 447 of file StaticCalibDataSvc.cc.
00448 { 00449 IMessageSvc* msg = msgSvc(); 00450 if( !msg ){ 00451 return StatusCode::FAILURE; 00452 } 00453 MsgStream log(msg,"StaticCalibSvc"); 00454 00455 std::ifstream input( feeDataFileName.c_str() ); 00456 if( !input.is_open() ){ 00457 std::ostringstream msgStr; 00458 msgStr << "Failed to open input file: " << feeDataFileName; 00459 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00460 return StatusCode::FAILURE; 00461 } 00462 int channelId; 00463 std::string description; 00464 int status; 00465 double adcThresholdHigh, adcThresholdLow, adcBaselineHigh, adcBaselineLow; 00466 std::string line; 00467 while( std::getline(input,line) ){ 00468 std::ostringstream msgStr; 00469 msgStr << "Got line: " << line; 00470 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00471 msgStr.str(""); 00472 std::stringstream streamLine(line); 00473 if( streamLine.peek() == '#' ){ 00474 continue; 00475 } 00476 streamLine >> channelId >> description 00477 >> status >> adcThresholdHigh >> adcThresholdLow 00478 >> adcBaselineHigh >> adcBaselineLow; 00479 msgStr << "Adding PMT: " << description; 00480 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00481 00482 DayaBay::FeeChannelId feeChannelId(channelId); 00483 DayaBay::Detector detector(feeChannelId.site(),feeChannelId.detectorId()); 00484 DayaBay::FeeCalibData fee; 00485 fee.m_channelId = feeChannelId; 00486 fee.m_status = (DayaBay::FeeCalibData::Status_t)status; 00487 fee.m_adcThresholdHigh = adcThresholdHigh; 00488 fee.m_adcThresholdLow = adcThresholdLow; 00489 fee.m_adcBaselineHigh = adcBaselineHigh; 00490 fee.m_adcBaselineLow = adcBaselineLow; 00491 std::vector<DayaBay::FeeCalibData>& feeList = feeData[detector]; 00492 feeList.push_back(fee); 00493 // Add lookup by channel ID 00494 feeDataByChannel[feeChannelId] = feeList[feeList.size()-1]; 00495 } 00496 00497 return StatusCode::SUCCESS; 00498 00499 }
static const InterfaceID& ICalibDataSvc::interfaceID | ( | ) | [inline, static, inherited] |
Reimplemented from IInterface.
Definition at line 113 of file ICalibDataSvc.h.
00113 { 00114 return IID_ICalibDataSvc; 00115 }
PmtDataMap StaticCalibDataSvc::m_pmtDataMap [private] |
Definition at line 111 of file StaticCalibDataSvc.h.
RpcDataMap StaticCalibDataSvc::m_rpcDataMap [private] |
Definition at line 112 of file StaticCalibDataSvc.h.
FeeDataMap StaticCalibDataSvc::m_feeDataMap [private] |
Definition at line 113 of file StaticCalibDataSvc.h.
FecDataMap StaticCalibDataSvc::m_fecDataMap [private] |
Definition at line 114 of file StaticCalibDataSvc.h.
Definition at line 116 of file StaticCalibDataSvc.h.
Definition at line 117 of file StaticCalibDataSvc.h.
Definition at line 119 of file StaticCalibDataSvc.h.
Definition at line 120 of file StaticCalibDataSvc.h.
Definition at line 124 of file StaticCalibDataSvc.h.
Definition at line 125 of file StaticCalibDataSvc.h.
Definition at line 126 of file StaticCalibDataSvc.h.
Definition at line 127 of file StaticCalibDataSvc.h.
PmtData* StaticCalibDataSvc::m_currentPmtData [private] |
Definition at line 131 of file StaticCalibDataSvc.h.
RpcData* StaticCalibDataSvc::m_currentRpcData [private] |
Definition at line 132 of file StaticCalibDataSvc.h.
FeeData* StaticCalibDataSvc::m_currentFeeData [private] |
Definition at line 133 of file StaticCalibDataSvc.h.
FecData* StaticCalibDataSvc::m_currentFecData [private] |
Definition at line 134 of file StaticCalibDataSvc.h.
Definition at line 137 of file StaticCalibDataSvc.h.
Definition at line 138 of file StaticCalibDataSvc.h.
Definition at line 141 of file StaticCalibDataSvc.h.
Definition at line 142 of file StaticCalibDataSvc.h.
std::string StaticCalibDataSvc::m_masterPmtDataFileName [private] |
User specified file. If not present, load the default ones from Master.CalibMap.txt.
Definition at line 148 of file StaticCalibDataSvc.h.
std::string StaticCalibDataSvc::m_masterFeeDataFileName [private] |
Definition at line 152 of file StaticCalibDataSvc.h.
std::string StaticCalibDataSvc::m_pmtDataFileName [private] |
User specified file. If not present, load the default ones from Master.CalibMap.txt.
Definition at line 164 of file StaticCalibDataSvc.h.
std::string StaticCalibDataSvc::m_rpcDataFileName [private] |
Definition at line 166 of file StaticCalibDataSvc.h.
std::string StaticCalibDataSvc::m_feeDataFileName [private] |
Definition at line 168 of file StaticCalibDataSvc.h.
std::string StaticCalibDataSvc::m_fecDataFileName [private] |
Definition at line 170 of file StaticCalibDataSvc.h.
PmtData StaticCalibDataSvc::m_pmtDataUser [private] |
Definition at line 174 of file StaticCalibDataSvc.h.
RpcData StaticCalibDataSvc::m_rpcDataUser [private] |
Definition at line 175 of file StaticCalibDataSvc.h.
FeeData StaticCalibDataSvc::m_feeDataUser [private] |
Definition at line 176 of file StaticCalibDataSvc.h.
FecData StaticCalibDataSvc::m_fecDataUser [private] |
Definition at line 177 of file StaticCalibDataSvc.h.
Definition at line 180 of file StaticCalibDataSvc.h.
Definition at line 181 of file StaticCalibDataSvc.h.
Definition at line 184 of file StaticCalibDataSvc.h.
Definition at line 185 of file StaticCalibDataSvc.h.