Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
IOVDbFolder Class Reference

#include <IOVDbFolder.h>

Inheritance diagram for IOVDbFolder:
Collaboration diagram for IOVDbFolder:

Public Member Functions

 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 bool crestToFile=false, const std::string &crestServer="", const std::string &crestTag="", const bool crestCoolToFile=false)
 
 ~IOVDbFolder ()
 
const std::string & folderName () const
 
const std::string & key () const
 
IOVDbConnconn ()
 
bool multiVersion () const
 
bool timeStamp () const
 
bool tagOverride () const
 
bool retrieved () const
 
bool noOverride () const
 
IOVDbNamespace::FolderType folderType () const
 
bool readMeta () const
 
bool writeMeta () const
 
bool fromMetaDataOnly () const
 
bool extensible () const
 
bool dropped () const
 
bool iovOverridden () const
 
const std::string & joTag () const
 
const std::string & resolvedTag () const
 
const std::string & eventStore () const
 
CLID clid () const
 
unsigned long long bytesRead () const
 
float readTime () const
 
const IOVRangecurrentRange () const
 
void useFileMetaData ()
 
void setFolderDescription (const std::string &description)
 
void setTagOverride (const std::string &tag, const bool setFlag)
 
void setWriteMeta ()
 
void setIOVOverride (const unsigned int run, const unsigned int lumiblock, const unsigned int time)
 
void setDropped (const bool dropped)
 
cool::ValidityKey iovTime (const IOVTime &reftime) const
 
bool cacheValid (const cool::ValidityKey reftime) const
 
bool loadCache (const cool::ValidityKey vkey, const unsigned int cacheDiv, const std::string &globalTag, const bool ignoreMissChan)
 
void resetCache ()
 
bool getAddress (const cool::ValidityKey reftime, IAddressCreator *persSvc, const unsigned int poolSvcContext, std::unique_ptr< IOpaqueAddress > &address, IOVRange &range, bool &poolPayloadRequested)
 
void summary ()
 
std::unique_ptr< SG::TransientAddresspreLoadFolder (ITagInfoMgr *tagInfoMgr, const unsigned int cacheRun, const unsigned int cacheTime)
 
void printCache ()
 
bool loadCacheIfDbChanged (const cool::ValidityKey vkey, const std::string &globalTag, const cool::IDatabasePtr &dbPtr, const ServiceHandle< IIOVSvc > &iovSvc)
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Types

using IOVHash = std::pair< IOVDbNamespace::IovStore::Iov_t, std::string >
 
using IOV2Index = std::pair< cool::ValidityKey, size_t >
 
typedef std::pair< cool::ChannelId, cool::ChannelId > ChanRange
 

Private Member Functions

void clearCache ()
 
bool resolveTag (const cool::IFolderPtr &fptr, const std::string &globalTag)
 
bool magicTag (std::string &tag)
 
bool addMetaAttrList (const coral::AttributeList &atrlist, const IOVRange &range)
 
bool addMetaAttrListColl (const CondAttrListCollection *coll)
 
void setSharedSpec (const coral::AttributeList &atrlist)
 
void addIOVtoCache (cool::ValidityKey since, cool::ValidityKey until)
 
bool overrideOptionsFromParsedDescription (const IOVDbParser &parsedDescription)
 
std::unique_ptr< SG::TransientAddresscreateTransientAddress (const std::vector< std::string > &symlinks)
 
void setCacheLength (const bool timeIs_nsOfEpoch, const unsigned int cacheRun, const unsigned int cacheTime)
 
template<class T >
unsigned int cacheUpdateImplementation (T &obj, const ServiceHandle< IIOVSvc > &iovSvc)
 
bool objectIteratorIsValid (cool::IObjectIteratorPtr &objItr)
 
bool objectIteratorIsValid (CoraCoolObjectIterPtr &objItr)
 
void specialCacheUpdate (CoraCoolObject &obj, const ServiceHandle< IIOVSvc > &iovSvc)
 
void specialCacheUpdate (const cool::IObject &obj, const ServiceHandle< IIOVSvc > &iovSvc)
 
std::vector< IOVHashfetchCrestIOVs (cool::ValidityKey since, cool::ValidityKey until)
 
std::vector< IOVDbNamespace::BasicFolderfetchCrestObjects (cool::ValidityKey since, cool::ValidityKey until, bool vectorPayloadFlag, cool::ValidityKey vkey, const std::string &nodeDesc)
 
void dumpFile (const std::string &dumpName, const cool::ValidityKey &vkey, IOVDbNamespace::Cool2Json *json, bool skipCoolIoV, IOVDbNamespace::BasicFolder *basicFolder, const std::string &crestNodeDescr, const std::string &specString) const
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

ITagInfoMgrp_tagInfoMgr {nullptr}
 
IClassIDSvc * p_clidSvc {nullptr}
 
IIOVDbMetaDataToolp_metaDataTool {nullptr}
 
IOVDbConnm_conn {nullptr}
 
std::string m_foldername
 
std::string m_key
 
std::string m_folderDescription
 
bool m_multiversion {false}
 
bool m_timestamp {false}
 
bool m_tagoverride {false}
 
bool m_notagoverride {false}
 
bool m_writemeta {false}
 
bool m_useFileMetaData {false}
 
bool m_fromMetaDataOnly {false}
 
bool m_extensible {false}
 
bool m_named {false}
 
bool m_iovoverridden {false}
 
bool m_jokey {false}
 
bool m_dropped {false}
 
bool m_autocache {true}
 
bool m_checklock {true}
 
cool::ValidityKey m_iovoverride {0}
 
IOVDbNamespace::FolderType m_foldertype
 
cool::ValidityKey m_cachelength {0}
 
int m_cachehint {0}
 
int m_cacheinc {0}
 
cool::ChannelSelection m_chansel
 
std::vector< ChanRangem_chanrange
 
std::string m_jotag
 
std::string m_tag
 
std::string m_typename
 
std::string m_eventstore
 
std::string m_cachepar
 
std::string m_addrheader
 
CLID m_clid {0}
 
unsigned int m_ndbread {0}
 
unsigned int m_ncacheread {0}
 
unsigned int m_nobjread {0}
 
unsigned long long m_nbytesread {0}
 
float m_readtime {0}
 
unsigned int m_nchan {0}
 
std::vector< cool::ChannelId > m_channums
 
std::vector< std::string > m_channames
 
bool m_retrieved {false}
 
IOVRange m_currange
 
coral::AttributeListSpecification * m_cachespec {nullptr}
 
std::vector< cool::ChannelId > m_cachechan
 
std::vector< coral::AttributeList > m_cacheattr
 
std::vector< unsigned int > m_cacheccstart
 
std::vector< unsigned int > m_cacheccend
 
IOVDbNamespace::IovStore m_iovs
 
const bool m_outputToFile {false}
 
const bool m_crestToFile {false}
 
const bool m_crestCoolToFile {false}
 
const std::string m_source
 
const std::string m_crestServer
 
const std::string m_crestTag
 
std::string m_crest_tag = ""
 
nlohmann::json m_tag_info = nullptr
 
std::optional< IOVDbNamespace::CrestFunctionsm_cfunctions
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 52 of file IOVDbFolder.h.

Member Typedef Documentation

◆ ChanRange

typedef std::pair<cool::ChannelId,cool::ChannelId> IOVDbFolder::ChanRange
private

Definition at line 291 of file IOVDbFolder.h.

◆ IOV2Index

using IOVDbFolder::IOV2Index = std::pair<cool::ValidityKey,size_t>
private

Definition at line 237 of file IOVDbFolder.h.

◆ IOVHash

using IOVDbFolder::IOVHash = std::pair<IOVDbNamespace::IovStore::Iov_t,std::string>
private

Definition at line 236 of file IOVDbFolder.h.

Constructor & Destructor Documentation

◆ IOVDbFolder()

IOVDbFolder::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 bool  crestToFile = false,
const std::string &  crestServer = "",
const std::string &  crestTag = "",
const bool  crestCoolToFile = false 
)

Definition at line 73 of file IOVDbFolder.cxx.

79  :
80  AthMessaging("IOVDbFolder"),
81  p_clidSvc(clidsvc),
82  p_metaDataTool(metadatatool),
83  m_conn(conn),
84  m_checklock(checklock),
87  m_outputToFile{outputToFile},
88  m_crestToFile{crestToFile},
89  m_crestCoolToFile{crestCoolToFile},
92  m_crestTag{crestTag}
93 {
94  // set message same message level as our parent (IOVDbSvc)
95  setLevel(msg.level());
96  // extract settings from the properties
97  // foldername from the 'unnamed' property
98  m_foldername=folderprop.folderName();
99  // SG key from 'key' property, otherwise same as foldername
100  // m_jokey is true if the 'key' property was set - need to remember this
101  // to avoid using folder description <key> if present later
102  m_key=folderprop.key();
103  m_jokey=folderprop.hasKey();
104  // tag from 'tag' property
105  m_jotag=folderprop.tag();
106  // event store from 'eventStoreName' property, default 'StoreGateSvc'
107  m_eventstore=folderprop.eventStoreName();
108  // cachelength (seconds or LB)
109  m_cachepar = folderprop.cache();
110  // check for <noover> - disables using tag override read from input file
111  m_notagoverride=folderprop.noTagOverride();
112  if (m_source == "CREST")
114  if (m_notagoverride) ATH_MSG_INFO( "Inputfile tag override disabled for " << m_foldername );
115 
116  // channel selection from 'channelSelection' property
117  // syntax is A:B,C:D,E:F
118  // :B implies zero lower limit, A: implies zero upper limit
119  std::string chanspec;
120  if (folderprop.getKey("channelSelection","",chanspec) && !chanspec.empty()) {
121  m_chanrange=IOVDbNamespace::parseChannelSpec<cool::ChannelId>(chanspec);
122  // explicit setting of channel selection
123  // push to the channel selection
124  try{
125  bool first(true);
126  for(const auto & i:m_chanrange){
127  if (first){
128  first = false;
129  m_chansel = cool::ChannelSelection(i.first,i.second);
130  } else {
131  m_chansel.addRange(i.first,i.second);
132  }
133  }
134  } catch (cool::Exception& e) {
135  ATH_MSG_ERROR("defining channel range (must be given in ascending order)");
136  throw;
137  }
138  }
139  if (folderprop.overridesIov(msg)){
140  m_iovoverridden=true;
141  m_iovoverride=folderprop.iovOverrideValue(msg);
142  if (m_timestamp){
143  ATH_MSG_INFO( "Override timestamp to " << m_iovoverride << " for folder " << m_foldername );
144  } else {
146  ATH_MSG_INFO( "Override run/LB number to [" << run << ":" << lumi << "] for folder " << m_foldername );
147  }
148  }
149 
151  if (m_fromMetaDataOnly) {
152  ATH_MSG_INFO( "Read from meta data only for folder " << m_foldername );
153  }
154 
155  m_extensible=folderprop.extensible();
156  if (m_extensible) {
157  ATH_MSG_INFO( "Extensible folder " << m_foldername );
158  }
159 
160 }

◆ ~IOVDbFolder()

IOVDbFolder::~IOVDbFolder ( )

Definition at line 162 of file IOVDbFolder.cxx.

162  {
163  if (m_cachespec!=nullptr) m_cachespec->release();
164 }

Member Function Documentation

◆ addIOVtoCache()

void IOVDbFolder::addIOVtoCache ( cool::ValidityKey  since,
cool::ValidityKey  until 
)
private

Definition at line 1153 of file IOVDbFolder.cxx.

1153  {
1154  // add IOV to the cache
1155  ATH_MSG_DEBUG("Adding IOV to cache, from "<<since<<" to "<<until);
1157 }

◆ addMetaAttrList()

bool IOVDbFolder::addMetaAttrList ( const coral::AttributeList &  atrlist,
const IOVRange range 
)
private

Definition at line 1113 of file IOVDbFolder.cxx.

1114  {
1115  // make a temporary CondAttrListCollection with channel 0xFFFF
1116  // This channel number is used to flag on readback that an
1117  // AthenaAttributeList and not a CondAttrListCollection must be created
1119  tmpColl.add(0xFFFF,atrlist);
1120  tmpColl.add(0xFFFF,range);
1121  return addMetaAttrListColl(&tmpColl);
1122 }

◆ addMetaAttrListColl()

bool IOVDbFolder::addMetaAttrListColl ( const CondAttrListCollection coll)
private

Definition at line 1125 of file IOVDbFolder.cxx.

1125  {
1126  // send given payload to folder metadata
1127  // make a new CondAttrListCollection for the payload
1128  CondAttrListCollection* flmdColl=new CondAttrListCollection(*coll);
1129  if (StatusCode::SUCCESS!=p_metaDataTool->addPayload(m_foldername,flmdColl)) {
1130  ATH_MSG_ERROR( "addMetaAttrList: Failed to write metadata for folder " << m_foldername);
1131  return false;
1132  } else {
1133  ATH_MSG_DEBUG( "addMetaAttrList: write metadata for folder " << m_foldername );
1134  return true;
1135  }
1136 }

◆ bytesRead()

unsigned long long IOVDbFolder::bytesRead ( ) const
inline

Definition at line 379 of file IOVDbFolder.h.

380 { return m_nbytesread; }

◆ cacheUpdateImplementation()

template<class T >
unsigned int IOVDbFolder::cacheUpdateImplementation ( T &  obj,
const ServiceHandle< IIOVSvc > &  iovSvc 
)
inlineprivate

Definition at line 177 of file IOVDbFolder.h.

