ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
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. More...
 
 TGCDatabaseInPP (const TGCDatabaseInPP &)
 Copy constructor. More...
 
virtual ~TGCDatabaseInPP (void)
 Destructor. More...
 
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. More...
 
virtual void getindexDBVectorIn (std::vector< int > &tmpindexDBIn) const
 Get the IndexDBIn table. More...
 
virtual void getNIndexDBIn (int &tmpNIndexDBIn) const
 Get the size of the IndexDBIn table. More...
 
virtual void getmaxIndexIn (int *tmpmaxIndexIn) const
 Get the maximum values of indexIn with NIndexIn dimensions. More...
 
virtual void getminIndexIn (int *tmpminIndexIn) const
 Get the minimum values of indexIn with NIndexIn dimensions. More...
 
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. More...
 
virtual int convertIndexDBIn (int *indexIn) const
 Get the internal number, which is between 0 and NIndexDBIn-1. More...
 
TGCDatabaseInPPoperator= (const TGCDatabaseInPP &right)
 hidden assignment operator More...
 

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

Enumerator
NoDatabaseType 
ASDToPP 
InPP 
PPToSL 
SLBToROD 
MaxDatabaseType 

Definition at line 17 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)

(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.

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 }

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

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

◆ 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(entry);
150  }
151 
152  file.close();
153 
154  makeIndexDBIn();
155 }

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

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.

◆ m_minIndexIn

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

Definition at line 69 of file TGCDatabaseInPP.h.

◆ 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:
MuonTGC_Cabling::TGCDatabaseInPP::IndexInMax
@ IndexInMax
Definition: TGCDatabaseInPP.h:31
MuonTGC_Cabling::TGCDatabase::PPToSL
@ PPToSL
Definition: TGCDatabase.h:18
ConvertOldHistosToNewHistos.converted
converted
Definition: ConvertOldHistosToNewHistos.py:40
checkFileSG.line
line
Definition: checkFileSG.py:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
MuonTGC_Cabling::TGCDatabase::ASDToPP
@ ASDToPP
Definition: TGCDatabase.h:18
index
Definition: index.py:1
LB_AnalMapSplitter.of
of
Definition: LB_AnalMapSplitter.py:48
MuonTGC_Cabling::TGCDatabase::NoDatabaseType
@ NoDatabaseType
Definition: TGCDatabase.h:17
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
MuonTGC_Cabling::TGCDatabaseInPP::find
virtual int find(const std::vector< int > &) const override
Definition: TGCDatabaseInPP.cxx:62
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonTGC_Cabling::TGCDatabaseInPP::m_minIndexIn
int m_minIndexIn[NIndexIn]
Definition: TGCDatabaseInPP.h:69
x
#define x
MuonTGC_Cabling::TGCDatabaseInPP::readDB
virtual void readDB(void) override
Definition: TGCDatabaseInPP.cxx:111
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
MuonTGC_Cabling::TGCDatabase::m_filename
std::string m_filename
Definition: TGCDatabase.h:52
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:92
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
MuonTGC_Cabling::TGCDatabaseInPP::m_indexDBIn
std::vector< int > m_indexDBIn
Definition: TGCDatabaseInPP.h:66
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
file
TFile * file
Definition: tile_monitor.h:29
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
python.egammaTruthD3PDObject.blockname
blockname
Definition: egammaTruthD3PDObject.py:64
merge.output
output
Definition: merge.py:17
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
MuonTGC_Cabling::TGCDatabaseInPP::makeIndexDBIn
virtual void makeIndexDBIn(void)
Make the IndexDBIn table.
Definition: TGCDatabaseInPP.cxx:157
MuonTGC_Cabling::TGCDatabase::m_blockname
std::string m_blockname
Definition: TGCDatabase.h:53
MuonTGC_Cabling::TGCDatabase::MaxDatabaseType
@ MaxDatabaseType
Definition: TGCDatabase.h:19
MuonTGC_Cabling::TGCDatabaseInPP::m_NIndexDBIn
int m_NIndexDBIn
Definition: TGCDatabaseInPP.h:67
MuonTGC_Cabling::TGCDatabase::SLBToROD
@ SLBToROD
Definition: TGCDatabase.h:18
DeMoScan.index
string index
Definition: DeMoScan.py:362
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
MuonTGC_Cabling::TGCDatabaseInPP::IndexInMin
@ IndexInMin
Definition: TGCDatabaseInPP.h:31
MuonTGC_Cabling::TGCDatabaseInPP::convertIndexDBIn
virtual int convertIndexDBIn(int *indexIn) const
Get the internal number, which is between 0 and NIndexDBIn-1.
Definition: TGCDatabaseInPP.cxx:176
Root::OR
@ OR
Definition: TGRLCollection.h:32
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
MuonTGC_Cabling::TGCDatabase::TGCDatabase
TGCDatabase(DatabaseType type=NoDatabaseType)
Definition: TGCDatabase.cxx:10
MuonTGC_Cabling::TGCDatabase::m_database
std::vector< std::vector< int > > m_database
Definition: TGCDatabase.h:54
MuonTGC_Cabling::TGCDatabase::InPP
@ InPP
Definition: TGCDatabase.h:18
MuonTGC_Cabling::TGCDatabaseInPP::NIndexIn
@ NIndexIn
Definition: TGCDatabaseInPP.h:31
MuonTGC_Cabling::TGCDatabaseInPP::m_maxIndexIn
int m_maxIndexIn[NIndexIn]
Definition: TGCDatabaseInPP.h:68
MuonTGC_Cabling::TGCDatabase::m_type
DatabaseType m_type
Definition: TGCDatabase.h:57