ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DecodeVersionKey Class Reference

This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag and node to pass to RDBAccessServer. More...

#include <DecodeVersionKey.h>

Collaboration diagram for DecodeVersionKey:

Public Member Functions

 DecodeVersionKey (const IGeoModelSvc *, const std::string &node)
 Constructor is passed a pointer to GeoModelSvc plus the node for which you want the tag. More...
 
 DecodeVersionKey (const IGeoDbTagSvc *, const std::string &node)
 
 DecodeVersionKey (const std::string &node)
 
const std::string & tag () const
 Return version tag. More...
 
const std::string & node () const
 Return the version node. More...
 
bool custom () const
 Return true if CUSTOM is selected. More...
 

Private Member Functions

template<class T >
void defineTag (const T *svc, const std::string &node)
 
bool getCustomTag (const std::string &inputTag, std::string &outputTag)
 

Private Attributes

std::string m_tag
 
std::string m_node
 
bool m_custom
 

Detailed Description

This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag and node to pass to RDBAccessServer.

If a subsystem has an override tag then that tag is used otherwise the ATLAS tag is used.

Definition at line 17 of file DecodeVersionKey.h.

Constructor & Destructor Documentation

◆ DecodeVersionKey() [1/3]

DecodeVersionKey::DecodeVersionKey ( const IGeoModelSvc geoModel,
const std::string &  node 
)

Constructor is passed a pointer to GeoModelSvc plus the node for which you want the tag.

Possible nodes are ATLAS, InnerDetector, Pixel, SCT, TRT, LAr, TileCal, or MuonSpectrometer.

Definition at line 13 of file DecodeVersionKey.cxx.

14 {
15  defineTag<IGeoModelSvc>(geoModel,node);
16 }

◆ DecodeVersionKey() [2/3]

DecodeVersionKey::DecodeVersionKey ( const IGeoDbTagSvc geoDbTag,
const std::string &  node 
)

Definition at line 18 of file DecodeVersionKey.cxx.

19 {
20  defineTag<IGeoDbTagSvc>(geoDbTag,node);
21 }

◆ DecodeVersionKey() [3/3]

DecodeVersionKey::DecodeVersionKey ( const std::string &  node)

Definition at line 23 of file DecodeVersionKey.cxx.

24 {
25  ISvcLocator* svcLocator = Gaudi::svcLocator();
26  IGeoDbTagSvc* geoDbTag{nullptr};
27  if(svcLocator->service("GeoDbTagSvc",geoDbTag).isFailure())
28  throw std::runtime_error("DecodeVersionKey constructor: cannot access GeoDbTagSvc");
29  defineTag<IGeoDbTagSvc>(geoDbTag,node);
30 }

Member Function Documentation

◆ custom()

bool DecodeVersionKey::custom ( ) const

Return true if CUSTOM is selected.

Definition at line 105 of file DecodeVersionKey.cxx.

106 {
107  return m_custom;
108 }

◆ defineTag()

template<class T >
void DecodeVersionKey::defineTag ( const T *  svc,
const std::string &  node 
)
private

Definition at line 33 of file DecodeVersionKey.cxx.

