ATLAS Offline Software
CrestFunctions.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 #ifndef IOVDBSVC_CRESTFUNCTIONS_H
13 #define IOVDBSVC_CRESTFUNCTIONS_H
14 
15 #include <vector>
16 #include <string>
17 #include <map> //also contains std::pair
18 #include <string_view>
19 
20 #include "CoolKernel/ChannelId.h"
21 
22 #include "nlohmann/json.hpp"
23 
24 #include <CrestApi/CrestApiBase.h>
25 
26 
27 namespace IOVDbNamespace{
28  typedef std::pair<std::string,std::string> IovHashPair; // <IOV,Hash> pairs extracted from Json
29 
31  {
32 
33  public:
34 
35  CrestFunctions(const std::string & crest_path);
36 
37  const std::string & getURLBase();
38 
39  void setURLBase(const std::string & crest_path);
40 
41  std::string
42  extractHashFromJson(const std::string & jsonReply);
43 
44  std::vector<IovHashPair>
45  getIovsForTag(const std::string & tag, uint64_t since, uint64_t until);
46 
47  std::string
48  getLastHashForTag(const std::string & tag);
49 
50  std::string
51  getPayloadForHash(const std::string & hash);
52 
53  std::string
54  folderDescriptionForTag(const std::string & tag);
55 
56  std::string
57  extractDescriptionFromJson(const std::string & jsonReply);
58 
59  std::map<std::string, std::string>
60  getGlobalTagMap(const std::string& globaltag);
61 
62  nlohmann::json getTagInfo(const std::string & tag);
63 
64  nlohmann::json getTagProperties(const std::string & tag);
65 
66  std::string
67  getTagInfoElement(nlohmann::json tag_info, const std::string & key);
68 
69  std::pair<std::vector<cool::ChannelId> , std::vector<std::string>>
70  extractChannelListFromString(const std::string & chanString);
71 
72  std::vector<uint64_t>
73  getIovGroups(const std::string & tag);
74 
75  std::pair<uint64_t,uint64_t>
76  getSinceUntilPair(const std::vector<uint64_t>& v, const uint64_t since, const uint64_t until);
77 
78  int
79  getTagSize(const std::string& tagname);
80 
81  std::pair<uint64_t,uint64_t>
82  getIovInterval(const std::string& tag, const uint64_t since, const uint64_t until);
83 
84  private:
85 
86  std::unique_ptr<Crest::CrestApiBase> m_crestCl;
87 
88  std::string m_CREST_PATH = "";
89 
91 
92  };
93 }
94 #endif
IOVDbNamespace::CrestFunctions::m_CREST_PATH
std::string m_CREST_PATH
Definition: CrestFunctions.h:88
IOVDbNamespace::CrestFunctions::getIovsForTag
std::vector< IovHashPair > getIovsForTag(const std::string &tag, uint64_t since, uint64_t until)
Definition: CrestFunctions.cxx:293
CrestApiBase.h
Header file for CREST C++ Client Library.
IOVDbNamespace::CrestFunctions::getIovInterval
std::pair< uint64_t, uint64_t > getIovInterval(const std::string &tag, const uint64_t since, const uint64_t until)
Definition: CrestFunctions.cxx:285
IOVDbNamespace::CrestFunctions::m_crestCl
std::unique_ptr< Crest::CrestApiBase > m_crestCl
Definition: CrestFunctions.h:86
json
nlohmann::json json
Definition: HistogramDef.cxx:9
IOVDbNamespace::CrestFunctions::getSinceUntilPair
std::pair< uint64_t, uint64_t > getSinceUntilPair(const std::vector< uint64_t > &v, const uint64_t since, const uint64_t until)
Definition: CrestFunctions.cxx:244
IOVDbNamespace::CrestFunctions::setURLBase
void setURLBase(const std::string &crest_path)
Definition: CrestFunctions.cxx:41
IOVDbNamespace::IovHashPair
std::pair< std::string, std::string > IovHashPair
Definition: CrestFunctions.h:28
IOVDbNamespace::CrestFunctions::extractChannelListFromString
std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > extractChannelListFromString(const std::string &chanString)
Definition: CrestFunctions.cxx:199
IOVDbNamespace::CrestFunctions::getTagProperties
nlohmann::json getTagProperties(const std::string &tag)
Definition: CrestFunctions.cxx:172
IOVDbNamespace::CrestFunctions::CrestFunctions
CrestFunctions(const std::string &crest_path)
Definition: CrestFunctions.cxx:22
IOVDbNamespace::CrestFunctions::extractHashFromJson
std::string extractHashFromJson(const std::string &jsonReply)
Definition: CrestFunctions.cxx:47
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
dq_defect_copy_defect_database.until
def until
Definition: dq_defect_copy_defect_database.py:55
IOVDbNamespace::CrestFunctions
Definition: CrestFunctions.h:31
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
CheckTagAssociation.globaltag
globaltag
Definition: CheckTagAssociation.py:18
IOVDbNamespace::CrestFunctions::getTagInfoElement
std::string getTagInfoElement(nlohmann::json tag_info, const std::string &key)
Definition: CrestFunctions.cxx:183
IOVDbNamespace::CrestFunctions::getTagInfo
nlohmann::json getTagInfo(const std::string &tag)
Definition: CrestFunctions.cxx:154
python.PyAthena.v
v
Definition: PyAthena.py:154
IOVDbNamespace::CrestFunctions::getResources
nlohmann::json getResources(nlohmann::json &js)
Definition: CrestFunctions.cxx:220
IOVDbNamespace::CrestFunctions::getURLBase
const std::string & getURLBase()
Definition: CrestFunctions.cxx:36
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
IOVDbNamespace::CrestFunctions::getPayloadForHash
std::string getPayloadForHash(const std::string &hash)
Definition: CrestFunctions.cxx:86
IOVDbNamespace::CrestFunctions::getIovGroups
std::vector< uint64_t > getIovGroups(const std::string &tag)
Definition: CrestFunctions.cxx:227
IOVDbNamespace::CrestFunctions::folderDescriptionForTag
std::string folderDescriptionForTag(const std::string &tag)
Definition: CrestFunctions.cxx:122
tagname
Definition: tagname.h:29
IOVDbNamespace::CrestFunctions::getTagSize
int getTagSize(const std::string &tagname)
Definition: CrestFunctions.cxx:274
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
IOVDbNamespace::CrestFunctions::getLastHashForTag
std::string getLastHashForTag(const std::string &tag)
Definition: CrestFunctions.cxx:66
IOVDbNamespace::CrestFunctions::getGlobalTagMap
std::map< std::string, std::string > getGlobalTagMap(const std::string &globaltag)
Definition: CrestFunctions.cxx:133
IOVDbNamespace::CrestFunctions::extractDescriptionFromJson
std::string extractDescriptionFromJson(const std::string &jsonReply)
Definition: CrestFunctions.cxx:101
IOVDbNamespace
Definition: Base64Codec.cxx:16
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37