Newer
Older
FairShipTools / TP.py
@Ubuntu Ubuntu on 28 May 2015 4 KB status just after the tp
from distribsForHNLandBG_byEvent import *



## non funziona
#from ShipStyle import *
#lhcbstyleSetup()

r.gROOT.ProcessLine(".x newGen/mystyle.C")
r.gROOT.SetBatch(r.kTRUE)

#accPlotsTP('pimu')

if not os.path.exists('accPlotsTP'):
    os.system('mkdir accPlotsTP')

cSaver = {}

# BG stuff
bg_t = studies['nu']['data']
bg_geo = studies['nu']['geo']
bg_ntot = studies['nu']['ntot']
bg_tc = cutsWithDraw()
bg_tc.setNoB('NoB_')
bg_zmin = bg_geo['Veto_5']['z']['pos']+bg_geo['Veto_5']['z']['dim']
bg_zmax = bg_geo['Tr1_1']['z']['pos']-bg_geo['Tr1_1']['z']['dim']

for study in ['pimu', 'mumunu', 'tiny']:
    #r.gROOT.ProcessLine(".x newGen/mystyle.C")
    t = studies[study]['data']
    geo = studies[study]['geo']
    ntot = studies[study]['ntot']
    tc = cutsWithDraw()
    zmin = geo['Veto_5']['z']['pos']+geo['Veto_5']['z']['dim']
    zmax = geo['Tr1_1']['z']['pos']-geo['Tr1_1']['z']['dim']
    # Latest requests... making Hans and Thomas happy :)
    additionalCuts = "&&"+tc.ndf(25)[0]+"&&"+tc.redChi2(5.)[0]#+"&&"+tc.fiducial(zmin, zmax, 245., 495.)[0]+"&&"+tc.doca(2.)[0]#+"&&"+tc.nRecoed(1)[0]
    prefix = 'NoB_'
    # Not vetoed
    ip = plotSigBg(cSaver, study+"-IP0", t, ntot, bg_t, prefix+"IP0", tc.notVetoed(1000.)[0]+additionalCuts, "Impact parameter to target [cm]", (0.27, 0.75, 0.50, 0.92, "Not vetoed"), ("y"))
    iplin = plotSigBg(cSaver, study+"-IP0-lin", t, ntot, bg_t, prefix+"IP0", tc.notVetoed(1000.)[0]+additionalCuts, "Impact parameter to target [cm]", (0.64, 0.75, 0.87, 0.92, "Not vetoed"), ())
    chi2 = plotSigBg(cSaver, study+"-chi2", t, ntot, bg_t, prefix+"MaxDaughtersRedChi2", tc.notVetoed(1000.)[0], "Maximum daughters #chi^{2}/ndf", (0.64, 0.72, 0.87, 0.89, "Not vetoed"), ("y"))
    doca = plotSigBg(cSaver, study+"-doca", t, ntot, bg_t, prefix+"DOCA", tc.notVetoed(1000.)[0]+additionalCuts, "DOCA of daughter tracks [cm]", (0.64, 0.72, 0.87, 0.89, "Not vetoed"), ("y"))
    z = plotSigBg(cSaver, study+"-z", t, ntot, bg_t, prefix+"vtxz", tc.notVetoed(1000.)[0]+additionalCuts, "Reco vertex z position [cm]", (0.165, 0.72, 0.395, 0.89, "Not vetoed"), ("y"))
    ndf = plotSigBg(cSaver, study+"-ndf", t, ntot, bg_t, prefix+"MinDaughtersNdf", tc.notVetoed(1000.)[0], "Minimum daughters ndf", (0.50, 0.74, 0.73, 0.92, "Not vetoed"), ())
    mass = plotSigBg(cSaver, study+"-mass", t, ntot, bg_t, prefix+"Mass", tc.notVetoed(1000.)[0]+additionalCuts, "Candidate mass [GeV]", (0.64, 0.72, 0.87, 0.89, "Not vetoed"), ("y"))
    mass = plotSigBg(cSaver, study+"-mass-no-bg-mass", t, ntot, bg_t, prefix+"Mass", tc.notVetoed(1000.)[0]+additionalCuts, "Candidate mass [GeV]", (0.64, 0.72, 0.87, 0.89, "Not vetoed"), ("y"))
    #mass2 = plotSigBg(cSaver, study+"-mass2", t, ntot, bg_t, prefix+"Mass", tc.notVetoed(1000.)[0]+'&&'+tc.ndf(25)[0]+'&&'+tc.redChi2(5.)[0]+additionalCuts, "Candidate mass [GeV]", (0.57, 0.72, 0.95, 0.89, "Not vetoed, #chi^{2}, ndf"), ("y"))
    # Reconstructed
    ip_all = plotSigBg(cSaver, study+"-IP0-all", t, ntot, bg_t, prefix+"IP0", tc.recoed()[0]+additionalCuts, "Impact parameter to target [cm]", (0.27, 0.75, 0.58, 0.92, "Reconstructed"), ("y"))
    iplin_all = plotSigBg(cSaver, study+"-IP0-lin-all", t, ntot, bg_t, prefix+"IP0", tc.recoed()[0]+additionalCuts, "Impact parameter to target [cm]", (0.64, 0.75, 0.96, 0.92, "Reconstructed"), ())
    chi2_all = plotSigBg(cSaver, study+"-chi2-all", t, ntot, bg_t, prefix+"MaxDaughtersRedChi2", tc.recoed()[0], "Maximum daughters #chi^{2}/ndf", (0.64, 0.72, 0.95, 0.89, "Reconstructed"), ("y"))
    doca_all = plotSigBg(cSaver, study+"-doca-all", t, ntot, bg_t, prefix+"DOCA", tc.recoed()[0]+additionalCuts, "DOCA of daughter tracks [cm]", (0.64, 0.72, 0.95, 0.89, "Reconstructed"), ("y"))
    z_all = plotSigBg(cSaver, study+"-z-all", t, ntot, bg_t, prefix+"vtxz", tc.recoed()[0]+additionalCuts, "Reco vertex z position [cm]", (0.165, 0.72, 0.475, 0.89, "Reconstructed"), ("y"))
    ndf_all = plotSigBg(cSaver, study+"-ndf-all", t, ntot, bg_t, prefix+"MinDaughtersNdf", tc.recoed()[0], "Minimum daughters ndf", (0.43, 0.74, 0.74, 0.92, "Reconstructed"), ())
    mass_all = plotSigBg(cSaver, study+"-mass-all", t, ntot, bg_t, prefix+"Mass", tc.recoed()[0]+additionalCuts, "Candidate mass [GeV]", (0.64, 0.72, 0.95, 0.89, "Reconstructed"), ("y"))
    mass_all = plotSigBg(cSaver, study+"-mass-no-bg-mass-all", t, ntot, bg_t, prefix+"Mass", tc.recoed()[0]+additionalCuts, "Candidate mass [GeV]", (0.64, 0.72, 0.95, 0.89, "Reconstructed"), ("y"))
    #mass2_all = plotSigBg(cSaver, study+"-mass2-all", t, ntot, bg_t, prefix+"Mass", tc.recoed()[0]+'&&'+tc.ndf(25)[0]+'&&'+tc.redChi2(5.)[0]+additionalCuts, "Candidate mass [GeV]", (0.57, 0.72, 0.98, 0.89, "Reconstructed, #chi^{2}, ndf"), ("y"))

for name in cSaver.keys():
    cSaver[name][0].Print("accPlotsTP/"+name+".pdf")
    cSaver[name][0].Print("accPlotsTP/"+name+".png")



#tex = raw_input("\n\nWould you like me to print some latex acceptance tables?\n")
#if (str(tex) == 'yes'):
res = tableWithDraw()
makeTex(res)