ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTGC_Cabling::TGCDatabaseSLBToROD Class Reference

#include <TGCDatabaseSLBToROD.h>

Inheritance diagram for MuonTGC_Cabling::TGCDatabaseSLBToROD:
Collaboration diagram for MuonTGC_Cabling::TGCDatabaseSLBToROD:

Public Types

enum  DatabaseType {
  NoDatabaseType = -1 , ASDToPP , InPP , PPToSL ,
  SLBToROD , MaxDatabaseType
}

Public Member Functions

 TGCDatabaseSLBToROD (const std::string &filename, const std::string &blockname)
 TGCDatabaseSLBToROD (const TGCDatabaseSLBToROD &)=default
virtual ~TGCDatabaseSLBToROD ()
virtual bool update (const std::vector< int > &)
virtual int find (const std::vector< int > &) const
DatabaseType getDatabaseType () const
virtual int getEntry (int entry, int column) const
virtual int getEntrySize (int entry) const
virtual int getMaxEntry () const
virtual int getIndexDBIn (int *indexIn) const
virtual int getIndexDBOut (int *indexOut) const

Protected Attributes

std::string m_filename
std::string m_blockname
std::vector< std::vector< int > > m_database

Private Member Functions

virtual void readDB ()

Private Attributes

DatabaseType m_type

Detailed Description

Definition at line 12 of file TGCDatabaseSLBToROD.h.

Member Enumeration Documentation

◆ DatabaseType

Enumerator
NoDatabaseType 
ASDToPP 
InPP 
PPToSL 
SLBToROD 
MaxDatabaseType 

Definition at line 15 of file TGCDatabase.h.

Constructor & Destructor Documentation

◆ TGCDatabaseSLBToROD() [1/2]

MuonTGC_Cabling::TGCDatabaseSLBToROD::TGCDatabaseSLBToROD ( const std::string & filename,
const std::string & blockname )

Definition at line 12 of file TGCDatabaseSLBToROD.cxx.

14 : TGCDatabase(TGCDatabase::SLBToROD, filename, blockname) {
15 // read out ascii file and fill database
17}
TGCDatabase(DatabaseType type=NoDatabaseType)

◆ TGCDatabaseSLBToROD() [2/2]

MuonTGC_Cabling::TGCDatabaseSLBToROD::TGCDatabaseSLBToROD ( const TGCDatabaseSLBToROD & )
default

◆ ~TGCDatabaseSLBToROD()

MuonTGC_Cabling::TGCDatabaseSLBToROD::~TGCDatabaseSLBToROD ( )
virtual

Definition at line 56 of file TGCDatabaseSLBToROD.cxx.

56{}

Member Function Documentation

◆ find()

int MuonTGC_Cabling::TGCDatabaseSLBToROD::find ( const std::vector< int > & channel) const
virtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 76 of file TGCDatabaseSLBToROD.cxx.

76 {
77 int index = -1;
78
79 const unsigned int size = m_database.size();
80
81 if (channel.size() < 4) {
82 // SSW block
83 for (unsigned int i = 0; i < size; i++) {
84 if (m_database[i].at(0) == channel.at(0)) {
85 index = i;
86 break;
87 }
88 }
89 } else {
90 // SLB block
91 for (unsigned int i = 0; i < size; i++) {
92 if (m_database[i].at(3) == channel.at(3) &&
93 m_database[i].at(2) == channel.at(2) &&
94 m_database[i].at(1) == channel.at(1) &&
95 m_database[i].at(0) == channel.at(0)) {
96 index = i;
97 break;
98 }
99 }
100 }
101
102 return index;
103}
std::vector< std::vector< int > > m_database
Definition TGCDatabase.h:56
str index
Definition DeMoScan.py:362

◆ getDatabaseType()

DatabaseType MuonTGC_Cabling::TGCDatabase::getDatabaseType ( ) const
inlineinherited

Definition at line 37 of file TGCDatabase.h.

37{ return m_type; }

◆ getEntry()

int MuonTGC_Cabling::TGCDatabase::getEntry ( int entry,
int column ) const
virtualinherited