177  {
178  const auto & objSince = obj.since();
179  const auto & objUntil = obj.until();
180  const auto & objChannel = obj.channelId();
181  ATH_MSG_DEBUG("from DB \t chID: "<<objChannel<<"\tobjstart:\t"<<objSince<<"\t objstop: \t"
182  << objUntil );
183  // The covered flag is used to check whether the
184  // requested IOV time is inside the range covered
185  // by the current cache. If not, a cache reset
186  // will be done.
187  unsigned int counter{};
188  bool covered{false};
189  //find the iterator distance into the channel array which gives the sought ChannelId
190  const auto pCacheChannel = std::find(m_cachechan.begin(), m_cachechan.end(), objChannel);
191  if (pCacheChannel != m_cachechan.end()){
192  //find corresponding iov, which we shall modify
193  const auto iovIdx = std::distance(m_cachechan.begin(), pCacheChannel);
194  const auto & iov = m_iovs.at(iovIdx);
195  if ((iov.first < objSince) and (objSince < iov.second)){
196  // obj time is larger than cache start (and less than cache stop)
197  // ==> update cache
198  ++counter;
199  ATH_MSG_DEBUG("special reload needed on THIS ONE !!!!!!!!!!!");
200  // just change existing IOVRange
201  ATH_MSG_DEBUG("changing "<<iov.second<<" to "<<objSince-1);
202  m_iovs.extendIov(iovIdx, objSince-1);
203  specialCacheUpdate(obj, iovSvc); // reset proxy, add to cache, addIOV
204  covered = true;
205  }
206  if ( (objSince>=iov.first and objSince<iov.second) or (objUntil>iov.first and objUntil<=iov.second) ) covered=true;
207  }
208  if (!covered) {
209  // cache range has not been covered, so update the cache
210  ++counter;
211  specialCacheUpdate(obj, iovSvc);
212  }
213  return counter;
214  }

◆ cacheValid()

bool IOVDbFolder::cacheValid ( const cool::ValidityKey  reftime) const
inline

Definition at line 387 of file IOVDbFolder.h.

387  {
388  const auto & [cacheStart, cacheStop]=m_iovs.getCacheBounds();
389  return ((reftime>cacheStart) and (reftime<cacheStop));
390 }

◆ clearCache()

void IOVDbFolder::clearCache ( )
private

Definition at line 1038 of file IOVDbFolder.cxx.

1038  {
1039  // clear all the cache vectors of information
1040  m_iovs.clear();
1041  m_cachechan.clear();
1042  m_cacheattr.clear();
1043  m_cacheccstart.clear();
1044  m_cacheccend.clear();
1045 }

◆ clid()

CLID IOVDbFolder::clid ( ) const
inline

Definition at line 377 of file IOVDbFolder.h.

377 { return m_clid; }

◆ conn()

IOVDbConn * IOVDbFolder::conn ( )
inline

Definition at line 340 of file IOVDbFolder.h.

340 { return m_conn;}

◆ createTransientAddress()

std::unique_ptr< SG::TransientAddress > IOVDbFolder::createTransientAddress ( const std::vector< std::string > &  symlinks)
private

Definition at line 874 of file IOVDbFolder.cxx.

874  {
875  auto tad = std::make_unique<SG::TransientAddress>(m_clid,m_key);
876  //
877  for (const auto & linkname:symlinks){
878  if (not linkname.empty()) {
879  CLID sclid;
880  if (StatusCode::SUCCESS==p_clidSvc->getIDOfTypeName(linkname,sclid)) {
881  tad->setTransientID(sclid);
882  ATH_MSG_DEBUG( "Setup symlink " << linkname << " CLID " <<sclid << " for folder " << m_foldername );
883  } else {
884  ATH_MSG_ERROR( "Could not get clid for symlink: "<< linkname );
885  return nullptr;
886  }
887  }
888  }
889  return tad;
890 }

◆ currentRange()

const IOVRange & IOVDbFolder::currentRange ( ) const
inline

Definition at line 385 of file IOVDbFolder.h.

385 { return m_currange; }

◆ dropped()

bool IOVDbFolder::dropped ( ) const
inline

Definition at line 366 of file IOVDbFolder.h.

366 { return m_dropped; }

◆ dumpFile()

void IOVDbFolder::dumpFile ( const std::string &  dumpName,
const cool::ValidityKey &  vkey,
IOVDbNamespace::Cool2Json json,
bool  skipCoolIoV,
IOVDbNamespace::BasicFolder basicFolder,
const std::string &  crestNodeDescr,
const std::string &  specString 
) const
private

Definition at line 1209 of file IOVDbFolder.cxx.

1216 {
1217  std::ofstream myFile;
1218  std::string fMain(dumpName);
1219  const std::string sanitisedFolder=fMain+"/"+sanitiseFilename(m_foldername);
1220  const std::string fabricatedName=sanitisedFolder+delimiter+std::to_string(vkey)+fileSuffix;
1221  std::filesystem::create_directory(fMain);
1222  myFile.open(fabricatedName,std::ios::out);
1223  if (not myFile.is_open()) {
1224  std::string errorMessage{"File creation for "+fabricatedName+" failed."};
1225  ATH_MSG_FATAL(errorMessage);
1226  throw std::runtime_error(errorMessage);
1227  }
1228  else {
1229  ATH_MSG_INFO("File "<<fabricatedName<<" created.");
1230  }
1231 
1232  myFile<<s_openJson;
1233  if(json) {
1234  // Dump COOL data
1235  myFile<<json->description()<<s_delimiterJson<<std::endl;
1236  myFile<<json->payloadSpec()<<s_delimiterJson<<std::endl;
1237  if(!skipCoolIoV) {
1238  myFile<<json->iov()<<s_delimiterJson<<std::endl;
1239  }
1240  myFile<<json->payload()<<std::endl;
1241  }
1242  else {
1243  // Dump CREST data
1244  std::string newNodeDescription = std::regex_replace(crestNodeDescr, std::regex("\""), "\\\"");
1245  std::string newSpecString = std::regex_replace(specString, std::regex(":"), ": ");
1246  newSpecString = std::regex_replace(newSpecString, std::regex(","), s_delimiterJson);
1247  myFile<<"\"node_description\" : \""<<newNodeDescription<< '\"'<<s_delimiterJson<<std::endl;
1248  myFile<<"\"folder_payloadspec\": \""<<newSpecString<< '\"'<<s_delimiterJson<<std::endl;
1249  myFile<<basicFolder->jsonPayload(newNodeDescription,newSpecString)<<std::endl;
1250  }
1251  myFile<<s_closeJson;
1252 }

◆ eventStore()

const std::string & IOVDbFolder::eventStore ( ) const
inline

Definition at line 374 of file IOVDbFolder.h.

375 { return m_eventstore; }

◆ extensible()

bool IOVDbFolder::extensible ( ) const
inline

Definition at line 364 of file IOVDbFolder.h.

364 { return m_extensible; }

◆ fetchCrestIOVs()

std::vector< IOVDbFolder::IOVHash > IOVDbFolder::fetchCrestIOVs ( cool::ValidityKey  since,
cool::ValidityKey  until 
)
private

Definition at line 1174 of file IOVDbFolder.cxx.

1175 {
1176  std::vector<IOVHash> result;
1177 
1178  // Get a vector of pairs retrieved from crest
1179  auto crestIOVs = m_cfunctions.value().getIovsForTag(m_crestTag, since, until);
1180  if(crestIOVs.empty()){
1181  ATH_MSG_WARNING("Load cache failed for " << m_foldername << ". No IOVs retrieved from the DB");
1182  return result;
1183  }
1184  std::vector<IOV2Index> iov2IndexVect; // Temporary vector for sorting IOV_SINCE values
1185  iov2IndexVect.reserve(crestIOVs.size());
1186  size_t hashInd{0};
1187  for(const auto& crestIOV : crestIOVs) {
1188  iov2IndexVect.emplace_back(std::stoull(crestIOV.first),hashInd++);
1189  }
1190 
1191  size_t nIOVs = iov2IndexVect.size();
1192  result.reserve(nIOVs);
1193  if(nIOVs>0) {
1194  if(nIOVs>1) {
1195  for(size_t ind=0; ind<nIOVs-1; ++ind) {
1196  result.emplace_back(IovStore::Iov_t(iov2IndexVect[ind].first
1197  , iov2IndexVect[ind+1].first)
1198  , crestIOVs[iov2IndexVect[ind].second].second);
1199  }
1200  }
1201  result.emplace_back(IovStore::Iov_t(iov2IndexVect[nIOVs-1].first
1202  , cool::ValidityKeyMax)
1203  , crestIOVs[iov2IndexVect[nIOVs-1].second].second);
1204  }
1205 
1206  return result;
1207 }

◆ fetchCrestObjects()

std::vector< BasicFolder > IOVDbFolder::fetchCrestObjects ( cool::ValidityKey  since,
cool::ValidityKey  until,
bool  vectorPayloadFlag,
cool::ValidityKey  vkey,
const std::string &  nodeDesc 
)
private

Definition at line 1254 of file IOVDbFolder.cxx.

1259 {
1260 
1261  std::string crestPayloadType="crest-json-single-iov";
1262  nlohmann::json tagProperties = m_cfunctions.value().getTagProperties(m_crestTag);
1263  if(tagProperties!=nullptr
1264  && tagProperties.contains("payloadSpec")) {
1265  crestPayloadType=tagProperties["payloadSpec"].get<std::string>();
1266  }
1267 
1268  if(crestPayloadType.compare("crest-json-multi-iov")==0) {
1269 /*
1270  try {
1271  nlohmann::json multiPayload = nlohmann::json::parse(reply);
1272  nlohmann::json jsIovs=multiPayload["obj"];
1273  std::vector<IOV2Index> iov2IndexVect;
1274  iov2IndexVect.reserve(jsIovs.size());
1275  size_t hashInd{0};
1276  for(const auto& jsIov : jsIovs.items()) {
1277  iov2IndexVect.emplace_back(std::stoull(jsIov.key()),hashInd++);
1278  }
1279  std::sort(iov2IndexVect.begin(),iov2IndexVect.end(),
1280  [](const IOV2Index& a, const IOV2Index& b)
1281  {
1282  return a.first < b.first;
1283  });
1284  if(vkey < iov2IndexVect[0].first) {
1285  std::string errorMessage{"Load cache failed for "+m_foldername+". No valid IOV retrieved from the payload"};
1286  ATH_MSG_FATAL(errorMessage);
1287  throw std::runtime_error{errorMessage};
1288  }
1289 
1290  uint64_t iov = 0;
1291  for(const auto& iovhash : iov2IndexVect) {
1292  if(vkey >= iovhash.first) {
1293  iov=iovhash.first;
1294  continue;
1295  }
1296  else {
1297  break;
1298  }
1299  }
1300  if (indIOV>=0){
1301  iovHashVect[indIOV].first.first=iov;
1302  nlohmann::json payload={};
1303  payload["data"]=jsIovs[std::to_string(iov)];
1304  reply=payload.dump();
1305  } else {
1306  ATH_MSG_FATAL("indIOV is negative in IOVDbFolder::dumpFile");
1307  }
1308  }
1309  catch (std::exception & e) {
1310  std::string errorMessage = "Failed of parse multi iovs struct of internal iovs from payload for DCS type: " + std::string{e.what()};
1311  ATH_MSG_FATAL(errorMessage);
1312  throw std::runtime_error{errorMessage};
1313  }
1314  }
1315  ATH_MSG_DEBUG("Found IOV for " << m_foldername << " and VKEY " << vkey
1316  << " " << iovHashVect[indIOV].first);
1317 
1318  if (m_crestToFile and (indIOV>=0)) { //indIOV must be >=0, it's used as a vector index in this block
1319  unsigned long long sinceT = iovHashVect[indIOV].first.first;
1320 
1321  std::string crest_work_dir=std::filesystem::current_path();
1322  crest_work_dir += "/crest_data";
1323  bool crest_rewrite = true;
1324  Crest::CrestClient crestFSClient = Crest::CrestClient(crest_rewrite, crest_work_dir);
1325 
1326  nlohmann::json js =
1327  {
1328  {"name", m_crestTag}
1329  };
1330 
1331  try{
1332  crestFSClient.createTag(js);
1333  ATH_MSG_INFO("Tag " << m_crestTag << " saved to disk.");
1334  ATH_MSG_INFO("CREST Dump dir = " << crest_work_dir);
1335  }
1336  catch (const std::exception& e) {
1337  ATH_MSG_WARNING("Data saving for tag " << m_crestTag << " failed: " << e.what());
1338  }
1339 
1340  try{
1341  crestFSClient.storePayloadDump(m_crestTag, sinceT, reply);
1342  ATH_MSG_INFO("Data (payload and IOV) saved for tag " << m_crestTag << ".");
1343  }
1344  catch (const std::exception& e) {
1345  ATH_MSG_WARNING("Data (payload and IOV) saving for tag " << m_crestTag<<" failed; " << e.what());
1346  }
1347  }
1348 
1349  const std::string& specString = cfunctions.getTagInfoElement(m_tag_info,"payload_spec");
1350  if (specString.empty()) {
1351  std::string errorMessage = "Reading payload spec from "+m_foldername+" failed.";
1352 */
1353  // Support for this type of payload will be added later
1354  std::string errorMessage = m_foldername + ": has multi-iov payload. Folders with multi-iov payloads currently not supported!";
1355  ATH_MSG_FATAL(errorMessage);
1356  throw std::runtime_error{errorMessage};
1357  }
1358  const std::string specString = m_cfunctions.value().getTagInfoElement(m_tag_info,"payload_spec");
1359  if (specString.empty()) {
1360  std::string errorMessage = "Reading payload spec from " + m_foldername + " failed.";
1361  ATH_MSG_FATAL(errorMessage);
1362  throw std::runtime_error{errorMessage};
1363  }
1364 
1365  std::vector<BasicFolder> retVector;
1366 
1367  // Vector of non-overlapping IOVs + corresponding Hashes
1368  std::vector<IOVHash> iovHashVect = fetchCrestIOVs(since, until);
1369 
1370  if(iovHashVect.empty() || until<=iovHashVect[0].first.first) {
1371  if(iovHashVect.empty()) {
1372  ATH_MSG_INFO("NO IOVs retrieved for the folder "+ m_foldername);
1373  }
1374  else {
1375  ATH_MSG_INFO("Cache boundaries outside available IOVs for the folder "+ m_foldername);
1376  }
1377  BasicFolder basicFolder;
1378  basicFolder.setVectorPayloadFlag(vectorPayloadFlag);
1379  retVector.push_back(basicFolder);
1380  return retVector;
1381  }
1382 
1383  unsigned indIOVStart = 0;
1384  for(const auto& iovhash : iovHashVect) {
1385  if(since < iovhash.first.first) break; // 'since' is earlier that the first IOV segment. indIOVStart=0
1386  if(since < iovhash.first.second
1387  && since >= iovhash.first.first) {
1388  break;
1389  }
1390  ++indIOVStart;
1391  }
1392  unsigned indIOVEnd = indIOVStart;
1393  while(indIOVEnd < iovHashVect.size()) {
1394  if(iovHashVect[indIOVEnd].first.first < until
1395  && iovHashVect[indIOVEnd].first.second >= until) {
1396  break;
1397  }
1398  ++indIOVEnd;
1399  }
1400 
1401  for(unsigned ind = indIOVStart; ind <= indIOVEnd; ++ind) {
1402  std::string reply = m_cfunctions.value().getPayloadForHash(iovHashVect[ind].second);
1403 
1404  if (m_crestToFile) {
1405  unsigned long long sinceT = iovHashVect[ind].first.first;
1406 
1407  std::string crest_work_dir=std::filesystem::current_path();
1408  crest_work_dir += "/crest_data";
1409  bool crest_rewrite = true;
1410  Crest::CrestApiFs crestFSClient = Crest::CrestApiFs(crest_rewrite, crest_work_dir);
1411 
1412  nlohmann::json js =
1413  {
1414  {"description", "none"},
1415  {"endOfValidity", 0},
1416  {"lastValidatedTime", 0},
1417  {"name", m_crestTag},
1418  {"payloadSpec", "none"},
1419  {"synchronization", "none"},
1420  {"timeType", "time"}};
1421 
1422  TagDto dto = TagDto();
1423  dto = dto.fromJson(js);
1424 
1425  try{
1426  crestFSClient.createTag(dto);
1427 
1428  ATH_MSG_INFO("Tag " << m_crestTag << " saved to disk.");
1429  ATH_MSG_INFO("CREST Dump dir = " << crest_work_dir);
1430  }
1431  catch (const std::exception& e) {
1432  ATH_MSG_WARNING("Data saving for tag " << m_crestTag << " failed: " << e.what());
1433  }
1434 
1435  uint64_t endtime = 0;
1436  nlohmann::json elem =
1437  {
1438  {"since", sinceT},
1439  {"data", reply},
1440  {"streamerInfo", "none"}
1441  };
1442 
1443  nlohmann::json jResources = json::array();
1444  jResources.push_back(elem);
1445 
1446  nlohmann::json jsStoreSet=
1447  {
1448  {"size", 1},
1449  {"datatype", "data"},
1450  {"format", "StoreSetDto"},
1451  {"resources", jResources}
1452  };
1453 
1454  StoreSetDto storeSetDto = StoreSetDto::fromJson(jsStoreSet);
1455 
1456  try{
1457  crestFSClient.storeData(m_crestTag, storeSetDto, "JSON", "test", "test", "1", endtime);
1458 
1459  ATH_MSG_INFO("Data (payload and IOV) saved for tag " << m_crestTag << ".");
1460  }
1461  catch (const std::exception& e) {
1462  ATH_MSG_WARNING("Data (payload and IOV) saving for tag " << m_crestTag<<" failed; " << e.what());
1463  }
1464  }
1465 
1466  //basic folder now contains the info
1467  BasicFolder basicFolder;
1468  basicFolder.setVectorPayloadFlag(vectorPayloadFlag);
1469  std::istringstream ss(reply);
1470  Json2Cool inputJson(ss, basicFolder, specString, &(iovHashVect[ind].first));
1471  if (basicFolder.empty()){
1472  std::string errorMessage = "Reading channel data from "+m_foldername+" failed.";
1473  ATH_MSG_FATAL(errorMessage);
1474  throw std::runtime_error{errorMessage};
1475  }
1476 
1477  if(m_crestCoolToFile) {
1478  dumpFile("crest_dump",vkey,nullptr,false,&basicFolder,nodeDesc,specString);
1479  }
1480 
1481  retVector.push_back(basicFolder);
1482  }
1483  return retVector;
1484 }

