diff --git a/scripts/checkTrackSelection.py b/scripts/checkTrackSelection.py index c31daf4..303f05d 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-03 19:08:43 +# @Last Modified time: 2017-05-22 11:33:54 import sys import os from math import sqrt @@ -85,14 +85,19 @@ return c -def printSelection(f, t_sig, det, fill, stat): +def printSelection(f, t_sig, det, fill, stat, good_steps=True): r.gStyle.SetPadLeftMargin(0.20) r.gStyle.SetPadRightMargin(0.25) r.gStyle.SetPadBottomMargin(0.15) r.gStyle.SetPadTopMargin(0.05) - print t_sig.Draw("GhostP : TrChi2/TrNDoF>>hsig(100,0., 5,100, 0.,1.)", "val%s>%s" % (val[det], cut[det]), "goff", stat, 0) + cut_sig = "(val%s>%s)" % (val[det], cut[det]) + cut_noise = "(val%s<%s)" % (val[det], cut[det]) + if good_steps: + cut_sig += ' && (odinStep<12)' + cut_noise += ' && (odinStep<12)' + print(t_sig.Draw("GhostP : TrChi2/TrNDoF>>hsig(100,0., 5,100, 0.,1.)", cut_sig, "goff", stat, 0)) h_sig = r.gDirectory.Get('hsig') - print t_sig.Draw("GhostP : TrChi2/TrNDoF>>hnoise(100,0., 5,100, 0.,1.)", "val%s<%s" % (val[det], cut[det]), "goff", stat, 0) + 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 = [] @@ -114,7 +119,10 @@ csaver[-1].Update() csaver[-1], line = putLine(csaver[-1], det) csaver[-1] = put_fill(csaver[-1], fill) - csaver[-1].SaveAs('%s/%s_%s_fill%s.pdf' % (out_location, det, h.name, fill)) + save_name = '%s/%s_%s_fill%s.pdf' % (out_location, det, h.name, fill) + if good_steps: + save_name.replace('.pdf', '_odinStep_lt_12.pdf') + csaver[-1].SaveAs(save_name) h.Delete() # h_sig.Divide(h_noise) # h_sig.GetZaxis().SetRangeUser(0, 10)