ATLAS Offline Software
LArCalorimeter
LArExample
LArConditionsCommon
python
LArExtendedFTGrouping.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
from
__future__
import
print_function
3
4
5
class
LArExtendedFTGrouping
:
6
def
__init__
(self):
7
self.
_EMBC
=
range
(3,35)
#+[1006]
8
self.
_EMBA
=
range
(35,67)
#+[1005]
9
self.
_EMBCPS
=
range
(117,149)
#+[]
10
self.
_EMBAPS
=
range
(149,181)
#+[]
11
12
#List of EMEC OW channels (C-side)
13
EMEC=(67, 68, 69, 71, 72, 74, 75, 76, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91)
14
self.
_EMECC
=EMEC+(231,233,235,237)
# EMEC C OW + IW
15
self.
_EMECA
=()
16
for
i
in
EMEC:
#EMECA OW is EMECC OW +25
17
self.
_EMECA
+=(i+25,)
18
self.
_EMECA
+=(232,234,236,238)
#EMECA OW + EMECA IW
19
20
self.
_EMECCPS
=()
21
self.
_EMECAPS
=()
22
for
i
in
EMEC:
23
self.
_EMECCPS
+=(i+114,)
24
self.
_EMECAPS
+=(i+139,)
25
26
self.
_HECC
=(70,77,83,89)
27
self.
_HECA
=()
28
for
i
in
self.
_HECC
:
29
self.
_HECA
+=(i+25,)
30
31
self.
_FCALC
=(73,)
32
self.
_FCALA
=(73+25,)
33
34
self.
_emptyC
=(184,187,191,197,203)
35
self.
_emptyA
=(209,212,216,222,228)
36
self.
_empty
=self.
_emptyC
+ self.
_emptyA
37
38
self.
_withCorr
=
True
39
40
#Build dictionary:
41
self.
_partitions
=dict()
42
self.
_partitions
[
'EMBAPS'
] = self.
_EMBAPS
43
self.
_partitions
[
'EMBCPS'
] = self.
_EMBCPS
44
self.
_partitions
[
'EMECAPS'
] = self.
_EMECAPS
45
self.
_partitions
[
'EMECCPS'
] = self.
_EMECCPS
46
self.
_partitions
[
'EMBA'
] = self.
_EMBA
47
self.
_partitions
[
'EMBC'
] = self.
_EMBC
48
self.
_partitions
[
'EMECA'
]= self.
_EMECA
49
self.
_partitions
[
'EMECC'
] = self.
_EMECC
50
self.
_partitions
[
'HECA'
] = self.
_HECA
51
self.
_partitions
[
'HECC'
] = self.
_HECC
52
self.
_partitions
[
'FCALA'
] = self.
_FCALA
53
self.
_partitions
[
'FCALC'
] = self.
_FCALC
54
self.
_partitions
[
'EMPTYA'
] = self.
_emptyA
55
self.
_partitions
[
'EMPTYC'
] = self.
_emptyC
56
57
#Correction Channels:
58
self.
_corr
=dict()
59
self.
_corr
[
'EMBAPS'
] = 1001
60
self.
_corr
[
'EMBCPS'
] = 1002
61
self.
_corr
[
'EMECAPS'
] = 1003
62
self.
_corr
[
'EMECCPS'
] = 1004
63
self.
_corr
[
'EMBA'
] = 1005
64
self.
_corr
[
'EMBC'
] = 1006
65
self.
_corr
[
'EMECA'
] = 1007
66
self.
_corr
[
'EMECC'
] = 1008
67
self.
_corr
[
'HECA'
] = 1009
68
self.
_corr
[
'HECC'
] = 1010
69
self.
_corr
[
'FCALA'
] = 1011
70
self.
_corr
[
'FCALC'
] = 1012
71
72
#Lookup-dict indexed by channel (partition is the payload)
73
self.
_revLookup
=dict()
74
for
(p, chs)
in
self.
_partitions
.
iteritems
():
75
for
c
in
chs:
76
self.
_revLookup
[c]=p
77
78
79
def
setWithCorr
(self,val):
80
self.
_withCorr
=val
81
82
def
Print
(self):
83
print
(self.
_EMBC
)
84
print
(self.
_EMBA
)
85
86
87
def
getChannelList
(self,partitions,gains=[0]):
88
chans=
list
()
89
for
g
in
gains:
90
if
g<0
or
g>2:
91
print
(
"ERROR: Unkown gain"
,g)
92
return
None
93
94
extPart=
list
()
95
for
partition
in
partitions:
96
p=partition.upper()
97
if
(p==
"ECC"
):
98
extPart+=[
"EMECCPS"
,
"EMECC"
,
"HECC"
,
"FCALC"
]
99
elif
(p==
"ECA"
):
100
extPart+=[
"EMECAPS"
,
"EMECA"
,
"HECA"
,
"FCALA"
]
101
elif
(p==
"EC"
):
102
extPart+=[
"EMECAPS"
,
"EMECA"
,
"HECA"
,
"FCALA"
,
103
"EMECCPS"
,
"EMECC"
,
"HECC"
,
"FCALC"
]
104
elif
(p==
"EMB"
):
105
extPart+=[
"EMBA"
,
"EMBAPS"
,
"EMBC"
,
"EMBCPS"
]
106
else
:
107
extPart+=[p]
108
109
for
p
in
extPart:
110
if
p
in
self.
_partitions
:
111
for
g
in
gains:
112
for
c
in
self.
_partitions
[p]:
113
chans+=[c+(g*236)]
114
if
(self.
_withCorr
):
115
for
g
in
gains:
116
chans+=[self.
_corr
[p]+g*12]
117
else
:
118
print
(
"ERROR: Unkown partition '"
,partition,
"'"
)
119
120
return
chans
121
122
def
makeRange
(self,chans):
123
chans.sort()
124
retVal=
""
125
if
(len(chans)==0):
126
return
retVal
127
retVal=
str
(chans[0])
128
c1=chans[0]
129
series=
False
130
for
c2
in
chans[1:]:
131
if
c1 == c2:
132
print
(
"Duplicated entry"
,c2)
133
continue
134
if
c2-1 == c1
or
c2-1
in
self.
_empty
:
135
series=
True
136
else
:
137
if
series:
138
retVal+=
":"
+
str
(c1)+
","
+
str
(c2)
139
series=
False
140
else
:
141
retVal+=
","
+
str
(c2)
142
# print ("c1=",c1,"c2=",c2,"sep=",sep)
143
c1=c2
144
if
series: retVal+=
":"
+
str
(c1)
145
return
retVal
146
147
148
149
def
getChannelSelection
(self,partitions,gains):
150
return
self.
makeRange
(self.
getChannelList
(partitions,gains))
151
152
def
getChannelSelectionAllGains
(self,partitions):
153
chans=
list
()
154
for
p
in
partitions:
155
chans+=self.
getChannelList
([p],[0,1,2])
156
return
self.
makeRange
(chans)
157
158
159
def
getGain
(self,c):
160
if
c<2:
161
return
(0,
None
)
162
if
c<239:
163
return
(0,c)
164
if
c<475:
165
return
(1,c-236)
166
if
c<711:
167
return
(2,c-472)
168
if
c<1001:
169
return
(0,
None
)
170
if
c<1013:
171
return
(0,c)
172
if
c<1025:
173
return
(1,c-12)
174
if
c<1037:
175
return
(2,c-24)
176
return
(0,
None
)
177
178
179
def
channelsPerPartition
(self,chans,show=True):
180
class
counterElem:
181
def
__init__
(self,l,n):
182
self.
size
=l
183
self.
name
=n
184
self.
counts
=[0,0,0]
185
def
inc(self,g):
186
self.
counts
[g]=1+self.
counts
[g]
187
188
def
show(self):
189
print
(
"%7s: "
% self.
name
, end=
""
)
190
print
(
"HIGH:%2i/%2i"
% (self.
counts
[0],self.
size
),)
191
if
self.
counts
[0] != self.
size
:
192
print
(
"* "
,end=
""
)
193
else
:
194
print
(
" "
,end=
""
)
195
print
(
"MED:%2i/%2i"
% (self.
counts
[1],self.
size
),)
196
if
self.
counts
[1] != self.
size
:
197
print
(
"* "
,end=
""
)
198
else
:
199
print
(
" "
,end=
""
)
200
print
(
"LOW:%2i/%2i"
% (self.
counts
[2],self.
size
),)
201
if
self.
counts
[2] != self.
size
:
202
print
(
"* "
)
203
else
:
204
print
(
" "
)
205
206
partCounter=dict()
207
for
(p, chs)
in
self.
_partitions
.
iteritems
():
208
partCounter[p]=counterElem(len(chs),p)
209
210
for
c
in
chans:
211
(gain,cs)=self.
getGain
(c)
212
if
cs
is
None
:
213
print
(
"ERROR: Unkown channel"
,c)
214
else
:
215
if
(c<711):
216
p=self.
_revLookup
[cs]
217
partCounter[p].inc(gain)
218
219
return
partCounter
220
221
python.Bindings.iteritems
iteritems
Definition:
Control/AthenaPython/python/Bindings.py:820
python.LArExtendedFTGrouping.LArExtendedFTGrouping.size
size
Definition:
LArExtendedFTGrouping.py:182
python.LArExtendedFTGrouping.LArExtendedFTGrouping.makeRange
def makeRange(self, chans)
Definition:
LArExtendedFTGrouping.py:122
python.LArExtendedFTGrouping.LArExtendedFTGrouping._partitions
_partitions
Definition:
LArExtendedFTGrouping.py:41
python.LArExtendedFTGrouping.LArExtendedFTGrouping._empty
_empty
Definition:
LArExtendedFTGrouping.py:36
python.LArExtendedFTGrouping.LArExtendedFTGrouping._HECC
_HECC
Definition:
LArExtendedFTGrouping.py:26
python.LArExtendedFTGrouping.LArExtendedFTGrouping._withCorr
_withCorr
Definition:
LArExtendedFTGrouping.py:38
python.LArExtendedFTGrouping.LArExtendedFTGrouping._corr
_corr
Definition:
LArExtendedFTGrouping.py:58
python.LArExtendedFTGrouping.LArExtendedFTGrouping._FCALA
_FCALA
Definition:
LArExtendedFTGrouping.py:32
python.LArExtendedFTGrouping.LArExtendedFTGrouping.getChannelSelectionAllGains
def getChannelSelectionAllGains(self, partitions)
Definition:
LArExtendedFTGrouping.py:152
python.LArExtendedFTGrouping.LArExtendedFTGrouping.getChannelSelection
def getChannelSelection(self, partitions, gains)
Definition:
LArExtendedFTGrouping.py:149
python.LArExtendedFTGrouping.LArExtendedFTGrouping._FCALC
_FCALC
Definition:
LArExtendedFTGrouping.py:31
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMBAPS
_EMBAPS
Definition:
LArExtendedFTGrouping.py:10
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMECC
_EMECC
Definition:
LArExtendedFTGrouping.py:14
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMECA
_EMECA
Definition:
LArExtendedFTGrouping.py:15
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMBC
_EMBC
Definition:
LArExtendedFTGrouping.py:7
plotBeamSpotVxVal.range
range
Definition:
plotBeamSpotVxVal.py:195
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMBA
_EMBA
Definition:
LArExtendedFTGrouping.py:8
histSizes.list
def list(name, path='/')
Definition:
histSizes.py:38
python.LArExtendedFTGrouping.LArExtendedFTGrouping._emptyA
_emptyA
Definition:
LArExtendedFTGrouping.py:35
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMECAPS
_EMECAPS
Definition:
LArExtendedFTGrouping.py:21
print
void print(char *figname, TCanvas *c1)
Definition:
TRTCalib_StrawStatusPlots.cxx:25
python.LArExtendedFTGrouping.LArExtendedFTGrouping.Print
def Print(self)
Definition:
LArExtendedFTGrouping.py:82
python.LArExtendedFTGrouping.LArExtendedFTGrouping.setWithCorr
def setWithCorr(self, val)
Definition:
LArExtendedFTGrouping.py:79
python.LArExtendedFTGrouping.LArExtendedFTGrouping.getGain
def getGain(self, c)
Definition:
LArExtendedFTGrouping.py:159
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMECCPS
_EMECCPS
Definition:
LArExtendedFTGrouping.py:20
python.LArExtendedFTGrouping.LArExtendedFTGrouping
Definition:
LArExtendedFTGrouping.py:5
python.LArExtendedFTGrouping.LArExtendedFTGrouping.counts
counts
Definition:
LArExtendedFTGrouping.py:184
python.LArExtendedFTGrouping.LArExtendedFTGrouping._EMBCPS
_EMBCPS
Definition:
LArExtendedFTGrouping.py:9
python.LArExtendedFTGrouping.LArExtendedFTGrouping.__init__
def __init__(self)
Definition:
LArExtendedFTGrouping.py:6
python.LArExtendedFTGrouping.LArExtendedFTGrouping._HECA
_HECA
Definition:
LArExtendedFTGrouping.py:27
python.LArExtendedFTGrouping.LArExtendedFTGrouping.getChannelList
def getChannelList(self, partitions, gains=[0])
Definition:
LArExtendedFTGrouping.py:87
python.LArExtendedFTGrouping.LArExtendedFTGrouping._revLookup
_revLookup
Definition:
LArExtendedFTGrouping.py:73
str
Definition:
BTagTrackIpAccessor.cxx:11
python.LArExtendedFTGrouping.LArExtendedFTGrouping.channelsPerPartition
def channelsPerPartition(self, chans, show=True)
Definition:
LArExtendedFTGrouping.py:179
python.LArExtendedFTGrouping.LArExtendedFTGrouping._emptyC
_emptyC
Definition:
LArExtendedFTGrouping.py:34
python.LArExtendedFTGrouping.LArExtendedFTGrouping.name
name
Definition:
LArExtendedFTGrouping.py:183
Generated on Wed Jan 8 2025 21:12:45 for ATLAS Offline Software by
1.8.18