◆ folderName()

const std::string & IOVDbFolder::folderName ( ) const
inline

Definition at line 337 of file IOVDbFolder.h.

337 {return m_foldername;}

◆ folderType()

IOVDbNamespace::FolderType IOVDbFolder::folderType ( ) const
inline

Definition at line 352 of file IOVDbFolder.h.

353 {return m_foldertype;}

◆ fromMetaDataOnly()

bool IOVDbFolder::fromMetaDataOnly ( ) const
inline

Definition at line 362 of file IOVDbFolder.h.

362 { return m_fromMetaDataOnly; }

◆ getAddress()

bool IOVDbFolder::getAddress ( const cool::ValidityKey  reftime,
IAddressCreator *  persSvc,
const unsigned int  poolSvcContext,
std::unique_ptr< IOpaqueAddress > &  address,
IOVRange range,
bool &  poolPayloadRequested 
)

Definition at line 634 of file IOVDbFolder.cxx.

638  {
639 
640  ++m_ncacheread;
641  // will produce strAddress and one pointer type depending on folder data
642  std::string strAddress;
643  AthenaAttributeList* attrList=nullptr;
644  CondAttrListCollection* attrListColl=nullptr;
645  CondAttrListVec* attrListVec=nullptr;
646  cool::ValidityKey naystart=0;
647  cool::ValidityKey naystop=cool::ValidityKeyMax;
648  if( m_useFileMetaData ) {
650  readFromMetaData(m_foldername, p_metaDataTool, reftime, m_timestamp);
651  if (not readFromMetaData.isValid()){
652  ATH_MSG_ERROR( "read:Could not find IOVPayloadContainer for folder "<< m_foldername );
653  return false;
654  }
655  // read from file metadata
656  m_foldertype=readFromMetaData.folderType();
657  m_nobjread+=readFromMetaData.numberOfObjects();
658  poolPayloadReq=readFromMetaData.poolPayloadRequested();
659  strAddress = readFromMetaData.stringAddress();
660  range = readFromMetaData.range();
661  attrList = readFromMetaData.attributeList();
662  attrListColl = readFromMetaData.attrListCollection();
663  ATH_MSG_DEBUG( "Read file metadata for folder " << m_foldername << " foldertype is " << m_foldertype );
664  } else {
665  // COOL/CoraCool data to be read from cache
666  // for AttrListColl or PoolRefColl, need a CondAttrListCollection ready
667  // to receive the data
669  attrListColl=new CondAttrListCollection(!m_timestamp);
670  } else if (m_foldertype==CoraCool || m_foldertype==CoolVector) {
671  // for CoraCool/CoolVector, assume we will get everything in the cache
672  attrListVec=new CondAttrListVec(!m_timestamp, m_cacheattr.size());
673  }
674  // loop over cached data
675  unsigned int nobj=0;
676  // keep track of closest neighbouring IOVs
677  std::tie(naystart, naystop) = m_iovs.getCacheBounds();
678 
679  for (unsigned int ic=0; ic!=m_iovs.size();++ic) {
680  const auto & thisIov = m_iovs.at(ic);
681  if (thisIov.first<=reftime && reftime<thisIov.second) {
682  ++nobj;
684  // retrieve of AthenaAttributeList or single PoolRef
685  if (m_foldertype==AttrList) {
686  attrList=new AthenaAttributeList(m_cacheattr[ic]);
687  strAddress="POOLContainer_AthenaAttributeList][CLID=x";
688  } else {
689  strAddress=(m_cacheattr[ic])["PoolRef"].data<std::string>();
690  }
691  range=IOVDbNamespace::makeRange(thisIov.first,thisIov.second, m_timestamp);
692  // write meta-data if required
693  if (m_writemeta)
694  if (!addMetaAttrList(m_cacheattr[ic],range)) return false;
696  // retrieve of CondAttrListCollection
697  attrListColl->addShared(m_cachechan[ic],m_cacheattr[ic]);
698  attrListColl->add(m_cachechan[ic],IOVDbNamespace::makeRange(thisIov.first,thisIov.second, m_timestamp));
699  } else if (m_foldertype==CoraCool || m_foldertype==CoolVector) {
700  // retrieval of CoraCool data
701  attrListVec->addSlice(IOVDbNamespace::makeRange(thisIov.first,thisIov.second, m_timestamp),
704  if (m_writemeta) {
705  ATH_MSG_ERROR( "Writing of CoraCool folders to file metadata not implemented");
706  return false;
707  }
708  } else {
709  ATH_MSG_ERROR( "Unhandled folder type " << m_foldertype);
710  return false;
711  }
712  } else if (thisIov.second<=reftime && thisIov.second>naystart) {
713  naystart=thisIov.second;
714  } else if (thisIov.first>reftime && thisIov.first<naystop) {
715  naystop=thisIov.first;
716  }
717  }
718  // post-loop actions
720  // set up channel names if required
721  if (m_named) {
722  std::vector<std::string>::const_iterator nitr=m_channames.begin();
723  for (std::vector<cool::ChannelId>::const_iterator chitr=m_channums.begin();
724  chitr!=m_channums.end(); ++chitr,++nitr) {
725  attrListColl->add(*chitr,*nitr);
726  }
727  }
728  // set range
729  range=attrListColl->minRange();
730  strAddress="POOLContainer_CondAttrListCollection][CLID=x";
731  } else if (m_foldertype==CoraCool || m_foldertype==CoolVector) {
732  range=attrListVec->minRange();
733  strAddress="POOLContainer_CondAttrListVec][CLID=x";
734  } else if (m_foldertype==AttrList || m_foldertype==PoolRef) {
735  // single object retrieve - should have exactly one object
736  if (nobj==0) {
737  ATH_MSG_ERROR("COOL object not found in single-channel retrieve, folder "
738  << m_foldername << " currentTime " << reftime );
739  return false;
740  } else if (nobj>1) {
741  ATH_MSG_ERROR( nobj <<
742  " valid objects found for single-channel retrieve, folder " <<
743  m_foldername << " currentTime " << reftime );
744  return false;
745  }
746  }
747  ATH_MSG_DEBUG( "Retrieved object: folder " << m_foldername
748  << " at IOV " << reftime << " channels " << nobj << " has range "
749  << range );
750  // shrink range so it does not extend into 'gap' channels or outside cache
751  IOVTime tnaystart=makeEpochOrRunLumi(naystart, m_timestamp);
752  IOVTime tnaystop=makeEpochOrRunLumi(naystop, m_timestamp);
753  IOVTime rstart=range.start();
754  IOVTime rstop=range.stop();
755  if (tnaystart > rstart || rstop > tnaystop) {
756  ATH_MSG_DEBUG( "Shrink IOV range for " << m_foldername
757  << " from [" << rstart << ":" << rstop << "] to ["
758  << tnaystart << ":" << tnaystop << "]" );
759  if (tnaystart > rstart) rstart=tnaystart;
760  if (tnaystop < rstop) rstop=tnaystop;
761  range=IOVRange(rstart,rstop);
763  attrListColl->addNewStart(rstart);
764  attrListColl->addNewStop(rstop);
765  }
766  }
767  }
768  // save the range for possible later lookup in IOVDbSvc::getKeyInfo
770  m_retrieved=true;
771  // write metadata for attrListColl if required (after range shrinking)
772  if (m_writemeta &&
774  if (!addMetaAttrListColl(attrListColl)) return false;
775  }
776 
777  // turn the data into an IOpaqueAddress
778  strAddress=m_addrheader+strAddress;
779  IOpaqueAddress* addrp = nullptr;
780  if (StatusCode::SUCCESS!=persSvc->createAddress(0,0,strAddress,addrp)) {
781  ATH_MSG_ERROR( "Could not get IOpaqueAddress from string address "<< strAddress );
782  return false;
783  }
784  address = std::unique_ptr<IOpaqueAddress>(addrp);
785  GenericAddress* gAddr=dynamic_cast<GenericAddress*>(address.get());
786  if (!gAddr) {
787  ATH_MSG_ERROR( "Could not cast IOpaqueAddress to GenericAddress");
788  return false;
789  }
790  // create a new GenericAddress to set pool context
791  if (m_foldertype==AttrListColl) {
792  auto addr = std::make_unique<CondAttrListCollAddress>(*gAddr);
793  addr->setAttrListColl(attrListColl);
794  address = std::move(addr);
795  } else if (m_foldertype==PoolRefColl || m_foldertype==PoolRef) {
796  auto addr = std::make_unique<CondAttrListCollAddress>(gAddr->svcType(),
797  gAddr->clID(),gAddr->par()[0],gAddr->par()[1],
798  poolSvcContext,gAddr->ipar()[1]);
799  if (m_foldertype==PoolRefColl) {
800  addr->setAttrListColl(attrListColl);
801  }
802  address = std::move(addr);
803  poolPayloadReq=true;
804  } else if (m_foldertype==AttrList) {
805  auto addr = std::make_unique<AthenaAttrListAddress>(*gAddr);
806  addr->setAttrList(attrList);
807  address = std::move(addr);
808  } else if (m_foldertype==CoraCool || m_foldertype==CoolVector) {
809  auto addr = std::make_unique<CondAttrListVecAddress>(*gAddr);
810  addr->setAttrListVec(attrListVec);
811  address = std::move(addr);
812  }
813  return true;
814 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ iovOverridden()

bool IOVDbFolder::iovOverridden ( ) const
inline

Definition at line 368 of file IOVDbFolder.h.

368 { return m_iovoverridden; }

◆ iovTime()

cool::ValidityKey IOVDbFolder::iovTime ( const IOVTime reftime) const

Definition at line 217 of file IOVDbFolder.cxx.

217  {
218  if (m_iovoverridden) {
219  return m_iovoverride;
220  } else {
221  return (m_timestamp ? reftime.timestamp() : reftime.re_time());
222  }
223 }

◆ joTag()

const std::string & IOVDbFolder::joTag ( ) const
inline

Definition at line 370 of file IOVDbFolder.h.

370 { return m_jotag; }

◆ key()

const std::string & IOVDbFolder::key ( ) const
inline

Definition at line 338 of file IOVDbFolder.h.

338 { return m_key;}

◆ loadCache()

bool IOVDbFolder::loadCache ( const cool::ValidityKey  vkey,
const unsigned int  cacheDiv,
const std::string &  globalTag,
const bool  ignoreMissChan 
)

Definition at line 226 of file IOVDbFolder.cxx.

