ATLAS Offline Software
Loading...
Searching...
No Matches
TGCCablingDbTool Class Reference

#include <TGCCablingDbTool.h>

Inheritance diagram for TGCCablingDbTool:
Collaboration diagram for TGCCablingDbTool:

Public Member Functions

 TGCCablingDbTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
virtual StatusCode initialize () override
 Initilize.
virtual std::vector< std::string > * giveASD2PP_DIFF_12 () override
 Method to provide database.
virtual std::string getFolderName () const override
 Get the folder name.
virtual StatusCode readASD2PP_DIFF_12FromText () override
 Load parameters from text database.

Private Attributes

std::string m_DataLocation
 Data location.
std::string m_Folder
 Folder name.
std::unique_ptr< std::vector< std::string > > m_ASD2PP_DIFF_12
 Database as strings.
bool m_readASD2PP_DIFF_12FromText
 Flag for readASD2PP_DIFF_12FromText()
std::string m_filename
 File name of the text database.

Detailed Description

Definition at line 15 of file TGCCablingDbTool.h.

Constructor & Destructor Documentation

◆ TGCCablingDbTool()

TGCCablingDbTool::TGCCablingDbTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor.

Definition at line 19 of file TGCCablingDbTool.cxx.

22 : base_class(type, name, parent),
23 m_DataLocation ("keyTGC")
24{
25 declareProperty("Folder", m_Folder="/TGC/CABLING/MAP_SCHEMA");
26
27 // ASD2PP_diff_12.db is the text database for the TGCcabling12 package
28 declareProperty("filename_ASD2PP_DIFF_12", m_filename="ASD2PP_diff_12_ONL.db");
29 declareProperty("readASD2PP_DIFF_12FromText", m_readASD2PP_DIFF_12FromText=true);
30}
std::string m_filename
File name of the text database.
std::string m_DataLocation
Data location.
std::string m_Folder
Folder name.
bool m_readASD2PP_DIFF_12FromText
Flag for readASD2PP_DIFF_12FromText()

Member Function Documentation

◆ getFolderName()

std::string TGCCablingDbTool::getFolderName ( ) const
overridevirtual

Get the folder name.

Definition at line 37 of file TGCCablingDbTool.cxx.

37 {
38 return m_Folder;
39}

◆ giveASD2PP_DIFF_12()

std::vector< std::string > * TGCCablingDbTool::giveASD2PP_DIFF_12 ( )
overridevirtual

Method to provide database.

Definition at line 41 of file TGCCablingDbTool.cxx.

41 {
42 ATH_MSG_INFO("giveASD2PP_DIFF_12 (m_ASD2PP_DIFF_12 is " << (!m_ASD2PP_DIFF_12 ? "NULL" : "not NULL") << ")");
43
44 // If no database found, null pointer is returned.
45 if(!m_ASD2PP_DIFF_12) {
46 return nullptr;
47 }
48
49 // Copy the database
50 return new std::vector<std::string> (*m_ASD2PP_DIFF_12);
51}
#define ATH_MSG_INFO(x)
std::unique_ptr< std::vector< std::string > > m_ASD2PP_DIFF_12
Database as strings.

◆ initialize()

StatusCode TGCCablingDbTool::initialize ( )
overridevirtual

Initilize.

Definition at line 32 of file TGCCablingDbTool.cxx.

32 {
33 ATH_MSG_INFO("initialize");
34 return StatusCode::SUCCESS;
35}

◆ readASD2PP_DIFF_12FromText()

StatusCode TGCCablingDbTool::readASD2PP_DIFF_12FromText ( )
overridevirtual

Load parameters from text database.

Definition at line 53 of file TGCCablingDbTool.cxx.

53 {
54 ATH_MSG_INFO("readTGCMap from text");
55
56 // PathResolver finds the full path of the file (default file name is ASD2PP_diff_12.db)
57 std::string location = PathResolver::find_file(m_filename, "DATAPATH");
58 if(location.empty()) {
59 ATH_MSG_ERROR("Could not find " << m_filename.c_str());
60 return StatusCode::FAILURE;
61 }
62
63 // ASD2PP_diff_12.db is opened as inASDToPP
64 std::ifstream inASDToPP;
65 inASDToPP.open(location.c_str());
66 if(inASDToPP.bad()) {
67 ATH_MSG_ERROR("Could not open file " << location.c_str());
68 return StatusCode::FAILURE;
69 }
70
71 ATH_MSG_INFO("readTGCMap found file " << location.c_str());
72
73 // New database is created
74 m_ASD2PP_DIFF_12.reset(new std::vector<std::string>);
75
76 unsigned int nLines = 0;
77 std::string buf;
78 // Copy database into m_ASD2PP_DIFF_12
79 while(getline(inASDToPP, buf)){
80 m_ASD2PP_DIFF_12->push_back(buf);
81 ATH_MSG_DEBUG(m_filename.c_str() << " L" << ++nLines << ": " << buf.c_str());
82 }
83
84 inASDToPP.close();
85 return StatusCode::SUCCESS;
86}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)

Member Data Documentation

◆ m_ASD2PP_DIFF_12

std::unique_ptr<std::vector<std::string> > TGCCablingDbTool::m_ASD2PP_DIFF_12
private

Database as strings.

Definition at line 40 of file TGCCablingDbTool.h.

◆ m_DataLocation

std::string TGCCablingDbTool::m_DataLocation
private

Data location.

Definition at line 35 of file TGCCablingDbTool.h.

◆ m_filename

std::string TGCCablingDbTool::m_filename
private

File name of the text database.

Definition at line 45 of file TGCCablingDbTool.h.

◆ m_Folder

std::string TGCCablingDbTool::m_Folder
private

Folder name.

Definition at line 37 of file TGCCablingDbTool.h.

◆ m_readASD2PP_DIFF_12FromText

bool TGCCablingDbTool::m_readASD2PP_DIFF_12FromText
private

Flag for readASD2PP_DIFF_12FromText()

Definition at line 43 of file TGCCablingDbTool.h.


The documentation for this class was generated from the following files: