3 #include <pdbcalbase/RunToTime.h>
38 mySpecificCopy =
nullptr;
40 while (beginruntimes.begin() != beginruntimes.end())
42 delete beginruntimes.begin()->second;
43 beginruntimes.erase(beginruntimes.begin());
45 while (endruntimes.begin() != endruntimes.end())
47 delete endruntimes.begin()->second;
48 endruntimes.erase(endruntimes.begin());
60 __instance = mySpecificCopy;
75 <<
" Fatal Exception caught during DriverManager::getConnection" << endl;
98 std::ostringstream
cmd;
99 cmd <<
"select brunixtime,erunixtime,updateunixtime from run where runnumber = " << runNumber
104 cout << cmd.str() << endl;
115 cout <<
"Fatal Exception caught during stmt->executeQuery(" << cmd.str() <<
")" << endl;
116 cout <<
"Message: " << e.
getMessage() << endl;
131 map<const int, PHTimeStamp*>::reverse_iterator iter = beginruntimes.rbegin();
134 int delrun = iter->first;
136 beginruntimes.erase(delrun);
137 map<const int, PHTimeStamp*>::iterator iter2;
138 iter2 = endruntimes.find(delrun);
139 if (iter2 != endruntimes.end())
141 delete iter2->second;
142 endruntimes.erase(iter2);
152 cout <<
"Fatal Exception caught during rs->getInt(\"brunixtime\")" << endl;
153 cout <<
"Message: " << e.
getMessage() << endl;
156 beginruntimes[runNumber] = whatTime;
160 unsigned int eruntics = rs->
getInt(
"erunixtime");
164 eruntics = rs->
getInt(
"updateunixtime");
170 cout <<
"Fatal Exception caught during rs->getInt(\"brunixtime\")" << endl;
171 cout <<
"Message: " << e.
getMessage() << endl;
174 endruntimes[runNumber] = whatTime;
175 if (what ==
"brunixtime")
178 return beginruntimes[runNumber];
180 else if (what ==
"erunixtime")
183 return endruntimes[runNumber];
187 cout <<
"invalid time selection " << what << endl;
199 map<const int, PHTimeStamp*>::const_iterator iter = beginruntimes.find(runNumber);
200 if (iter == beginruntimes.end())
202 BeginRunTime = getTime(runNumber,
"brunixtime");
206 BeginRunTime = iter->second;
220 map<const int, PHTimeStamp*>::const_iterator iter = endruntimes.find(runNumber);
221 if (iter == endruntimes.end())
223 EndRunTime = getTime(runNumber,
"erunixtime");
227 EndRunTime = iter->second;
243 std::ostringstream
cmd;
249 cmd <<
"select runnumber from run where brunixtime <= " << tics
250 <<
" order by runnumber desc limit 1";
260 cout <<
"Fatal Exception caught during stmt->executeQuery(" << cmd.str() <<
")" << endl;
261 cout <<
"Message: " << e.
getMessage() << endl;
270 runnumber = rs->
getInt(
"runnumber");
279 cmd <<
"select erunixtime from run where runnumber = " <<
runnumber;
287 cout <<
"Fatal Exception caught during stmt->executeQuery(" << cmd.str() <<
")" << endl;
288 cout <<
"Message: " << e.
getMessage() << endl;
295 eruntics = rs->
getInt(
"erunixtime");
296 if (eruntics > 0 && eruntics < tics)
298 cout <<
"Timestamp " << tics
299 <<
" not covered by any run, closest smaller begin run time is from run "
300 << runnumber << endl;