9 #include "CoolKernel/Exception.h"
10 #include "CoolKernel/FolderSpecification.h"
11 #include "CoolKernel/IDatabaseSvc.h"
12 #include "CoolKernel/IDatabase.h"
13 #include "CoolKernel/IFolder.h"
14 #include "CoolKernel/IFolderSet.h"
15 #include "CoolKernel/IObject.h"
16 #include "CoolKernel/IObjectIterator.h"
17 #include "CoolKernel/pointers.h"
18 #include "CoolApplication/DatabaseSvcFactory.h"
21 #include "RelationalAccess/IConnectionServiceConfiguration.h"
22 #include "RelationalAccess/ConnectionService.h"
23 #include "RelationalAccess/ISessionProxy.h"
24 #include "RelationalAccess/ITransaction.h"
25 #include "RelationalAccess/ISchema.h"
26 #include "RelationalAccess/ITable.h"
27 #include "RelationalAccess/IQuery.h"
28 #include "RelationalAccess/ICursor.h"
81 typename std::list<std::pair<IOVRange, T > >
data;
94 m_last =
data.begin();
107 if (
data.empty())
return T(-1);
109 typename std::list<std::pair<IOVRange, T> >
::iterator it;
123 if ((m_last->first).isInRange(
time))
return m_last->second;
126 if (++(m_last) !=
data.end()) {
128 if ((m_last->first).isInRange(
time))
return m_last->second;
131 m_last =
data.begin();
138 if ( m_last ==
data.end() ) --m_last;
141 if (m_last->first.stop() <=
time) {
144 for (++m_last; m_last !=
data.end(); ++m_last) {
146 if ((m_lastData = (m_last->first).isInRange(
time)))
return m_last->second;
149 }
else if ( m_last !=
data.begin() && m_last->first.start() >
time) {
155 if ((m_lastData = (m_last->first).isInRange(
time)))
return m_last->second;
156 }
while (m_last !=
data.begin());
160 if ((m_lastData = m_last->first.isInRange(
time)))
return m_last->second;
165 m_last =
data.begin();
175 std::list<std::pair<IOVRange, T> > mydata;
186 typename std::list<std::pair<IOVRange, T> >
::iterator elem;
188 std::pair<IOVRange, T>
val;
191 for (elem = m_last; elem !=
data.end(); ++elem) {
196 if (
val.first.start() < firsttime ||
val.first.stop() > lasttime) {
197 IOVTime iovstart((
val.first.start() < firsttime ? firsttime :
val.first.start()));
198 IOVTime iovstop((
val.first.stop() > lasttime ? lasttime :
val.first.stop()));
201 mydata.push_back(
val);
204 if (elem->first.isInRange(lasttime))
break;
247 void setIOV(
const cool::ValidityKey
start,
const cool::ValidityKey
stop);
252 cool::ChannelId
getHLTChannelId(
const std::string& trigger,
const std::string& folder_name);
255 cool::ChannelId
getL1ChannelId(
const std::string& trigger,
const std::string& folder_name);
258 cool::ChannelId
getLumiChannelId(
const std::string& lumimethod,
const std::string& folder_name);
278 std::map<cool::ValidityKey, T>
getObjMapFromFolderAtChan(
const std::string& obj_name,
const std::string& folder_name,
const cool::ChannelId&
id);
281 std::map<cool::ValidityKey, T>
getTrigObjMapFromFolderByName(
const std::string& obj_name,
const std::string& folder_name,
const std::string& trigger);
288 std::map<cool::ValidityKey, T>
getLumiIterator(
const std::string& luminame,
const std::string& folder_name,
const std::string&
tag,
const cool::ChannelId&
id );
301 std::map<cool::ValidityKey, LumiFolderData>
311 std::map<cool::ValidityKey, L1CountFolderData>
316 IOVData<T> getIOVData(
const std::string&
name,
const std::string& folder_name,
const cool::ChannelId&
id,
const std::string&
tag=
"");
319 std::string
transConn(
const std::string& inconn);
347 std::map<cool::ValidityKey, T> mymap;
349 cool::IFolderPtr folder_ptr =
m_sourceDbPtr->getFolder(folder_name);
352 while (obj_itr->goToNext()){
354 const cool::IRecord&
payload=obj_itr->currentRef().payload();
357 if(
payload[
"ChainName"].data<std::string>() == trigger){
359 const cool::IRecord&
payload=obj_itr->currentRef().payload();
361 mymap.insert( std::pair<cool::ValidityKey, T>(obj_itr->currentRef().since() ,
payload[obj_name].data<
T>()));
377 std::map<cool::ValidityKey, T> mymap;
378 cool::IFolderPtr folder_ptr =
m_sourceDbPtr->getFolder(folder_name);
379 cool::ChannelSelection chsel(
id);
380 if(folder_ptr->existsChannel(
id)){
381 cool::IObjectIteratorPtr itr = folder_ptr->browseObjects(
m_VKstart,
m_VKstop,chsel);
382 while (itr->goToNext()) {
383 const cool::IRecord&
payload=itr->currentRef().payload();
385 mymap.insert( std::pair<cool::ValidityKey, T>(itr->currentRef().since() ,
payload[obj_name].data<
T>()));
397 std::map<cool::ValidityKey, T>
CoolQuery::getLumiIterator(
const std::string& luminame,
const std::string& folder_name,
const std::string&
tag,
const cool::ChannelId&
id ){
399 std::map<cool::ValidityKey, T> mymap;
400 cool::IFolderPtr folder_ptr =
m_sourceDbPtr->getFolder(folder_name);
402 if(folder_ptr->existsChannel(
id) && folder_ptr->existsUserTag(
tag)){
404 while (itr->goToNext()) {
405 const cool::IRecord&
payload=itr->currentRef().payload();
406 mymap.insert( std::pair<cool::ValidityKey, T>(itr->currentRef().since() ,
payload[luminame].data<
T>()));
408 }
else if(folder_ptr->existsChannel(
id) && !folder_ptr->existsUserTag(
tag)){
410 mymap = CoolQuery::getObjMapFromFolderAtChan<T>(luminame, folder_name,
id);
421 CoolQuery::getIOVData(
const std::string& obj_name,
const std::string& folder_name,
const cool::ChannelId&
id,
const std::string&
tag) {
425 cool::IFolderPtr folder_ptr =
m_sourceDbPtr->getFolder(folder_name);
426 cool::ChannelSelection chsel(
id);
427 if(!folder_ptr->existsChannel(
id)){
433 cool::IObjectIteratorPtr itr;
434 if (folder_ptr->existsUserTag(
tag)) {
440 while (itr->goToNext()) {
442 since.setRETime(itr->currentRef().since());
443 until.setRETime(itr->currentRef().until());
447 const cool::IRecord&
payload=itr->currentRef().payload();
457 #endif //> COOLQUERY_H