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

#include <TGCDatabaseInPP.h>

Inheritance diagram for MuonTGC_Cabling::TGCDatabaseInPP:
Collaboration diagram for MuonTGC_Cabling::TGCDatabaseInPP:

Public Types

enum  INDEXIN { NIndexIn =3 , IndexInMin =0 , IndexInMax =2 }
enum  DatabaseType {
  NoDatabaseType =-1 , ASDToPP , InPP , PPToSL ,
  SLBToROD , MaxDatabaseType
}

Public Member Functions

 TGCDatabaseInPP (const std::string &filename, const std::string &blockname)
 Constructor.
 TGCDatabaseInPP (const TGCDatabaseInPP &)
 Copy constructor.
virtual ~TGCDatabaseInPP (void)
 Destructor.
virtual bool update (const std::vector< int > &) override
virtual int find (const std::vector< int > &) const override
virtual int getIndexDBIn (int *indexIn) const override
 Get IndexDBIn (position in the databse between 0 and database.size()-1) from indexIn which is NIndexIn-dimension array.
virtual void getindexDBVectorIn (std::vector< int > &tmpindexDBIn) const
 Get the IndexDBIn table.
virtual void getNIndexDBIn (int &tmpNIndexDBIn) const
 Get the size of the IndexDBIn table.
virtual void getmaxIndexIn (int *tmpmaxIndexIn) const
 Get the maximum values of indexIn with NIndexIn dimensions.
virtual void getminIndexIn (int *tmpminIndexIn) const
 Get the minimum values of indexIn with NIndexIn dimensions.
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 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) override
 TGCDatabaseInPP (void)
virtual void makeIndexDBIn (void)
 Make the IndexDBIn table.
virtual int convertIndexDBIn (int *indexIn) const
 Get the internal number, which is between 0 and NIndexDBIn-1.
TGCDatabaseInPPoperator= (const TGCDatabaseInPP &right)
 hidden assignment operator

Private Attributes

std::vector< int > m_indexDBIn
int m_NIndexDBIn = 0
int m_maxIndexIn [NIndexIn] {}
int m_minIndexIn [NIndexIn] {}
DatabaseType m_type

Detailed Description

Definition at line 13 of file TGCDatabaseInPP.h.

Member Enumeration Documentation

◆ DatabaseType

◆ INDEXIN

share/MuonTGC_Cabling_PP.db
s t uu x y zz (X Y ZZ)
s = output PP ID
t = output-connector ID
uu = output-channel ID of a connector
x = input PP ID
y = input-connector ID
zz = input-channel ID of a connector
X, Y, ZZ = OR'ed channel informationin (if exist)
std::vector< Identifier > ID
static Double_t a
#define y
#define x

(s, t, uu) is used as IndexIn in this class.

Enumerator
NIndexIn 
IndexInMin 
IndexInMax 

Definition at line 31 of file TGCDatabaseInPP.h.

Constructor & Destructor Documentation

◆ TGCDatabaseInPP() [1/3]

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

Constructor.

Definition at line 13 of file TGCDatabaseInPP.cxx.

15 : TGCDatabase(TGCDatabase::InPP, filename, blockname), m_NIndexDBIn(0)
16{
17 for(int iIndexIn=0; iIndexIn<NIndexIn; iIndexIn++) {
18 m_maxIndexIn[iIndexIn] = 0;
19 m_minIndexIn[iIndexIn] = 9999;
20 }
21
22 // read out ascii file and fill database
24}
virtual void readDB(void) override
TGCDatabase(DatabaseType type=NoDatabaseType)

◆ TGCDatabaseInPP() [2/3]

MuonTGC_Cabling::TGCDatabaseInPP::TGCDatabaseInPP ( const TGCDatabaseInPP & right)

Copy constructor.

Definition at line 26 of file TGCDatabaseInPP.cxx.

27 : TGCDatabase(right)
28{
29 right.getindexDBVectorIn(m_indexDBIn);
30 right.getNIndexDBIn(m_NIndexDBIn);
31 right.getmaxIndexIn(m_maxIndexIn);
32 right.getminIndexIn(m_minIndexIn);
33}

◆ ~TGCDatabaseInPP()

MuonTGC_Cabling::TGCDatabaseInPP::~TGCDatabaseInPP ( void )
virtual

Destructor.

Definition at line 35 of file TGCDatabaseInPP.cxx.

36{
37}

◆ TGCDatabaseInPP() [3/3]

MuonTGC_Cabling::TGCDatabaseInPP::TGCDatabaseInPP ( void )
inlineprivate

Definition at line 59 of file TGCDatabaseInPP.h.

59{}

Member Function Documentation

◆ convertIndexDBIn()

int MuonTGC_Cabling::TGCDatabaseInPP::convertIndexDBIn ( int * indexIn) const
privatevirtual

