ATLAS Offline Software
Loading...
Searching...
No Matches
python.pix_defect Namespace Reference

Functions

 find_standby (nlayer, hhits, lb_max, standby_lb)
 find_notready (nlayer, hist, pct_low, pct_high, notready_lb, lb_max=2000)
 find_btagdeg (hist, pct_low, pct_high, btagdeg_lb, lb_max)
 print_def (defect_name, defect_lb)
 print_btagdegdef (defect_name, defect_lb)
 assign_defect (db, defect_name, run, defect_lb)
 assign_lowstat (db, run, comment)
 assign_btagdegdef (db, defect_name, run, defect_lb)
 execute (run, sfile, lb_max)

Variables

 defect_val
 defect_iov

Function Documentation

◆ assign_btagdegdef()

python.pix_defect.assign_btagdegdef ( db,
defect_name,
run,
defect_lb )

Definition at line 153 of file pix_defect.py.

153def assign_btagdegdef(db, defect_name, run, defect_lb):
154 for i in range(0, len(defect_lb)):
155 sdefect = "PIXEL_" + defect_name
156 lbstart = defect_lb[i][0]
157 lbend = defect_lb[i][1]
158
159 start = (run << 32) + lbstart
160 until = (run << 32) + lbend + 1
161
162 comment = "assign " + sdefect
163 db.append(defect_iov(sdefect, comment, False, start, until))
164
165
166

◆ assign_defect()

python.pix_defect.assign_defect ( db,
defect_name,
run,
defect_lb )

Definition at line 113 of file pix_defect.py.

113def assign_defect(db, defect_name, run, defect_lb):
114 for i in range(0, len(defect_lb)):
115 layer = defect_lb[i][0]
116 if layer == 0:
117 slayer = "IBL"
118 elif layer == 1:
119 slayer = "LAYER0"
120 elif layer == 2:
121 slayer = "BARREL"
122 elif layer == 3:
123 slayer = "BARREL"
124 elif layer == 4:
125 slayer = "ENDCAPA"
126 elif layer == 5:
127 slayer = "ENDCAPC"
128
129 sdefect = "PIXEL_" + slayer + "_" + defect_name
130
131 lbstart = defect_lb[i][1]
132 lbend = defect_lb[i][2]
133
134 start = (run << 32) + lbstart
135 until = (run << 32) + lbend + 1
136
137 #print(sdefect, ": LB = ", lbstart,"-",lbend,")")
138 comment = "assign " + sdefect
139 db.append(defect_iov(sdefect, comment, False, start, until))
140
141
142

◆ assign_lowstat()

python.pix_defect.assign_lowstat ( db,
run,
comment )

Definition at line 143 of file pix_defect.py.

143def assign_lowstat(db, run, comment):
144 sdefect = "PIXEL_LOWSTAT"
145 lbstart = 1
146 lbend = 2000
147 start = (run << 32) + lbstart
148 until = (run << 32) + lbend + 1
149 #print(sdefect, ": LB = ", lbstart,"-",lbend,")")
150 db.append(defect_iov(sdefect, comment, False, start, until))
151
152

◆ execute()

python.pix_defect.execute ( run,
sfile,
lb_max )

Definition at line 167 of file pix_defect.py.

167def execute(run, sfile, lb_max):
168 db = []
169 gROOT.Reset()
170 file = TFile(sfile)
171
172 shits = []
173 shits.append("InnerDetector/Pixel/IBL/Hits/AvgOccActivePerLumi_IBL2D")
174 shits.append("InnerDetector/Pixel/BLayer/Hits/AvgOccActivePerLumi_BLayer")
175 shits.append("InnerDetector/Pixel/Layer1/Hits/AvgOccActivePerLumi_Layer1")
176 shits.append("InnerDetector/Pixel/Layer2/Hits/AvgOccActivePerLumi_Layer2")
177 shits.append("InnerDetector/Pixel/ECA/Hits/AvgOccActivePerLumi_ECA")
178 shits.append("InnerDetector/Pixel/ECC/Hits/AvgOccActivePerLumi_ECC")
179
180 sbtagdeg = "InnerDetector/Pixel/PixelExpert/BTagDegEstimation/TotalDegradationPerLumi"
181
182 sclus = "Global/Luminosity/AnyTrigger/nClustersAll_vs_LB"
183
184 nlayer = 6
185 hhits = []
186 fexist_hhits = True
187 for i in range(0, nlayer):
188 if not file.Get(shits[i]):
189 fexist_hhits = False
190 continue
191
192 hhits.append(file.Get(shits[i]))
193
194 standby_lb = []
195 if fexist_hhits is True:
196 find_standby(nlayer, hhits, lb_max, standby_lb)
197
198 #print_def("standby", standby_lb)
199 #user = "atlpixdq"
200 #assign_defect(db, "STANDBY", run, standby_lb)
201
202 fexist_hbtagdeg = True
203 hbtagdeg = file.Get(sbtagdeg)
204 if not hbtagdeg:
205 fexist_hbtagdeg = False
206 btagdegestim_tolerable_lb = []
207 btagdegestim_intolerable_lb = []
208
209 if fexist_hhits is True and fexist_hbtagdeg is True:
210 find_btagdeg(hbtagdeg, 0.05, 0.25, btagdegestim_tolerable_lb, lb_max)
211 find_btagdeg(hbtagdeg, 0.25, 1., btagdegestim_intolerable_lb, lb_max)
212
213 if 0:
214 print_btagdegdef("tolerable", btagdegestim_tolerable_lb)
215 print_btagdegdef("intolerable", btagdegestim_intolerable_lb)
216
217 if 1:
218 assign_btagdegdef(db, "PERFORMANCE_TOLERABLE", run, btagdegestim_tolerable_lb)
219 assign_btagdegdef(db, "PERFORMANCE_INTOLERABLE", run, btagdegestim_intolerable_lb)
220
221 fexist_hclus = True
222 hclus = file.Get(sclus)
223 if not hclus:
224 fexist_hclus = False
225 if fexist_hclus is True:
226 nevent = hclus.GetEntries()
227 if nevent < 100000:
228 assign_lowstat(db, run, "assign PIXEL_LOWSTAT")
229
230 return db