Definition at line 17 of file TGCDatabase.cxx.

17 {
18 return m_database[entry].at(column);
19}

◆ getEntrySize()

int MuonTGC_Cabling::TGCDatabase::getEntrySize ( int entry) const
virtualinherited

Definition at line 21 of file TGCDatabase.cxx.

21 {
22 return m_database[entry].size();
23}

◆ getIndexDBIn()

int MuonTGC_Cabling::TGCDatabase::getIndexDBIn ( int * indexIn) const
virtualinherited

Reimplemented in MuonTGC_Cabling::TGCDatabaseASDToPP, and MuonTGC_Cabling::TGCDatabaseInPP.

Definition at line 39 of file TGCDatabase.cxx.

39 {
40 // not implemented in the base class
41 if (!indexIn) {
42 return -1;
43 }
44
45 return -1;
46}

◆ getIndexDBOut()

int MuonTGC_Cabling::TGCDatabase::getIndexDBOut ( int * indexOut) const
virtualinherited

Reimplemented in MuonTGC_Cabling::TGCDatabaseASDToPP.

Definition at line 48 of file TGCDatabase.cxx.

48 {
49 // not implemented in the base class
50 if (!indexOut) {
51 return -1;
52 }
53
54 return -1;
55}

◆ getMaxEntry()

int MuonTGC_Cabling::TGCDatabase::getMaxEntry ( ) const
virtualinherited

Definition at line 25 of file TGCDatabase.cxx.

25 {
26 return m_database.size();
27}

◆ readDB()

void MuonTGC_Cabling::TGCDatabaseSLBToROD::readDB ( )
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 19 of file TGCDatabaseSLBToROD.cxx.

19 {
20 std::ifstream file(m_filename.c_str());
21 std::string buf;
22
23 unsigned int space = m_blockname.find(' ');
24 std::string_view module = std::string_view(m_blockname).substr(0, space);
25 std::string_view type = std::string_view(m_blockname).substr(space + 1);
26
27 while (getline(file, buf)) {
28 if (buf.compare(0, module.size(), module) == 0) {
29 break;
30 }
31 }
32
33 while (getline(file, buf)) {
34 if (buf.compare(1, type.size(), type) == 0) {
35 break;
36 }
37 }
38
39 while (getline(file, buf)) {
40 if (buf.compare(0, 2, " ") != 0) {
41 break;
42 }
43 std::istringstream line(buf);
44 std::vector<int> entry;
45 for (int i = 0; i < 6; i++) {
46 int temp = -1;
47 line >> temp;
48 entry.push_back(temp);
49 }
50 m_database.emplace_back(std::move(entry));
51 }
52
53 file.close();
54}
TFile * file

◆ update()

bool MuonTGC_Cabling::TGCDatabaseSLBToROD::update ( const std::vector< int > & input)
virtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 58 of file TGCDatabaseSLBToROD.cxx.

58 {
59 int ip = find(input);
60 if (ip < 0) {
61 return false;
62 }
63
64 if (input.size() < 6) {
65 // SSW block
66 m_database[ip].at(1) = input.at(1);
67 } else {
68 // SLB block
69 m_database[ip].at(4) = input.at(4);
70 m_database[ip].at(5) = input.at(5);
71 }
72
73 return true;
74}
virtual int find(const std::vector< int > &) const

Member Data Documentation

◆ m_blockname

std::string MuonTGC_Cabling::TGCDatabase::m_blockname
protectedinherited

Definition at line 55 of file TGCDatabase.h.

◆ m_database

std::vector<std::vector<int> > MuonTGC_Cabling::TGCDatabase::m_database
protectedinherited

Definition at line 56 of file TGCDatabase.h.

◆ m_filename

std::string MuonTGC_Cabling::TGCDatabase::m_filename
protectedinherited

Definition at line 54 of file TGCDatabase.h.

◆ m_type

DatabaseType MuonTGC_Cabling::TGCDatabase::m_type
privateinherited

Definition at line 59 of file TGCDatabase.h.


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