9#include "GaudiKernel/Bootstrap.h"
10#include "GaudiKernel/IOpaqueAddress.h"
11#include "GaudiKernel/GenericAddress.h"
12#include "GaudiKernel/IAddressCreator.h"
13#include "GaudiKernel/ISvcLocator.h"
16#include "CoolKernel/IObject.h"
17#include "CoolKernel/IObjectIterator.h"
18#include "CoolKernel/IRecord.h"
19#include "CoolKernel/IRecordIterator.h"
20#include "CoralBase/AttributeList.h"
21#include "CoralBase/AttributeListSpecification.h"
22#include "CoralBase/Attribute.h"
23#include "CoralBase/AttributeSpecification.h"
24#include "CoralBase/Blob.h"
25#include "TStopwatch.h"
58#include "CrestApi/CrestApiFs.h"
67 const std::string fileSuffix{
".json"};
75 const bool checklock,
const bool outputToFile,
76 const std::string &
source,
77 const std::string & crestServer,
78 const std::string & crestTag,
79 const bool crestCoolToFile):
115 folderprop.
getKey(
"db",
"",dbconn);
116 if (dbconn.find(
"crest")!=std::string::npos) {
120 const std::string fsPrefix(
"crest_fs:");
121 if (dbconn.starts_with(fsPrefix)) dbconn=dbconn.substr(fsPrefix.size());
127 std::string crestFldrTag;
128 if (folderprop.
getKey(
"ctag",
"",crestFldrTag)) {
141 std::string chanspec;
142 if (folderprop.
getKey(
"channelSelection",
"",chanspec) && !chanspec.empty()) {
151 m_chansel = cool::ChannelSelection(i.first,i.second);
156 }
catch (cool::Exception& e) {
157 ATH_MSG_ERROR(
"defining channel range (must be given in ascending order)");
215 const unsigned int lumiblock,
216 const unsigned int time) {
227 if (
run!=0 || lumiblock!=0) {
229 ATH_MSG_INFO(
"Override run/LB number to [" <<
run <<
":" << lumiblock <<
249 const unsigned int cacheDiv,
250 const std::string& globalTag,
251 const bool ignoreMissChan) {
258 TStopwatch cachetimer;
259 const auto & [cachestart, cachestop] =
m_iovs.getCacheBounds();
261 bool vectorPayload{};
265 vectorPayload =
m_crest_mng.value().isVectorPayload();
280 auto [changedCacheLo, changedCacheHi] =
m_iovs.getCacheBounds();
284 if (cacheq>0) changedCacheLo=vkey - vkey % cacheq;
290 changedCacheLo=vkey & (0x7FFFFFFFLL << 32);
296 if (changedCacheHi>cool::ValidityKeyMax) changedCacheHi=cool::ValidityKeyMax;
301 const auto & [since, until] =
m_iovs.getCacheBounds();
302 ATH_MSG_DEBUG(
"IOVDbFolder:loadCache limits set to [" << since <<
"," << until <<
"]" );
327 bool retrievedone=
false;
332 ATH_MSG_FATAL(
"Conditions database connection " <<
m_conn->name() <<
" cannot be opened - STOP" );
336 unsigned int attempts=0;
338 ATH_MSG_DEBUG(
"loadCache: Expecting to see " << nChannelsExpected <<
" channels" );
340 while (attempts<2 && !retrievedone) {
347 if (not
m_conn->valid())
throw std::runtime_error(
"COOL database pointer invalidated");
353 if (!
resolveTag(folder,globalTag))
return false;
361 auto [since,until] =
m_iovs.getCacheBounds();
363 while (itr->hasNext()) {
387 auto [since,until] =
m_iovs.getCacheBounds();
388 cool::IObjectIteratorPtr itr=folder->browseObjects(since,until,
m_chansel,
m_tag);
397 while (itr->goToNext()) {
398 const cool::IObject&
ref=itr->currentRef();
406 cool::IRecordIterator& pitr=
ref.payloadIterator();
407 const cool::IRecordVectorPtr&
pvec=pitr.fetchAllAsVector();
408 for (cool::IRecordVector::const_iterator vitr=
pvec->begin();vitr!=
pvec->end();++vitr) {
409 const coral::AttributeList& atrlist=(*vitr)->attributeList();
424 const coral::AttributeList& atrlist=
ref.payload().attributeList();
439 }
catch (std::exception& e) {
440 ATH_MSG_WARNING(
"COOL retrieve attempt " << attempts <<
" failed: " << e.what() );
442 if (not
m_conn->dropAndReconnect())
ATH_MSG_ERROR(
"Tried to reconnect in 'loadCache' but failed");
448 unsigned int iadd = 0;
449 auto [since,until] =
m_iovs.getCacheBounds();
453 for(
const auto & [iov, hash] : iovs) {
455 const auto & channelNumbers=
m_crest_mng.value().channelIds(iov.first);
456 for (
auto const & chan: channelNumbers){
459 std::istringstream tokenStream(chan);
460 std::getline(tokenStream, token,
':');
465 for (
const auto & attList:vPayload){
491 const auto & [since,until] =
m_iovs.getCacheBounds();
494 "," << until <<
"]" );
499 const auto & [nChannelsLo, nChannelsHi] =
m_iovs.numberOfIovsOnBoundaries();
500 const auto missing=std::pair<unsigned int, unsigned int>(nChannelsExpected-nChannelsLo, nChannelsExpected-nChannelsHi);
501 ATH_MSG_DEBUG(
"Cache retrieve missing " << missing.first <<
" lower and " << missing.second <<
" upper channels" );
503 const auto & span =
m_iovs.getMinimumStraddlingSpan();
504 const auto & [cacheStart, cacheStop] =
m_iovs.getCacheBounds();
506 if ((missing.first==0 or ignoreMissChan) and
m_iovs.extendCacheLo()){
507 ATH_MSG_DEBUG(
"Lower cache limit extended from " << cacheStart <<
" to " << span.first );
510 if ((missing.second==0 or ignoreMissChan) and
m_iovs.extendCacheHi()){
511 ATH_MSG_DEBUG(
"Upper cache limit extended from " << cacheStop <<
" tp " << span.second );
515 const float timeinc=cachetimer.RealTime();
518 m_iovs.size() <<
" objects stored in" << std::fixed <<
519 std::setw(8) << std::setprecision(2) << timeinc <<
" s" );
524 const std::string& globalTag,
525 const cool::IDatabasePtr& ,
534 unsigned int attempts = 0;
535 bool retrievedone =
false;
538 ATH_MSG_DEBUG(
"loadCacheIfDbChanged: Expecting to see " << nChannelsExpected <<
" channels" );
540 while (attempts<2 && !retrievedone) {
548 if (!
resolveTag(folder,globalTag))
return false;
551 const auto & [since,until] =
m_iovs.getCacheBounds();
567 cool::IObjectIteratorPtr itr=folder->browseObjects(vkey+1, vkey+2,
m_chansel,
m_tag);
569 const cool::IObject&
ref=itr->currentRef();
576 ATH_MSG_DEBUG(
"Need a special update for " << counter <<
" objects " );
578 }
catch (std::exception& e) {
579 ATH_MSG_WARNING(
"COOL retrieve attempt " << attempts <<
" failed: " << e.what() );
580 if (not
m_conn->dropAndReconnect())
ATH_MSG_ERROR(
"Tried reconnecting in loadCacheIfDbChanged but failed");
592 if (StatusCode::SUCCESS != iovSvc->setRange(
clid(),
key(), range,
eventStore())) {
593 ATH_MSG_ERROR(
"IOVDbFolder::specialCacheUpdate - setRange failed for folder "
618 if (StatusCode::SUCCESS != iovSvc->setRange(
clid(),
key(), range,
eventStore())) {
619 ATH_MSG_ERROR(
"IOVDbFolder::specialCacheUpdate - setRange failed for folder "
626 const coral::AttributeList& atrlist =
ref.payload().attributeList();
649 IAddressCreator* persSvc,
650 const unsigned int poolSvcContext,
651 std::unique_ptr<IOpaqueAddress>& address,
652 IOVRange& range,
bool& poolPayloadReq) {
656 std::string strAddress;
660 cool::ValidityKey naystart=0;
661 cool::ValidityKey naystop=cool::ValidityKeyMax;
665 if (not readFromMetaData.
isValid()){
674 range = readFromMetaData.
range();
691 std::tie(naystart, naystop) =
m_iovs.getCacheBounds();
693 for (
unsigned int ic=0; ic!=
m_iovs.size();++ic) {
694 const auto & thisIov =
m_iovs.at(ic);
695 if (thisIov.first<=reftime && reftime<thisIov.second) {
701 strAddress=
"POOLContainer_AthenaAttributeList][CLID=x";
703 strAddress=(
m_cacheattr[ic])[
"PoolRef"].data<std::string>();
719 ATH_MSG_ERROR(
"Writing of CoraCool folders to file metadata not implemented");
726 }
else if (thisIov.second<=reftime && thisIov.second>naystart) {
727 naystart=thisIov.second;
728 }
else if (thisIov.first>reftime && thisIov.first<naystop) {
729 naystop=thisIov.first;
736 std::vector<std::string>::const_iterator nitr=
m_channames.begin();
737 for (std::vector<cool::ChannelId>::const_iterator chitr=
m_channums.begin();
739 attrListColl->
add(*chitr,*nitr);
744 strAddress=
"POOLContainer_CondAttrListCollection][CLID=x";
747 strAddress=
"POOLContainer_CondAttrListVec][CLID=x";
751 ATH_MSG_ERROR(
"COOL object not found in single-channel retrieve, folder "
756 " valid objects found for single-channel retrieve, folder " <<
762 <<
" at IOV " << reftime <<
" channels " << nobj <<
" has range "
769 if (tnaystart > rstart || rstop > tnaystop) {
771 <<
" from [" << rstart <<
":" << rstop <<
"] to ["
772 << tnaystart <<
":" << tnaystop <<
"]" );
773 if (tnaystart > rstart) rstart=tnaystart;
774 if (tnaystop < rstop) rstop=tnaystop;
793 IOpaqueAddress* addrp =
nullptr;
794 if (StatusCode::SUCCESS!=persSvc->createAddress(0,0,strAddress,addrp)) {
795 ATH_MSG_ERROR(
"Could not get IOpaqueAddress from string address "<< strAddress );
798 address = std::unique_ptr<IOpaqueAddress>(addrp);
799 GenericAddress* gAddr=
dynamic_cast<GenericAddress*
>(address.get());
801 ATH_MSG_ERROR(
"Could not cast IOpaqueAddress to GenericAddress");
806 auto addr = std::make_unique<CondAttrListCollAddress>(*gAddr);
807 addr->setAttrListColl(attrListColl);
808 address = std::move(addr);
810 auto addr = std::make_unique<CondAttrListCollAddress>(gAddr->svcType(),
811 gAddr->clID(),gAddr->par()[0],gAddr->par()[1],
812 poolSvcContext,gAddr->ipar()[1]);
814 addr->setAttrListColl(attrListColl);
816 address = std::move(addr);
819 auto addr = std::make_unique<AthenaAttrListAddress>(*gAddr);
820 addr->setAttrList(attrList);
821 address = std::move(addr);
823 auto addr = std::make_unique<CondAttrListVecAddress>(*gAddr);
824 addr->setAttrListVec(attrListVec);
825 address = std::move(addr);
838 << std::setprecision(2) <<
m_readtime <<
" ))s" );
851 if (
auto newkey=parsedDescription.
key(); not newkey.empty() and not
m_jokey) {
853 m_key=std::move(newkey);
862 if (
auto newAddrHeader = parsedDescription.
addressHeader();not newAddrHeader.empty()){
887std::unique_ptr<SG::TransientAddress>
889 auto tad = std::make_unique<SG::TransientAddress>(
m_clid,
m_key);
891 for (
const auto & linkname:symlinks){
892 if (not linkname.empty()) {
894 if (StatusCode::SUCCESS==
p_clidSvc->getIDOfTypeName(linkname,sclid)) {
895 tad->setTransientID(sclid);
898 ATH_MSG_ERROR(
"Could not get clid for symlink: "<< linkname );
906std::unique_ptr<SG::TransientAddress>
960 const auto & linknameVector = folderpar.
symLinks();
972 if (timeIs_nsOfEpoch){
973 long long int clen=600;
982 ATH_MSG_DEBUG(
"Cache length set to " << clen <<
" seconds" );
994 ATH_MSG_DEBUG(
"Cache length set to " <<
run <<
" runs " << lumi <<
" lumiblocks" );
1015 if (tag==
"HEAD")
return true;
1016 if (tag.empty()) tag=globalTag;
1018 ATH_MSG_ERROR(
"No IOVDbSvc.GlobalTag specified on job options or input file" );
1031 const std::vector<std::string>& taglist=
fptr->listTags();
1032 if (
find(taglist.begin(),taglist.end(),tag)!=taglist.end()) {
1038 std::string restag=
fptr->resolveTag(tag);
1042 tag=std::move(restag);
1043 }
catch (cool::Exception& e) {
1044 ATH_MSG_ERROR(
"Tag " << tag <<
" cannot be resolved for folder " <<
m_foldername <<
": " << e.domain() <<
"/" << e.what() );
1052 if (not tagLock.has_value()){
1053 ATH_MSG_ERROR(
"Could not check tag lock status for " << tag );
1056 if (not tagLock.value()){
1057 ATH_MSG_ERROR(
"Tag " << tag <<
" is not locked and IOVDbSvc.CheckLock is set" );
1068 return (not tag.empty());
1080 tmpColl.
add(0xFFFF,atrlist);
1081 tmpColl.
add(0xFFFF,range);
1087 if (!coll)
return false;
1102 m_cachespec=
new coral::AttributeListSpecification;
1103 for (
const auto & attribute:atrlist){
1104 const coral::AttributeSpecification& aspec=attribute.specification();
1108 " in folder " <<
m_foldername <<
" will not be counted for bytes-read statistics" );
1117 ATH_MSG_DEBUG(
"Adding IOV to cache, from "<<since<<
" to "<<until);
1118 m_iovs.addIov(since, until);
1123 const auto & [since,until] =
m_iovs.getCacheBounds();
1127 const auto & iovs =
m_iovs.vectorStore();
1128 std::vector<cool::ChannelId>::iterator ci=
m_cachechan.begin();
1129 for (
const auto & iov:iovs){
1130 ATH_MSG_DEBUG(
"channelID:\t"<<(*ci++)<<
"\t since: "<<iov.first<<
"\t until: "<<iov.second);
1138 std::vector<IOVHash> result;
1141 std::vector<std::pair<cool::ValidityKey,std::string>> crestIOVs =
m_crest_mng.value().getIovsForTag(since,until);
1142 size_t nIOVs = crestIOVs.size();
1143 if(crestIOVs.empty()){
1150 for(
size_t ind=0; ind<nIOVs-1; ++ind) {
1151 result.emplace_back(
IovStore::Iov_t(crestIOVs[ind].first, crestIOVs[ind+1].first),crestIOVs[ind].second);
1154 result.emplace_back(
IovStore::Iov_t(crestIOVs[nIOVs-1].first, cool::ValidityKeyMax),crestIOVs[nIOVs-1].second);
1161 ,
const cool::ValidityKey& vkey
1165 ,
const cool::ValidityKey crestVkey
1168 std::ofstream myFile;
1169 std::string fMain(dumpName);
1171 const std::string fabricatedName=sanitisedFolder+
delimiter+std::to_string(vkey)+fileSuffix;
1172 std::filesystem::create_directory(fMain);
1176 myFile.open(fabricatedName,std::ios::out);
1177 if (not myFile.is_open()) {
1178 std::string errorMessage{
"File creation for "+fabricatedName+
" failed."};
1180 throw std::runtime_error(errorMessage);
1194 myFile<<
json->payload()<<
'\n';
1200 myFile<<
"\"data_array\" : "<<mng->
dumpPayload(crestVkey)<<
'\n';
1207 std::vector<IOVDbFolder::IOVHash> iovHashVect =
fetchCrestIOVs(since,until);
1208 if(iovHashVect.empty() || until<=iovHashVect[0].first.first) {
1209 if(iovHashVect.empty()) {
1219 unsigned indIOVStart = 0;
1220 for(
const auto& iovhash : iovHashVect) {
1221 if(vkey>=iovhash.first.first && vkey<iovhash.first.second)
1225 unsigned indIOVEnd = indIOVStart;
1226 while(indIOVEnd < iovHashVect.size()) {
1227 if(iovHashVect[indIOVEnd].first.first < until
1228 && iovHashVect[indIOVEnd].first.second >= until) {
1233 std::vector<IOVDbFolder::IOVHash> resIovHashVect;
1234 for(
unsigned ind = indIOVStart; ind <= indIOVEnd; ++ind) {
1235 std::vector<uint64_t> resIovs=
m_crest_mng.value().loadPayloadForHash(iovHashVect[ind].first.first,iovHashVect[ind].second);
1236 if(resIovs.size()>1){
1237 uint64_t sTmp=iovHashVect[ind].first.first;
1239 for(
unsigned int i=1;i<resIovs.size();i++){
1241 resIovHashVect.emplace_back(
IovStore::Iov_t(sTmp, uTmp),iovHashVect[ind].second);
1244 if(sTmp!=iovHashVect[ind].first.second){
1245 resIovHashVect.emplace_back(
IovStore::Iov_t(sTmp, iovHashVect[ind].first.second),iovHashVect[ind].second);
1248 else if(resIovs.size()==1){
1249 resIovHashVect.emplace_back(
IovStore::Iov_t(resIovs[0],iovHashVect[ind].first.second),iovHashVect[ind].second);
1255 for(
const auto& iovhash : resIovHashVect) {
1256 if(vkey>=iovhash.first.first && vkey<iovhash.first.second)
1258 if(indIOVStart+1<resIovHashVect.size())
1262 dumpFile(
"crest_dump",vkey,
nullptr,
false,&
m_crest_mng.value(),resIovHashVect[indIOVStart].first.first);
1264 return resIovHashVect;
const std::regex ref(r_ef)
#define ATH_MSG_WARNING(x)
This file contains the class definition for the AthenaAttrListAddress class.
This file contains the class definition for the CondAttrListCollAddress class.
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
This file contains the class definition for the CondAttrListVecAddress class.
A CondAttrListVec is an Athena DataObject holding a vector of CORAL AttributeLists,...
boost::shared_ptr< CoraCoolObject > CoraCoolObjectPtr
boost::shared_ptr< CoraCoolObjectIter > CoraCoolObjectIterPtr
boost::shared_ptr< CoraCoolDatabase > CoraCoolDatabasePtr
boost::shared_ptr< CoraCoolFolder > CoraCoolFolderPtr
uint32_t CLID
The Class ID type.
void setLevel(MSG::Level lvl)
Change the current logging level.
MsgStream & msg() const
The standard message stream.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
An AttributeList represents a logical row of attributes in a metadata table.
This class is a collection of AttributeLists where each one is associated with a channel number.
void addNewStart(const IOVTime &start)
Add new start time to minRange - make sure that start is >= to new start.
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop.
const IOVRange & minRange() const
Current minimal IOVRange.
void addShared(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs with shared data.
void addSlice(const IOVRange &range, const unsigned int chan, const std::vector< coral::AttributeList > &data, const unsigned int datastart, const unsigned int dataend)
const IOVRange & minRange() const
AttrListVec::const_iterator const_iterator
std::string dumpPayload(cool::ValidityKey since)
std::string getPayloadSpec()
const bool m_crestCoolToFile
std::vector< unsigned int > m_cacheccend
std::vector< std::string > m_channames
coral::AttributeListSpecification * m_cachespec
ITagInfoMgr * p_tagInfoMgr
IOVDbFolder(IOVDbConn *conn, const IOVDbParser &folderprop, MsgStream &msg, IClassIDSvc *clidsvc, IIOVDbMetaDataTool *metadatatool, const bool checklock, const bool outputToFile=false, const std::string &source="COOL_DATABASE", const std::string &crestServer="", const std::string &crestTag="", const bool crestCoolToFile=false)
cool::ValidityKey m_cachelength
bool loadCacheIfDbChanged(const cool::ValidityKey vkey, const std::string &globalTag, const cool::IDatabasePtr &dbPtr, const ServiceHandle< IIOVSvc > &iovSvc)
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)
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
IOVDbNamespace::FolderType m_foldertype
std::optional< CoralCrestManager > m_crest_mng
bool objectIteratorIsValid(cool::IObjectIteratorPtr &objItr)
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
std::vector< cool::ChannelId > m_cachechan
std::string m_folderDescription
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)
std::unique_ptr< SG::TransientAddress > createTransientAddress(const std::vector< std::string > &symlinks)
IIOVDbMetaDataTool * p_metaDataTool
std::unique_ptr< SG::TransientAddress > preLoadFolder(ITagInfoMgr *tagInfoMgr, const unsigned int cacheRun, const unsigned int cacheTime)
bool addMetaAttrListColl(const CondAttrListCollection *coll)
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 std::string & eventStore() const
const bool m_outputToFile
std::vector< cool::ChannelId > m_channums
const std::string & source() const
unsigned int m_ncacheread
cool::ChannelSelection m_chansel
IOVDbNamespace::IovStore m_iovs
void setSharedSpec(const coral::AttributeList &atrlist)
std::vector< ChanRange > m_chanrange
std::string m_crestServer
const std::string & folderName() const
std::pair< cool::ValidityKey, cool::ValidityKey > Iov_t
std::vector< std::string > symLinks() const
std::string cache() const
CLID classId(MsgStream &msg) const
bool onlyReadMetadata() const
bool getKey(const std::string &key, const std::string &devvalue, std::string &value) const
original 'getKey' method, now implemented using 'at'
std::string eventStoreName() const
bool timebaseIs_nsOfEpoch() const
unsigned long long iovOverrideValue(MsgStream &msg) const
bool overridesIov(MsgStream &msg) const
return true if this description overrides the timestamp or runlumi
bool noTagOverride() const
std::string addressHeader() const
std::string folderName() const
give the folder name contained in the parsed description
Basic time unit for IOVSvc.
uint64_t timestamp() const noexcept
uint64_t re_time() const noexcept
This is a Athena service which manages detector description tag information.
std::vector< TFile * > fptr
std::string find(const std::string &s)
return a remapped string
static const std::string delimiter("/")
std::string resolveUsingTagInfo(const std::string &tag, const ITagInfoMgr *tagInfoMgr)
FolderType determineFolderType(const std::string &folderDescription, const std::string &spec, const std::vector< cool::ChannelId > &chans)
Determine folder type with optional check using clid service to check clid matches typename.
int countSelectedChannels(const std::vector< cool::ChannelId > &channels, const cool::ChannelSelection &selected)
Count the number of selected channels in a vector of channels according to cool::Channel selection.
std::vector< std::pair< IntType, IntType > > parseChannelSpec(const std::string &chanspecString)
Parse a channel specification string of the format ":3, 65:67,100:120, 130: " into a vector of pairs.
std::string sanitiseFilename(const std::string &fname)
Replace the '/' of a file path with '^'.
std::string folderTypeName(const FolderType f)
Give a string name for the folder type.
unsigned int attributeListSize(const coral::AttributeList &atrlist)
return the size (in bytes) of an AttributeList
std::pair< unsigned long long, unsigned long long > runLumiFromIovTime(const unsigned long long iovTime)
Return a [run,lumi] pair from an IOV time.
bool typeSizeIsKnown(const coral::Attribute &attribute)
Return a bool indicating whether the size of a given Attribute can be determined.
std::pair< bool, std::string > folderMetadata(IOVDbConn *pConnection, const std::string &folderName)
Retrieve (bool) multiversion flag and folder description.
IOVTime makeEpochOrRunLumi(const cool::ValidityKey key, const bool timeIsEpoch)
Create an IOVTime in ns of epoch or run-lumi (determined by the bool) from a ValidityKey.
std::string spaceStrip(const std::string &input)
Trim leading and trailing spaces,return a new trimmed string.
std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > channelList(IOVDbConn *pConnection, const std::string &folderName, const bool named)
Retrieve channel information.
bool replaceServiceType71(std::string &addrHeader)
static const std::string s_delimiterJson
json standard delimiter ', '
unsigned long long iovTimeFromSeconds(const unsigned long long seconds)
Create a long long time in ns from s.
std::optional< bool > checkTagLock(const cool::IFolderPtr &fptr, const std::string &tag)
Check whether a tag is locked on a folder, if possible.
constexpr unsigned long long ALL_LUMI_BLOCKS
All the lumi blocks in one run.
bool looksLikeMagicTag(const std::string &candidateTag)
Looks like it should be magic.
unsigned long long iovTimeFromRunLumi(const unsigned long long run, const unsigned long long lumi)
Create a long long representing the IOV from run, lumi.
static const std::string s_closeJson
json close tag, '}'
IOVRange makeRange(const cool::ValidityKey since, const cool::ValidityKey until, const bool timeIsEpoch)
Make an IOVRange from two validity keys.
static const std::string s_openJson
json open tag, '{'
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.
int run(int argc, char *argv[])