229  {
230  // load the cache for the given IOVTime, making a range around this time
231  // according to the caching policy
232  // if cacheDiv > 0, specifies number of slices of cache for query alignment
233  // if ignoreMissChan set, don't worry about missing channels outside the cache range
234  // return false if any problem
235  // timer to track amount of time in loadCache
236  TStopwatch cachetimer;
237  const auto & [cachestart, cachestop] = m_iovs.getCacheBounds();
238 
239  bool vectorPayload{};
240  std::string strCrestNodeDesc;
241  if (m_source == "CREST"){
242  ATH_MSG_INFO("Download tag would be: "<<m_crestTag);
243 
244  if (m_crest_tag != m_crestTag){
246  m_tag_info = m_cfunctions.value().getTagInfo(m_crestTag);
247  }
248  strCrestNodeDesc = m_cfunctions.value().folderDescriptionForTag(m_crestTag);
249  vectorPayload = (strCrestNodeDesc.find("CondAttrListVec") != std::string::npos);
250  }
251  else {
252  vectorPayload = (m_foldertype ==CoraCool) or (m_foldertype == CoolVector);
253  }
254 
255  ATH_MSG_DEBUG( "Load cache for folder " << m_foldername << " validitykey " << vkey);
256  // if not first time through, and limit not reached,and cache was not reset,
257  // and we are going forwards in time, double cachesize
258  if (m_ndbread>0 && m_cacheinc<3 && (cachestop!=cachestart) && vkey>cachestart && m_autocache) {
259  m_cachelength*=2;
260  ++m_cacheinc;
261  ATH_MSG_INFO( "Increase cache length (step " << m_cacheinc << ") for folder " << m_foldername << " to " << m_cachelength << " at validityKey " << vkey );
262  }
263  ++m_ndbread;
264  auto [changedCacheLo, changedCacheHi] = m_iovs.getCacheBounds();
265  if (cacheDiv>0) {
266  // quantise queries on boundaries that are sub-multiples of cache length
267  unsigned long long cacheq=m_cachelength/cacheDiv;
268  if (cacheq>0) changedCacheLo=vkey - vkey % cacheq;
269  changedCacheHi=changedCacheLo+m_cachelength;
270  } else {
271  // for run/LB indexed folders and cache of at least one run
272  // align the query to the run start
274  changedCacheLo=vkey & (0x7FFFFFFFLL << 32);
275  } else {
276  changedCacheLo=vkey;
277  }
278  changedCacheHi=vkey+m_cachelength;
279  }
280  if (changedCacheHi>cool::ValidityKeyMax) changedCacheHi=cool::ValidityKeyMax;
281  //
282  //
283  m_iovs.setCacheBounds(IovStore::Iov_t(changedCacheLo, changedCacheHi));
284  //
285  const auto & [since, until] = m_iovs.getCacheBounds();
286  ATH_MSG_DEBUG( "IOVDbFolder:loadCache limits set to [" << since << "," << until << "]" );
287 
288  if (m_cachespec==nullptr) {
289  // on first init, guess size based on channel count
290  unsigned int estsize=m_nchan;
291  if (m_cachehint > 0) {
292  estsize=estsize*m_cachehint;
293  } else if (m_timestamp) {
294  // for timestamp indexed folder (likely to be DCS), increase this
295  estsize=estsize*3;
296  }
297  // note this is only reserved size of the cache vectors
298  // actual datastorage is mainly allocated by pointer elsewhere
299  m_cachechan.reserve(estsize);
300  m_cacheattr.reserve(estsize);
301  if (vectorPayload) {
302  m_cacheccstart.reserve(estsize);
303  m_cacheccend.reserve(estsize);
304  }
305  } else {
306  // reset cache if it already contained data
307  // TBIO - could keep the attributelists and only change the data on reload
308  // avoiding some attributelist construction/destruction
309  clearCache();
310  }
311  bool retrievedone=false;
312  unsigned int nChannelsExpected = (m_chanrange.empty())? (m_nchan) : (IOVDbNamespace::countSelectedChannels(m_channums, m_chansel));
313  if (m_source == "COOL_DATABASE"){
314  // query to fill cache - request for database activates connection
315  if (not m_conn->open()) {
316  ATH_MSG_FATAL( "Conditions database connection " <<m_conn->name() << " cannot be opened - STOP" );
317  return false;
318  }
319  // access COOL inside try/catch in case of using stale connection
320  unsigned int attempts=0;
321 
322  ATH_MSG_DEBUG( "loadCache: Expecting to see " << nChannelsExpected << " channels" );
323  //
324  while (attempts<2 && !retrievedone) {
325  ++attempts;
326  try {
327  unsigned int iadd=0;
328  m_iovs.setIovSpan(IovStore::Iov_t(0,cool::ValidityKeyMax));
329  // check pointer is still valid - can go stale in AthenaMT environment
330  // according to CORAL server tests done by Andrea Valassi (23/6/09)
331  if (not m_conn->valid()) throw std::runtime_error("COOL database pointer invalidated");
332  // access COOL folder in case needed to resolve tag (even for CoraCool)
333  cool::IFolderPtr folder=m_conn->getFolderPtr(m_foldername);
334 
335  // resolve the tag for MV folders if not already done so
336  if (m_multiversion && m_tag.empty()) {
337  if (!resolveTag(folder,globalTag)) return false;
338 
339  }
340  if (m_foldertype==CoraCool) {
341  // CoraCool retrieve
343  CoraCoolFolderPtr ccfolder=ccDbPtr->getFolder(m_foldername);
344 
345  auto [since,until] = m_iovs.getCacheBounds();
346  CoraCoolObjectIterPtr itr=ccfolder->browseObjects(since, until,m_chansel,m_tag);
347  while (itr->hasNext()) {
348  CoraCoolObjectPtr obj=itr->next();
349  //should be skipping non-selected channels here?
350  addIOVtoCache(obj->since(),obj->until());
351  m_cachechan.push_back(obj->channelId());
352  // store all the attributeLists in the buffer
353  // save pointer to start
354  const unsigned int istart=m_cacheattr.size();
355  for (CoraCoolObject::const_iterator pitr=obj->begin();pitr!=obj->end(); ++pitr) {
356  // setup shared specification on first store
357  if (m_cachespec==nullptr) setSharedSpec(*pitr);
358  // use the shared specification in storing the payload
359  m_cacheattr.emplace_back(*m_cachespec,true);
360  m_cacheattr.back().fastCopyData(*pitr);
362  }
363  // save pointers to start and end
364  m_cacheccstart.push_back(istart);
365  m_cacheccend.push_back(m_cacheattr.size());
366  ++iadd;
367  }
368  itr->close();
369  retrievedone=true;
370  } else {
371  auto [since,until] = m_iovs.getCacheBounds();
372  cool::IObjectIteratorPtr itr=folder->browseObjects(since,until,m_chansel,m_tag);
375  dumpFile("cool_dump",vkey,&json,m_crestCoolToFile,nullptr,"","");
376  }
377  while (itr->goToNext()) {
378  const cool::IObject& ref=itr->currentRef();
379  addIOVtoCache(ref.since(),ref.until());
380  m_cachechan.push_back(ref.channelId());
381  if (m_foldertype==CoolVector) {
382  // store all the attributeLists in the buffer
383  // save pointer to start
384  const unsigned int istart=m_cacheattr.size();
385  // get payload iterator and vector of payload records
386  cool::IRecordIterator& pitr=ref.payloadIterator();
387  const cool::IRecordVectorPtr& pvec=pitr.fetchAllAsVector();
388  for (cool::IRecordVector::const_iterator vitr=pvec->begin();vitr!=pvec->end();++vitr) {
389  const coral::AttributeList& atrlist=(*vitr)->attributeList();
390  // setup shared specification on first store
391  if (m_cachespec==nullptr) setSharedSpec(atrlist);
392  // use the shared specification in storing the payload
393  m_cacheattr.emplace_back(*m_cachespec,true);
394  m_cacheattr.back().fastCopyData(atrlist);
396  }
397  // save pointers to start and end
398  m_cacheccstart.push_back(istart);
399  m_cacheccend.push_back(m_cacheattr.size());
400  ++iadd;
401  pitr.close();
402  } else {
403  // standard COOL retrieve
404  const coral::AttributeList& atrlist=ref.payload().attributeList();
405  // setup shared specification on first store
406  if (m_cachespec==nullptr) setSharedSpec(atrlist);
407  // use the shared specification in storing the payload
408  m_cacheattr.emplace_back(*m_cachespec,true);
409  m_cacheattr[iadd].fastCopyData(atrlist);
410  ++iadd;
412  }
413  }
414  itr->close();
415  retrievedone=true;
416  }
417  ATH_MSG_DEBUG( "Retrieved " << iadd << " objects for "<< m_nchan << " channels into cache" );
418  m_nobjread+=iadd;
419  } catch (std::exception& e) {
420  ATH_MSG_WARNING( "COOL retrieve attempt " << attempts << " failed: " << e.what() );
421  // disconnect and reconnect
422  if (not m_conn->dropAndReconnect()) ATH_MSG_ERROR("Tried to reconnect in 'loadCache' but failed");
423  }
424  }
425  } // End of COOL reading section
426  else {
427  // CREST reading section
428  auto [since,until] = m_iovs.getCacheBounds();
429  std::vector<BasicFolder> crestObjs;
430  try {
431  crestObjs = fetchCrestObjects(since,until,vectorPayload,vkey,strCrestNodeDesc);
432  }
433  catch(std::exception&) {
434  return false;
435  }
436 
437  unsigned int iadd = 0;
438 
439  if (!resolveTag(nullptr,globalTag)) return false;
440  ATH_MSG_DEBUG( "loadCache: Expecting to see " << nChannelsExpected << " channels" );
441 
442  for(BasicFolder& basicFolder : crestObjs) {
443  const auto & channelNumbers=basicFolder.channelIds();
444  ATH_MSG_DEBUG( "ChannelIds is " << channelNumbers.size() << " long" );
445  for (const auto & chan: channelNumbers){
446  addIOVtoCache(basicFolder.iov().first, basicFolder.iov().second);
447  m_cachechan.push_back(chan);
448  if (basicFolder.isVectorPayload()) {
449  const auto & vPayload = basicFolder.getVectorPayload(chan);
450  const unsigned int istart=m_cacheattr.size();
451  for (const auto & attList:vPayload){
452  if (m_cachespec==nullptr) setSharedSpec(attList);
453  m_cacheattr.emplace_back(*m_cachespec,true);// maybe needs to be cleared before
454  m_cacheattr.back().fastCopyData(attList);
456  }
457  m_cacheccstart.push_back(istart);
458  m_cacheccend.push_back(m_cacheattr.size());
459  ++iadd;
460  } else {
461  auto const & attList = basicFolder.getPayload(chan);
462  if (m_cachespec==nullptr) setSharedSpec(attList);
463  const coral::AttributeList c(*m_cachespec,true);
464  m_cacheattr.push_back(c);// maybe needs to be cleared before
465  m_cacheattr.back().fastCopyData(attList);
467  ++iadd;
468  }
469  }
470  }
471  retrievedone=true;
472  ATH_MSG_DEBUG( "Retrieved " << iadd << " objects for "<< m_nchan << " channels into cache" );
473  m_nobjread+=iadd;
474  } // End of reading from CREST
475 
476  if (!retrievedone) {
477  const auto & [since,until] = m_iovs.getCacheBounds();
478  ATH_MSG_ERROR( "Could not retrieve Cond data for folder " <<
479  m_foldername << " tag " << m_tag << " validityKeys [" << since <<
480  "," << until << "]" );
481  return false;
482  }
483  // check if cache can be stretched according to extent of IOVs crossing
484  // boundaries - this requires all channels to have been seen
485  const auto & [nChannelsLo, nChannelsHi] = m_iovs.numberOfIovsOnBoundaries();
486  const auto missing=std::pair<unsigned int, unsigned int>(nChannelsExpected-nChannelsLo, nChannelsExpected-nChannelsHi);
487  ATH_MSG_DEBUG( "Cache retrieve missing " << missing.first << " lower and " << missing.second << " upper channels" );
488  //
489  const auto & span = m_iovs.getMinimumStraddlingSpan();
490  const auto & [cacheStart, cacheStop] =m_iovs.getCacheBounds();
491  //new code
492  if ((missing.first==0 or ignoreMissChan) and m_iovs.extendCacheLo()){
493  ATH_MSG_DEBUG( "Lower cache limit extended from " << cacheStart << " to " << span.first );
494  }
495 
496  if ((missing.second==0 or ignoreMissChan) and m_iovs.extendCacheHi()){
497  ATH_MSG_DEBUG( "Upper cache limit extended from " << cacheStop << " tp " << span.second );
498  }
499  //
500  // keep track of time spent
501  const float timeinc=cachetimer.RealTime();
502  m_readtime+=timeinc;
503  ATH_MSG_DEBUG( "Cache retrieve done for " << m_foldername << " with " <<
504  m_iovs.size() << " objects stored in" << std::fixed <<
505  std::setw(8) << std::setprecision(2) << timeinc << " s" );
506  return true;
507 }

◆ loadCacheIfDbChanged()

bool IOVDbFolder::loadCacheIfDbChanged ( const cool::ValidityKey  vkey,
const std::string &  globalTag,
const cool::IDatabasePtr &  dbPtr,
const ServiceHandle< IIOVSvc > &  iovSvc 
)

Definition at line 509 of file IOVDbFolder.cxx.

