22 logger = logging.getLogger(
"mpsvalidate")
26 ROOT.gStyle.SetOptStat(
"emrs")
27 ROOT.gStyle.SetPadLeftMargin(0.07)
30 with open(os.path.join(config.jobDataPath,
".weights.pkl"),
"rb")
as f:
31 weight_conf = pickle.load(f)
34 for filename
in os.listdir(
"{0}".
format(config.jobDataPath)):
35 if (filename.endswith(
".root")
and filename.startswith(
"millepedemonitor_")):
37 inputname = os.path.splitext(filename.split(
"millepedemonitor_")[-1])[0]
40 rootfile = ROOT.TFile(os.path.join(config.jobDataPath, filename))
42 plotPaths = [
"usedTrackHists/usedptTrack",
"usedTrackHists/usedetaTrack",
43 "usedTrackHists/usedphiTrack",
"usedTrackHists/usednHitTrack"]
46 for plotNumber, plotPath
in enumerate(plotPaths):
48 plotName = plotPath.split(
"/")[1]
50 plot = rootfile.Get(plotPath)
54 ntracks = int(plot.GetEntries())
56 for item
in weight_conf
57 if item[0] == inputname][0]
58 mpsv_classes.MonitorData(inputname.replace(
"_",
" "), ntracks, weight)
61 canvas = ROOT.TCanvas(
"canvas{0}_{1}".
format(
62 inputname, plotName),
"Monitor", 300, 0, 800, 600)
66 mpsv_style.setstatsize(canvas, plot, config)
73 "{0}/plots/pdf/monitor_{1}_{2}.pdf".
format(config.outputPath, inputname.replace(
".",
"_"), plotName))
76 image = ROOT.TImage.Create()
79 "{0}/plots/png/monitor_{1}_{2}.png".
format(config.outputPath, inputname.replace(
".",
"_"), plotName))
82 output = mpsv_classes.OutputData(plottype=
"monitor", name=inputname.replace(
"_",
" "), number=plotName, filename=
"monitor_{1}_{2}".
format(
83 config.outputPath, inputname.replace(
".",
"_"), plotName))
84 config.outputList.append(output)
87 ROOT.gStyle.SetOptStat(0)
88 ROOT.gStyle.SetPadLeftMargin(0.17)