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  SmartIF<IGeoDbTagSvc> geoDbTag{Gaudi::svcLocator()->service("GeoDbTagSvc")};
26  if(!geoDbTag.isValid()) throw std::runtime_error("DecodeVersionKey constructor: cannot access GeoDbTagSvc");
27  defineTag<IGeoDbTagSvc>(geoDbTag,node);
28 }

Member Function Documentation

◆ custom()

bool DecodeVersionKey::custom ( ) const

Return true if CUSTOM is selected.

Definition at line 103 of file DecodeVersionKey.cxx.

104 {
105  return m_custom;
106 }

◆ defineTag()

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

Definition at line 31 of file DecodeVersionKey.cxx.

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

◆ getCustomTag()

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

Definition at line 111 of file DecodeVersionKey.cxx.

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

◆ node()

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

Return the version node.

Definition at line 97 of file DecodeVersionKey.cxx.

98 {
99  return m_node;
100 }

◆ tag()

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

Return version tag.

Definition at line 91 of file DecodeVersionKey.cxx.

92 {
93  return m_tag;
94 }

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:103
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:97
DecodeVersionKey::getCustomTag
bool getCustomTag(const std::string &inputTag, std::string &outputTag)
Definition: DecodeVersionKey.cxx:111
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