512  {
513  ATH_MSG_DEBUG( "IOVDbFolder::recheck with DB for folder " << m_foldername<< " validitykey: " << vkey );
514  if (m_iovs.empty()) {
515  ATH_MSG_DEBUG( "Cache empty ! returning ..." );
516  return true;
517  }
518  ++m_ndbread;
519  // access COOL inside try/catch in case of using stale connection
520  unsigned int attempts = 0;
521  bool retrievedone = false;
522  //
523  unsigned int nChannelsExpected = (m_chanrange.empty())? (m_nchan) : (IOVDbNamespace::countSelectedChannels(m_channums, m_chansel));
524  ATH_MSG_DEBUG( "loadCacheIfDbChanged: Expecting to see " << nChannelsExpected << " channels" );
525  //
526  while (attempts<2 && !retrievedone) {
527  ++attempts;
528  try {
529  m_iovs.setIovSpan(IovStore::Iov_t(0,cool::ValidityKeyMax));
530  // access COOL folder in case needed to resolve tag (even for CoraCool)
531  cool::IFolderPtr folder=m_conn->getFolderPtr(m_foldername);
532  // resolve the tag for MV folders if not already done so
533  if (m_multiversion && m_tag.empty()) { // NEEDED OR NOT?
534  if (!resolveTag(folder,globalTag)) return false;
535  }
536  int counter=0;
537  const auto & [since,until] = m_iovs.getCacheBounds();
538  ATH_MSG_DEBUG(IOVDbNamespace::folderTypeName(m_foldertype)<<" type. cachestart:\t"<<since<<" \t cachestop:"<< until);
539  ATH_MSG_DEBUG("checking range: "<<vkey+1<<" - "<<vkey+2);
540  if (m_foldertype==CoraCool) {
541  // CoraCool retrieve initialise CoraCool connection
543  // this returns all the objects whose IOVRanges crosses this range .
544  CoraCoolObjectIterPtr itr = ccfolder->browseObjects(vkey+1, vkey+2,m_chansel,m_tag);
545  while (objectIteratorIsValid(itr)) {
546  CoraCoolObjectPtr obj = itr->next();
547  //code delegated to templated member, allowing for difference between CoraCoolObjectPtr and IObject
549  }
550  itr->close();
551  } else {
552  // this returns all the objects whose IOVRanges crosses this range .
553  cool::IObjectIteratorPtr itr=folder->browseObjects(vkey+1, vkey+2, m_chansel,m_tag);
554  while (objectIteratorIsValid(itr)) {
555  const cool::IObject& ref=itr->currentRef();
556  //code delegated to templated member, allowing for difference between CoraCoolObjectPtr and IObject
558  }
559  itr->close();
560  }
561  retrievedone=true;
562  ATH_MSG_DEBUG( "Need a special update for " << counter << " objects " );
564  }catch (std::exception& e) {
565  ATH_MSG_WARNING( "COOL retrieve attempt " << attempts << " failed: " << e.what() );
566  if (not m_conn->dropAndReconnect()) ATH_MSG_ERROR("Tried reconnecting in loadCacheIfDbChanged but failed");
567  }
568  }
569  return true;
570 }

◆ magicTag()

bool IOVDbFolder::magicTag ( std::string &  tag)
private

Definition at line 1105 of file IOVDbFolder.cxx.

