ATLAS Offline Software
CrestFunctions.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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 
25 namespace IOVDbNamespace{
26  typedef std::pair<std::string,std::string> IovHashPair; // <IOV,Hash> pairs extracted from Json
27 
29  {
30 
31  public:
32 
33  CrestFunctions(const std::string & crest_path);
34 
35  const std::string & getURLBase();
36 
37  void setURLBase(const std::string & crest_path);
38 
39  std::vector<IovHashPair>
40  extractIovAndHash(const std::string_view jsonReply);
41 
42  std::string
43  extractHashFromJson(const std::string & jsonReply);
44 
45  std::vector<IovHashPair>
46  getIovsForTag(const std::string & tag, const bool testing=false);
47 
48  std::string
49  getLastHashForTag(const std::string & tag, const bool testing=false);
50 
51  std::string
52  getPayloadForHash(const std::string & hash, const bool testing=false);
53 
54  std::pair<std::vector<cool::ChannelId> , std::vector<std::string>>
55  extractChannelListFromJson(const std::string & jsonReply);
56 
57  std::pair<std::vector<cool::ChannelId> , std::vector<std::string>>
58  channelListForTag(const std::string & tag, const bool testing=false);
59 
60  std::map<cool::ChannelId, std::string>
61  channelNameMap(const std::string & folderName);
62 
63  std::string
64  getPayloadForTag(const std::string & tag,const bool testing=false);
65 
66  std::string
67  folderDescriptionForTag(const std::string & tag, const bool testing=false);
68 
69  std::string
70  payloadSpecificationForTag(const std::string & tag, const bool testing=false);
71 
72  std::string
73  extractDescriptionFromJson(const std::string & jsonReply);
74 
75  std::string
76  resolveCrestTag(const std::string & globalTagName, const std::string & folderName, const std::string & forceTag="", const bool testing=false);
77 
78 
79  std::string
80  jsonTagName(const std::string &globalTag, const std::string & folderName);
81 
82  std::map<std::string, std::string>
83  getGlobalTagMap(const std::string& globaltag);
84 
85  nlohmann::json getTagInfo(const std::string & tag);
86 
87  nlohmann::json getTagProperties(const std::string & tag);
88 
89  std::string
90  extractPayloadSpecification(const std::string & tag, nlohmann::json tagMeta);
91 
92  std::string
93  getTagInfoElement(nlohmann::json tag_info, const std::string & key);
94 
95  std::pair<std::vector<cool::ChannelId> , std::vector<std::string>>
96  extractChannelListFromString(const std::string & chanString);
97 
98  std::string
99  extractSpecificationFromJson(const std::string & jsonReply);
100 
101  private:
102 
103  std::string m_CREST_PATH = "";
104 
105  };
106 }
107 #endif
IOVDbNamespace::CrestFunctions::getGlobalTagMap
std::map< std::string, std::string > getGlobalTagMap(const std::string &globaltag)
IOVDbNamespace::CrestFunctions::m_CREST_PATH
std::string m_CREST_PATH
Definition: CrestFunctions.h:103
IOVDbNamespace::CrestFunctions::payloadSpecificationForTag
std::string payloadSpecificationForTag(const std::string &tag, const bool testing=false)
json
nlohmann::json json
Definition: HistogramDef.cxx:9
IOVDbNamespace::CrestFunctions::setURLBase
void setURLBase(const std::string &crest_path)
IOVDbNamespace::CrestFunctions::getURLBase
const std::string & getURLBase()
IOVDbNamespace::IovHashPair
std::pair< std::string, std::string > IovHashPair
Definition: CrestFunctions.h:26
IOVDbNamespace::CrestFunctions::extractIovAndHash
std::vector< IovHashPair > extractIovAndHash(const std::string_view jsonReply)
IOVDbNamespace::CrestFunctions::extractSpecificationFromJson
std::string extractSpecificationFromJson(const std::string &jsonReply)
IOVDbNamespace::CrestFunctions::getTagProperties
nlohmann::json getTagProperties(const std::string &tag)
IOVDbNamespace::CrestFunctions::CrestFunctions
CrestFunctions(const std::string &crest_path)
IOVDbNamespace::CrestFunctions::resolveCrestTag
std::string resolveCrestTag(const std::string &globalTagName, const std::string &folderName, const std::string &forceTag="", const bool testing=false)
IOVDbNamespace::CrestFunctions::extractHashFromJson
std::string extractHashFromJson(const std::string &jsonReply)
IOVDbNamespace::CrestFunctions::channelListForTag
std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > channelListForTag(const std::string &tag, const bool testing=false)
IOVDbNamespace::CrestFunctions
Definition: CrestFunctions.h:29
IOVDbNamespace::CrestFunctions::folderDescriptionForTag
std::string folderDescriptionForTag(const std::string &tag, const bool testing=false)
IOVDbNamespace::CrestFunctions::getLastHashForTag
std::string getLastHashForTag(const std::string &tag, const bool testing=false)
IOVDbNamespace::CrestFunctions::extractPayloadSpecification
std::string extractPayloadSpecification(const std::string &tag, nlohmann::json tagMeta)
CheckTagAssociation.globaltag
globaltag
Definition: CheckTagAssociation.py:18
IOVDbNamespace::CrestFunctions::getPayloadForTag
std::string getPayloadForTag(const std::string &tag, const bool testing=false)
CaloCellTimeCorrFiller.folderName
string folderName
Definition: CaloCellTimeCorrFiller.py:20
IOVDbNamespace::CrestFunctions::channelNameMap
std::map< cool::ChannelId, std::string > channelNameMap(const std::string &folderName)
IOVDbNamespace::CrestFunctions::getTagInfoElement
std::string getTagInfoElement(nlohmann::json tag_info, const std::string &key)
IOVDbNamespace::CrestFunctions::getTagInfo
nlohmann::json getTagInfo(const std::string &tag)
IOVDbNamespace::CrestFunctions::extractChannelListFromString
std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > extractChannelListFromString(const std::string &chanString)
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
IOVDbNamespace::CrestFunctions::jsonTagName
std::string jsonTagName(const std::string &globalTag, const std::string &folderName)
IOVDbNamespace::CrestFunctions::getIovsForTag
std::vector< IovHashPair > getIovsForTag(const std::string &tag, const bool testing=false)
IOVDbNamespace::CrestFunctions::extractChannelListFromJson
std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > extractChannelListFromJson(const std::string &jsonReply)
Example_ReadSampleNoise.globalTag
globalTag
Definition: Example_ReadSampleNoise.py:15
IOVDbNamespace::CrestFunctions::getPayloadForHash
std::string getPayloadForHash(const std::string &hash, const bool testing=false)
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
IOVDbNamespace::CrestFunctions::extractDescriptionFromJson
std::string extractDescriptionFromJson(const std::string &jsonReply)
IOVDbNamespace
Definition: Base64Codec.cxx:16
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37