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