1105  { //alters the argument
1107  return (not tag.empty());
1108 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ multiVersion()

bool IOVDbFolder::multiVersion ( ) const
inline

Definition at line 342 of file IOVDbFolder.h.

342 { return m_multiversion; }

◆ noOverride()

bool IOVDbFolder::noOverride ( ) const
inline

Definition at line 348 of file IOVDbFolder.h.

348 { return m_notagoverride; }

◆ objectIteratorIsValid() [1/2]

bool IOVDbFolder::objectIteratorIsValid ( cool::IObjectIteratorPtr &  objItr)
inlineprivate

Definition at line 218 of file IOVDbFolder.h.

218  {
219  return objItr->goToNext();
220  }

◆ objectIteratorIsValid() [2/2]

bool IOVDbFolder::objectIteratorIsValid ( CoraCoolObjectIterPtr objItr)
inlineprivate

Definition at line 223 of file IOVDbFolder.h.

223  {
224  return objItr->hasNext();
225  }

◆ overrideOptionsFromParsedDescription()

bool IOVDbFolder::overrideOptionsFromParsedDescription ( const IOVDbParser parsedDescription)
private

Definition at line 832 of file IOVDbFolder.cxx.

832  {
833  bool success{true};
834  // check for timeStamp indicating folder is timestamp indexed
835  m_timestamp=parsedDescription.timebaseIs_nsOfEpoch();
836  // check for key, giving a different key to the foldername
837  if (auto newkey=parsedDescription.key(); not newkey.empty() and not m_jokey) {
838  ATH_MSG_DEBUG( "Key for folder " << m_foldername << " set to "<< newkey << " from description string" );
839  m_key=newkey;
840  }
841  // check for 'cache' but only if not already found in joboptions
842  if (m_cachepar.empty()) m_cachepar=parsedDescription.cache();
843  // check for cachehint
844  if (int newCachehint=parsedDescription.cachehint();newCachehint!=0) m_cachehint=newCachehint;
845  // check for <named/>
846  m_named=parsedDescription.named();
847  // get addressHeader
848  if (auto newAddrHeader = parsedDescription.addressHeader();not newAddrHeader.empty()){
850  m_addrheader=newAddrHeader;
851  }
852  //get clid, if it exists (set to zero otherwise)
853  m_clid=parsedDescription.classId(msg());
854  // decode the typeName
855  if (!parsedDescription.getKey("typeName","",m_typename)) {
856  ATH_MSG_ERROR( "Primary type name is empty" );
857  return false;
858  }
859  bool gotCLID=(m_clid!=0);
860 
861  ATH_MSG_DEBUG( "Got folder typename " << m_typename );
862  if (!gotCLID)
863  if (StatusCode::SUCCESS==p_clidSvc->getIDOfTypeName(m_typename,m_clid))
864  gotCLID=true;
865  if (!gotCLID) {
866  ATH_MSG_ERROR("Could not get clid for typeName: " << m_typename);
867  return false;
868  }
869  ATH_MSG_DEBUG( "Got folder typename " << m_typename << " with CLID " << m_clid );
870  return success;
871 }

◆ preLoadFolder()

std::unique_ptr< SG::TransientAddress > IOVDbFolder::preLoadFolder ( ITagInfoMgr tagInfoMgr,
const unsigned int  cacheRun,
const unsigned int  cacheTime 
)

Definition at line 893 of file IOVDbFolder.cxx.

893  {
894  // preload Address from SG - does folder setup including COOL access
895  // also set detector store location - cannot be done in constructor
896  // as detector store does not exist yet in IOVDbSvc initialisation
897  // and sets up cache length, taking into account optional overrides
898  // returns null pointer in case of problem
899  p_tagInfoMgr = tagInfoMgr;
900  if( not m_useFileMetaData ) {
901  if(m_source=="CREST"){
902  if (m_crest_tag != m_crestTag){
904  m_tag_info = m_cfunctions.value().getTagInfo(m_crestTag);
905  }
906  m_folderDescription = m_cfunctions.value().folderDescriptionForTag(m_crestTag);
907  } else {
908  //folder desc from db
910  }
911  } else {
912  // folder description from meta-data set already earlier
913  }
914  ATH_MSG_DEBUG( "Folder description for " << m_foldername << ": " << m_folderDescription);
915  // register folder with meta-data tool if writing metadata
916  if (m_writemeta) {
917  if (StatusCode::SUCCESS!=p_metaDataTool->registerFolder(m_foldername,m_folderDescription)) {
918  ATH_MSG_ERROR( "Failed to register folder " << m_foldername<< " for meta-data write" );
919  return nullptr;
920  }
921  }
922  // parse the description string
923  IOVDbParser folderpar(m_folderDescription, msg());
924  //use the overrides in the folderdescription, return nullptr immediately if something went wrong
925  if (not overrideOptionsFromParsedDescription(folderpar)) return nullptr;
926  // setup channel list and folder type
927  if( not m_useFileMetaData ) {
928  if(m_source=="CREST"){
929  const std::string & payloadSpec = m_cfunctions.value().getTagInfoElement(m_tag_info,"payload_spec");
930  std::string chanList = m_cfunctions.value().getTagInfoElement(m_tag_info,"channel_list");
931  std::tie(m_channums, m_channames) = m_cfunctions.value().extractChannelListFromString(chanList);
932 
933  //determine foldertype from the description, the spec and the number of channels
935 
936  if (m_crestToFile){
937  int n_size = m_channums.size();
939  for (int i = 0; i < n_size; i++) {
940 
941  nlohmann::json elem;
942  std::string key = std::to_string(m_channums[i]);
943  elem[key] = m_channames[i];
944  chan_list.push_back(elem);
945  }
946 
947  char ch = ':';
948  int colsize = std::count(payloadSpec.begin(), payloadSpec.end(), ch);
949 
950  nlohmann::json tag_meta;
951  tag_meta["tagName"] = m_crestTag;
952  tag_meta["description"] = "";
953  tag_meta["chansize"] = n_size;
954  tag_meta["colsize"] = colsize;
955 
956  nlohmann::json tagInfo;
957  tagInfo["channel_list"] = chan_list;
958  tagInfo["node_description"] = m_folderDescription;
959  tagInfo["payload_spec"] = payloadSpec;
960 
961  tag_meta["tagInfo"] = tagInfo.dump();
962 
963  std::string crest_work_dir=std::filesystem::current_path();
964  crest_work_dir += "/crest_data";
965  bool crest_rewrite = true;
966 
967  Crest::CrestApiFs crestFSClient = Crest::CrestApiFs(crest_rewrite, crest_work_dir);
968 
969  try{
970  TagMetaDto dto = TagMetaDto();
971  dto = dto.fromJson(tag_meta);
972  crestFSClient.createTagMeta(dto);
973 
974  ATH_MSG_INFO("Tag meta info for " << m_crestTag << " saved to disk.");
975  ATH_MSG_INFO("CREST Dump dir = " << crest_work_dir);
976  }
977  catch (const std::exception& e) {
978  ATH_MSG_WARNING("Tag meta info saving for tag " << m_crestTag << " failed: " << e.what());
979  }
980  } // m_crestToFile
981 
982  } else {
983  // data being read from COOL
984  auto fldPtr=m_conn->getFolderPtr<cool::IFolderPtr>(m_foldername);
985  // get the list of channels
987  // set folder type
989  }
990  }
991  m_nchan=m_channums.size();
992  ATH_MSG_DEBUG( "Folder identified as type " << m_foldertype );
993  // note that for folders read from metadata, folder type identification
994  // is deferred until getAddress when first data is read
995  // and channel number/name information is not read
996 
997  // change channel selection for single-object read
998  if (m_foldertype==AttrList || m_foldertype==PoolRef) m_chansel=cool::ChannelSelection(0);
999  const auto & linknameVector = folderpar.symLinks();
1000  // now create TAD
1001  auto tad{createTransientAddress(linknameVector)};
1002  if (not tad) {
1003  ATH_MSG_WARNING("Transient address is null in "<<__func__);
1004  return nullptr;
1005  }
1006  setCacheLength(m_timestamp, cacheRun, cacheTime);
1007  return tad;
1008 }

◆ printCache()

void IOVDbFolder::printCache ( )

Definition at line 1160 of file IOVDbFolder.cxx.

1160  {
1161  const auto & [since,until] = m_iovs.getCacheBounds();
1162  ATH_MSG_DEBUG("folder cache printout -------------------");
1163  ATH_MSG_DEBUG(m_foldername << " length: "<<m_cachelength<<"\tstart: "<<since<<"\tstop: "<<until);
1164  ATH_MSG_DEBUG("current range: "<<m_currange);
1165  const auto & iovs = m_iovs.vectorStore();
1167  for (const auto & iov:iovs){
1168  ATH_MSG_DEBUG("channelID:\t"<<(*ci++)<<"\t since: "<<iov.first<<"\t until: "<<iov.second);
1169  }
1170  ATH_MSG_DEBUG("folder cache printout -------------------");
1171 
1172 }

◆ readMeta()

bool IOVDbFolder::readMeta ( ) const
inline

Definition at line 358 of file IOVDbFolder.h.

358 { return m_useFileMetaData; }

◆ readTime()

float IOVDbFolder::readTime ( ) const
inline

Definition at line 382 of file IOVDbFolder.h.

383 { return m_readtime; }

◆ resetCache()

void IOVDbFolder::resetCache ( )

Definition at line 626 of file IOVDbFolder.cxx.

626  {
627  // reset the cache to unfilled state, used if no more data will be required
628  // from this folder
630  clearCache();
631 }

◆ resolvedTag()

const std::string & IOVDbFolder::resolvedTag ( ) const
inline

Definition at line 372 of file IOVDbFolder.h.

372 { return m_tag; }

◆ resolveTag()

bool IOVDbFolder::resolveTag ( const cool::IFolderPtr &  fptr,
const std::string &  globalTag 
)
private

Definition at line 1048 of file IOVDbFolder.cxx.

1048  {
1049  // resolve the tag
1050  // if specified in job options or already-processed override use that,
1051  // else use global tag
1052  // return false for failure
1053  std::string tag=m_jotag;
1054  if (tag=="HEAD") return true;
1055  if (tag.empty()) tag=globalTag;
1056  if (tag.empty()) {
1057  ATH_MSG_ERROR( "No IOVDbSvc.GlobalTag specified on job options or input file" );
1058  return false;
1059  }
1060  if(m_source=="CREST"){
1061 
1062  m_tag = m_crestTag;
1063 
1064  ATH_MSG_DEBUG( "resolveTag returns " << m_tag );
1065  return true;
1066  }
1067  // check for magic tags
1068  if (IOVDbNamespace::looksLikeMagicTag(tag) and not magicTag(tag)) return false;
1069  // check tag exists - if not, lookup hierarchically
1070  const std::vector<std::string>& taglist=fptr->listTags();
1071  if (find(taglist.begin(),taglist.end(),tag)!=taglist.end()) {
1072  // tag exists directly in folder
1073  ATH_MSG_DEBUG( "Using tag "<< tag << " for folder " << m_foldername );
1074  } else {
1075  // tag maybe an HVS tag
1076  try {
1077  std::string restag=fptr->resolveTag(tag);
1078  ATH_MSG_INFO( "HVS tag " << tag << " resolved to "<< restag << " for folder " << m_foldername );
1079  // HVS tag may itself be magic
1080  if (IOVDbNamespace::looksLikeMagicTag(restag) and not magicTag(restag)) return false;
1081  tag=restag;
1082  }catch (cool::Exception& e) {
1083  ATH_MSG_ERROR( "Tag " << tag <<" cannot be resolved for folder " << m_foldername );
1084  return false;
1085  }
1086  }
1087  m_tag=tag;
1088  // optionally check if tag is locked
1089  if (m_checklock) {
1090  const auto tagLock=IOVDbNamespace::checkTagLock(fptr,tag);
1091  if (not tagLock.has_value()){
1092  ATH_MSG_ERROR( "Could not check tag lock status for " << tag );
1093  return false;
1094  }
1095  if (not tagLock.value()){
1096  ATH_MSG_ERROR("Tag " << tag <<" is not locked and IOVDbSvc.CheckLock is set" );
1097  return false;
1098  }
1099  }
1100  ATH_MSG_DEBUG( "resolveTag returns " << m_tag );
1101  return true;
1102 }

◆ retrieved()

bool IOVDbFolder::retrieved ( ) const
inline

Definition at line 350 of file IOVDbFolder.h.

350 { return m_retrieved; }

◆ setCacheLength()

void IOVDbFolder::setCacheLength ( const bool  timeIs_nsOfEpoch,
const unsigned int  cacheRun,
const unsigned int  cacheTime 
)
private

Definition at line 1010 of file IOVDbFolder.cxx.

1010  {
1011  if (timeIs_nsOfEpoch){
1012  long long int clen=600; // default value of 10 minutes
1013  if (cacheTime!=0) {
1014  clen=cacheTime;
1015  m_autocache=false;
1016  } else {
1017  // for timestamp, cache parameter (if set) sets length in seconds
1018  if (not m_cachepar.empty()) clen=std::stoi(m_cachepar);
1019  }
1021  ATH_MSG_DEBUG( "Cache length set to " << clen << " seconds" );
1022  } else {
1023  // for run/event, cache parameter sets length in LB
1024  // default value is 1 whole run
1026  if (cacheRun!=0) {
1028  m_autocache=false;
1029  } else {
1030  if (not m_cachepar.empty()) m_cachelength=std::stoi(m_cachepar);
1031  }
1033  ATH_MSG_DEBUG( "Cache length set to " << run <<" runs " << lumi << " lumiblocks" );
1034  }
1035 }

◆ setDropped()

void IOVDbFolder::setDropped ( const bool  dropped)
inline

Definition at line 392 of file IOVDbFolder.h.

392 { m_dropped=dropped; }

◆ setFolderDescription()

void IOVDbFolder::setFolderDescription ( const std::string &  description)
inline

Definition at line 355 of file IOVDbFolder.h.

◆ setIOVOverride()

void IOVDbFolder::setIOVOverride ( const unsigned int  run,
const unsigned int  lumiblock,
const unsigned int  time 
)

Definition at line 192 of file IOVDbFolder.cxx.

194  {
195  // set IOV override for this folder if run!=0 or time!=0
196  // folder-specific override takes precedence if set
197  if (m_iovoverridden) return;
198  if (m_timestamp) {
199  if (time!=0) {
201  ATH_MSG_INFO( "Override timestamp to " << m_iovoverride << " for folder "<< m_foldername );
202  m_iovoverridden=true;
203  }
204  } else {
205  if (run!=0 || lumiblock!=0) {
207  ATH_MSG_INFO( "Override run/LB number to [" << run << ":" << lumiblock <<
208  "] for folder " << m_foldername );
209  m_iovoverridden=true;
210  }
211  }
212 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setSharedSpec()

void IOVDbFolder::setSharedSpec ( const coral::AttributeList &  atrlist)
private

Definition at line 1139 of file IOVDbFolder.cxx.

1139  {
1140  m_cachespec=new coral::AttributeListSpecification;
1141  for (const auto & attribute:atrlist){
1142  const coral::AttributeSpecification& aspec=attribute.specification();
1143  m_cachespec->extend(aspec.name(),aspec.type());
1144  if (not typeSizeIsKnown(attribute)) {
1145  ATH_MSG_WARNING( "addType: unknown type " << aspec.typeName()<<
1146  " in folder " << m_foldername << " will not be counted for bytes-read statistics" );
1147  }
1148  }
1149  ATH_MSG_DEBUG( "Setup shared AttributeListSpecification with " << m_cachespec->size() << " elements" );
1150 }

◆ setTagOverride()

void IOVDbFolder::setTagOverride ( const std::string &  tag,
const bool  setFlag 
)

Definition at line 177 of file IOVDbFolder.cxx.

177  {
178  if (m_tagoverride) {
179  ATH_MSG_WARNING( "Request to override tag for folder " <<
180  m_foldername << " to " << tag << " supercedes earlier override to " << m_jotag );
181  } else {
182  if (setFlag) m_tagoverride=true;
183  }
185 }

◆ setWriteMeta()

void IOVDbFolder::setWriteMeta ( )

Definition at line 187 of file IOVDbFolder.cxx.

187  {
188  m_writemeta=true;
189 }

◆ specialCacheUpdate() [1/2]

void IOVDbFolder::specialCacheUpdate ( const cool::IObject &  obj,
const ServiceHandle< IIOVSvc > &  iovSvc 
)
private

Definition at line 599 of file IOVDbFolder.cxx.

599  {
600 
601  // reset IOVRange in IOVSvc to trigger reset of object. Set to a
602  // time earlier than since.
603  IOVRange range = IOVDbNamespace::makeRange(ref.since()-2, ref.since()-1, m_timestamp);
604  if (StatusCode::SUCCESS != iovSvc->setRange(clid(), key(), range, eventStore())) {
605  ATH_MSG_ERROR( "IOVDbFolder::specialCacheUpdate - setRange failed for folder "
606  << folderName() );
607  return;
608  }
609  // add new object.
610  addIOVtoCache(ref.since(),ref.until());
611  m_cachechan.push_back(ref.channelId());
612  const coral::AttributeList& atrlist = ref.payload().attributeList();
613  // use the shared specification in storing the payload
614  const unsigned int istart=m_cacheattr.size();
615  m_cacheattr.emplace_back(*m_cachespec,true);// maybe needs to be cleared before
616  m_cacheattr.back().fastCopyData(atrlist);
618  if (m_foldertype==CoolVector) {
619  // save pointers to start and end
620  m_cacheccstart.push_back(istart);
621  m_cacheccend.push_back(m_cacheattr.size());
622  }
623 }

◆ specialCacheUpdate() [2/2]

void IOVDbFolder::specialCacheUpdate ( CoraCoolObject obj,
const ServiceHandle< IIOVSvc > &  iovSvc 
)
private

Definition at line 573 of file IOVDbFolder.cxx.

573  {
574 
575  // reset IOVRange in IOVSvc to trigger reset of object. Set to a
576  // time earlier than since.
577  IOVRange range = IOVDbNamespace::makeRange(obj.since()-2, obj.since()-1, m_timestamp);
578  if (StatusCode::SUCCESS != iovSvc->setRange(clid(), key(), range, eventStore())) {
579  ATH_MSG_ERROR( "IOVDbFolder::specialCacheUpdate - setRange failed for folder "
580  << folderName() );
581  return;
582  }
583  addIOVtoCache(obj.since(),obj.until());
584  m_cachechan.push_back(obj.channelId());
585  // store all the attributeLists in the buffer save pointer to start
586  const unsigned int istart=m_cacheattr.size();
587  for (CoraCoolObject::const_iterator pitr=obj.begin(); pitr!=obj.end();++pitr) {
588  // use the shared specification in storing the payload
589  m_cacheattr.emplace_back(*m_cachespec,true);
590  m_cacheattr.back().fastCopyData(*pitr);
592  }
593  // save pointers to start and end
594  m_cacheccstart.push_back(istart);
595  m_cacheccend.push_back(m_cacheattr.size());
596 }

◆ summary()

void IOVDbFolder::summary ( )

Definition at line 817 of file IOVDbFolder.cxx.

817  {
819  // summarise the read statistics for this folder
820  ATH_MSG_INFO( "Folder " << m_foldername << " ("<<folderTypeName
821  << ") db-read " << m_ndbread << "/" <<
822  m_ncacheread << " objs/chan/bytes " << m_nobjread << "/" <<
823  m_nchan << "/" << m_nbytesread << " (( " << std::fixed << std::setw(8)
824  << std::setprecision(2) << m_readtime << " ))s" );
825  // print WARNING if data for this folder was never read from Storegate
826  if (m_ncacheread==0 && m_ndbread>0) {
827  ATH_MSG_WARNING( "Folder " << m_foldername << " is requested but no data retrieved" );
828  }
829 }

◆ tagOverride()

bool IOVDbFolder::tagOverride ( ) const
inline

Definition at line 346 of file IOVDbFolder.h.

346 { return m_tagoverride; }

◆ timeStamp()

bool IOVDbFolder::timeStamp ( ) const
inline

Definition at line 344 of file IOVDbFolder.h.

344 { return m_timestamp; }

◆ useFileMetaData()

void IOVDbFolder::useFileMetaData ( )

Definition at line 166 of file IOVDbFolder.cxx.

166  {
167  // enable folder from FLMD at given connection
168  m_useFileMetaData = true;
169  // if previously connected to a real DB connection, remove association
170  if (m_conn!=nullptr) {
171  m_conn->decUsage();
172  m_conn=nullptr;
173  }
174 }

◆ writeMeta()

bool IOVDbFolder::writeMeta ( ) const
inline

Definition at line 360 of file IOVDbFolder.h.

360 { return m_writemeta; }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_addrheader

std::string IOVDbFolder::m_addrheader
private

Definition at line 300 of file IOVDbFolder.h.

◆ m_autocache

bool IOVDbFolder::m_autocache {true}
private

Definition at line 281 of file IOVDbFolder.h.

◆ m_cacheattr

std::vector<coral::AttributeList> IOVDbFolder::m_cacheattr
private

Definition at line 321 of file IOVDbFolder.h.

◆ m_cacheccend

std::vector<unsigned int> IOVDbFolder::m_cacheccend
private

Definition at line 323 of file IOVDbFolder.h.

◆ m_cacheccstart

std::vector<unsigned int> IOVDbFolder::m_cacheccstart
private

Definition at line 322 of file IOVDbFolder.h.

◆ m_cachechan

std::vector<cool::ChannelId> IOVDbFolder::m_cachechan
private

Definition at line 320 of file IOVDbFolder.h.

◆ m_cachehint

int IOVDbFolder::m_cachehint {0}
private

Definition at line 287 of file IOVDbFolder.h.

◆ m_cacheinc

int IOVDbFolder::m_cacheinc {0}
private

Definition at line 288 of file IOVDbFolder.h.

◆ m_cachelength

cool::ValidityKey IOVDbFolder::m_cachelength {0}
private

Definition at line 286 of file IOVDbFolder.h.

◆ m_cachepar

std::string IOVDbFolder::m_cachepar
private

Definition at line 299 of file IOVDbFolder.h.

◆ m_cachespec

coral::AttributeListSpecification* IOVDbFolder::m_cachespec {nullptr}
private

Definition at line 319 of file IOVDbFolder.h.

◆ m_cfunctions

std::optional<IOVDbNamespace::CrestFunctions> IOVDbFolder::m_cfunctions
private

Definition at line 334 of file IOVDbFolder.h.

◆ m_channames

std::vector<std::string> IOVDbFolder::m_channames
private

Definition at line 312 of file IOVDbFolder.h.

◆ m_channums

std::vector<cool::ChannelId> IOVDbFolder::m_channums
private

Definition at line 311 of file IOVDbFolder.h.

◆ m_chanrange

std::vector<ChanRange> IOVDbFolder::m_chanrange
private

Definition at line 292 of file IOVDbFolder.h.

◆ m_chansel

cool::ChannelSelection IOVDbFolder::m_chansel
private

Definition at line 290 of file IOVDbFolder.h.

◆ m_checklock

bool IOVDbFolder::m_checklock {true}
private

Definition at line 282 of file IOVDbFolder.h.

◆ m_clid

CLID IOVDbFolder::m_clid {0}
private

Definition at line 301 of file IOVDbFolder.h.

◆ m_conn

IOVDbConn* IOVDbFolder::m_conn {nullptr}
private

Definition at line 265 of file IOVDbFolder.h.

◆ m_crest_tag

std::string IOVDbFolder::m_crest_tag = ""
private

Definition at line 331 of file IOVDbFolder.h.

◆ m_crestCoolToFile

const bool IOVDbFolder::m_crestCoolToFile {false}
private

Definition at line 327 of file IOVDbFolder.h.

◆ m_crestServer

const std::string IOVDbFolder::m_crestServer
private

Definition at line 329 of file IOVDbFolder.h.

◆ m_crestTag

const std::string IOVDbFolder::m_crestTag
private

Definition at line 330 of file IOVDbFolder.h.

◆ m_crestToFile

const bool IOVDbFolder::m_crestToFile {false}
private

Definition at line 326 of file IOVDbFolder.h.

◆ m_currange

IOVRange IOVDbFolder::m_currange
private

Definition at line 316 of file IOVDbFolder.h.

◆ m_dropped

bool IOVDbFolder::m_dropped {false}
private

Definition at line 280 of file IOVDbFolder.h.

◆ m_eventstore

std::string IOVDbFolder::m_eventstore
private

Definition at line 298 of file IOVDbFolder.h.

◆ m_extensible

bool IOVDbFolder::m_extensible {false}
private

Definition at line 276 of file IOVDbFolder.h.

◆ m_folderDescription

std::string IOVDbFolder::m_folderDescription
private

Definition at line 268 of file IOVDbFolder.h.

◆ m_foldername

std::string IOVDbFolder::m_foldername
private

Definition at line 266 of file IOVDbFolder.h.

◆ m_foldertype

IOVDbNamespace::FolderType IOVDbFolder::m_foldertype
private

Definition at line 284 of file IOVDbFolder.h.

◆ m_fromMetaDataOnly

bool IOVDbFolder::m_fromMetaDataOnly {false}
private

Definition at line 275 of file IOVDbFolder.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_iovoverridden

bool IOVDbFolder::m_iovoverridden {false}
private

Definition at line 278 of file IOVDbFolder.h.

◆ m_iovoverride

cool::ValidityKey IOVDbFolder::m_iovoverride {0}
private

Definition at line 283 of file IOVDbFolder.h.

◆ m_iovs

IOVDbNamespace::IovStore IOVDbFolder::m_iovs
private

Definition at line 324 of file IOVDbFolder.h.

◆ m_jokey

bool IOVDbFolder::m_jokey {false}
private

Definition at line 279 of file IOVDbFolder.h.

◆ m_jotag

std::string IOVDbFolder::m_jotag
private

Definition at line 295 of file IOVDbFolder.h.

◆ m_key

std::string IOVDbFolder::m_key
private

Definition at line 267 of file IOVDbFolder.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_multiversion

bool IOVDbFolder::m_multiversion {false}
private

Definition at line 269 of file IOVDbFolder.h.

◆ m_named

bool IOVDbFolder::m_named {false}
private

Definition at line 277 of file IOVDbFolder.h.

◆ m_nbytesread

unsigned long long IOVDbFolder::m_nbytesread {0}
private

Definition at line 306 of file IOVDbFolder.h.

◆ m_ncacheread

unsigned int IOVDbFolder::m_ncacheread {0}
private

Definition at line 304 of file IOVDbFolder.h.

◆ m_nchan

unsigned int IOVDbFolder::m_nchan {0}
private

Definition at line 310 of file IOVDbFolder.h.

◆ m_ndbread

unsigned int IOVDbFolder::m_ndbread {0}
private

Definition at line 303 of file IOVDbFolder.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nobjread

unsigned int IOVDbFolder::m_nobjread {0}
private

Definition at line 305 of file IOVDbFolder.h.

◆ m_notagoverride

bool IOVDbFolder::m_notagoverride {false}
private

Definition at line 272 of file IOVDbFolder.h.

◆ m_outputToFile

const bool IOVDbFolder::m_outputToFile {false}
private

Definition at line 325 of file IOVDbFolder.h.

◆ m_readtime

float IOVDbFolder::m_readtime {0}
private

Definition at line 307 of file IOVDbFolder.h.

◆ m_retrieved

bool IOVDbFolder::m_retrieved {false}
private

Definition at line 315 of file IOVDbFolder.h.

◆ m_source

const std::string IOVDbFolder::m_source
private

Definition at line 328 of file IOVDbFolder.h.

◆ m_tag

std::string IOVDbFolder::m_tag
private

Definition at line 296 of file IOVDbFolder.h.

◆ m_tag_info

nlohmann::json IOVDbFolder::m_tag_info = nullptr
private

Definition at line 332 of file IOVDbFolder.h.

◆ m_tagoverride

bool IOVDbFolder::m_tagoverride {false}
private

Definition at line 271 of file IOVDbFolder.h.

◆ m_timestamp

bool IOVDbFolder::m_timestamp {false}
private

Definition at line 270 of file IOVDbFolder.h.

◆ m_typename

std::string IOVDbFolder::m_typename
private

Definition at line 297 of file IOVDbFolder.h.

◆ m_useFileMetaData

bool IOVDbFolder::m_useFileMetaData {false}
private

Definition at line 274 of file IOVDbFolder.h.

◆ m_writemeta

bool IOVDbFolder::m_writemeta {false}
private

Definition at line 273 of file IOVDbFolder.h.

◆ p_clidSvc

IClassIDSvc* IOVDbFolder::p_clidSvc {nullptr}
private

Definition at line 263 of file IOVDbFolder.h.

◆ p_metaDataTool

IIOVDbMetaDataTool* IOVDbFolder::p_metaDataTool {nullptr}
private

Definition at line 264 of file IOVDbFolder.h.

◆ p_tagInfoMgr

ITagInfoMgr* IOVDbFolder::p_tagInfoMgr {nullptr}
private

Definition at line 262 of file IOVDbFolder.h.


The documentation for this class was generated from the following files:
IOVDbFolder::m_dropped
bool m_dropped
Definition: IOVDbFolder.h:280
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CondAttrListCollection::minRange
const IOVRange & minRange() const
Current minimal IOVRange.
Definition: CondAttrListCollection.h:438
IOVDbNamespace::IovStore::extendIov
void extendIov(const unsigned int idx, const cool::ValidityKey &newUntilTime)
Extend a specific iov at the index to a new 'until' time.
Definition: IovStore.cxx:77
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
IOVDbParser::noTagOverride
bool noTagOverride() const
Definition: IOVDbParser.cxx:217
IOVDbNamespace::spaceStrip
std::string spaceStrip(const std::string &input)
Trim leading and trailing spaces,return a new trimmed string.
Definition: IOVDbStringFunctions.cxx:11
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
IOVDbFolder::m_outputToFile
const bool m_outputToFile
Definition: IOVDbFolder.h:325
CxxUtils::span
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.
IOVDbFolder::m_cacheccend
std::vector< unsigned int > m_cacheccend
Definition: IOVDbFolder.h:323
IOVDbNamespace::Cool2Json
Definition: Cool2Json.h:26
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
IOVDbFolder::m_crestCoolToFile
const bool m_crestCoolToFile
Definition: IOVDbFolder.h:327
IOVDbFolder::m_useFileMetaData
bool m_useFileMetaData
Definition: IOVDbFolder.h:274
IOVDbFolder::magicTag
bool magicTag(std::string &tag)
Definition: IOVDbFolder.cxx:1105
IOVDbFolder::dropped
bool dropped() const
Definition: IOVDbFolder.h:366
get_generator_info.result
result
Definition: get_generator_info.py:21
IOVDbFolder::m_checklock
bool m_checklock
Definition: IOVDbFolder.h:282
IOVDbFolder::p_metaDataTool
IIOVDbMetaDataTool * p_metaDataTool
Definition: IOVDbFolder.h:264
dqt_zlumi_alleff_HIST.iov
iov
Definition: dqt_zlumi_alleff_HIST.py:119
IOVDbFolder::m_foldername
std::string m_foldername
Definition: IOVDbFolder.h:266
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
IOVDbFolder::m_tagoverride
bool m_tagoverride
Definition: IOVDbFolder.h:271
IOVDbFolder::conn
IOVDbConn * conn()
Definition: IOVDbFolder.h:340
IOVDbFolder::m_retrieved
bool m_retrieved
Definition: IOVDbFolder.h:315
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
IOVDbFolder::m_ncacheread
unsigned int m_ncacheread
Definition: IOVDbFolder.h:304
python.MagFieldUtils.lumiblock
lumiblock
Definition: MagFieldUtils.py:188
IOVDbFolder::fetchCrestObjects
std::vector< IOVDbNamespace::BasicFolder > fetchCrestObjects(cool::ValidityKey since, cool::ValidityKey until, bool vectorPayloadFlag, cool::ValidityKey vkey, const std::string &nodeDesc)
Definition: IOVDbFolder.cxx:1254
IOVDbNamespace::IovStore::vectorStore
std::vector< Iov_t > & vectorStore()
Return the internal vector store.
Definition: IovStore.cxx:64
json
nlohmann::json json
Definition: HistogramDef.cxx:9
IOVDbFolder::m_cfunctions
std::optional< IOVDbNamespace::CrestFunctions > m_cfunctions
Definition: IOVDbFolder.h:334
IOVDbParser::cachehint
int cachehint() const
Definition: IOVDbParser.cxx:168
IOVDbFolder::m_jokey
bool m_jokey
Definition: IOVDbFolder.h:279
find_tgc_unfilled_channelids.iovs
iovs
Definition: find_tgc_unfilled_channelids.py:12
IOVDbNamespace::IovStore::getMinimumStraddlingSpan
Iov_t getMinimumStraddlingSpan() const
Get the minimum straddling span (max 'since' to min 'until')
Definition: IovStore.cxx:45
CondAttrListCollection::addNewStop
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop
Definition: CondAttrListCollection.h:518
IOVDbConn::open
bool open()
Definition: IOVDbConn.cxx:74
python.LArRawChannelBuilderCrestConfig.crestServer
crestServer
Definition: LArRawChannelBuilderCrestConfig.py:118
IOVDbFolder::m_crestTag
const std::string m_crestTag
Definition: IOVDbFolder.h:330
IOVDbFolder::m_crestServer
const std::string m_crestServer
Definition: IOVDbFolder.h:329
IOVDbNamespace::ALL_LUMI_BLOCKS
constexpr unsigned long long ALL_LUMI_BLOCKS
All the lumi blocks in one run.
Definition: IOVDbCoolFunctions.h:36
IOVDbNamespace::IovStore::numberOfIovsOnBoundaries
std::pair< unsigned int, unsigned int > numberOfIovsOnBoundaries() const
Return the current count of added Iovs which straddled cache boundaries.
Definition: IovStore.cxx:51
IOVDbFolder::m_currange
IOVRange m_currange
Definition: IOVDbFolder.h:316
IOVDbConn::name
const std::string & name() const
Definition: IOVDbConn.h:70
IOVDbFolder::m_cacheinc
int m_cacheinc
Definition: IOVDbFolder.h:288
IOVDbNamespace::IovStore::clear
void clear()
clear the store
Definition: IovStore.cxx:56
IOVDbFolder::createTransientAddress
std::unique_ptr< SG::TransientAddress > createTransientAddress(const std::vector< std::string > &symlinks)
Definition: IOVDbFolder.cxx:874
IIOVDbMetaDataTool::registerFolder
virtual StatusCode registerFolder(const std::string &folderName, const std::string &folderDescription) const =0
Register folder in the IOV Db MetaData.
IOVDbNamespace::IovStore::size
unsigned int size() const
length of store
Definition: IovStore.h:45
IOVDbFolder::specialCacheUpdate
void specialCacheUpdate(CoraCoolObject &obj, const ServiceHandle< IIOVSvc > &iovSvc)
Definition: IOVDbFolder.cxx:573
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
IOVDbParser::onlyReadMetadata
bool onlyReadMetadata() const
Definition: IOVDbParser.cxx:179
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
IOVDbFolder::m_tag_info
nlohmann::json m_tag_info
Definition: IOVDbFolder.h:332
IOVDbFolder::m_cachelength
cool::ValidityKey m_cachelength
Definition: IOVDbFolder.h:286
CheckTagAssociation.taglist
taglist
Definition: CheckTagAssociation.py:103
IOVDbNamespace::PoolRefColl
@ PoolRefColl
Definition: FolderTypes.h:31
CopyBlobFromCool.payloadSpec
payloadSpec
Definition: CopyBlobFromCool.py:114
CondAttrListCollection::addNewStart
void addNewStart(const IOVTime &start)
Add new start time to minRange - make sure that start is >= to new start.
Definition: CondAttrListCollection.h:508
IOVDbNamespace::iovTimeFromSeconds
unsigned long long iovTimeFromSeconds(const unsigned long long seconds)
Create a long long time in ns from s.
Definition: IOVDbCoolFunctions.cxx:98
IOVDbFolder::m_tag
std::string m_tag
Definition: IOVDbFolder.h:296
IOVDbFolder::eventStore
const std::string & eventStore() const
Definition: IOVDbFolder.h:374
IOVDbFolder::m_chansel
cool::ChannelSelection m_chansel
Definition: IOVDbFolder.h:290
IOVDbFolder::fetchCrestIOVs
std::vector< IOVHash > fetchCrestIOVs(cool::ValidityKey since, cool::ValidityKey until)
Definition: IOVDbFolder.cxx:1174
IOVDbNamespace::PoolRef
@ PoolRef
Definition: FolderTypes.h:30
IOVDbParser::overridesIov
bool overridesIov(MsgStream &msg) const
return true if this description overrides the timestamp or runlumi
Definition: IOVDbParser.cxx:262
IOVDbConn::valid
bool valid() const
Definition: IOVDbConn.h:60
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
IOVDbFolder::p_tagInfoMgr
ITagInfoMgr * p_tagInfoMgr
Definition: IOVDbFolder.h:262
IOVDbFolder::m_fromMetaDataOnly
bool m_fromMetaDataOnly
Definition: IOVDbFolder.h:275
IOVDbNamespace::makeEpochOrRunLumi
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.
Definition: IOVDbCoolFunctions.cxx:87
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
IOVDbNamespace::IovStore::Iov_t
std::pair< cool::ValidityKey, cool::ValidityKey > Iov_t
Definition: IovStore.h:22
IOVDbFolder::setSharedSpec
void setSharedSpec(const coral::AttributeList &atrlist)
Definition: IOVDbFolder.cxx:1139
makeDTCalibBlob_pickPhase.globalTag
globalTag
Definition: makeDTCalibBlob_pickPhase.py:398
IOVDbParser::named
bool named() const
Definition: IOVDbParser.cxx:174
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
IOVDbNamespace::replaceServiceType71
bool replaceServiceType71(std::string &addrHeader)
Definition: IOVDbStringFunctions.cxx:212
IOVDbFolder::folderName
const std::string & folderName() const
Definition: IOVDbFolder.h:337
IOVDbConn::getFolderPtr
T getFolderPtr(const std::string &folderName)
Definition: IOVDbConn.h:43
IOVDbFolder::m_foldertype
IOVDbNamespace::FolderType m_foldertype
Definition: IOVDbFolder.h:284
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
IOVDbNamespace::Json2Cool
Produces cool objects from their JSON representation, storing them in a 'BasicFolder'.
Definition: Json2Cool.h:28
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
dq_defect_copy_defect_database.until
def until
Definition: dq_defect_copy_defect_database.py:55
AthMessaging::setLevel
void setLevel(MSG::Level lvl)
Change the current logging level.
Definition: AthMessaging.cxx:28
IOVDbFolder::m_addrheader
std::string m_addrheader
Definition: IOVDbFolder.h:300
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
CoraCoolObject::const_iterator
AttrListVec::const_iterator const_iterator
Definition: CoraCoolObject.h:23
IOVDbFolder::clid
CLID clid() const
Definition: IOVDbFolder.h:377
python.AthDsoLogger.delimiter
delimiter
Definition: AthDsoLogger.py:71
IOVDbFolder::m_readtime
float m_readtime
Definition: IOVDbFolder.h:307
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
IOVDbFolder::m_jotag
std::string m_jotag
Definition: IOVDbFolder.h:295
IOVDbFolder::m_iovoverride
cool::ValidityKey m_iovoverride
Definition: IOVDbFolder.h:283
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IOVDbParser::extensible
bool extensible() const
Definition: IOVDbParser.cxx:184
IOVDbFolder::addMetaAttrListColl
bool addMetaAttrListColl(const CondAttrListCollection *coll)
Definition: IOVDbFolder.cxx:1125
python.AppMgr.iadd
def iadd(self, tool)
associator for public tools -------------------------------------------—
Definition: AppMgr.py:29
IOVDbFolder::p_clidSvc
IClassIDSvc * p_clidSvc
Definition: IOVDbFolder.h:263
CondAttrListVec
Definition: CondAttrListVec.h:31
lumiFormat.i
int i
Definition: lumiFormat.py:85
IOVDbNamespace::checkTagLock
std::optional< bool > checkTagLock(const cool::IFolderPtr &fptr, const std::string &tag)
Check whether a tag is locked on a folder, if possible.
Definition: TagFunctions.cxx:43
IOVDbNamespace::CrestFunctions
Definition: CrestFunctions.h:31
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
IOVDbFolder::m_cachehint
int m_cachehint
Definition: IOVDbFolder.h:287
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
IOVDbFolder::m_clid
CLID m_clid
Definition: IOVDbFolder.h:301
IOVDbFolder::m_cachepar
std::string m_cachepar
Definition: IOVDbFolder.h:299
IOVDbFolder::m_channames
std::vector< std::string > m_channames
Definition: IOVDbFolder.h:312
IOVDbParser::cache
std::string cache() const
Definition: IOVDbParser.cxx:163
calibdata.exception
exception
Definition: calibdata.py:496
IOVDbFolder::m_iovs
IOVDbNamespace::IovStore m_iovs
Definition: IOVDbFolder.h:324
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
IOVDbNamespace::IovStore::getCacheBounds
Iov_t getCacheBounds() const
Report the current cache bounds.
Definition: IovStore.cxx:31
IOVDbNamespace::CoolVector
@ CoolVector
Definition: FolderTypes.h:33
IOVDbFolder::m_iovoverridden
bool m_iovoverridden
Definition: IOVDbFolder.h:278
IOVDbNamespace::CoraCool
@ CoraCool
Definition: FolderTypes.h:32
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
IOVDbFolder::m_crest_tag
std::string m_crest_tag
Definition: IOVDbFolder.h:331
IOVDbFolder::m_autocache
bool m_autocache
Definition: IOVDbFolder.h:281
run
Definition: run.py:1
IOVDbNamespace::channelList
std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > channelList(IOVDbConn *pConnection, const std::string &folderName, const bool named)
Retrieve channel information.
Definition: IOVDbCoolFunctions.cxx:160
IOVDbNamespace::BasicFolder::empty
bool empty() const
Definition: BasicFolder.cxx:31
IOVDbNamespace::IovStore::setCacheBounds
void setCacheBounds(const Iov_t &cacheBounds)
Set the cache bound variables.
Definition: IovStore.cxx:36
fptr
std::vector< TFile * > fptr
Definition: hcg.cxx:48
HLT::setFlag
void setFlag(TrigPassFlags *flags, const T *obj, const CONTAINER *container, const std::vector< bool > &flag)
Set the flag at index position.
Definition: TrigPassFlags.h:121
IOVDbFolder::m_folderDescription
std::string m_folderDescription
Definition: IOVDbFolder.h:268
IOVDbNamespace::AttrListColl
@ AttrListColl
Definition: FolderTypes.h:29
IOVDbParser::iovOverrideValue
unsigned long long iovOverrideValue(MsgStream &msg) const
Definition: IOVDbParser.cxx:301
IOVDbFolder::m_source
const std::string m_source
Definition: IOVDbFolder.h:328
IIOVDbMetaDataTool::addPayload
virtual StatusCode addPayload(const std::string &folderName, CondAttrListCollection *payload) const =0
Add an IOV and Payload for a particular folder - replaces payloads if there is an IOV overlap.
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
IOVDbParser::key
std::string key() const
Definition: IOVDbParser.cxx:138
CoraCoolFolderPtr
boost::shared_ptr< CoraCoolFolder > CoraCoolFolderPtr
Definition: CoraCoolTypes.h:15
IOVDbFolder::addMetaAttrList
bool addMetaAttrList(const coral::AttributeList &atrlist, const IOVRange &range)
Definition: IOVDbFolder.cxx:1113
IOVDbFolder::m_writemeta
bool m_writemeta
Definition: IOVDbFolder.h:273
IOVDbFolder::addIOVtoCache
void addIOVtoCache(cool::ValidityKey since, cool::ValidityKey until)
Definition: IOVDbFolder.cxx:1153
grepfile.ic
int ic
Definition: grepfile.py:33
IOVDbParser::tag
std::string tag() const
Definition: IOVDbParser.cxx:148
lumiFormat.array
array
Definition: lumiFormat.py:91
IOVDbFolder::dumpFile
void dumpFile(const std::string &dumpName, const cool::ValidityKey &vkey, IOVDbNamespace::Cool2Json *json, bool skipCoolIoV, IOVDbNamespace::BasicFolder *basicFolder, const std::string &crestNodeDescr, const std::string &specString) const
Definition: IOVDbFolder.cxx:1209
CoraCoolDatabasePtr
boost::shared_ptr< CoraCoolDatabase > CoraCoolDatabasePtr
Definition: CoraCoolTypes.h:12
IOVDbNamespace::makeRange
IOVRange makeRange(const cool::ValidityKey since, const cool::ValidityKey until, const bool timeIsEpoch)
Make an IOVRange from two validity keys.
Definition: IOVDbCoolFunctions.cxx:113
IOVDbNamespace::IovStore::addIov
void addIov(const Iov_t &iov)
Add an iov to the store and update the span variables.
Definition: IovStore.cxx:16
IOVDbNamespace::BasicFolder
Definition: BasicFolder.h:21
IOVDbParser::getKey
bool getKey(const std::string &key, const std::string &devvalue, std::string &value) const
original 'getKey' method, now implemented using 'at'
Definition: IOVDbParser.cxx:108
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
IOVDbParser
Definition: IOVDbParser.h:19
IOVDbNamespace::sanitiseFilename
std::string sanitiseFilename(const std::string &fname)
Replace the '/' of a file path with '^'.
Definition: IOVDbStringFunctions.cxx:110
IOVDbFolder::m_chanrange
std::vector< ChanRange > m_chanrange
Definition: IOVDbFolder.h:292
IOVDbFolder::m_channums
std::vector< cool::ChannelId > m_channums
Definition: IOVDbFolder.h:311
IOVDbFolder::m_nobjread
unsigned int m_nobjread
Definition: IOVDbFolder.h:305
IOVDbFolder::key
const std::string & key() const
Definition: IOVDbFolder.h:338
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
IOVDbNamespace::typeSizeIsKnown
bool typeSizeIsKnown(const coral::Attribute &attribute)
Return a bool indicating whether the size of a given Attribute can be determined.
Definition: IOVDbCoolFunctions.cxx:67
IOVDbParser::timebaseIs_nsOfEpoch
bool timebaseIs_nsOfEpoch() const
Definition: IOVDbParser.cxx:158
IOVDbFolder::cacheUpdateImplementation
unsigned int cacheUpdateImplementation(T &obj, const ServiceHandle< IIOVSvc > &iovSvc)
Definition: IOVDbFolder.h:177
IOVDbNamespace::resolveUsingTagInfo
std::string resolveUsingTagInfo(const std::string &tag, const ITagInfoMgr *tagInfoMgr)
Definition: TagFunctions.cxx:54
IOVDbFolder::m_cachespec
coral::AttributeListSpecification * m_cachespec
Definition: IOVDbFolder.h:319
IOVDbFolder::m_nchan
unsigned int m_nchan
Definition: IOVDbFolder.h:310
IOVDbFolder::m_crestToFile
const bool m_crestToFile
Definition: IOVDbFolder.h:326
IOVDbNamespace::runLumiFromIovTime
std::pair< unsigned long long, unsigned long long > runLumiFromIovTime(const unsigned long long iovTime)
Return a [run,lumi] pair from an IOV time.
Definition: IOVDbCoolFunctions.cxx:108
IOVDbFolder::m_named
bool m_named
Definition: IOVDbFolder.h:277
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
IOVDbFolder::clearCache
void clearCache()
Definition: IOVDbFolder.cxx:1038
IOVDbParser::folderName
std::string folderName() const
give the folder name contained in the parsed description
Definition: IOVDbParser.cxx:133
CoraCoolObjectIterPtr
boost::shared_ptr< CoraCoolObjectIter > CoraCoolObjectIterPtr
Definition: CoraCoolTypes.h:21
IOVDbNamespace::attributeListSize
unsigned int attributeListSize(const coral::AttributeList &atrlist)
return the size (in bytes) of an AttributeList
Definition: IOVDbCoolFunctions.cxx:72
IOVDbFolder::resolveTag
bool resolveTag(const cool::IFolderPtr &fptr, const std::string &globalTag)
Definition: IOVDbFolder.cxx:1048
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
IOVDbFolder::m_notagoverride
bool m_notagoverride
Definition: IOVDbFolder.h:272
IOVDbNamespace::folderMetadata
std::pair< bool, std::string > folderMetadata(IOVDbConn *pConnection, const std::string &folderName)
Retrieve (bool) multiversion flag and folder description
Definition: IOVDbCoolFunctions.cxx:136
IOVDbFolder::setCacheLength
void setCacheLength(const bool timeIs_nsOfEpoch, const unsigned int cacheRun, const unsigned int cacheTime)
Definition: IOVDbFolder.cxx:1010
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IOVDbParser::hasKey
bool hasKey() const
Definition: IOVDbParser.cxx:143
ref
const boost::regex ref(r_ef)
IOVDbConn::decUsage
void decUsage()
Definition: IOVDbConn.h:74
IOVDbNamespace::IovStore::extendCacheHi
bool extendCacheHi()
Extend upper cache bound to the minimum 'until' time; return whether this changes its value.
Definition: IovStore.cxx:96
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DeMoScan.first
bool first
Definition: DeMoScan.py:536
CoraCoolObjectPtr
boost::shared_ptr< CoraCoolObject > CoraCoolObjectPtr
Definition: CoraCoolTypes.h:18
IOVDbNamespace::AttrList
@ AttrList
Definition: FolderTypes.h:28
IOVDbFolder::overrideOptionsFromParsedDescription
bool overrideOptionsFromParsedDescription(const IOVDbParser &parsedDescription)
Definition: IOVDbFolder.cxx:832
IOVDbNamespace::SafeReadFromFileMetaData
Definition: ReadFromFileMetaData.h:74
IOVDbFolder::m_cachechan
std::vector< cool::ChannelId > m_cachechan
Definition: IOVDbFolder.h:320
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
IOVDbFolder::m_ndbread
unsigned int m_ndbread
Definition: IOVDbFolder.h:303
IOVDbNamespace::IovStore::at
Iov_t at(const unsigned int idx) const
'at' to read iov at specific index
Definition: IovStore.h:49
IOVDbNamespace::folderTypeName
std::string folderTypeName(const FolderType f)
Give a string name for the folder type.
Definition: FolderTypes.cxx:135
IOVDbNamespace::BasicFolder::setVectorPayloadFlag
void setVectorPayloadFlag(const bool flag)
Definition: BasicFolder.cxx:36
pvec
std::array< fp_t, 2 > pvec
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:9
copySelective.source
string source
Definition: copySelective.py:32
IOVDbParser::classId
CLID classId(MsgStream &msg) const
Definition: IOVDbParser.cxx:190
IOVDbNamespace::iovTimeFromRunLumi
unsigned long long iovTimeFromRunLumi(const unsigned long long run, const unsigned long long lumi)
Create a long long representing the IOV from run, lumi.
Definition: IOVDbCoolFunctions.cxx:103
IOVDbFolder::m_multiversion
bool m_multiversion
Definition: IOVDbFolder.h:269
IOVDbNamespace::determineFolderType
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.
Definition: FolderTypes.cxx:17
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
IOVDbNamespace::IovStore::extendCacheLo
bool extendCacheLo()
Extend lower cache bound to the maximum 'since' time; return whether this changes its value.
Definition: IovStore.cxx:89
IOVDbFolder::m_nbytesread
unsigned long long m_nbytesread
Definition: IOVDbFolder.h:306
IOVDbNamespace::countSelectedChannels
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.
Definition: IOVDbCoolFunctions.cxx:81
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
IOVDbFolder::m_key
std::string m_key
Definition: IOVDbFolder.h:267
IOVDbNamespace::looksLikeMagicTag
bool looksLikeMagicTag(const std::string &candidateTag)
Looks like it should be magic.
Definition: IOVDbStringFunctions.cxx:151
CondAttrListVec::addSlice
void addSlice(const IOVRange &range, const unsigned int chan, const std::vector< coral::AttributeList > &data, const unsigned int datastart, const unsigned int dataend)
Definition: CondAttrListVec.h:268
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
IOVDbFolder::m_cacheccstart
std::vector< unsigned int > m_cacheccstart
Definition: IOVDbFolder.h:322
test_pyathena.counter
counter
Definition: test_pyathena.py:15
IOVDbConn::dropAndReconnect
bool dropAndReconnect()
Definition: IOVDbConn.cxx:85
python.PyAthena.obj
obj
Definition: PyAthena.py:132
IOVDbNamespace::BasicFolder::jsonPayload
std::string jsonPayload(const std::string &folderDescription, const std::string &spec)
Definition: BasicFolder.cxx:119
IOVDbParser::addressHeader
std::string addressHeader() const
Definition: IOVDbParser.cxx:206
CondAttrListCollection::add
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
Definition: CondAttrListCollection.h:452
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:67
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
python.compressB64.c
def c
Definition: compressB64.py:93
IOVDbFolder::m_conn
IOVDbConn * m_conn
Definition: IOVDbFolder.h:265
IOVDbNamespace::IovStore::empty
bool empty() const
is the store empty?
Definition: IovStore.h:43
IOVDbNamespace::IovStore::setIovSpan
void setIovSpan(const Iov_t &span)
Set span.
Definition: IovStore.cxx:82
IOVDbParser::eventStoreName
std::string eventStoreName() const
Definition: IOVDbParser.cxx:153
IOVDbConn::getCoraCoolDb
CoraCoolDatabasePtr getCoraCoolDb()
Definition: IOVDbConn.cxx:102
IOVDbFolder::m_typename
std::string m_typename
Definition: IOVDbFolder.h:297
IOVDbFolder::objectIteratorIsValid
bool objectIteratorIsValid(cool::IObjectIteratorPtr &objItr)
Definition: IOVDbFolder.h:218
IOVDbFolder::m_timestamp
bool m_timestamp
Definition: IOVDbFolder.h:270
CondAttrListVec::minRange
const IOVRange & minRange() const
Definition: CondAttrListVec.h:232
extractSporadic.myFile
myFile
Definition: extractSporadic.py:87
IOVDbFolder::m_cacheattr
std::vector< coral::AttributeList > m_cacheattr
Definition: IOVDbFolder.h:321
CondAttrListCollection::addShared
void addShared(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs with shared data.
Definition: CondAttrListCollection.h:469
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
IOVDbFolder::m_eventstore
std::string m_eventstore
Definition: IOVDbFolder.h:298
IOVDbFolder::m_extensible
bool m_extensible
Definition: IOVDbFolder.h:276