ATLAS Offline Software
Loading...
Searching...
No Matches
SCTPostProcessing.py
Go to the documentation of this file.
2# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3#
5 # hist name format: <histname>_<layer>_<link>
6 # possible <histnames> (B, ECA, ECC):
7 # (noiseoccupancymaptrigger, noiseoccupancymaptriggerECp, noiseoccupancymaptriggerECm)
8 # (ineff, ineffp, ineffm)
9 # (SCT_NumberOfErrorsB, SCT_NumberOfErrorsEA, SCT_NumberOfErrorsEC)
10 name = h.GetName()
11 # define bec
12 if 'EA' in name or 'ECp' in name or 'ineffp' in name:
13 bec = 2
14 elif 'EC' in name or 'ECm' in name or 'ineffm' in name:
15 bec = -2
16 else:
17 bec = 0
18 # define layer and link
19 layer = int(name.split('_')[-2])
20 link = int(name.split('_')[-1])
21 return (bec, layer, link)
22
23def effcomb(inputs):
24 import ROOT
25 rv = ROOT.TH1F('SctEffDistribution;Efficiency;Links', 'SCT Efficiency Distribution', 500, 0, 1)
26 plots = [_[1][0] for _ in inputs] # all plots passed as first element of list
27 rv.GetXaxis().SetTitle('Efficiency')
28 rv.GetYaxis().SetTitle('Links')
29 for plot in plots:
30 for xbin in range(plot.GetNbinsX()):
31 for ybin in range(plot.GetNbinsY()):
32 if(plot.GetBinEntries(plot.GetBin(xbin,ybin))==0):
33 continue
34 rv.Fill(plot.GetBinContent(xbin,ybin))
35 return [rv]
36
37def conf(inputs, label, thr):
38 import ROOT
39 rh = ROOT.TH1F('SCTConfNew', 'Num of Problematic Modules in All Region', 5, -0.5, 4.5)
40 for l in range(len(label)):
41 rh.GetXaxis().SetBinLabel(l+1,label[l])
42 for i in range(len(inputs[0][1])):
43 plots = [_[1][i] for _ in inputs] # all plots passed as first element of list
44 if i < 3:
45 # order the plots, two layer links are next to each other
46 plots = sorted(plots, key=_bec_layer_link)
47 for m in range(int(len(plots)/2)):
48 plot0 = plots[2*m]
49 plot1 = plots[2*m+1]
50 for xbin in range(plot0.GetNbinsX()):
51 for ybin in range(plot0.GetNbinsY()):
52 if (plot0.GetBinContent(xbin+1,ybin+1) > thr[i] or plot1.GetBinContent(xbin+1,ybin+1) > thr[i]):
53 rh.Fill(i)
54 else:
55 #use only first plot as all others are replicas (only for Masked and flagged links plots)
56 rh.Fill(i,plots[0].GetBinContent(4))
57 return [rh]
if(febId1==febId2)
conf(inputs, label, thr)