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 ()
 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 () const
virtual int getEntry (int entry, int column) const
virtual int getEntrySize (int entry) const
virtual int getMaxEntry () 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 () override
 TGCDatabaseInPP ()
virtual void makeIndexDBIn ()
 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 12 of file TGCDatabaseInPP.h.

Member Enumeration Documentation

◆ DatabaseType

Enumerator
NoDatabaseType 
ASDToPP 
InPP 
PPToSL 
SLBToROD 
MaxDatabaseType 

Definition at line 15 of file TGCDatabase.h.

◆ 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 29 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 12 of file TGCDatabaseInPP.cxx.

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

◆ TGCDatabaseInPP() [2/3]

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

Copy constructor.

Definition at line 24 of file TGCDatabaseInPP.cxx.

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

◆ ~TGCDatabaseInPP()

MuonTGC_Cabling::TGCDatabaseInPP::~TGCDatabaseInPP ( )
virtual

Destructor.

Definition at line 32 of file TGCDatabaseInPP.cxx.

32{}

◆ TGCDatabaseInPP() [3/3]

MuonTGC_Cabling::TGCDatabaseInPP::TGCDatabaseInPP ( )
inlineprivate

Definition at line 57 of file TGCDatabaseInPP.h.

57{}

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 177 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 58 of file TGCDatabaseInPP.cxx.

58 {
59 int index = -1;
60 const unsigned int size = m_database.size();
61 for (unsigned int i = 0; i < size; i++) {
62 if (m_database[i].at(2) == channel.at(2) &&
63 m_database[i].at(1) == channel.at(1) &&
64 m_database[i].at(0) == channel.at(0)) {
65 index = i;
66 break;
67 }
68 }
69 return index;
70}
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::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 72 of file TGCDatabaseInPP.cxx.

72 {
73 if (!indexIn) {
74 return -1;
75 }
76
77 int converted = convertIndexDBIn(indexIn);
78 if (converted < 0 || converted >= m_NIndexDBIn) {
79 return -1;
80 }
81
82 return m_indexDBIn.at(converted);
83}
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 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}

◆ getindexDBVectorIn()

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

Get the IndexDBIn table.

Definition at line 85 of file TGCDatabaseInPP.cxx.

85 {
86 tmpindexDBIn = m_indexDBIn;
87}

◆ getMaxEntry()

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

Definition at line 25 of file TGCDatabase.cxx.

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

◆ getmaxIndexIn()

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

Get the maximum values of indexIn with NIndexIn dimensions.

Definition at line 93 of file TGCDatabaseInPP.cxx.

93 {
94 for (int iIndexIn = 0; iIndexIn < NIndexIn; iIndexIn++) {
95 tmpmaxIndexIn[iIndexIn] = m_maxIndexIn[iIndexIn];
96 }
97}

◆ getminIndexIn()

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

Get the minimum values of indexIn with NIndexIn dimensions.

Definition at line 99 of file TGCDatabaseInPP.cxx.

99 {
100 for (int iIndexIn = 0; iIndexIn < NIndexIn; iIndexIn++) {
101 tmpminIndexIn[iIndexIn] = m_minIndexIn[iIndexIn];
102 }
103}

◆ getNIndexDBIn()

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

Get the size of the IndexDBIn table.

Definition at line 89 of file TGCDatabaseInPP.cxx.

89 {
90 tmpNIndexDBIn = m_NIndexDBIn;
91}

◆ makeIndexDBIn()

void MuonTGC_Cabling::TGCDatabaseInPP::makeIndexDBIn ( )
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] =
171 m_database.at(i).at(iIndexIn + IndexInMin);
172 }
173 m_indexDBIn.at(convertIndexDBIn(tmpValIndexIn)) = i;
174 }
175}

◆ operator=()

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

hidden assignment operator

◆ readDB()

void MuonTGC_Cabling::TGCDatabaseInPP::readDB ( )
overrideprivatevirtual

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 105 of file TGCDatabaseInPP.cxx.

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

◆ update()

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

Reimplemented from MuonTGC_Cabling::TGCDatabase.

Definition at line 34 of file TGCDatabaseInPP.cxx.

34 {
35 int ip = find(input);
36 if (ip < 0) {
37 return false;
38 }
39
40 const unsigned int input_size = input.size();
41
42 const unsigned int database_ip_size = m_database[ip].size();
43 for (unsigned int i = 3; i < database_ip_size; i++) {
44 if (i < input.size()) {
45 m_database[ip].at(i) = input.at(i);
46 } else {
47 m_database[ip].at(i) = -1;
48 }
49 }
50 if (database_ip_size < input_size) {
51 for (unsigned int i = database_ip_size; i < input_size; i++) {
52 m_database[ip].push_back(input.at(i));
53 }
54 }
55 return true;
56}
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 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_indexDBIn

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

Definition at line 64 of file TGCDatabaseInPP.h.

◆ m_maxIndexIn

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

Definition at line 66 of file TGCDatabaseInPP.h.

66{};

◆ m_minIndexIn

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

Definition at line 67 of file TGCDatabaseInPP.h.

67{};

◆ m_NIndexDBIn

int MuonTGC_Cabling::TGCDatabaseInPP::m_NIndexDBIn = 0
private

Definition at line 65 of file TGCDatabaseInPP.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: