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

#include <TGCDatabasePPToSL.h>

Inheritance diagram for MuonTGC_Cabling::TGCDatabasePPToSL:
Collaboration diagram for MuonTGC_Cabling::TGCDatabasePPToSL:

Public Types

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

Public Member Functions

 TGCDatabasePPToSL (const std::string &filename, const std::string &blockname)
 TGCDatabasePPToSL (const TGCDatabasePPToSL &)
virtual ~TGCDatabasePPToSL (void)
virtual bool update (const std::vector< int > &)
virtual int find (const std::vector< int > &) const
DatabaseType getDatabaseType (void) const
virtual int getEntry (int entry, int column) const
virtual int getEntrySize (int entry) const
virtual int getMaxEntry (void) 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 (void)
 TGCDatabasePPToSL (void)
TGCDatabasePPToSLoperator= (const TGCDatabasePPToSL &right)
 hidden assignment operator

Private Attributes

DatabaseType m_type

Detailed Description

Definition at line 12 of file TGCDatabasePPToSL.h.

Member Enumeration Documentation

◆ DatabaseType

Enumerator
NoDatabaseType 
ASDToPP 
InPP 
PPToSL 
SLBToROD 
MaxDatabaseType 

Definition at line 15 of file TGCDatabase.h.

Constructor & Destructor Documentation

◆ TGCDatabasePPToSL() [1/3]

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

Definition at line 12 of file TGCDatabasePPToSL.cxx.

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

◆ TGCDatabasePPToSL() [2/3]

MuonTGC_Cabling::TGCDatabasePPToSL::TGCDatabasePPToSL ( const TGCDatabasePPToSL & right)

Definition at line 19 of file TGCDatabasePPToSL.cxx.

20 : TGCDatabase(right) {}

◆ ~TGCDatabasePPToSL()

MuonTGC_Cabling::TGCDatabasePPToSL::~TGCDatabasePPToSL ( void )
virtual

Definition at line 92 of file TGCDatabasePPToSL.cxx.

92{}

◆ TGCDatabasePPToSL() [3/3]

MuonTGC_Cabling::TGCDatabasePPToSL::TGCDatabasePPToSL ( void )
inlineprivate

Definition at line 28 of file TGCDatabasePPToSL.h.

28{}

Member Function Documentation

◆ find()

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

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 114 of file TGCDatabasePPToSL.cxx.

114 {
115 int index = -1;
116 const unsigned int size = m_database.size();
117 for (unsigned int i = 0; i < size; i++) {
118 if (m_database[i].at(0) == channel.at(0)) {
119 index = i;
120 break;
121 }
122 }
123 return index;
124}
std::vector< std::vector< int > > m_database
Definition TGCDatabase.h:56
str index
Definition DeMoScan.py:362

◆ getDatabaseType()

DatabaseType MuonTGC_Cabling::TGCDatabase::getDatabaseType ( void ) 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 ( void ) const
virtualinherited

Definition at line 25 of file TGCDatabase.cxx.

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

◆ operator=()

TGCDatabasePPToSL & MuonTGC_Cabling::TGCDatabasePPToSL::operator= ( const TGCDatabasePPToSL & right)
private

hidden assignment operator

◆ readDB()

void MuonTGC_Cabling::TGCDatabasePPToSL::readDB ( void )
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 22 of file TGCDatabasePPToSL.cxx.

22 {
23 std::ifstream file(m_filename.c_str());
24 std::string buf;
25
26 unsigned int space = m_blockname.find(' ');
27 std::string_view module = std::string_view(m_blockname).substr(0, space);
28 std::string_view region =
29 std::string_view(m_blockname).substr(space + 1, 1);
30 std::string_view type = std::string_view(m_blockname).substr(space + 2);
31
32 int offset = -1;
33 if (type == "WT") {
34 offset = 1;
35 }
36 if (type == "WD") {
37 offset = 2;
38 }
39 if (type == "ST") {
40 offset = 3;
41 }
42 if (type == "SD") {
43 offset = 4;
44 }
45 if (type == "WI") {
46 offset = 5;
47 }
48 if (type == "SI") {
49 offset = 6;
50 }
51 if (type == "W") {
52 offset = 1;
53 }
54 if (type == "S") {
55 offset = 2;
56 }
57
58 while (getline(file, buf)) {
59 if (buf.compare(0, 1, region) == 0) {
60 break;
61 }
62 }
63
64 while (getline(file, buf)) {
65 if (buf.compare(1, module.size(), module) == 0) {
66 break;
67 }
68 }
69
70 while (getline(file, buf)) {
71 if (buf.compare(0, 2, " ") != 0) {
72 break;
73 }
74 if (buf.compare(2, 1, "0") == 0) {
75 offset--;
76 }
77 if (offset == 0) {
78 std::istringstream line(buf);
79 std::vector<int> entry;
80 for (int i = 0; i < 3; i++) {
81 int temp = -1;
82 line >> temp;
83 entry.push_back(temp);
84 }
85 m_database.emplace_back(std::move(entry));
86 }
87 }
88
89 file.close();
90}
TFile * file

◆ update()

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

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 94 of file TGCDatabasePPToSL.cxx.

94 {
95 int ip = find(input);
96 if (ip < 0) {
97 return false;
98 }
99
100 const unsigned int input_size = input.size();
101
102 const unsigned int database_size = m_database[ip].size();
103 for (unsigned int i = 1; i < database_size; i++) {
104 if (i < input_size) {
105 m_database[ip].at(i) = input.at(i);
106 } else {
107 m_database[ip].at(i) = -1;
108 }
109 }
110
111 return true;
112}
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: