ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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. More...
 
virtual StatusCode initialize () override
 Initilize. More...
 
virtual std::vector< std::string > * giveASD2PP_DIFF_12 () override
 Method to provide database. More...
 
virtual std::string getFolderName () const override
 Get the folder name. More...
 
virtual StatusCode readASD2PP_DIFF_12FromText () override
 Load parameters from text database. More...
 

Private Attributes

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

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 }

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 }

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

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:
TGCCablingDbTool::m_Folder
std::string m_Folder
Folder name.
Definition: TGCCablingDbTool.h:37
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
TGCCablingDbTool::m_readASD2PP_DIFF_12FromText
bool m_readASD2PP_DIFF_12FromText
Flag for readASD2PP_DIFF_12FromText()
Definition: TGCCablingDbTool.h:43
TGCCablingDbTool::m_ASD2PP_DIFF_12
std::unique_ptr< std::vector< std::string > > m_ASD2PP_DIFF_12
Database as strings.
Definition: TGCCablingDbTool.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TGCCablingDbTool::m_DataLocation
std::string m_DataLocation
Data location.
Definition: TGCCablingDbTool.h:35
TGCCablingDbTool::m_filename
std::string m_filename
File name of the text database.
Definition: TGCCablingDbTool.h:45