#!/usr/bin/env python2 ## Example skeleton for validation check of the previously filled histograms ## of G4 trajectories from IValidationAnalyzer. import sys import ROOT import math ##ROOT.gStyle.SetOptStat("") ROOT.gStyle.SetOptStat(1111) ROOT.gStyle.SetOptFit(1111) ## The minimum entries for the histogram to be considered good. minEntries = 1000000 ## The x of magnitude minX = 1 input = ROOT.TFile("IcedustValidate-110FieldMap.root","OLD") if not input.IsOpen(): print "MISSING INPUT" sys.exit(0) input.cd() Magnitude = input.Get("hMagnitude") SideComponent = input.Get("hSideways") UpComponent = input.Get("hUpwards") OutComponent = input.Get("hOutwards") ## Save plots as files Magnitude.Draw("colz") ROOT.gPad.Print("IcedustValidate-930FieldMapValidationAnalysis-Magnitude.eps") SideComponent.Draw("colz") ROOT.gPad.Print("IcedustValidate-930FieldMapValidationAnalysis-SideComponent.eps") UpComponent.Draw("colz") ROOT.gPad.Print("IcedustValidate-930FieldMapValidationAnalysis-UpComponent.eps") OutComponent.Draw("colz") ROOT.gPad.Print("IcedustValidate-930FieldMapValidationAnalysis-OutComponent.eps") fail = False #Check number of entries if Magnitude.GetEntries() < minEntries: fail = True print "Too low number of entries %f" % (Magnitude.GetEntries()) #Check x of magnitude is non-zero if abs(Magnitude.GetMean(1)) < minX: fail = True print "Too low mean x of Magnitude %f" % (Magnitude.GetMean()) #Check y of magnitude is non-zero if abs(Magnitude.GetMean(2)) < minX: fail = True print "Too low mean y of Magnitude %f" % (Magnitude.GetMean()) #Check number of entries if SideComponent.GetEntries() < minEntries: fail = True print "Too low number of entries %f" % (SideComponent.GetEntries()) #Check x is non-zero if abs(SideComponent.GetMean(1)) < minX: fail = True print "Too low mean x of Side Component %f" % (SideComponent.GetMean()) #Check y is non-zero if abs(SideComponent.GetMean(2)) < minX: fail = True print "Too low mean y of Side Component %f" % (SideComponent.GetMean()) #Check number of entries if UpComponent.GetEntries() < minEntries: fail = True print "Too low number of entries %f" % (UpComponent.GetEntries()) #Check x is non-zero if abs(UpComponent.GetMean(1)) < minX: fail = True print "Too low mean x of Up Component %f" % (UpComponent.GetMean()) #Check y is non-zero if abs(UpComponent.GetMean(2)) < minX: fail = True print "Too low mean y of Up Component %f" % (UpComponent.GetMean()) #Check number of entries if OutComponent.GetEntries() < minEntries: fail = True print "Too low number of entries %f" % (OutComponent.GetEntries()) #Check x is non-zero if abs(OutComponent.GetMean(1)) < minX: fail = True print "Too low mean x of Out Component %f" % (UpComponent.GetMean()) #Check y is non-zero if abs(OutComponent.GetMean(2)) < minX: fail = True print "Too low mean y of Out Component %f" % (OutComponent.GetMean()) if fail: print "FAIL" sys.exit(1)