13 def CreateProfile( infile, HistDir, HistName, Var, doAverage = False ):
14 hist = infile.Get(HistDir).
Get(HistName)
19 prof_ave.SetName( hist.GetName().
replace(
'_vs_',
'_ProfMean_vs_' ) )
20 prof_ave.SetTitle( Var +
' Pull vs pt (Mean)' )
21 prof_ave.SetXTitle(
'Transverse Momentum [GeV]' )
22 prof_ave.SetYTitle( Var +
' Pull Mean' )
24 prof_std.SetName( hist.GetName().
replace(
'_vs_',
'_ProfStDev_vs_' ) )
25 prof_std.SetTitle( Var +
' Pull vs pt (StDev)' )
26 prof_std.SetXTitle(
'Transverse Momentum [GeV]' )
27 prof_std.SetYTitle( Var +
' Pull StdDev' )
29 if not infile.Get( HistDir ).WriteTObject( prof_ave, prof_ave.GetName(),
"Overwrite" ):
30 print(
'WARNING Failed to write histogram to file: ' + HistDir +
'/' + prof_ave.GetName() )
31 if not infile.Get( HistDir ).WriteTObject( prof_std, prof_std.GetName(),
"Overwrite" ):
32 print(
'WARNING Failed to write histogram to file: ' + HistDir +
'/' + prof_std.GetName() )
33 del prof_ave, prof_std