Get the internal number, which is between 0 and NIndexDBIn-1.

Definition at line 176 of file TGCDatabaseInPP.cxx.

177{
178 int converted = indexIn[0]-m_minIndexIn[0];
179 for(int iIndexIn=1; iIndexIn<NIndexIn; iIndexIn++) {
180 converted *= (m_maxIndexIn[iIndexIn]-m_minIndexIn[iIndexIn]+1);
181 converted += indexIn[iIndexIn]-m_minIndexIn[iIndexIn];
182 }
183 return converted;
184}

◆ find()

int MuonTGC_Cabling::TGCDatabaseInPP::find ( const std::vector< int > & channel) const
overridevirtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 62 of file TGCDatabaseInPP.cxx.

63{
64 int index=-1;
65 const unsigned int size = m_database.size();
66 for(unsigned int i=0; i<size; i++){
67 if(m_database[i].at(2) == channel.at(2) &&
68 m_database[i].at(1) == channel.at(1) &&
69 m_database[i].at(0) == channel.at(0)) {
70 index = i;
71 break;
72 }
73 }
74 return index;
75}
std::vector< std::vector< int > > m_database
Definition TGCDatabase.h:54
str index
Definition DeMoScan.py:362

◆ getDatabaseType()

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

Definition at line 35 of file TGCDatabase.h.

35{ return m_type; }

◆ getEntry()

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

Definition at line 28 of file TGCDatabase.cxx.

28 {
29 return m_database[entry].at(column);
30}

◆ getEntrySize()

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

Definition at line 32 of file TGCDatabase.cxx.

32 {
33 return m_database[entry].size();
34}

◆ getIndexDBIn()

int MuonTGC_Cabling::TGCDatabaseInPP::getIndexDBIn ( int * indexIn) const
overridevirtual

Get IndexDBIn (position in the databse between 0 and database.size()-1) from indexIn which is NIndexIn-dimension array.

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 77 of file TGCDatabaseInPP.cxx.

78{
79 if(!indexIn) return -1;
80
81 int converted = convertIndexDBIn(indexIn);
82 if(converted<0 || converted>=m_NIndexDBIn) return -1;
83
84 return m_indexDBIn.at(converted);
85}
virtual int convertIndexDBIn(int *indexIn) const
Get the internal number, which is between 0 and NIndexDBIn-1.

◆ getIndexDBOut()

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

Reimplemented in MuonTGC_Cabling::TGCDatabaseASDToPP.

Definition at line 60 of file TGCDatabase.cxx.

61{
62 // not implemented in the base class
63 if(!indexOut) return -1;
64
65 return -1;
66}

◆ getindexDBVectorIn()

void MuonTGC_Cabling::TGCDatabaseInPP::getindexDBVectorIn ( std::vector< int > & tmpindexDBIn) const
virtual

Get the IndexDBIn table.

Definition at line 87 of file TGCDatabaseInPP.cxx.

88{
89 tmpindexDBIn = m_indexDBIn;
90}

◆ getMaxEntry()

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

Definition at line 36 of file TGCDatabase.cxx.

36 {
37 return m_database.size();
38}

◆ getmaxIndexIn()

void MuonTGC_Cabling::TGCDatabaseInPP::getmaxIndexIn ( int * tmpmaxIndexIn) const
virtual

Get the maximum values of indexIn with NIndexIn dimensions.

Definition at line 97 of file TGCDatabaseInPP.cxx.

98{
99 for(int iIndexIn=0; iIndexIn<NIndexIn; iIndexIn++) {
100 tmpmaxIndexIn[iIndexIn] = m_maxIndexIn[iIndexIn];
101 }
102}

◆ getminIndexIn()

void MuonTGC_Cabling::TGCDatabaseInPP::getminIndexIn ( int * tmpminIndexIn) const
virtual

Get the minimum values of indexIn with NIndexIn dimensions.

Definition at line 104 of file TGCDatabaseInPP.cxx.

105{
106 for(int iIndexIn=0; iIndexIn<NIndexIn; iIndexIn++) {
107 tmpminIndexIn[iIndexIn] = m_minIndexIn[iIndexIn];
108 }
109}

◆ getNIndexDBIn()

void MuonTGC_Cabling::TGCDatabaseInPP::getNIndexDBIn ( int & tmpNIndexDBIn) const
virtual

Get the size of the IndexDBIn table.

Definition at line 92 of file TGCDatabaseInPP.cxx.

93{
94 tmpNIndexDBIn = m_NIndexDBIn;
95}

◆ makeIndexDBIn()

void MuonTGC_Cabling::TGCDatabaseInPP::makeIndexDBIn ( void )
privatevirtual

Make the IndexDBIn table.

Definition at line 157 of file TGCDatabaseInPP.cxx.

