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

#include <DatabaseAccessTool.h>

Collaboration diagram for DatabaseAccessTool:

Classes

class  Clockwork
 

Public Member Functions

 DatabaseAccessTool ()
 
 ~DatabaseAccessTool ()
 
double getDouble (const std::string &TableName, const std::string &FallbackVersion, const std::string &ColumnName) const
 

Private Member Functions

DatabaseAccessTooloperator= (const DatabaseAccessTool &)
 
 DatabaseAccessTool (const DatabaseAccessTool &)
 

Private Attributes

Clockworkm_cw
 

Detailed Description

Definition at line 16 of file DatabaseAccessTool.h.

Constructor & Destructor Documentation

◆ DatabaseAccessTool() [1/2]

DatabaseAccessTool::DatabaseAccessTool ( )

Definition at line 25 of file DatabaseAccessTool.cxx.

26  :m_cw(new Clockwork())
27 {
28  ISvcLocator *svcLocator=Gaudi::svcLocator();
29  SmartIF<IGeoModelSvc> geoModel{svcLocator->service("GeoModelSvc")};
30  if (!geoModel.isValid()) {
31  throw std::runtime_error ("Cannot locate GeoModelSvc!!");
32  }
33 
34  SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service("RDBAccessSvc")};
35  if(!rdbAccess.isValid()) {
36  throw std::runtime_error ("Cannot locate RDBAccessSvc!!");
37  }
38  m_cw->pAccessSvc = rdbAccess.get();
39 
40  // Obtain the geometry version information:
41 
42  std::string AtlasVersion = geoModel->atlasVersion();
43  std::string LArVersion = geoModel->LAr_VersionOverride();
44 
45  m_cw->detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
46  m_cw->detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
47 
48 }

◆ ~DatabaseAccessTool()

DatabaseAccessTool::~DatabaseAccessTool ( )

Definition at line 50 of file DatabaseAccessTool.cxx.

51 {
52  delete m_cw;
53 }

◆ DatabaseAccessTool() [2/2]

DatabaseAccessTool::DatabaseAccessTool ( const DatabaseAccessTool )
private

Member Function Documentation

◆ getDouble()

double DatabaseAccessTool::getDouble ( const std::string &  TableName,
const std::string &  FallbackVersion,
const std::string &  ColumnName 
) const

Definition at line 55 of file DatabaseAccessTool.cxx.

57  {
58 
60 
61  IRDBRecordset_ptr rec = (m==m_cw->recMap.end()) ? m_cw->pAccessSvc->getRecordsetPtr(TableName,m_cw->detectorKey,m_cw->detectorNode): (*m).second;
62  if (rec->size()==0) {
63  rec = m_cw->pAccessSvc->getRecordsetPtr(TableName,FallbackVersion);
64  if (rec->size()==0) {
65  throw std::runtime_error((std::string("Cannot find the Table: ") + TableName).c_str());
66  }
67  }
68  double retval = (*rec)[0]->getDouble(ColumnName);
69  if (m==m_cw->recMap.end()) {
70  m_cw->recMap[TableName]=rec;
71  }
72  return retval;
73 }

◆ operator=()

DatabaseAccessTool& DatabaseAccessTool::operator= ( const DatabaseAccessTool )
private

Member Data Documentation

◆ m_cw

Clockwork* DatabaseAccessTool::m_cw
private

Definition at line 41 of file DatabaseAccessTool.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
DatabaseAccessTool::Clockwork::recMap
std::map< std::string, IRDBRecordset_ptr > recMap
Definition: DatabaseAccessTool.cxx:21
LArCellBinning_test.retval
def retval
Definition: LArCellBinning_test.py:112
DatabaseAccessTool::Clockwork::detectorKey
std::string detectorKey
Definition: DatabaseAccessTool.cxx:19
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
DatabaseAccessTool::Clockwork::detectorNode
std::string detectorNode
Definition: DatabaseAccessTool.cxx:20
DatabaseAccessTool::Clockwork::pAccessSvc
IRDBAccessSvc * pAccessSvc
Definition: DatabaseAccessTool.cxx:18
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
DatabaseAccessTool::m_cw
Clockwork * m_cw
Definition: DatabaseAccessTool.h:40