ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1TGC
src
TGCConnectionASDToPP.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
7
#include "
TrigT1TGC/TGCConnectionASDToPP.h
"
8
#include "
TrigT1TGC/TGCConnectionPPToSB.h
"
9
#include "
TrigT1TGC/TGCDatabaseManager.h
"
10
11
#include "
PathResolver/PathResolver.h
"
12
#include <iostream>
13
#include <fstream>
14
#include <sstream>
15
#include <ctype.h>
16
#include <string>
17
18
19
namespace
LVL1TGCTrigger
{
20
21
int
TGCConnectionASDToPP::getConnection
(
const
int
/*sideId*/
,
const
int
layer,
const
int
chamber,
22
const
int
line,
int
* pp,
int
* connector,
int
* channel)
const
23
{
24
int
i;
25
for
( i=0; i<
m_totalNumberOfChannel
; i+=1){
26
// wiregroupID assign in ASDOut and ASD2PP.db are different.
27
if
((
m_layerId
[i]==layer)&&(
m_chamberId
[i]==chamber)&&(
m_lineId
[i]==line)){
28
// if((m_layerId[i]==layer)&&(m_lineId[i]==line)){
29
*pp =
m_PPId
[i];
30
*connector =
m_connectorId
[i];
31
*channel =
m_channelId
[i];
32
return
0;
33
}
34
}
35
*pp=-2;
36
*connector=-2;
37
*channel=-2;
38
return
-1;
39
}
40
41
void
TGCConnectionASDToPP::dump
()
const
42
{
43
#ifdef TGCCOUT
44
int
i;
45
std::cout <<
"TGCConnectionASDToPP::dump "
<<
m_totalNumberOfChannel
<< std::endl;
46
std::cout <<
"layerId chamberID line(WIRE) PPID ConnectorID"
<< std::endl;
47
for
( i=0; i<
m_totalNumberOfChannel
; i+=1)
48
std::cout<<
m_layerId
[i]<<
" "
<<
m_chamberId
[i]<<
" "
<<
m_lineId
[i]<<
" "
<<
m_PPId
[i]<<
" "
<<
m_connectorId
[i]<<
" "
<<
m_channelId
[i]<< std::endl;
49
#endif
50
}
51
52
53
bool
TGCConnectionASDToPP::readData
(
TGCRegionType
region,
int
type
,
54
TGCForwardBackwardType
forwardBackward)
55
{
56
this->
m_type
=
type
;
57
this->
m_forwardBackward
= forwardBackward;
58
59
enum
{ BufferSize = 1024 };
60
char
buf[BufferSize];
61
62
std::string fn, fullName ;
63
// fn = "ASD2PP.db" ;
64
fn =
TGCDatabaseManager::getFilename
(0);
65
66
fullName =
PathResolver::find_file
(fn,
"PWD"
);
67
if
( fullName.length() == 0 )
68
fullName =
PathResolver::find_file
(fn,
"DATAPATH"
);
69
std::ifstream
file
(fullName.c_str() ,std::ios::in);
70
if
(!
file
)
return
false
;
71
72
std::string PPType;
73
while
(
file
.getline(buf,BufferSize)){
74
if
((buf[0]==
'E'
)||(buf[0]==
'F'
)){
75
76
std::istringstream line(buf);
77
int
nChannel;
78
line >> PPType >> nChannel;
79
// find a entry matches in region and Patch Panel m_type.
80
if
(((region ==
TGCRegionType::ENDCAP
) &&
81
( (PPType==
"EWT"
&&
m_type
==
TGCSector::WTPP
)||(PPType==
"EWD"
&&
m_type
==
TGCSector::WDPP
)
82
||(PPType==
"EST"
&&
m_type
==
TGCSector::STPP
)||(PPType==
"ESD"
&&
m_type
==
TGCSector::SDPP
)
83
||(PPType==
"EWI"
&&
m_type
==
TGCSector::WIPP
)||(PPType==
"ESI"
&&
m_type
==
TGCSector::SIPP
) ) )||
84
((region ==
TGCRegionType::FORWARD
) &&
85
( (PPType==
"FWT"
&&
m_type
==
TGCSector::WTPP
)||(PPType==
"FWD"
&&
m_type
==
TGCSector::WDPP
)
86
||(PPType==
"FST"
&&
m_type
==
TGCSector::STPP
)||(PPType==
"FSD"
&&
m_type
==
TGCSector::SDPP
)
87
||(PPType==
"FWI"
&&
m_type
==
TGCSector::WIPP
)||(PPType==
"FSI"
&&
m_type
==
TGCSector::SIPP
) ) ) ){
88
m_totalNumberOfChannel
= nChannel;
89
//coverity[TAINTED_SCALAR]
90
m_layerId
=
new
int
[
m_totalNumberOfChannel
];
91
//coverity[TAINTED_SCALAR]
92
m_chamberId
=
new
int
[
m_totalNumberOfChannel
];
93
//coverity[TAINTED_SCALAR]
94
m_lineId
=
new
int
[
m_totalNumberOfChannel
];
95
//coverity[TAINTED_SCALAR]
96
m_PPId
=
new
int
[
m_totalNumberOfChannel
];
97
//coverity[TAINTED_SCALAR]
98
m_connectorId
=
new
int
[
m_totalNumberOfChannel
];
99
//coverity[TAINTED_SCALAR]
100
m_channelId
=
new
int
[
m_totalNumberOfChannel
];
101
102
103
//******************************************************
104
// ChamberID in kmura's def. start from 1 in T1 station.
105
int
chamberIdBase=0;
106
if
(region ==
TGCRegionType::ENDCAP
&& (PPType==
"EWT"
||PPType==
"EST"
)) chamberIdBase=1;
107
//******************************************************
108
int
lineIdBase=0;
109
// initialize array
110
//coverity[TAINTED_SCALAR]
111
for
(
int
i=0; i<
m_totalNumberOfChannel
; i+=1){
112
m_layerId
[i] = 0;
113
m_chamberId
[i] = 0;
114
m_lineId
[i] = 0;
115
m_PPId
[i] = 0;
116
m_connectorId
[i] = 0;
117
m_channelId
[i] = 0;
118
}
119
// read lines
120
for
(
int
i=0; i<
m_totalNumberOfChannel
; i+=1){
121
file
.getline(buf,BufferSize);
122
std::istringstream line(buf);
123
line >>
m_layerId
[i] >>
m_chamberId
[i] >>
m_lineId
[i]
124
>>
m_PPId
[i] >>
m_connectorId
[i] >>
m_channelId
[i];
125
126
// DB is Backward
127
if
(PPType==
"FST"
||PPType==
"FSD"
||PPType==
"EST"
||PPType==
"ESD"
||PPType==
"FSI"
||PPType==
"ESI"
){
128
if
(forwardBackward==
ForwardSector
){
129
//coverity[TAINTED_SCALAR]
130
//coverity[INTEGER_OVERFLOW]
131
m_layerId
[i] =
s_forwardLayer
[
m_layerId
[i]];
132
}
133
}
134
135
136
//******************************************************
137
// ChamberID in kmura's def. start from 1 in T1 station.
138
m_chamberId
[i]+=chamberIdBase;
139
//******************************************************
140
//******************************************************
141
// hitID assign for each Module in kmura's def.,
142
// not for each chamber like in hasuko's def.
143
if
( (
m_type
==
TGCSector::WTPP
)||(
m_type
==
TGCSector::WDPP
)||(
m_type
==
TGCSector::WIPP
) ){
144
if
((i!=0)&&(
m_chamberId
[i]!=
m_chamberId
[i-1])){
145
if
(
m_layerId
[i]==
m_layerId
[i-1])
146
lineIdBase=
m_lineId
[i-1]+1;
147
else
148
lineIdBase=0;
149
}
150
m_lineId
[i]+=lineIdBase;
151
}
152
//******************************************************
153
}
154
break
;
155
}
156
}
157
}
158
return
true
;
159
}
160
161
TGCConnectionASDToPP::TGCConnectionASDToPP
(
const
TGCConnectionASDToPP
& right)
162
{
163
m_totalNumberOfChannel
= right.
m_totalNumberOfChannel
;
164
m_type
= right.
m_type
;
165
m_forwardBackward
= right.
m_forwardBackward
;
166
m_layerId
= 0;
167
m_chamberId
= 0;
168
m_lineId
= 0;
169
m_PPId
= 0;
170
m_connectorId
= 0;
171
m_channelId
= 0;
172
173
if
(
m_totalNumberOfChannel
!=0){
174
m_layerId
=
new
int
[
m_totalNumberOfChannel
];
175
m_chamberId
=
new
int
[
m_totalNumberOfChannel
];
176
m_lineId
=
new
int
[
m_totalNumberOfChannel
];
177
m_PPId
=
new
int
[
m_totalNumberOfChannel
];
178
m_connectorId
=
new
int
[
m_totalNumberOfChannel
];
179
m_channelId
=
new
int
[
m_totalNumberOfChannel
];
180
181
for
(
int
i=0; i<
m_totalNumberOfChannel
; i+=1){
182
m_layerId
[i]=right.
m_layerId
[i];
183
m_chamberId
[i]=right.
m_chamberId
[i];
184
m_lineId
[i]=right.
m_lineId
[i];
185
m_PPId
[i]=right.
m_PPId
[i];
186
m_connectorId
[i]=right.
m_connectorId
[i];
187
m_channelId
[i]=right.
m_channelId
[i];
188
}
189
}
190
}
191
192
TGCConnectionASDToPP
&
193
TGCConnectionASDToPP::operator=
(
const
TGCConnectionASDToPP
& right)
194
{
195
if
(
this
!= &right) {
196
m_type
= right.
m_type
;
197
m_forwardBackward
= right.
m_forwardBackward
;
198
199
m_totalNumberOfChannel
= right.
m_totalNumberOfChannel
;
200
if
(
m_layerId
!=0) {
201
delete
[]
m_layerId
;
202
delete
[]
m_chamberId
;
203
delete
[]
m_lineId
;
204
delete
[]
m_PPId
;
205
delete
[]
m_connectorId
;
206
delete
[]
m_channelId
;
207
}
208
if
(
m_totalNumberOfChannel
!=0){
209
m_layerId
=
new
int
[
m_totalNumberOfChannel
];
210
m_chamberId
=
new
int
[
m_totalNumberOfChannel
];
211
m_lineId
=
new
int
[
m_totalNumberOfChannel
];
212
m_PPId
=
new
int
[
m_totalNumberOfChannel
];
213
m_connectorId
=
new
int
[
m_totalNumberOfChannel
];
214
m_channelId
=
new
int
[
m_totalNumberOfChannel
];
215
for
(
int
i=0; i<
m_totalNumberOfChannel
; i+=1){
216
m_layerId
[i]=right.
m_layerId
[i];
217
m_chamberId
[i]=right.
m_chamberId
[i];
218
m_lineId
[i]=right.
m_lineId
[i];
219
m_PPId
[i]=right.
m_PPId
[i];
220
m_connectorId
[i]=right.
m_connectorId
[i];
221
m_channelId
[i]=right.
m_channelId
[i];
222
}
223
}
224
}
225
return
*
this
;
226
}
227
228
TGCConnectionASDToPP::TGCConnectionASDToPP
():
229
m_totalNumberOfChannel
(0),
m_type
(0),
m_forwardBackward
(
ForwardSector
),
230
m_layerId
(0),
m_chamberId
(0),
m_lineId
(0),
231
m_PPId
(0),
m_connectorId
(0),
m_channelId
(0)
232
{
233
}
234
235
236
TGCConnectionASDToPP::~TGCConnectionASDToPP
()
237
{
238
if
(
m_layerId
!=0)
delete
[]
m_layerId
;
239
m_layerId
=0;
240
if
(
m_chamberId
!=0)
delete
[]
m_chamberId
;
241
m_chamberId
=0;
242
if
(
m_lineId
!=0)
delete
[]
m_lineId
;
243
m_lineId
=0;
244
if
(
m_PPId
!=0)
delete
[]
m_PPId
;
245
m_PPId
=0;
246
if
(
m_connectorId
!=0)
delete
[]
m_connectorId
;
247
m_connectorId
=0;
248
if
(
m_channelId
!=0)
delete
[]
m_channelId
;
249
m_channelId
=0;
250
}
251
252
}
//end of namespace bracket
PathResolver.h
TGCConnectionASDToPP.h
TGCConnectionPPToSB.h
TGCDatabaseManager.h
LVL1TGCTrigger::TGCConnectionASDToPP
Definition
TGCConnectionASDToPP.h:12
LVL1TGCTrigger::TGCConnectionASDToPP::operator=
TGCConnectionASDToPP & operator=(const TGCConnectionASDToPP &right)
Definition
TGCConnectionASDToPP.cxx:193
LVL1TGCTrigger::TGCConnectionASDToPP::s_forwardLayer
static constexpr int s_forwardLayer[]
Definition
TGCConnectionASDToPP.h:39
LVL1TGCTrigger::TGCConnectionASDToPP::m_channelId
int * m_channelId
Definition
TGCConnectionASDToPP.h:36
LVL1TGCTrigger::TGCConnectionASDToPP::m_lineId
int * m_lineId
Definition
TGCConnectionASDToPP.h:32
LVL1TGCTrigger::TGCConnectionASDToPP::m_connectorId
int * m_connectorId
Definition
TGCConnectionASDToPP.h:35
LVL1TGCTrigger::TGCConnectionASDToPP::m_chamberId
int * m_chamberId
Definition
TGCConnectionASDToPP.h:31
LVL1TGCTrigger::TGCConnectionASDToPP::~TGCConnectionASDToPP
~TGCConnectionASDToPP()
Definition
TGCConnectionASDToPP.cxx:236
LVL1TGCTrigger::TGCConnectionASDToPP::m_forwardBackward
TGCForwardBackwardType m_forwardBackward
Definition
TGCConnectionASDToPP.h:28
LVL1TGCTrigger::TGCConnectionASDToPP::getConnection
int getConnection(const int sideId, const int layer, const int chamber, const int line, int *pp, int *connector, int *channel) const
Definition
TGCConnectionASDToPP.cxx:21
LVL1TGCTrigger::TGCConnectionASDToPP::dump
void dump() const
Definition
TGCConnectionASDToPP.cxx:41
LVL1TGCTrigger::TGCConnectionASDToPP::m_layerId
int * m_layerId
Definition
TGCConnectionASDToPP.h:30
LVL1TGCTrigger::TGCConnectionASDToPP::readData
bool readData(TGCRegionType region, int type, TGCForwardBackwardType forward)
Definition
TGCConnectionASDToPP.cxx:53
LVL1TGCTrigger::TGCConnectionASDToPP::TGCConnectionASDToPP
TGCConnectionASDToPP()
Definition
TGCConnectionASDToPP.cxx:228
LVL1TGCTrigger::TGCConnectionASDToPP::m_PPId
int * m_PPId
Definition
TGCConnectionASDToPP.h:34
LVL1TGCTrigger::TGCConnectionASDToPP::m_totalNumberOfChannel
int m_totalNumberOfChannel
Definition
TGCConnectionASDToPP.h:26
LVL1TGCTrigger::TGCConnectionASDToPP::m_type
int m_type
Definition
TGCConnectionASDToPP.h:27
LVL1TGCTrigger::TGCDatabaseManager::getFilename
static std::string getFilename(int type)
Definition
TGCDatabaseManager.cxx:239
LVL1TGCTrigger::TGCSector::WTPP
@ WTPP
Definition
TGCSector.h:35
LVL1TGCTrigger::TGCSector::SIPP
@ SIPP
Definition
TGCSector.h:35
LVL1TGCTrigger::TGCSector::WDPP
@ WDPP
Definition
TGCSector.h:35
LVL1TGCTrigger::TGCSector::WIPP
@ WIPP
Definition
TGCSector.h:35
LVL1TGCTrigger::TGCSector::SDPP
@ SDPP
Definition
TGCSector.h:35
LVL1TGCTrigger::TGCSector::STPP
@ STPP
Definition
TGCSector.h:35
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition
PathResolver.cxx:220
LVL1TGCTrigger
Definition
LVL1TGCTrigger.cxx:48
LVL1TGCTrigger::TGCForwardBackwardType
TGCForwardBackwardType
Definition
TGCNumbering.h:59
LVL1TGCTrigger::ForwardSector
@ ForwardSector
Definition
TGCNumbering.h:59
LVL1TGCTrigger::TGCRegionType
TGCRegionType
Definition
TGCNumbering.h:49
LVL1TGCTrigger::TGCRegionType::FORWARD
@ FORWARD
Definition
TGCNumbering.h:49
LVL1TGCTrigger::TGCRegionType::ENDCAP
@ ENDCAP
Definition
TGCNumbering.h:49
type
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0