35 if len( args ) > 1:
36 filename = args[1]
37 else:
38 print(
'Usage: python {0} filename'.format( args[0] ) )
39 return
40
41 if not os.path.exists( filename ):
42 print ( 'File not found: ' + filename )
43 return
44
45 infile = ROOT.TFile.Open( filename, 'update' )
46
47 MuonTypes = [ 'All', 'Prompt', 'InFlight', 'NonIsolated' ]
48 PullTypes = [ '', 'ID', 'MS' ]
49 Variables = [ 'phi', 'theta', 'qOverP', 'd0', 'z0' ]
50
51 for MuonType in MuonTypes:
52 if not infile.Get( 'Muons/' + MuonType ):
53 print(
'INFO TDirectory not found: Muons/' + MuonType )
54 continue
55 AuthDir = infile.Get( 'Muons/{0}/matched'.format( MuonType ) )
56 Authors = [ i.GetName() for i in AuthDir.GetListOfKeys() if AuthDir.Get( i.GetName() ).InheritsFrom( 'TDirectory' ) ]
57 for Author in Authors:
58 DirName = 'Muons/{0}/matched/{1}/Pulls'.format( MuonType, Author )
59 Dir = infile.Get( DirName )
60 if not Dir:
61 print(
'INFO TDirectory not found: ' + DirName )
62 continue
63 for PullType, var in itertools.product( PullTypes, Variables ):
64 HistName = '_'.join( DirName.split('/') ) + '_Pull{0}_'.format(PullType) + var
65 if not Dir.Get( HistName ):
66 print(
'INFO Histogram not found: ' + HistName )
67 continue
68 AddGaussian( infile, DirName, HistName )
69 infile.Close()
70
71
72