9#ifndef IOVDBSVC_IOVDBFOLDER_H
10#define IOVDBSVC_IOVDBFOLDER_H
13#include "GaudiKernel/IClassIDSvc.h"
14#include "GaudiKernel/ServiceHandle.h"
20#include "CoolKernel/ChannelSelection.h"
21#include "CoolKernel/ValidityKey.h"
22#include "CoolKernel/IFolder.h"
34#include "nlohmann/json.hpp"
62 const bool checklock,
const bool outputToFile=
false,
64 const std::string & crestServer=
"",
const std::string & crestTag=
"",
const bool crestCoolToFile=
false);
72 const std::string&
key()
const;
92 const std::string&
joTag()
const;
113 const unsigned int time);
121 bool cacheValid(
const cool::ValidityKey reftime)
const;
124 bool loadCache(
const cool::ValidityKey vkey,
const unsigned int cacheDiv,
125 const std::string& globalTag,
const bool ignoreMissChan);
132 bool getAddress(
const cool::ValidityKey reftime,IAddressCreator* persSvc,
133 const unsigned int poolSvcContext,
134 std::unique_ptr<IOpaqueAddress>& address,
135 IOVRange& range,
bool& poolPayloadRequested);
140 std::unique_ptr<SG::TransientAddress>
142 const unsigned int cacheRun,
143 const unsigned int cacheTime);
150 const std::string& globalTag,
151 const cool::IDatabasePtr& dbPtr,
158 bool resolveTag(
const cool::IFolderPtr&
fptr,
const std::string& globalTag);
172 void addIOVtoCache(cool::ValidityKey since, cool::ValidityKey until);
178 std::unique_ptr<SG::TransientAddress>
182 void setCacheLength(
const bool timeIs_nsOfEpoch,
const unsigned int cacheRun,
const unsigned int cacheTime);
188 const auto & objSince = obj.since();
189 const auto & objUntil = obj.until();
190 const auto & objChannel = obj.channelId();
191 ATH_MSG_DEBUG(
"from DB \t chID: "<<objChannel<<
"\tobjstart:\t"<<objSince<<
"\t objstop: \t"
197 unsigned int counter{};
203 const auto iovIdx = std::distance(
m_cachechan.begin(), pCacheChannel);
204 const auto & iov =
m_iovs.at(iovIdx);
205 if ((iov.first < objSince) and (objSince < iov.second)){
209 ATH_MSG_DEBUG(
"special reload needed on THIS ONE !!!!!!!!!!!");
212 m_iovs.extendIov(iovIdx, objSince-1);
216 if ( (objSince>=iov.first and objSince<iov.second) or (objUntil>iov.first and objUntil<=iov.second) ) covered=
true;
229 return objItr->goToNext();
234 return objItr->hasNext();
246 using IOVHash=std::pair<IOVDbNamespace::IovStore::Iov_t,std::string>;
251 std::vector<IOVHash>
fetchCrestIOVs(cool::ValidityKey since, cool::ValidityKey until);
254 std::vector<IOVHash>
fetchCrestObjects(cool::ValidityKey since, cool::ValidityKey until, cool::ValidityKey vkey);
259 void dumpFile(
const std::string& dumpName
260 ,
const cool::ValidityKey& vkey
264 ,
const cool::ValidityKey crestVkey=0
296 typedef std::pair<cool::ChannelId,cool::ChannelId>
ChanRange;
393 const auto & [cacheStart, cacheStop]=
m_iovs.getCacheBounds();
394 return ((reftime>cacheStart) and (reftime<cacheStop));
boost::shared_ptr< CoraCoolObjectIter > CoraCoolObjectIterPtr
Header for CoralCrestManager class.
uint32_t CLID
The Class ID type.
Basic time unit for IOVSvc.
helper class for IOVDbFolder managing cached iov since/until pairs
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This class is a collection of AttributeLists where each one is associated with a channel number.
const bool m_crestCoolToFile
std::vector< unsigned int > m_cacheccend
std::vector< std::string > m_channames
bool multiVersion() const
coral::AttributeListSpecification * m_cachespec
std::pair< cool::ValidityKey, size_t > IOV2Index
ITagInfoMgr * p_tagInfoMgr
cool::ValidityKey m_cachelength
bool loadCacheIfDbChanged(const cool::ValidityKey vkey, const std::string &globalTag, const cool::IDatabasePtr &dbPtr, const ServiceHandle< IIOVSvc > &iovSvc)
bool objectIteratorIsValid(CoraCoolObjectIterPtr &objItr)
std::vector< IOVHash > fetchCrestObjects(cool::ValidityKey since, cool::ValidityKey until, cool::ValidityKey vkey)
std::vector< coral::AttributeList > m_cacheattr
unsigned int cacheUpdateImplementation(T &obj, const ServiceHandle< IIOVSvc > &iovSvc)
void specialCacheUpdate(CoraCoolObject &obj, const ServiceHandle< IIOVSvc > &iovSvc)
unsigned long long bytesRead() const
void dumpFile(const std::string &dumpName, const cool::ValidityKey &vkey, IOVDbNamespace::Cool2Json *json, bool skipCoolIoV, CoralCrestManager *mng=NULL, const cool::ValidityKey crestVkey=0) const
bool magicTag(std::string &tag)
cool::ValidityKey m_iovoverride
bool iovOverridden() const
IOVDbNamespace::FolderType m_foldertype
std::optional< CoralCrestManager > m_crest_mng
bool objectIteratorIsValid(cool::IObjectIteratorPtr &objItr)
bool fromMetaDataOnly() const
bool overrideOptionsFromParsedDescription(const IOVDbParser &parsedDescription)
cool::ValidityKey iovTime(const IOVTime &reftime) const
void setTagOverride(const std::string &tag, const bool setFlag)
bool addMetaAttrList(const coral::AttributeList &atrlist, const IOVRange &range)
void setCacheLength(const bool timeIs_nsOfEpoch, const unsigned int cacheRun, const unsigned int cacheTime)
std::vector< IOVHash > fetchCrestIOVs(cool::ValidityKey since, cool::ValidityKey until)
unsigned long long m_nbytesread
const std::string & key() const
const IOVRange & currentRange() const
std::vector< cool::ChannelId > m_cachechan
std::string m_folderDescription
IOVDbFolder(IOVDbConn *conn, const IOVDbParser &folderprop, MsgStream &msg, IClassIDSvc *clidsvc, IIOVDbMetaDataTool *metadatatool, const bool checklock, const bool outputToFile=false, const source_t source=source_t::COOLDB, const std::string &crestServer="", const std::string &crestTag="", const bool crestCoolToFile=false)
bool loadCache(const cool::ValidityKey vkey, const unsigned int cacheDiv, const std::string &globalTag, const bool ignoreMissChan)
void setIOVOverride(const unsigned int run, const unsigned int lumiblock, const unsigned int time)
void setDropped(const bool dropped)
std::unique_ptr< SG::TransientAddress > createTransientAddress(const std::vector< std::string > &symlinks)
IIOVDbMetaDataTool * p_metaDataTool
void setFolderDescription(const std::string &description)
std::unique_ptr< SG::TransientAddress > preLoadFolder(ITagInfoMgr *tagInfoMgr, const unsigned int cacheRun, const unsigned int cacheTime)
bool addMetaAttrListColl(const CondAttrListCollection *coll)
std::pair< cool::ChannelId, cool::ChannelId > ChanRange
bool cacheValid(const cool::ValidityKey reftime) const
void addIOVtoCache(cool::ValidityKey since, cool::ValidityKey until)
std::vector< unsigned int > m_cacheccstart
bool getAddress(const cool::ValidityKey reftime, IAddressCreator *persSvc, const unsigned int poolSvcContext, std::unique_ptr< IOpaqueAddress > &address, IOVRange &range, bool &poolPayloadRequested)
bool resolveTag(const cool::IFolderPtr &fptr, const std::string &globalTag)
const source_t & source() const
const std::string & eventStore() const
const bool m_outputToFile
IOVDbNamespace::FolderType folderType() const
std::vector< cool::ChannelId > m_channums
const std::string & joTag() const
std::pair< IOVDbNamespace::IovStore::Iov_t, std::string > IOVHash
unsigned int m_ncacheread
cool::ChannelSelection m_chansel
const std::string & resolvedTag() const
IOVDbNamespace::IovStore m_iovs
void setSharedSpec(const coral::AttributeList &atrlist)
std::vector< ChanRange > m_chanrange
std::string m_crestServer
const std::string & folderName() const
Basic time unit for IOVSvc.
This is a Athena service which manages detector description tag information.
The Athena Transient Store API.
std::vector< TFile * > fptr
std::string description
glabal timer - how long have I taken so far?
int run(int argc, char *argv[])