157 {
158 m_NIndexDBIn = 1;
159 for(int iIndexIn=0; iIndexIn<NIndexIn; iIndexIn++) {
160 m_NIndexDBIn *= (m_maxIndexIn[iIndexIn]-m_minIndexIn[iIndexIn]+1);
161 }
162 for(int iIndexDBIn=0; iIndexDBIn<m_NIndexDBIn; iIndexDBIn++) {
163 m_indexDBIn.push_back(-1);
164 }
165
166 const int size = m_database.size();
167 for(int i=0; i<size; i++) {
168 int tmpValIndexIn[NIndexIn];
169 for(int iIndexIn=0; iIndexIn<NIndexIn; iIndexIn++) {
170 tmpValIndexIn[iIndexIn] = m_database.at(i).at(iIndexIn+IndexInMin);
171 }
172 m_indexDBIn.at(convertIndexDBIn(tmpValIndexIn)) = i;
173 }
174}

◆ operator=()

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

hidden assignment operator

◆ readDB()

void MuonTGC_Cabling::TGCDatabaseInPP::readDB ( void )
overrideprivatevirtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 111 of file TGCDatabaseInPP.cxx.

111 {
112 std::ifstream file(m_filename.c_str());
113 std::string buf;
114
115 for(int iIndexIn=0; iIndexIn<NIndexIn; iIndexIn++) {
116 m_maxIndexIn[iIndexIn] = 0;
117 m_minIndexIn[iIndexIn] = 9999;
118 }
119
120 while(getline(file,buf)){
121 if(buf.substr(0,m_blockname.size())==m_blockname) break;
122 }
123
124 while(getline(file,buf)){
125 if(buf.substr(0,1)=="E"||buf.substr(0,1)=="F") break;
126 std::istringstream line(buf);
127 std::vector<int> entry;
128 for(int i=0; i<6; i++){
129 int temp=-1;
130 line >> temp;
131 entry.push_back(temp);
132
133 if(IndexInMin<=i && i<=IndexInMax) {
134 int j = i-IndexInMin;
135 if(m_maxIndexIn[j]<temp) {
136 m_maxIndexIn[j] = temp;
137 }
138 if(m_minIndexIn[j]>temp) {
139 m_minIndexIn[j] = temp;
140 }
141 }
142 }
143 for(int i=0; i<3; i++){
144 int temp=-1;
145 line >> temp;
146 if(temp<0) break;
147 entry.push_back(temp);
148 }
149 m_database.push_back(std::move(entry));
150 }
151
152 file.close();
153
155}
virtual void makeIndexDBIn(void)
Make the IndexDBIn table.
TFile * file

◆ update()

bool MuonTGC_Cabling::TGCDatabaseInPP::update ( const std::vector< int > & input)
overridevirtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 39 of file TGCDatabaseInPP.cxx.

40{
41 int ip = find(input);
42 if(ip<0) return false;
43
44 const unsigned int input_size = input.size();
45
46 const unsigned int database_ip_size = m_database[ip].size();
47 for(unsigned int i=3; i<database_ip_size; i++){
48 if( i< input.size()){
49 m_database[ip].at(i) = input.at(i);
50 } else {
51 m_database[ip].at(i) = -1;
52 }
53 }
54 if(database_ip_size < input_size){
55 for(unsigned int i=database_ip_size; i<input_size; i++){
56 m_database[ip].push_back(input.at(i));
57 }
58 }
59 return true;
60}
virtual int find(const std::vector< int > &) const override

Member Data Documentation

◆ m_blockname

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

Definition at line 53 of file TGCDatabase.h.

◆ m_database

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

Definition at line 54 of file TGCDatabase.h.

◆ m_filename

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

Definition at line 52 of file TGCDatabase.h.

◆ m_indexDBIn

std::vector<int> MuonTGC_Cabling::TGCDatabaseInPP::m_indexDBIn
private

Definition at line 66 of file TGCDatabaseInPP.h.

◆ m_maxIndexIn

int MuonTGC_Cabling::TGCDatabaseInPP::m_maxIndexIn[NIndexIn] {}
private

Definition at line 68 of file TGCDatabaseInPP.h.

68{};

◆ m_minIndexIn

int MuonTGC_Cabling::TGCDatabaseInPP::m_minIndexIn[NIndexIn] {}
private

Definition at line 69 of file TGCDatabaseInPP.h.

69{};

◆ m_NIndexDBIn

int MuonTGC_Cabling::TGCDatabaseInPP::m_NIndexDBIn = 0
private

Definition at line 67 of file TGCDatabaseInPP.h.

◆ m_type

DatabaseType MuonTGC_Cabling::TGCDatabase::m_type
privateinherited

Definition at line 57 of file TGCDatabase.h.


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