10 from ROOT
import TH1F, TCanvas, TFile, TImage, gStyle
12 from Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.classes
import MonitorData, OutputData
13 from Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.style
import setstatsize
17 logger = logging.getLogger(
"mpsvalidate")
21 gStyle.SetOptStat(
"emrs")
22 gStyle.SetPadLeftMargin(0.07)
25 for filename
in os.listdir(
"{0}".
format(config.jobDataPath)):
26 if (filename.endswith(
".root")
and filename.startswith(
"millepedemonitor_")):
28 inputname = filename[17:-5]
31 rootfile = TFile(
"{0}/{1}".
format(config.jobDataPath, filename))
33 plotPaths = [
"usedTrackHists/usedptTrack",
"usedTrackHists/usedetaTrack",
34 "usedTrackHists/usedphiTrack",
"usedTrackHists/usednHitTrack"]
37 for plotNumber, plotPath
in enumerate(plotPaths):
39 plotName = plotPath.split(
"/")[1]
41 plot = rootfile.Get(plotPath)
45 ntracks =
int(plot.GetEntries())
46 MonitorData(inputname.replace(
"_",
" "), ntracks)
49 canvas = TCanvas(
"canvas{0}_{1}".
format(
50 inputname, plotName),
"Monitor", 300, 0, 800, 600)
61 "{0}/plots/pdf/monitor_{1}_{2}.pdf".
format(config.outputPath, inputname.replace(
".",
"_"), plotName))
64 image = TImage.Create()
67 "{0}/plots/png/monitor_{1}_{2}.png".
format(config.outputPath, inputname.replace(
".",
"_"), plotName))
70 output = OutputData(plottype=
"monitor", name=inputname.replace(
"_",
" "), number=plotName, filename=
"monitor_{1}_{2}".
format(
71 config.outputPath, inputname.replace(
".",
"_"), plotName))
72 config.outputList.append(output)
76 gStyle.SetPadLeftMargin(0.17)
def setstatsize(canvas, plot, config)
statistics size