/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #include "StaticCalibDataSvc.h" 00002 #include "GaudiKernel/IMessageSvc.h" 00003 #include "GaudiKernel/MsgStream.h" 00004 #include "GaudiKernel/SystemOfUnits.h" 00005 #include <sstream> 00006 #include <fstream> 00007 #include <stdlib.h> 00008 00009 using namespace Gaudi; 00010 using namespace std; 00011 00012 StaticCalibDataSvc::StaticCalibDataSvc(const std::string& name, ISvcLocator *svc) 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 } 00039 00040 StaticCalibDataSvc::~StaticCalibDataSvc() 00041 { 00042 } 00043 00044 StatusCode StaticCalibDataSvc::initialize() 00045 { 00046 this->Service::initialize(); 00047 00048 IMessageSvc* msg = msgSvc(); 00049 if( !msg ){ 00050 return StatusCode::FAILURE; 00051 } 00052 MsgStream log(msg,"StaticCalibDataSvc"); 00053 00054 log << MSG::INFO << "User specified PmtDataFile is [" << m_pmtDataFileName <<"]"<< endreq; 00055 // --------------- Here is a separator ------------------------------- 00057 if(m_pmtDataFileName!="") { 00058 log << MSG::INFO << "Loading PmtDataFile: " << m_pmtDataFileName << endreq; 00059 readPmtDataFile( m_pmtDataFileName, 00060 m_pmtDataUser, 00061 m_pmtDataBySensorUser ); 00062 } 00063 00064 if(m_feeDataFileName!=""){ 00065 msg->reportMessage( "StaticCalibDataSvc", MSG::INFO, ("Loading " + m_feeDataFileName).c_str() ); 00066 readFeeDataFile( m_feeDataFileName, 00067 m_feeDataUser, 00068 m_feeDataByChannelUser ); 00069 } 00070 00071 if(m_rpcDataFileName!=""){ 00072 // FIXME: Add RPC data file 00073 std::ostringstream msgStr; 00074 msgStr << "RPC calibration data file not yet implemented!"; 00075 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00076 return StatusCode::FAILURE; 00077 } 00078 00079 if(m_fecDataFileName!=""){ 00080 // FIXME: Add FEC data file 00081 std::ostringstream msgStr; 00082 msgStr << "FEC calibration data file not yet implemented!"; 00083 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00084 return StatusCode::FAILURE; 00085 } 00086 00087 // --------------- Here is a separator ------------------------------- 00088 FileNameList::iterator it, itend; 00089 00091 msg->reportMessage( "StaticCalibDataSvc", MSG::INFO, ("Loading " + m_masterPmtDataFileName).c_str() ); 00092 FileNameList PmtDataFileList; 00093 readMasterFile( m_masterPmtDataFileName, PmtDataFileList ); 00094 00095 itend = PmtDataFileList.end(); 00096 for( it=PmtDataFileList.begin(); it!=itend; it++ ) { 00097 PmtData aPmtData; 00098 PmtDataBySensor aPmtDataBySensor; 00099 readPmtDataFile( it->second, // file name 00100 aPmtData, 00101 aPmtDataBySensor ); 00102 00103 m_pmtDataMap[ it->first ] = aPmtData; 00104 m_pmtDataBySensorMap[ it->first ] = aPmtDataBySensor; 00105 } 00106 00107 // use the first one to start 00108 m_currentPmtContextRange = PmtDataFileList.begin()->first; 00109 m_currentPmtData = &(m_pmtDataMap.begin()->second); 00110 m_currentPmtDataBySensor = &(m_pmtDataBySensorMap.begin()->second); 00111 00113 msg->reportMessage( "StaticCalibDataSvc", MSG::INFO, ("Loading " + m_masterFeeDataFileName).c_str() ); 00114 FileNameList FeeDataFileList; 00115 readMasterFile( m_masterFeeDataFileName, FeeDataFileList ); 00116 00117 itend = FeeDataFileList.end(); 00118 for( it=FeeDataFileList.begin(); it!=itend; it++ ) { 00119 FeeData aFeeData; 00120 FeeDataByChannel aFeeDataByChannel; 00121 readFeeDataFile( it->second, // file name 00122 aFeeData, 00123 aFeeDataByChannel ); 00124 00125 m_feeDataMap[ it->first ] = aFeeData; 00126 m_feeDataByChannelMap[ it->first ] = aFeeDataByChannel; 00127 } 00128 00129 // use the first one to start 00130 m_currentFeeContextRange = FeeDataFileList.begin()->first; 00131 m_currentFeeData = &(m_feeDataMap.begin()->second); 00132 m_currentFeeDataByChannel = &(m_feeDataByChannelMap.begin()->second); 00133 00138 00139 return StatusCode::SUCCESS; 00140 } 00141 00142 StatusCode StaticCalibDataSvc::finalize() 00143 { 00144 return this->Service::finalize(); 00145 } 00146 00147 StatusCode StaticCalibDataSvc::queryInterface(const InterfaceID& riid, 00148 void** ppvInterface) 00149 { 00150 StatusCode sc = StatusCode::FAILURE; 00151 if (ppvInterface) { 00152 *ppvInterface = 0; 00153 00154 if (ICalibDataSvc::interfaceID().versionMatch(riid)) { 00155 *ppvInterface = static_cast<ICalibDataSvc*>(this); 00156 sc = StatusCode::SUCCESS; 00157 addRef(); 00158 } 00159 else sc = Service::queryInterface( riid, ppvInterface ); 00160 } 00161 return sc; 00162 } 00163 00174 const DayaBay::PmtCalibData* StaticCalibDataSvc::pmtCalibData( 00175 const DayaBay::DetectorSensor& pmtId, 00176 const ServiceMode& svcMode) 00177 { 00178 /* 00179 cout<<svcMode.context()<<endl; 00180 cout<<m_currentPmtContextRange.GetTimeStart().AsString()<<endl; 00181 cout<<m_currentPmtContextRange.GetTimeEnd().AsString()<<endl; 00182 */ 00183 PmtDataBySensor* pPmtDataBySensor = 0; 00184 00185 if (m_pmtDataFileName.size() != 0) { 00186 pPmtDataBySensor = &m_pmtDataBySensorUser; 00187 } else { 00188 const Context &cont = svcMode.context(); 00189 if ( m_currentPmtContextRange.IsCompatible( cont ) ) { 00190 pPmtDataBySensor = m_currentPmtDataBySensor; 00191 } else { 00194 PmtDataBySensorMap::iterator it, itend=m_pmtDataBySensorMap.end(); 00195 for( it = m_pmtDataBySensorMap.begin(); it!=itend; it++ ) { 00196 if( it->first.IsCompatible( cont ) ) { 00197 m_currentPmtContextRange = it->first; 00198 m_currentPmtDataBySensor = &(it->second); 00199 pPmtDataBySensor = m_currentPmtDataBySensor; 00201 m_currentPmtData = &(m_pmtDataMap[m_currentPmtContextRange]); 00202 break; 00203 } 00204 } 00205 } 00206 } 00207 00208 if( pPmtDataBySensor!=0 ) { 00209 std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData>::iterator result = 00210 pPmtDataBySensor->find(pmtId); 00211 if(result != pPmtDataBySensor->end()){ 00212 return &(result->second); 00213 } 00215 return 0; 00216 } 00217 00219 return 0; 00220 } 00221 00222 const DayaBay::PedBiasCalibData* StaticCalibDataSvc::pedBiasCalibData( 00223 const DayaBay::DetectorSensor& /*pmtId*/, 00224 const ServiceMode& /*svcMode*/) 00225 { 00226 00227 //error 00228 //Not implemented for StaticCalibDataSvc (jpochoa) 00229 return 0; 00230 00231 } 00232 00233 const DayaBay::HighGainCalibData* StaticCalibDataSvc::highGainCalibData( 00234 const DayaBay::DetectorSensor& /*pmtId*/, 00235 const ServiceMode& /*svcMode*/) 00236 { 00237 00238 //error 00239 //Not implemented for StaticCalibDataSvc (jpochoa) 00240 return 0; 00241 00242 } 00243 00244 const DayaBay::TimingCalibData* StaticCalibDataSvc::timingCalibData( 00245 const DayaBay::DetectorSensor& /*pmtId*/, 00246 const ServiceMode& /*svcMode*/) 00247 { 00248 00249 //error 00250 //Not implemented for StaticCalibDataSvc (jpochoa) 00251 return 0; 00252 00253 } 00254 00255 const DayaBay::GainConvCalibData* StaticCalibDataSvc::gainConvCalibData( 00256 const DayaBay::FeeChannelId& channelId, 00257 const ServiceMode& svcMode) 00258 { 00259 00260 //error 00261 //Not implemented for StaticCalibDataSvc (jpochoa) 00262 return 0; 00263 00264 } 00265 00266 00267 const DayaBay::RpcCalibData* StaticCalibDataSvc::rpcCalibData( 00268 const DayaBay::RpcSensor& rpcId, 00269 const ServiceMode& /* svcMode */) 00270 { 00271 std::map<DayaBay::RpcSensor, DayaBay::RpcCalibData>::iterator result = 00272 m_rpcDataBySensorUser.find(rpcId); 00273 if(result != m_rpcDataBySensorUser.end()){ 00274 return &(result->second); 00275 } 00276 return 0; 00277 } 00278 00279 const DayaBay::FeeCalibData* StaticCalibDataSvc::feeCalibData( 00280 const DayaBay::FeeChannelId& channelId, 00281 const ServiceMode& svcMode) 00282 { 00283 FeeDataByChannel * pFeeDataByChannel = 0; 00284 00285 if (m_feeDataFileName.size() != 0) { 00286 pFeeDataByChannel = &m_feeDataByChannelUser; 00287 } else { 00288 const Context &cont = svcMode.context(); 00289 if ( m_currentFeeContextRange.IsCompatible( cont ) ) { 00290 pFeeDataByChannel = m_currentFeeDataByChannel; 00291 } else { 00294 FeeDataByChannelMap::iterator it, itend=m_feeDataByChannelMap.end(); 00295 for( it = m_feeDataByChannelMap.begin(); it!=itend; it++ ) { 00296 if( it->first.IsCompatible( cont ) ) { 00297 m_currentFeeContextRange = it->first; 00298 m_currentFeeDataByChannel = &(it->second); 00299 pFeeDataByChannel = m_currentFeeDataByChannel; 00301 m_currentFeeData = &(m_feeDataMap[m_currentFeeContextRange]); 00302 break; 00303 } 00304 } 00305 } 00306 } 00307 00308 if( pFeeDataByChannel!=0 ) { 00309 std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData>::iterator result = 00310 pFeeDataByChannel->find(channelId); 00311 if(result != pFeeDataByChannel->end()){ 00312 return &(result->second); 00313 } 00315 return 0; 00316 } 00317 00319 return 0; 00320 } 00321 00322 const DayaBay::FecCalibData* StaticCalibDataSvc::fecCalibData( 00323 const DayaBay::FecChannelId& channelId, 00324 const ServiceMode& /* svcMode */) 00325 { 00326 std::map<DayaBay::FecChannelId, DayaBay::FecCalibData>::iterator result = 00327 m_fecDataByChannelUser.find(channelId); 00328 if(result != m_fecDataByChannelUser.end()){ 00329 return &(result->second); 00330 } 00331 return 0; 00332 } 00333 00334 const DayaBay::SrcEnergyData* StaticCalibDataSvc::srcEnergyData(int type, 00335 const ServiceMode& /*svcMode*/) 00336 { 00337 //error 00338 //Not implemented for StaticCalibDataSvc (jpochoa) 00339 return 0; 00340 00341 } 00342 00343 const std::vector<DayaBay::PmtCalibData>& StaticCalibDataSvc::pmtCalibList( 00344 const DayaBay::Detector& detectorId, 00345 const ServiceMode& svcMode) 00346 { 00347 PmtData* pPmtData = 0; 00348 00349 if (m_pmtDataFileName.size() != 0) { 00350 pPmtData = &m_pmtDataUser; 00351 } else { 00352 const Context &cont = svcMode.context(); 00353 if ( m_currentPmtContextRange.IsCompatible( cont ) ) { 00354 pPmtData = m_currentPmtData; 00355 } else { 00358 PmtDataMap::iterator it, itend=m_pmtDataMap.end(); 00359 for( it = m_pmtDataMap.begin(); it!=itend; it++ ) { 00360 if( it->first.IsCompatible( cont ) ) { 00361 m_currentPmtContextRange = it->first; 00362 m_currentPmtData = &(it->second); 00363 pPmtData = m_currentPmtData; 00365 m_currentPmtDataBySensor = &(m_pmtDataBySensorMap[m_currentPmtContextRange]); 00366 break; 00367 } 00368 } 00369 } 00370 } 00371 00372 if( pPmtData!=0 ) { 00373 return (*pPmtData)[detectorId]; 00374 } 00375 00377 cout<<"No available PmtCalibData found"<<endl; 00378 cout<<"No CalibData file specified, or wrong time range in Master.pmtCalibMap.txt, or no such data file at all"<<endl; 00379 abort(); 00380 } 00381 00382 const std::vector<DayaBay::PedBiasCalibData>& StaticCalibDataSvc::pedBiasCalibList( 00383 const DayaBay::Detector& /*detectorId*/, 00384 const ServiceMode& /*svcMode*/) 00385 { 00386 cout << "StaticCalibDataSvc::pedBiasCalibList not implemented" << endl; 00387 cout << "Use DbiCalibDataSvc instead" << endl; 00388 abort(); 00389 00390 } 00391 00392 const std::vector<DayaBay::HighGainCalibData>& StaticCalibDataSvc::highGainCalibList(//jpochoa 00393 const DayaBay::Detector& /*detectorId*/, 00394 const ServiceMode& /*svcMode*/) 00395 { 00396 cout << "StaticCalibDataSvc::highGainCalibList not implemented" << endl; 00397 cout << "Use DbiCalibDataSvc instead" << endl; 00398 abort(); 00399 00400 } 00401 00402 const std::vector<DayaBay::TimingCalibData>& StaticCalibDataSvc::timingCalibList(//jpochoa 00403 const DayaBay::Detector& /*detectorId*/, 00404 const ServiceMode& /*svcMode*/) 00405 { 00406 cout << "StaticCalibDataSvc::timingCalibList not implemented" << endl; 00407 cout << "Use DbiCalibDataSvc instead" << endl; 00408 abort(); 00409 00410 } 00411 00412 const std::vector<DayaBay::SrcEnergyData>& StaticCalibDataSvc::srcEnergyList(//littlejohn 00413 const ServiceMode& /*svcMode*/) 00414 { 00415 cout << "StaticCalibDataSvc::srcEnergyList not implemented" << endl; 00416 cout << "Use DbiCalibDataSvc instead" << endl; 00417 abort(); 00418 00419 } 00420 00421 const std::vector<DayaBay::GainConvCalibData>& StaticCalibDataSvc::gainConvCalibList(//jpochoa 00422 const DayaBay::Detector& detectorId, 00423 const ServiceMode& svcMode) 00424 { 00425 cout << "StaticCalibDataSvc::gainConvCalibList not implemented" << endl; 00426 cout << "Use DbiCalibDataSvc instead" << endl; 00427 abort(); 00428 00429 } 00430 00431 const std::vector<DayaBay::RpcCalibData>& StaticCalibDataSvc::rpcCalibList( 00432 const DayaBay::Detector& detectorId, 00433 const ServiceMode& /* svcMode */) 00434 { 00435 return m_rpcDataUser[detectorId]; 00436 } 00437 00438 const std::vector<DayaBay::FeeCalibData>& StaticCalibDataSvc::feeCalibList( 00439 const DayaBay::Detector& detectorId, 00440 const ServiceMode& svcMode) 00441 { 00442 FeeData * pFeeData = 0; 00443 00444 if (m_feeDataFileName.size() != 0) { 00445 pFeeData = &m_feeDataUser; 00446 } else { 00447 const Context &cont = svcMode.context(); 00448 if ( m_currentFeeContextRange.IsCompatible( cont ) ) { 00449 pFeeData = m_currentFeeData; 00450 } else { 00453 FeeDataMap::iterator it, itend=m_feeDataMap.end(); 00454 for( it = m_feeDataMap.begin(); it!=itend; it++ ) { 00455 if( it->first.IsCompatible( cont ) ) { 00456 m_currentFeeContextRange = it->first; 00457 m_currentFeeData = &(it->second); 00458 pFeeData = m_currentFeeData; 00460 m_currentFeeDataByChannel = &(m_feeDataByChannelMap[m_currentFeeContextRange]); 00461 break; 00462 } 00463 } 00464 } 00465 } 00466 00467 if( pFeeData!=0 ) { 00468 return (*pFeeData)[detectorId]; 00469 } 00470 00472 cout<<"No available FeeCalibData found"<<endl; 00473 cout<<"No CalibData file specified, or wrong time range in Master.feeCalibMap.txt, or no such data file at all"<<endl; 00474 abort(); 00475 } 00476 00477 const std::vector<DayaBay::FecCalibData>& StaticCalibDataSvc::fecCalibList( 00478 const DayaBay::Detector& detectorId, 00479 const ServiceMode& /* svcMode */) 00480 { 00481 return m_fecDataUser[detectorId]; 00482 } 00483 00484 00485 // Functions to read data file 00486 StatusCode StaticCalibDataSvc::readPmtDataFile( std::string pmtDataFileName, PmtData &pmtData, PmtDataBySensor &pmtDataBySensor ) 00487 { 00488 IMessageSvc* msg = msgSvc(); 00489 if( !msg ){ 00490 return StatusCode::FAILURE; 00491 } 00492 MsgStream log(msg,"StaticCalibDataSvc"); 00493 00494 std::ifstream input( pmtDataFileName.c_str() ); 00495 std::ostringstream prtStr; 00496 prtStr<<"PmtCalibMap "<<pmtDataFileName; 00497 msg->reportMessage("StaticCalibDataSvc",MSG::DEBUG,prtStr.str()); 00498 if( !input.is_open() ){ 00499 std::ostringstream msgStr; 00500 msgStr << "Failed to open input file: " << pmtDataFileName; 00501 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00502 return StatusCode::FAILURE; 00503 } 00504 int sensorId; 00505 std::string description; 00506 int status; 00507 double speHigh, sigmaSpeHigh, speLow, timeOffset, timeSpread, efficiency; 00508 double prePulseProb, afterPulseProb, darkRate; 00509 std::string line; 00510 while( std::getline(input,line) ){ 00511 std::ostringstream msgStr; 00512 msgStr << "Got line: " << line; 00513 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00514 msgStr.str(""); 00515 std::stringstream streamLine(line); 00516 if( streamLine.peek() == '#' ){ 00517 continue; 00518 } 00519 streamLine >> sensorId >> description 00520 >> status >> speHigh >> sigmaSpeHigh >> speLow 00521 >> timeOffset >> timeSpread >> efficiency >> prePulseProb 00522 >> afterPulseProb >> darkRate; 00523 msgStr << "Adding PMT: " << description; 00524 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00525 00526 DayaBay::DetectorSensor pmtId(sensorId); 00527 DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() ); 00528 DayaBay::PmtCalibData pmt; 00529 pmt.m_pmtId = pmtId; 00530 pmt.m_status = (DayaBay::PmtCalibData::Status_t)status; 00531 pmt.m_speHigh = speHigh; 00532 pmt.m_sigmaSpeHigh = sigmaSpeHigh; 00533 pmt.m_speLow = speLow; 00534 pmt.m_timeOffset = timeOffset * Units::ns; 00535 pmt.m_timeSpread = timeSpread * Units::ns; 00536 pmt.m_efficiency = efficiency; 00537 pmt.m_prePulseProb = prePulseProb; 00538 pmt.m_afterPulseProb = afterPulseProb; 00539 pmt.m_darkRate = darkRate * Units::hertz; 00540 std::vector<DayaBay::PmtCalibData>& pmtList = pmtData[detector]; 00541 pmtList.push_back(pmt); 00542 // Add lookup by sensor ID 00543 pmtDataBySensor[pmtId] = pmtList[pmtList.size()-1]; 00544 } 00545 00546 return StatusCode::SUCCESS; 00547 00548 } 00549 00550 00551 StatusCode StaticCalibDataSvc::readFeeDataFile( std::string feeDataFileName, FeeData &feeData, FeeDataByChannel &feeDataByChannel ) 00552 { 00553 IMessageSvc* msg = msgSvc(); 00554 if( !msg ){ 00555 return StatusCode::FAILURE; 00556 } 00557 MsgStream log(msg,"StaticCalibDataSvc"); 00558 00559 std::ifstream input( feeDataFileName.c_str() ); 00560 if( !input.is_open() ){ 00561 std::ostringstream msgStr; 00562 msgStr << "Failed to open input file: " << feeDataFileName; 00563 msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str()); 00564 return StatusCode::FAILURE; 00565 } 00566 int channelId; 00567 std::string description; 00568 int status; 00569 double adcThresholdHigh, adcThresholdLow, adcBaselineHigh, adcBaselineLow; 00570 std::string line; 00571 while( std::getline(input,line) ){ 00572 std::ostringstream msgStr; 00573 msgStr << "Got line: " << line; 00574 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00575 msgStr.str(""); 00576 std::stringstream streamLine(line); 00577 if( streamLine.peek() == '#' ){ 00578 continue; 00579 } 00580 streamLine >> channelId >> description 00581 >> status >> adcThresholdHigh >> adcThresholdLow 00582 >> adcBaselineHigh >> adcBaselineLow; 00583 msgStr << "Adding PMT: " << description; 00584 msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str()); 00585 00586 DayaBay::FeeChannelId feeChannelId(channelId); 00587 DayaBay::Detector detector(feeChannelId.site(),feeChannelId.detectorId()); 00588 DayaBay::FeeCalibData fee; 00589 fee.m_channelId = feeChannelId; 00590 fee.m_status = (DayaBay::FeeCalibData::Status_t)status; 00591 fee.m_adcThresholdHigh = adcThresholdHigh; 00592 fee.m_adcThresholdLow = adcThresholdLow; 00593 fee.m_adcBaselineHigh = adcBaselineHigh; 00594 fee.m_adcBaselineLow = adcBaselineLow; 00595 std::vector<DayaBay::FeeCalibData>& feeList = feeData[detector]; 00596 feeList.push_back(fee); 00597 // Add lookup by channel ID 00598 feeDataByChannel[feeChannelId] = feeList[feeList.size()-1]; 00599 } 00600 00601 return StatusCode::SUCCESS; 00602 00603 } 00604 00605 00606 StatusCode StaticCalibDataSvc::readMasterFile( std::string masterFileName, FileNameList &subFileNameList ) 00607 { 00608 IMessageSvc* msg = msgSvc(); 00609 if( !msg ){ 00610 return StatusCode::FAILURE; 00611 } 00612 MsgStream log(msg,"StaticCalibDataSvc"); 00613 00614 std::string Path = getenv ("DATASVCROOT"); 00615 std::ifstream masterFileStream( (Path+"/share/"+masterFileName).c_str() ); 00616 00617 if( !masterFileStream.is_open() ){ 00618 msg->reportMessage( "StaticCalibDataSvc", MSG::ERROR, ("Fail to open" + masterFileName).c_str() ); 00619 return StatusCode::FAILURE; 00620 } 00621 00622 int StartRun,EndRun; 00623 int Sites; 00624 int SimFlag, StartTimeSec, StartTimeNanoSec, EndTimeSec, EndTimeNanoSec; 00625 std::string MapFileName; 00626 00627 std::string line; 00628 00629 while( std::getline( masterFileStream, line ) ){ 00630 std::stringstream streamLine(line); 00631 if( streamLine.peek() == '#' ){ 00632 continue; 00633 } 00634 streamLine >>StartRun >>EndRun >>Sites 00635 >>SimFlag >>StartTimeSec>> StartTimeNanoSec >>EndTimeSec >>EndTimeNanoSec 00636 >>MapFileName; 00637 00638 ContextRange CRange( Sites, SimFlag, 00639 TimeStamp( StartTimeSec, StartTimeNanoSec ), 00640 TimeStamp( EndTimeSec, EndTimeNanoSec ) ); 00641 /* 00642 std::cout<<TimeStamp( StartTimeSec, StartTimeNanoSec ).AsString()<<std::endl; 00643 std::cout<<TimeStamp( EndTimeSec, EndTimeNanoSec ).AsString()<<std::endl; 00644 */ 00645 MapFileName = Path + "/share/" + MapFileName; 00646 subFileNameList[ CRange ] = MapFileName ; 00647 } 00648 00649 return StatusCode::SUCCESS; 00650 } 00651 00652 00653 // Local Variables: ** 00654 // c-basic-offset:2 ** 00655 // End: **