Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CoralCrestManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 // @file CoralCrestManager.cxx
5 // Implementation for CrestFunctions utilities
6 // @author Evgeny Alexandrov
7 // @date 24 February 2025
8 
9 #include "CoralCrestManager.h"
10 #include "CrestApi/CrestApi.h"
11 #include "CrestApi/CrestApiFs.h"
12 #include "CoralBase/AttributeList.h"
13 #include "CoralBase/Attribute.h"
14 #include "CoolKernel/StorageType.h"
15 #include "CoolKernel/RecordSpecification.h"
16 #include "CoolKernel/Record.h"
17 
18  CoralCrestManager::CoralCrestManager(const std::string & crest_path, const std::string & crestTag):m_crestTag(crestTag){
19  if(crest_path.length()==0)
20  return;
21  if (crest_path.starts_with(CoralCrestManager::prefix1) || crest_path.starts_with(CoralCrestManager::prefix2)){
22  m_crestCl = std::make_unique<Crest::CrestApi>(Crest::CrestApi(crest_path));
23  }
24  else{
25  m_crestCl = std::make_unique<Crest::CrestApiFs>(Crest::CrestApiFs(true,crest_path));
26  }
27 
28  }
29  std::map<std::string, std::string> CoralCrestManager::getGlobalTagMap(const std::string & crest_path, const std::string& globaltag){
30  Crest::CrestApiBase* crestCl=NULL;
31  if (crest_path.starts_with(CoralCrestManager::prefix1) || crest_path.starts_with(CoralCrestManager::prefix2)){
32  crestCl = new Crest::CrestApi(crest_path);
33  }
34  else{
35  crestCl = new Crest::CrestApiFs(true,crest_path);
36  }
37  std::map<std::string, std::string> tagmap;
38  try{
39  Crest::GlobalTagMapSetDto dto = crestCl->findGlobalTagMap(globaltag,"Trace");
40  for (const auto &tagMapDto : dto.getResources()){
41  tagmap[tagMapDto.getLabel()]=tagMapDto.getTagName();
42  }
43  } catch (std::exception & e){
44  std::cerr<<__FILE__<<":"<<__LINE__<< ": " << e.what() << " Cannot get a global tag map for " << globaltag << std::endl;
45  }
46  if(crestCl!=NULL){
47  delete crestCl;
48  crestCl=NULL;
49  }
50  return tagmap;
51  }
52 
53 
54 
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
CoralCrestManager::m_crestCl
std::unique_ptr< Crest::CrestApiBase > m_crestCl
Definition: CoralCrestManager.h:26
CoralCrestManager::getGlobalTagMap
static std::map< std::string, std::string > getGlobalTagMap(const std::string &crest_path, const std::string &globaltag)
Definition: CoralCrestManager.cxx:29
calibdata.exception
exception
Definition: calibdata.py:496
CheckTagAssociation.globaltag
globaltag
Definition: CheckTagAssociation.py:18
CoralCrestManager::prefix2
static const std::string prefix2
Definition: CoralCrestManager.h:22
CoralCrestManager.h
Header for CoralCrestManager class.
CoralCrestManager::prefix1
static const std::string prefix1
Definition: CoralCrestManager.h:21
CoralCrestManager::CoralCrestManager
CoralCrestManager(const std::string &crest_path, const std::string &crestTag)
Definition: CoralCrestManager.cxx:18