34 {
35  std::string nodeOverrideTag;
36  std::string indetOverrideTag; // Indet has two levels.
37  if (node == "ATLAS") {
38  nodeOverrideTag = "";
39  } else if (node == "InnerDetector") {
40  nodeOverrideTag = svc->inDetVersionOverride();
41  } else if (node == "Pixel") {
42  indetOverrideTag = svc->inDetVersionOverride();
43  nodeOverrideTag = svc->pixelVersionOverride();
44  } else if (node == "SCT") {
45  indetOverrideTag = svc->inDetVersionOverride();
46  nodeOverrideTag = svc->SCT_VersionOverride();
47  } else if (node == "TRT") {
48  indetOverrideTag = svc->inDetVersionOverride();
49  nodeOverrideTag = svc->TRT_VersionOverride();
50  } else if (node == "LAr") {
51  nodeOverrideTag = svc->LAr_VersionOverride();
52  } else if (node == "TileCal") {
53  nodeOverrideTag = svc->tileVersionOverride();
54  } else if (node == "MuonSpectrometer") {
55  nodeOverrideTag = svc->muonVersionOverride();
56  } else if (node == "Calorimeter") {
57  nodeOverrideTag = svc->caloVersionOverride();
58  } else if (node == "ForwardDetectors") {
59  nodeOverrideTag = svc->forwardDetectorsVersionOverride();
60  } else {
61  std::cout << "DecodeVersionKey passed an unknown node:" << node << std::endl;
62  nodeOverrideTag = "";
63  }
64 
65  // Default to atlas version
66  m_tag = svc->atlasVersion();
67  m_node = "ATLAS";
68 
69  // If indetOverrideTag is specified (and is not just "CUSTOM") then override with the indet tag.
70  std::string indetTag;
71  if (!indetOverrideTag.empty()) {
72  // We dont care about the return value (custom = true/false). We only take notice of the custom
73  // flag if the override is at the node we have selected. Ie we only look at nodeOverrideTag
74  // in order to set m_custom. At any rate, we have to remove the CUSTOM string if it is present.
75  getCustomTag(indetOverrideTag, indetTag);
76  }
77  if (!indetTag.empty()) {
78  m_tag = indetTag;
79  m_node = "InnerDetector";
80  }
81 
82  // Finally if subsystem tag is overriden then use that.
83  std::string outputTag;
84  m_custom = getCustomTag(nodeOverrideTag, outputTag);
85 
86  if (!outputTag.empty()) {
87  m_tag = outputTag;
88  m_node = node;
89  }
90 }

◆ getCustomTag()

bool DecodeVersionKey::getCustomTag ( const std::string &  inputTag,
std::string &  outputTag 
)
private

Definition at line 113 of file DecodeVersionKey.cxx.

114 {
115  //
116  // Check if CUSTOM is specified. If it is not specified then outputTag = inputTag.
117  // If the tag is just "CUSTOM" then set output tag to "" so that we use the higher level tag.
118  // If the tag is of the form CUSTOM-XXXXX use the XXXXX as the tag
119  // The separating character (in this example a '-') can be any character.
120  //
121  bool custom = false;
122  outputTag = inputTag;
123  if (!inputTag.empty()) {
124  if (inputTag.compare(0,6,"CUSTOM") == 0) {
125  custom = true;
126  // If its CUSTOM-something skip the next character and get the something
127  outputTag = inputTag.substr(6);
128  if (!outputTag.empty()) outputTag = outputTag.substr(1);
129  }
130  }
131  return custom;
132 }

◆ node()

const std::string & DecodeVersionKey::node ( ) const

Return the version node.

Definition at line 99 of file DecodeVersionKey.cxx.

100 {
101  return m_node;
102 }

◆ tag()

const std::string & DecodeVersionKey::tag ( ) const

Return version tag.

Definition at line 93 of file DecodeVersionKey.cxx.

94 {
95  return m_tag;
96 }

Member Data Documentation

◆ m_custom

bool DecodeVersionKey::m_custom
private

Definition at line 48 of file DecodeVersionKey.h.

◆ m_node

std::string DecodeVersionKey::m_node
private

Definition at line 47 of file DecodeVersionKey.h.

◆ m_tag

std::string DecodeVersionKey::m_tag
private

Definition at line 46 of file DecodeVersionKey.h.


The documentation for this class was generated from the following files:
DecodeVersionKey::custom
bool custom() const
Return true if CUSTOM is selected.
Definition: DecodeVersionKey.cxx:105
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:99
DecodeVersionKey::getCustomTag
bool getCustomTag(const std::string &inputTag, std::string &outputTag)
Definition: DecodeVersionKey.cxx:113
IGeoDbTagSvc
Definition: IGeoDbTagSvc.h:26
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
DecodeVersionKey::m_node
std::string m_node
Definition: DecodeVersionKey.h:47
DecodeVersionKey::m_tag
std::string m_tag
Definition: DecodeVersionKey.h:46
DecodeVersionKey::m_custom
bool m_custom
Definition: DecodeVersionKey.h:48
node
Definition: memory_hooks-stdcmalloc.h:74