26from ROOT
import Belle2
27from array
import array
30parser = argparse.ArgumentParser(description=
"Plot dead pixel maps")
31parser.add_argument(
'--maps', dest=
'maps', action=
"store_true", help=
'Create maps from payloads. This can be slow!')
32args = parser.parse_args()
48histofile = ROOT.TFile(
'deadpixel_histos.root',
'RECREATE')
50histofile.mkdir(
"maps")
53rfile = ROOT.TFile(
"dead_payloads.root",
"READ")
54b2.conditions = rfile.Get(
"conditions")
56deadpixel_table = dict()
57for sensorID
in sensor_list:
58 deadpixel_table[sensorID.getID()] = list()
61for condition
in b2.conditions:
62 if condition.PXDDeadPixelPar_valid:
63 print(f
"Starting on run {condition.run}")
64 run_list.append(condition.run)
66 for sensorID
in sensor_list:
71 deadsensormap = condition.PXDDeadPixelPar.getDeadSensorMap()
72 deaddrainmap = condition.PXDDeadPixelPar.getDeadDrainMap()
73 deadrowmap = condition.PXDDeadPixelPar.getDeadRowMap()
74 deadsinglesmap = condition.PXDDeadPixelPar.getDeadSinglePixelMap()
76 layer = sensorID.getLayerNumber()
77 ladder = sensorID.getLadderNumber()
78 sensor = sensorID.getSensorNumber()
81 counter = len(deaddrainmap[sensorID.getID()]) * 192
86 counter += len(deadrowmap[sensorID.getID()]) * 250
89 counter += len(deadsinglesmap[sensorID.getID()])
94 name = f
"DeadPixels_{layer:d}_{ladder:d}_{sensor:d}_run_{condition.run:d}"
95 title = f
"Dead Pixels Sensor={layer:d}.{ladder:d}.{sensor:d} run={condition.run:d}"
96 dead_map = ROOT.TH2F(name, title, nUCells, 0, nUCells, nVCells, 0, nVCells)
97 dead_map.GetXaxis().SetTitle(
"uCell")
98 dead_map.GetYaxis().SetTitle(
"vCell")
99 dead_map.GetZaxis().SetTitle(
"isDead")
102 for uCell
in range(nUCells):
103 for vCell
in range(nVCells):
104 pixID = uCell * nVCells + vCell
105 isDeadSinglePixel = condition.PXDDeadPixelPar.isDeadSinglePixel(sensorID.getID(), pixID)
106 isDeadRow = condition.PXDDeadPixelPar.isDeadRow(sensorID.getID(), vCell)
107 isDeadDrain = condition.PXDDeadPixelPar.isDeadDrain(sensorID.getID(), uCell * 4 + vCell % 4)
108 isDead = isDeadSinglePixel
or isDeadRow
or isDeadDrain
112 dead_map.SetBinContent(int(uCell + 1), int(vCell + 1), isDead)
117 deadfraction = counter / (nUCells * nVCells)
118 deadpixel_table[sensorID.getID()].append(deadfraction)
122c = ROOT.TCanvas(
'dead_vs_runno',
'Deadpixel evolution vs. run number', 200, 10, 700, 500)
125for sensorID
in sensor_list:
128 x, y = array(
'd'), array(
'd')
129 for value
in deadpixel_table[sensorID.getID()]:
134 gr = ROOT.TGraph(n, x, y)
135 gr.SetLineColor(ROOT.kBlue)
137 gr.SetName(f
"graph_{sensorID.getID()}")
138 gr.SetMarkerColor(ROOT.kBlue)
139 gr.SetMarkerStyle(21)
140 gr.SetTitle(f
'Deadpixel evolution Sensor={sensorID}')
141 gr.GetXaxis().SetTitle(
'run number')
142 gr.GetYaxis().SetTitle(
'dead fraction')
143 gr.GetYaxis().SetRangeUser(0.0, 1.0)
148 c.Print(f
'deadpixels_vs_runno_{sensorID.getID()}.png')
Class to uniquely identify a any structure of the PXD and SVD.