◆ find_btagdeg()

python.pix_defect.find_btagdeg ( hist,
pct_low,
pct_high,
btagdeg_lb,
lb_max )

Definition at line 85 of file pix_defect.py.

85def find_btagdeg(hist, pct_low, pct_high, btagdeg_lb, lb_max):
86 start = 0
87 start_lb = 0
88
89 nbin = hist.GetNbinsX()
90 for i in range(1, nbin-1):
91 val = hist.GetBinContent(i+1)
92 if val >= pct_low and val < pct_high:
93 if start == 0:
94 start = 1
95 start_lb = i
96 elif start == 1:
97 btagdeg_lb.append([start_lb, i-1])
98 start = 0
99 start_lb = 0
100 if start == 1:
101 btagdeg_lb.append([start_lb, lb_max])
102
103

◆ find_notready()

python.pix_defect.find_notready ( nlayer,
hist,
pct_low,
pct_high,
notready_lb,
lb_max = 2000 )

Definition at line 46 of file pix_defect.py.

46def find_notready(nlayer, hist, pct_low, pct_high, notready_lb, lb_max=2000):
47
48 for i in range(0, nlayer):
49 start = 0
50 start_lb = 0
51
52 nbin = hist[i].GetNbinsX()
53 if i == 2:
54 for j in range(1, nbin-1):
55 val = hist[2].GetBinContent(
56 j+1)*38/90 + hist[3].GetBinContent(j+1)*52/90
57 if val >= pct_low and val < pct_high:
58 if start == 0:
59 start = 1
60 start_lb = j
61 elif start == 1:
62 notready_lb.append([i, start_lb, j-1])
63 start = 0
64 start_lb = 0
65 if start == 1:
66 notready_lb.append([i, start_lb, lb_max])
67 elif i == 3:
68 # nothing to do
69 pass
70 else:
71 for j in range(1, nbin-1):
72 val = hist[i].GetBinContent(j+1)
73 if val >= pct_low and val < pct_high:
74 if start == 0:
75 start = 1
76 start_lb = j
77 elif start == 1:
78 notready_lb.append([i, start_lb, j-1])
79 start = 0
80 start_lb = 0
81 if start == 1:
82 notready_lb.append([i, start_lb, lb_max])
83
84

◆ find_standby()

python.pix_defect.find_standby ( nlayer,
hhits,
lb_max,
standby_lb )

Definition at line 12 of file pix_defect.py.

12def find_standby(nlayer, hhits, lb_max, standby_lb):
13 threshold_hit = 10
14 for i in range(0, nlayer):
15 start = 0
16 start_lb = 0
17 end_lb = 0
18
19 nbin = hhits[i].GetNbinsX()
20
21 start_lb = 0
22 for j in range(1, nbin-1):
23 val = hhits[i].GetBinContent(j+1)
24 if val >= threshold_hit:
25 end_lb = j
26 if start_lb == 0:
27 start_lb = j
28
29 for j in range(1, nbin-1):
30 #val_global = hglobal.GetBinContent(j+1)
31 val = hhits[i].GetBinContent(j+1)
32 if val < threshold_hit:
33 if start == 0:
34 start = 1
35 start_lb = j
36 elif start == 1:
37 if j > start_lb and j < end_lb:
38 standby_lb.append([i, start_lb, j-1])
39 start = 0
40 start_lb = 0
41 if start == 1:
42 if lb_max > start_lb:
43 standby_lb.append([i, start_lb, lb_max])
44
45

◆ print_btagdegdef()

python.pix_defect.print_btagdegdef ( defect_name,
defect_lb )

Definition at line 108 of file pix_defect.py.

108def print_btagdegdef(defect_name, defect_lb):
109 for i in range(0, len(defect_lb)):
110 print(defect_name, ": ", defect_lb[i][0], "-", defect_lb[i][1])
111
112
void print(char *figname, TCanvas *c1)

◆ print_def()

python.pix_defect.print_def ( defect_name,
defect_lb )

Definition at line 104 of file pix_defect.py.

104def print_def(defect_name, defect_lb):
105 for i in range(0, len(defect_lb)):
106 print(defect_name, "[", defect_lb[i][0], "]:", defect_lb[i][1], "-", defect_lb[i][2])
107

Variable Documentation

◆ defect_iov

python.pix_defect.defect_iov
Initial value:
1= collections.namedtuple('defect_iov',
2 'defect, comment, recoverable, since, until')

Definition at line 7 of file pix_defect.py.

◆ defect_val

python.pix_defect.defect_val
Initial value:
1= collections.namedtuple('defect_val',
2 'defect, comment, recoverable')

Definition at line 5 of file pix_defect.py.