Commit 034793ceb01ce6fa8e99d077565ed6054d09ca7c

Authored by Noel Dawe
1 parent 116a8618

include mean and RMS in plots

Showing 1 changed file with 12 additions and 2 deletions   Show diff stats
scripts/ftkplot
... ... @@ -233,15 +233,25 @@ def plot(filename):
233 233 for axis in "xy":
234 234 hist_pix = Hist(100, -1, 1)
235 235 diff = arr_ftk_flat['ftk_refit_track_loc{0}_pix_l{1}'.format(axis, layer)] - arr_ftk_flat['ftk_track_loc{0}_pix_l{1}'.format(axis, layer)]
  236 + diff = diff[~np.isnan(diff)]
  237 + # get stats
  238 + # quote means within 3*RMS of distribution
  239 + mean = np.mean(diff)
  240 + dev = np.std(diff[(diff < 10) & (diff > -10)])
  241 + mean = np.mean(diff[(diff < (mean + 3 * dev)) & (diff > (mean - 3 * dev))])
236 242 fill_hist(hist_pix, diff)
237 243 canvas = Canvas()
238 244 draw(hist_pix, xtitle="\Delta local{0} \;\;\; Pixel \; Layer \; {1} \;\;\; (Refit - Raw) \;\;\; [mm]".format(axis.upper(), layer), ytitle="FTK Tracks")
  245 + stats = ROOT.TLatex(0.2, 0.8, "#splitline{{mean = {0:.4f}}}{{RMS = {1:.4f}}}".format(mean, dev))
  246 + stats.SetNDC()
  247 + stats.Draw()
239 248 canvas.SaveAs("pixel_layer_{0}_local{1}_refit_v_raw.png".format(layer, axis.upper()))
240 249  
241 250 ###############################################################
242 251 # Plot all track parameters (truth, offline, raw and refit FTK)
243 252 # WARNING: This can be memory intensive!
244   -
  253 +
  254 + """
245 255 # Truth track parameters
246 256 tree = root_open(filename)['tracks']
247 257 truth_branches = [b for b in tree.branchnames if b.startswith('truth_')]
... ... @@ -263,7 +273,7 @@ def plot(filename):
263 273 fig = plot_variable_grid(ftk_arr)
264 274 fig.savefig('params_ftk.png')
265 275 del ftk_arr
266   -
  276 + """
267 277  
268 278 if __name__ == '__main__':
269 279 from argparse import ArgumentParser
... ...