6 boost::posix_time::ptime parseTimeFromIsoString(
const std::string& isoString ){
7 boost::posix_time::time_input_facet* tif =
new boost::posix_time::time_input_facet;
8 tif->set_iso_extended_format();
9 std::istringstream iss( isoString );
10 iss.imbue(std::locale(std::locale::classic(),tif));
11 boost::posix_time::ptime ret;
16 void getRunTimeParams(
const RunInfo& runInfo, boost::posix_time::ptime&
start, boost::posix_time::ptime&
end ){
18 if( startStr !=
"null" ){
19 start = parseTimeFromIsoString( startStr );
23 if( stopStr !=
"null" ){
24 end = parseTimeFromIsoString( stopStr );
30 m_dbSession(dbSession){
37 boost::posix_time::ptime
start;
38 boost::posix_time::ptime
end;
39 getRunTimeParams( runInfo, start, end );
40 edm::LogInfo(
"RunInfoUpdate" ) <<
"[RunInfoUpdate::" << __func__ <<
"]: Checking run " <<runInfo.
m_run<<
" for insertion in Condition DB"<< std::endl;
42 size_t newRuns = runInfoWriter.
flush();
43 edm::LogInfo(
"RunInfoUpdate" ) <<
"[RunInfoUpdate::" << __func__ <<
"]: "<<newRuns<<
" new run(s) inserted."<< std::endl;
49 std::cout <<
"# Loading tag "<<sourceTag<<
"..."<<std::endl;
53 std::cout <<
"# Last run found in RunInfo db : "<<lastRun<<std::endl;
56 it = runInfoTag.
find( lastRun+1 );
58 if( it == runInfoTag.
end() || (*it).since==
lastRun ){
59 std::cout <<
"# No more run found to be imported."<<std::endl;
64 auto h = (*it).payloadId;
66 if(runInfo->m_run != -1){
68 std::cout <<
"# Inserting run #"<<runInfo->m_run<<
" (from since="<<(*it).since<<
")" << std::endl;
69 boost::posix_time::ptime
start;
70 boost::posix_time::ptime
end;
71 getRunTimeParams( *runInfo, start, end );
72 editor.
insert( runInfo->m_run, start, end );
74 std::cout <<
"# Skipping fake run #" <<std::endl;
RunInfoUpdate(cond::persistency::Session &dbSession)
void insert(cond::Time_t runNumber, const boost::posix_time::ptime &start, const boost::posix_time::ptime &end)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
RunInfoEditor editRunInfo()
void insertNew(cond::Time_t runNumber, const boost::posix_time::ptime &start, const boost::posix_time::ptime &end)
size_t import(size_t maxEntries, const std::string &tag, cond::persistency::Session &sourceSession)
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
const unsigned int maxEntries
IOVProxy readIov(const std::string &tag, bool full=false)
unsigned long long Time_t
std::string m_start_time_str
Iterator find(cond::Time_t time)
void appendNewRun(const RunInfo &run)
cond::persistency::Session & m_dbSession
std::string m_stop_time_str
cond::Time_t getLastInserted()