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