7 from ROOT
import TFile, TH1
17 path = dir.GetPath().
split(
':/', 1)[-1]
20 keylist = dir.GetListOfKeys()
26 if obj.IsA().InheritsFrom(ROOT.TH2.Class())
or obj.IsA().InheritsFrom(ROOT.TProfile.Class())
or "fficiency" in obj.GetName()
or 'RecoFraction' in obj.GetName()
or 'purity' in obj.GetName()
or "PtResol" in obj.GetName()
or "PtScale" in obj.GetName()
or "Prof" in obj.GetName()
or "Fit" in obj.GetName():
29 if obj.IsA().InheritsFrom(ROOT.TH1.Class()) :
32 ii = 1.*obj.Integral()
37 pathdir.WriteTObject( obj , hname ,
"WriteDelete" )
40 if obj.IsA().InheritsFrom(ROOT.TDirectory.Class()):
49 Main function to be executed when starting the code.
53 print(
'No filename given' )
54 print(
'Usage: python '+argv[0]+
' physval_filename' )
58 if not os.path.exists( filename ):
59 print (
'File not found: ' + filename )
63 infile = ROOT.TFile.Open( filename,
'update' )
71 topDir = infile.GetDirectory(
"Muons")
78 if __name__ ==
"__main__":
80 Here the code should appear that is executed when running the plotter directly
81 (and not import it in another python file via 'import Plotter')