diff --git a/scripts/checkTrackSelection.py b/scripts/checkTrackSelection.py index 5bd1eb5..2957306 100644 --- a/scripts/checkTrackSelection.py +++ b/scripts/checkTrackSelection.py @@ -3,7 +3,7 @@ # @Author: Elena Graverini # @Date: 2015-10-27 18:26:49 # @Last Modified by: Elena Graverini -# @Last Modified time: 2017-05-22 14:59:43 +# @Last Modified time: 2017-05-22 15:19:06 import sys import os from math import sqrt @@ -88,7 +88,10 @@ return c -def printSelection(f, t_sig, det, fill, stat, good_steps=True): +csaver = [] + + +def printSelection(f, t_sig, det, fill, stat, good_steps=True, return_all=False): r.gStyle.SetPadLeftMargin(0.20) r.gStyle.SetPadRightMargin(0.25) r.gStyle.SetPadBottomMargin(0.15) @@ -103,7 +106,6 @@ print(t_sig.Draw("GhostP : TrChi2/TrNDoF>>hnoise(100,0., 5,100, 0.,1.)", cut_noise, "goff", stat, 0)) h_noise = r.gDirectory.Get('hnoise') # c = r.TCanvas() - csaver = [] h_s_over_b = s_over_b(h_sig, h_noise) h_s_over_b.GetZaxis().SetRangeUser(0, 10) h_s_over_b.GetZaxis().SetTitle('S/B ratio') @@ -126,7 +128,8 @@ if good_steps: save_name = save_name.replace('.pdf', '_odinStep_lt_12.pdf') csaver[-1].SaveAs(save_name) - h.Delete() + if not return_all: + h.Delete() # h_sig.Divide(h_noise) # h_sig.GetZaxis().SetRangeUser(0, 10) # h_sig.SetTitle('TTaU S/B ratio for fill %s' % fill) @@ -138,9 +141,12 @@ # c, line = putLine(c, det) # c = put_fill(c, fill) # c.SaveAs('%s/%s_fill%s.pdf' % (out_location, det, fill)) - h_sig.Delete() - h_noise.Delete() - return f, t_sig + if not return_all: + h_sig.Delete() + h_noise.Delete() + return f, t_sig + else: + return f, t_sig, [h_s_over_b, h_s_over_sqrtb, h_punzi_significance] def printADC(f, t_sig, det, fill, stat, step): @@ -211,15 +217,24 @@ # f.Close() -if __name__ == '__main__': +def make_all_plots(): for det in dets: for fill in fills: f = r.TFile(location[det] + '%s.root' % fill, 'read') t_sig = f.Get('STADCTrackMonitor/HitInfo/%s' % layer[det]) - f, t_sig = printSelection(f, t_sig, det, fill, stat, good_steps=False) + f, t_sig = printSelection(f, t_sig, det, fill, stat, good_steps=True) if '--steps' in sys.argv: for step in [0, 12, 48, 54, 60]: f, t_sig = printADC(f, t_sig, det, fill, stat, step) f.Close() + + +if __name__ == '__main__': + # make_all_plots() + det = 'TT' + fill = '5448' + f = r.TFile(location[det] + '%s.root' % fill, 'read') + t_sig = f.Get('STADCTrackMonitor/HitInfo/%s' % layer[det]) + f, t_sig, h_list = printSelection(f, t_sig, det, fill, stat, good_steps=True, return_all=True)