10 ROOT.PyConfig.IgnoreCommandLineOptions =
True
13 import Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.style
as mpsv_style
14 import Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.classes
as mpsv_classes
18 logger = logging.getLogger(
"mpsvalidate")
22 ROOT.gStyle.SetOptStat(
"emrs")
23 ROOT.gStyle.SetPadLeftMargin(0.07)
26 with open(os.path.join(config.jobDataPath,
".weights.pkl"),
"rb")
as f:
27 weight_conf = cPickle.load(f)
30 for filename
in os.listdir(
"{0}".
format(config.jobDataPath)):
31 if (filename.endswith(
".root")
and filename.startswith(
"millepedemonitor_")):
33 inputname = os.path.splitext(filename.split(
"millepedemonitor_")[-1])[0]
36 rootfile = ROOT.TFile(os.path.join(config.jobDataPath, filename))
38 plotPaths = [
"usedTrackHists/usedptTrack",
"usedTrackHists/usedetaTrack",
39 "usedTrackHists/usedphiTrack",
"usedTrackHists/usednHitTrack"]
42 for plotNumber, plotPath
in enumerate(plotPaths):
44 plotName = plotPath.split(
"/")[1]
46 plot = rootfile.Get(plotPath)
50 ntracks =
int(plot.GetEntries())
52 for item
in weight_conf
53 if item[0] == inputname][0]
54 mpsv_classes.MonitorData(inputname.replace(
"_",
" "), ntracks, weight)
57 canvas = ROOT.TCanvas(
"canvas{0}_{1}".
format(
58 inputname, plotName),
"Monitor", 300, 0, 800, 600)
62 mpsv_style.setstatsize(canvas, plot, config)
69 "{0}/plots/pdf/monitor_{1}_{2}.pdf".
format(config.outputPath, inputname.replace(
".",
"_"), plotName))
72 image = ROOT.TImage.Create()
75 "{0}/plots/png/monitor_{1}_{2}.png".
format(config.outputPath, inputname.replace(
".",
"_"), plotName))
78 output = mpsv_classes.OutputData(plottype=
"monitor", name=inputname.replace(
"_",
" "), number=plotName, filename=
"monitor_{1}_{2}".
format(
79 config.outputPath, inputname.replace(
".",
"_"), plotName))
80 config.outputList.append(output)
83 ROOT.gStyle.SetOptStat(0)
84 ROOT.gStyle.SetPadLeftMargin(0.17)