ATLAS Offline Software
Loading...
Searching...
No Matches
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
59 std::map<std::string, IRDBRecordset_ptr>::iterator m=m_cw->recMap.find(TableName);
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]=std::move(rec);
71 }
72 return retval;
73}
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
virtual unsigned int size() const =0

◆ 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: