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):
113 folderprop.
getKey(
"db",
"",dbconn);
114 if (dbconn.find(
"crest")!=std::string::npos) {
118 const std::string fsPrefix(
"crest_fs:");
119 if (dbconn.starts_with(fsPrefix)) dbconn=dbconn.substr(fsPrefix.size());
137 std::string chanspec;
138 if (folderprop.
getKey(
"channelSelection",
"",chanspec) && !chanspec.empty()) {
147 m_chansel = cool::ChannelSelection(i.first,i.second);
152 }
catch (cool::Exception& e) {
153 ATH_MSG_ERROR(
"defining channel range (must be given in ascending order)");
211 const unsigned int lumiblock,
212 const unsigned int time) {
223 if (
run!=0 || lumiblock!=0) {
225 ATH_MSG_INFO(
"Override run/LB number to [" <<
run <<
":" << lumiblock <<
245 const unsigned int cacheDiv,
246 const std::string& globalTag,
247 const bool ignoreMissChan) {
254 TStopwatch cachetimer;
255 const auto & [cachestart, cachestop] =
m_iovs.getCacheBounds();
257 bool vectorPayload{};
261 vectorPayload =
m_crest_mng.value().isVectorPayload();
276 auto [changedCacheLo, changedCacheHi] =
m_iovs.getCacheBounds();
280 if (cacheq>0) changedCacheLo=vkey - vkey % cacheq;
286 changedCacheLo=vkey & (0x7FFFFFFFLL << 32);
292 if (changedCacheHi>cool::ValidityKeyMax) changedCacheHi=cool::ValidityKeyMax;
297 const auto & [since, until] =
m_iovs.getCacheBounds();
298 ATH_MSG_DEBUG(
"IOVDbFolder:loadCache limits set to [" << since <<
"," << until <<
"]" );
323 bool retrievedone=
false;
328 ATH_MSG_FATAL(
"Conditions database connection " <<
m_conn->name() <<
" cannot be opened - STOP" );
332 unsigned int attempts=0;
334 ATH_MSG_DEBUG(
"loadCache: Expecting to see " << nChannelsExpected <<
" channels" );
336 while (attempts<2 && !retrievedone) {
343 if (not
m_conn->valid())
throw std::runtime_error(
"COOL database pointer invalidated");
349 if (!
resolveTag(folder,globalTag))
return false;
357 auto [since,until] =
m_iovs.getCacheBounds();
359 while (itr->hasNext()) {
383 auto [since,until] =
m_iovs.getCacheBounds();
384 cool::IObjectIteratorPtr itr=folder->browseObjects(since,until,
m_chansel,
m_tag);
393 while (itr->goToNext()) {
394 const cool::IObject&
ref=itr->currentRef();
402 cool::IRecordIterator& pitr=
ref.payloadIterator();
403 const cool::IRecordVectorPtr&
pvec=pitr.fetchAllAsVector();
404 for (cool::IRecordVector::const_iterator vitr=
pvec->begin();vitr!=
pvec->end();++vitr) {
405 const coral::AttributeList& atrlist=(*vitr)->attributeList();
420 const coral::AttributeList& atrlist=
ref.payload().attributeList();
435 }
catch (std::exception& e) {
436 ATH_MSG_WARNING(
"COOL retrieve attempt " << attempts <<
" failed: " << e.what() );
438 if (not
m_conn->dropAndReconnect())
ATH_MSG_ERROR(
"Tried to reconnect in 'loadCache' but failed");
444 unsigned int iadd = 0;
445 auto [since,until] =
m_iovs.getCacheBounds();
449 for(
const auto & [iov, hash] : iovs) {
451 const auto & channelNumbers=
m_crest_mng.value().channelIds(iov.first);
452 for (
auto const & chan: channelNumbers){
455 std::istringstream tokenStream(chan);
456 std::getline(tokenStream, token,
':');
461 for (
const auto & attList:vPayload){
487 const auto & [since,until] =
m_iovs.getCacheBounds();
490 "," << until <<
"]" );
495 const auto & [nChannelsLo, nChannelsHi] =
m_iovs.numberOfIovsOnBoundaries();
496 const auto missing=std::pair<unsigned int, unsigned int>(nChannelsExpected-nChannelsLo, nChannelsExpected-nChannelsHi);
497 ATH_MSG_DEBUG(
"Cache retrieve missing " << missing.first <<
" lower and " << missing.second <<
" upper channels" );
499 const auto & span =
m_iovs.getMinimumStraddlingSpan();
500 const auto & [cacheStart, cacheStop] =
m_iovs.getCacheBounds();
502 if ((missing.first==0 or ignoreMissChan) and
m_iovs.extendCacheLo()){
503 ATH_MSG_DEBUG(
"Lower cache limit extended from " << cacheStart <<
" to " << span.first );
506 if ((missing.second==0 or ignoreMissChan) and
m_iovs.extendCacheHi()){
507 ATH_MSG_DEBUG(
"Upper cache limit extended from " << cacheStop <<
" tp " << span.second );
511 const float timeinc=cachetimer.RealTime();
514 m_iovs.size() <<
" objects stored in" << std::fixed <<
515 std::setw(8) << std::setprecision(2) << timeinc <<
" s" );
520 const std::string& globalTag,
521 const cool::IDatabasePtr& ,
530 unsigned int attempts = 0;
531 bool retrievedone =
false;
534 ATH_MSG_DEBUG(
"loadCacheIfDbChanged: Expecting to see " << nChannelsExpected <<
" channels" );
536 while (attempts<2 && !retrievedone) {
544 if (!
resolveTag(folder,globalTag))
return false;
547 const auto & [since,until] =
m_iovs.getCacheBounds();
563 cool::IObjectIteratorPtr itr=folder->browseObjects(vkey+1, vkey+2,
m_chansel,
m_tag);
565 const cool::IObject&
ref=itr->currentRef();
572 ATH_MSG_DEBUG(
"Need a special update for " << counter <<
" objects " );
574 }
catch (std::exception& e) {
575 ATH_MSG_WARNING(
"COOL retrieve attempt " << attempts <<
" failed: " << e.what() );
576 if (not
m_conn->dropAndReconnect())
ATH_MSG_ERROR(
"Tried reconnecting in loadCacheIfDbChanged but failed");
588 if (StatusCode::SUCCESS != iovSvc->setRange(
clid(),
key(), range,
eventStore())) {
589 ATH_MSG_ERROR(
"IOVDbFolder::specialCacheUpdate - setRange failed for folder "
614 if (StatusCode::SUCCESS != iovSvc->setRange(
clid(),
key(), range,
eventStore())) {
615 ATH_MSG_ERROR(
"IOVDbFolder::specialCacheUpdate - setRange failed for folder "
622 const coral::AttributeList& atrlist =
ref.payload().attributeList();
645 IAddressCreator* persSvc,
646 const unsigned int poolSvcContext,
647 std::unique_ptr<IOpaqueAddress>& address,
648 IOVRange& range,
bool& poolPayloadReq) {
652 std::string strAddress;
656 cool::ValidityKey naystart=0;
657 cool::ValidityKey naystop=cool::ValidityKeyMax;
661 if (not readFromMetaData.
isValid()){
670 range = readFromMetaData.
range();
687 std::tie(naystart, naystop) =
m_iovs.getCacheBounds();
689 for (
unsigned int ic=0; ic!=
m_iovs.size();++ic) {
690 const auto & thisIov =
m_iovs.at(ic);
691 if (thisIov.first<=reftime && reftime<thisIov.second) {
697 strAddress=
"POOLContainer_AthenaAttributeList][CLID=x";
699 strAddress=(
m_cacheattr[ic])[
"PoolRef"].data<std::string>();
715 ATH_MSG_ERROR(
"Writing of CoraCool folders to file metadata not implemented");
722 }
else if (thisIov.second<=reftime && thisIov.second>naystart) {
723 naystart=thisIov.second;
724 }
else if (thisIov.first>reftime && thisIov.first<naystop) {
725 naystop=thisIov.first;
732 std::vector<std::string>::const_iterator nitr=
m_channames.begin();
733 for (std::vector<cool::ChannelId>::const_iterator chitr=
m_channums.begin();
735 attrListColl->
add(*chitr,*nitr);
740 strAddress=
"POOLContainer_CondAttrListCollection][CLID=x";
743 strAddress=
"POOLContainer_CondAttrListVec][CLID=x";
747 ATH_MSG_ERROR(
"COOL object not found in single-channel retrieve, folder "
752 " valid objects found for single-channel retrieve, folder " <<
758 <<
" at IOV " << reftime <<
" channels " << nobj <<
" has range "
765 if (tnaystart > rstart || rstop > tnaystop) {
767 <<
" from [" << rstart <<
":" << rstop <<
"] to ["
768 << tnaystart <<
":" << tnaystop <<
"]" );
769 if (tnaystart > rstart) rstart=tnaystart;
770 if (tnaystop < rstop) rstop=tnaystop;
789 IOpaqueAddress* addrp =
nullptr;
790 if (StatusCode::SUCCESS!=persSvc->createAddress(0,0,strAddress,addrp)) {
791 ATH_MSG_ERROR(
"Could not get IOpaqueAddress from string address "<< strAddress );
794 address = std::unique_ptr<IOpaqueAddress>(addrp);
795 GenericAddress* gAddr=
dynamic_cast<GenericAddress*
>(address.get());
797 ATH_MSG_ERROR(
"Could not cast IOpaqueAddress to GenericAddress");
802 auto addr = std::make_unique<CondAttrListCollAddress>(*gAddr);
803 addr->setAttrListColl(attrListColl);
804 address = std::move(addr);
806 auto addr = std::make_unique<CondAttrListCollAddress>(gAddr->svcType(),
807 gAddr->clID(),gAddr->par()[0],gAddr->par()[1],
808 poolSvcContext,gAddr->ipar()[1]);
810 addr->setAttrListColl(attrListColl);
812 address = std::move(addr);
815 auto addr = std::make_unique<AthenaAttrListAddress>(*gAddr);
816 addr->setAttrList(attrList);
817 address = std::move(addr);
819 auto addr = std::make_unique<CondAttrListVecAddress>(*gAddr);
820 addr->setAttrListVec(attrListVec);
821 address = std::move(addr);
834 << std::setprecision(2) <<
m_readtime <<
" ))s" );
847 if (
auto newkey=parsedDescription.
key(); not newkey.empty() and not
m_jokey) {
849 m_key=std::move(newkey);
858 if (
auto newAddrHeader = parsedDescription.
addressHeader();not newAddrHeader.empty()){
883std::unique_ptr<SG::TransientAddress>
885 auto tad = std::make_unique<SG::TransientAddress>(
m_clid,
m_key);
887 for (
const auto & linkname:symlinks){
888 if (not linkname.empty()) {
890 if (StatusCode::SUCCESS==
p_clidSvc->getIDOfTypeName(linkname,sclid)) {
891 tad->setTransientID(sclid);
894 ATH_MSG_ERROR(
"Could not get clid for symlink: "<< linkname );
902std::unique_ptr<SG::TransientAddress>
956 const auto & linknameVector = folderpar.
symLinks();
968 if (timeIs_nsOfEpoch){
969 long long int clen=600;
978 ATH_MSG_DEBUG(
"Cache length set to " << clen <<
" seconds" );
990 ATH_MSG_DEBUG(
"Cache length set to " <<
run <<
" runs " << lumi <<
" lumiblocks" );
1011 if (tag==
"HEAD")
return true;
1012 if (tag.empty()) tag=globalTag;
1014 ATH_MSG_ERROR(
"No IOVDbSvc.GlobalTag specified on job options or input file" );
1027 const std::vector<std::string>& taglist=
fptr->listTags();
1028 if (
find(taglist.begin(),taglist.end(),tag)!=taglist.end()) {
1034 std::string restag=
fptr->resolveTag(tag);
1038 tag=std::move(restag);
1039 }
catch (cool::Exception& e) {
1040 ATH_MSG_ERROR(
"Tag " << tag <<
" cannot be resolved for folder " <<
m_foldername <<
": " << e.domain() <<
"/" << e.what() );
1048 if (not tagLock.has_value()){
1049 ATH_MSG_ERROR(
"Could not check tag lock status for " << tag );
1052 if (not tagLock.value()){
1053 ATH_MSG_ERROR(
"Tag " << tag <<
" is not locked and IOVDbSvc.CheckLock is set" );
1064 return (not tag.empty());
1076 tmpColl.
add(0xFFFF,atrlist);
1077 tmpColl.
add(0xFFFF,range);
1083 if (!coll)
return false;
1098 m_cachespec=
new coral::AttributeListSpecification;
1099 for (
const auto & attribute:atrlist){
1100 const coral::AttributeSpecification& aspec=attribute.specification();
1104 " in folder " <<
m_foldername <<
" will not be counted for bytes-read statistics" );
1113 ATH_MSG_DEBUG(
"Adding IOV to cache, from "<<since<<
" to "<<until);
1114 m_iovs.addIov(since, until);
1119 const auto & [since,until] =
m_iovs.getCacheBounds();
1123 const auto & iovs =
m_iovs.vectorStore();
1124 std::vector<cool::ChannelId>::iterator ci=
m_cachechan.begin();
1125 for (
const auto & iov:iovs){
1126 ATH_MSG_DEBUG(
"channelID:\t"<<(*ci++)<<
"\t since: "<<iov.first<<
"\t until: "<<iov.second);
1134 std::vector<IOVHash> result;
1137 std::vector<std::pair<cool::ValidityKey,std::string>> crestIOVs =
m_crest_mng.value().getIovsForTag(since,until);
1138 size_t nIOVs = crestIOVs.size();
1139 if(crestIOVs.empty()){
1146 for(
size_t ind=0; ind<nIOVs-1; ++ind) {
1147 result.emplace_back(
IovStore::Iov_t(crestIOVs[ind].first, crestIOVs[ind+1].first),crestIOVs[ind].second);
1150 result.emplace_back(
IovStore::Iov_t(crestIOVs[nIOVs-1].first, cool::ValidityKeyMax),crestIOVs[nIOVs-1].second);
1157 ,
const cool::ValidityKey& vkey
1161 ,
const cool::ValidityKey crestVkey
1164 std::ofstream myFile;
1165 std::string fMain(dumpName);
1167 const std::string fabricatedName=sanitisedFolder+
delimiter+std::to_string(vkey)+fileSuffix;
1168 std::filesystem::create_directory(fMain);
1172 myFile.open(fabricatedName,std::ios::out);
1173 if (not myFile.is_open()) {
1174 std::string errorMessage{
"File creation for "+fabricatedName+
" failed."};
1176 throw std::runtime_error(errorMessage);
1190 myFile<<
json->payload()<<
'\n';
1196 myFile<<
"\"data_array\" : "<<mng->
dumpPayload(crestVkey)<<
'\n';
1203 std::vector<IOVDbFolder::IOVHash> iovHashVect =
fetchCrestIOVs(since,until);
1204 if(iovHashVect.empty() || until<=iovHashVect[0].first.first) {
1205 if(iovHashVect.empty()) {
1215 unsigned indIOVStart = 0;
1216 for(
const auto& iovhash : iovHashVect) {
1217 if(vkey>=iovhash.first.first && vkey<iovhash.first.second)
1221 unsigned indIOVEnd = indIOVStart;
1222 while(indIOVEnd < iovHashVect.size()) {
1223 if(iovHashVect[indIOVEnd].first.first < until
1224 && iovHashVect[indIOVEnd].first.second >= until) {
1229 std::vector<IOVDbFolder::IOVHash> resIovHashVect;
1230 for(
unsigned ind = indIOVStart; ind <= indIOVEnd; ++ind) {
1231 std::vector<uint64_t> resIovs=
m_crest_mng.value().loadPayloadForHash(iovHashVect[ind].first.first,iovHashVect[ind].second);
1232 if(resIovs.size()>1){
1233 uint64_t sTmp=iovHashVect[ind].first.first;
1235 for(
unsigned int i=1;i<resIovs.size();i++){
1237 resIovHashVect.emplace_back(
IovStore::Iov_t(sTmp, uTmp),iovHashVect[ind].second);
1240 if(sTmp!=iovHashVect[ind].first.second){
1241 resIovHashVect.emplace_back(
IovStore::Iov_t(sTmp, iovHashVect[ind].first.second),iovHashVect[ind].second);
1244 else if(resIovs.size()==1){
1245 resIovHashVect.emplace_back(
IovStore::Iov_t(resIovs[0],iovHashVect[ind].first.second),iovHashVect[ind].second);
1251 for(
const auto& iovhash : resIovHashVect) {
1252 if(vkey>=iovhash.first.first && vkey<iovhash.first.second)
1254 if(indIOVStart+1<resIovHashVect.size())
1258 dumpFile(
"crest_dump",vkey,
nullptr,
false,&
m_crest_mng.value(),resIovHashVect[indIOVStart].first.first);
1260 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[])