ATLAS Offline Software
MuonSpectrometer
MuonCablings
MuonTGC_Cabling
src
TGCDatabaseSLBToROD.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonTGC_Cabling/TGCDatabaseSLBToROD.h
"
6
7
#include <fstream>
8
#include <sstream>
9
10
namespace
MuonTGC_Cabling
11
{
12
13
TGCDatabaseSLBToROD::TGCDatabaseSLBToROD
(
const
std::string&
filename
,
14
const
std::string&
blockname
)
15
:
TGCDatabase
(
TGCDatabase
::SLBToROD,
filename
,
blockname
)
16
{
17
// read out ascii file and fill database
18
TGCDatabaseSLBToROD::readDB
();
19
}
20
21
TGCDatabaseSLBToROD::TGCDatabaseSLBToROD
(
const
TGCDatabaseSLBToROD
& right)
22
:
TGCDatabase
(right)
23
{
24
}
25
26
void
TGCDatabaseSLBToROD::readDB
(
void
) {
27
std::ifstream
file
(
m_filename
.c_str());
28
std::string buf;
29
30
unsigned
int
space =
m_blockname
.find(
' '
);
31
std::string_view
module
= std::string_view(
m_blockname
).substr(0,space);
32
std::string_view
type
= std::string_view(
m_blockname
).substr(space+1);
33
34
while
(getline(
file
,buf)){
35
if
(buf.compare(0,
module
.size(),
module
)==0)
break
;
36
}
37
38
while
(getline(
file
,buf)){
39
if
(buf.compare(1,
type
.size(),
type
)==0)
break
;
40
}
41
42
while
(getline(
file
,buf)){
43
if
(buf.compare(0,2,
" "
)!=0)
break
;
44
std::istringstream
line
(buf);
45
std::vector<int>
entry
;
46
for
(
int
i
=0;
i
<6;
i
++){
47
int
temp=-1;
48
line
>> temp;
49
entry
.push_back(temp);
50
}
51
m_database
.emplace_back(std::move(
entry
));
52
}
53
54
file
.close();
55
}
56
57
TGCDatabaseSLBToROD::~TGCDatabaseSLBToROD
(
void
)
58
{
59
}
60
61
bool
TGCDatabaseSLBToROD::update
(
const
std::vector<int>&
input
)
62
{
63
int
ip
=
find
(
input
);
64
if
(
ip
<0)
return
false
;
65
66
if
(
input
.size()<6) {
67
// SSW block
68
m_database
[
ip
].at(1) =
input
.at(1);
69
}
else
{
70
// SLB block
71
m_database
[
ip
].at(4) =
input
.at(4);
72
m_database
[
ip
].at(5) =
input
.at(5);
73
}
74
75
return
true
;
76
}
77
78
int
TGCDatabaseSLBToROD::find
(
const
std::vector<int>&
channel
)
const
79
{
80
int
index
=-1;
81
82
const
unsigned
int
size
=
m_database
.size();
83
84
if
(
channel
.size()<4) {
85
// SSW block
86
for
(
unsigned
int
i
=0;
i
<
size
;
i
++){
87
if
(
m_database
[
i
].at(0) ==
channel
.at(0)){
88
index
=
i
;
89
break
;
90
}
91
}
92
}
else
{
93
// SLB block
94
for
(
unsigned
int
i
=0;
i
<
size
;
i
++){
95
if
(
m_database
[
i
].at(3) ==
channel
.at(3) &&
96
m_database
[
i
].at(2) ==
channel
.at(2) &&
97
m_database
[
i
].at(1) ==
channel
.at(1) &&
98
m_database
[
i
].at(0) ==
channel
.at(0)){
99
index
=
i
;
100
break
;
101
}
102
}
103
}
104
105
return
index
;
106
}
107
108
}
// end of namespace
checkFileSG.line
line
Definition:
checkFileSG.py:75
MuonTGC_Cabling::TGCDatabaseSLBToROD::readDB
virtual void readDB(void)
Definition:
TGCDatabaseSLBToROD.cxx:26
plotting.yearwise_efficiency.channel
channel
Definition:
yearwise_efficiency.py:24
index
Definition:
index.py:1
MuonTGC_Cabling::TGCDatabase::m_filename
std::string m_filename
Definition:
TGCDatabase.h:52
python.setupRTTAlg.size
int size
Definition:
setupRTTAlg.py:39
MuonTGC_Cabling::TGCDatabase
Definition:
TGCDatabase.h:15
python.PyAthena.module
module
Definition:
PyAthena.py:131
lumiFormat.i
int i
Definition:
lumiFormat.py:85
MuonTGC_Cabling
Definition:
TGCCable.h:13
PlotPulseshapeFromCool.input
input
Definition:
PlotPulseshapeFromCool.py:106
MuonTGC_Cabling::TGCDatabaseSLBToROD::TGCDatabaseSLBToROD
TGCDatabaseSLBToROD(void)
Definition:
TGCDatabaseSLBToROD.h:31
file
TFile * file
Definition:
tile_monitor.h:29
find_tgc_unfilled_channelids.ip
ip
Definition:
find_tgc_unfilled_channelids.py:3
MuonTGC_Cabling::TGCDatabaseSLBToROD::~TGCDatabaseSLBToROD
virtual ~TGCDatabaseSLBToROD(void)
Definition:
TGCDatabaseSLBToROD.cxx:57
python.egammaTruthD3PDObject.blockname
blockname
Definition:
egammaTruthD3PDObject.py:64
MuonTGC_Cabling::TGCDatabaseSLBToROD::find
virtual int find(const std::vector< int > &) const
Definition:
TGCDatabaseSLBToROD.cxx:78
MuonTGC_Cabling::TGCDatabaseSLBToROD::update
virtual bool update(const std::vector< int > &)
Definition:
TGCDatabaseSLBToROD.cxx:61
GetAllXsec.entry
list entry
Definition:
GetAllXsec.py:132
TGCDatabaseSLBToROD.h
MuonTGC_Cabling::TGCDatabase::m_blockname
std::string m_blockname
Definition:
TGCDatabase.h:53
MuonTGC_Cabling::TGCDatabaseSLBToROD
Definition:
TGCDatabaseSLBToROD.h:14
DeMoScan.index
string index
Definition:
DeMoScan.py:364
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
CaloCellTimeCorrFiller.filename
filename
Definition:
CaloCellTimeCorrFiller.py:24
MuonTGC_Cabling::TGCDatabase::m_database
std::vector< std::vector< int > > m_database
Definition:
TGCDatabase.h:54
Generated on Sun Dec 22 2024 21:19:22 for ATLAS Offline Software by
1.8.18