import ROOT, argparse, operator, numpy, os.path import copy parser=argparse.ArgumentParser(description='Plot stuff along a track') parser.add_argument('--file',help='the recofile with cluster tree and digi and sample persistence',type=str) parser.add_argument('--pdir',help='the picture print directory',type=str,default="not") parser.add_argument('--filename', help='name of the file', type=str, default="not") args=parser.parse_args() ROOT.gROOT.ProcessLine(".x rootlogon.C") ROOT.gROOT.ProcessLine('gSystem->Load("libPhysics")') ROOT.gROOT.ProcessLine('gStyle->SetPalette(1)') ROOT.gROOT.ProcessLine('gROOT->SetStyle("Plain")') ROOT.gROOT.ProcessLine('gSystem->Load("libGeom")') ROOT.gROOT.LoadMacro("stlPYROOT.h+") hfactor=ROOT.TH1D("hfactor", "product", 446,110,556) htrackspl=ROOT.TH1D("htrackspl", "tracksplitting-code", 446,110,556) hcomple=ROOT.TH1D("hcomple", "completeness-code", 446,110,556) hpurity=ROOT.TH1D("hpurity", "purity", 446,110,556) hfactor_b=ROOT.TH1D("hfactor_b", "product", 240,310,550) htrackspl_b=ROOT.TH1D("htrackspl_b", "tracksplitting-code", 240 ,310,550) hcomple_b=ROOT.TH1D("hcomple_b", "completeness-code", 240 ,310,550) hpurity_b=ROOT.TH1D("hpurity_b", "detailed comparison", 240 ,310,550) c1 = ROOT.TCanvas("c1", "Plot1", 1000,700) c2 = ROOT.TCanvas("c2", "Plot2", 1000,700) c3 = ROOT.TCanvas("c3", "Plot3", 1000,700) c4 = ROOT.TCanvas("c4", "Plot4", 1000,700) c5 = ROOT.TCanvas("c5", "Plot5", 1000,700) proxc=1.0 proxZs=1.2 helixc=0.2 trk_min=999 com_min=999 pur_min=999 fac_min=999 code_proxc=1 code_proxZs=1 code_helixc=1 while proxc < 3.5: while proxZs < 2.0: while helixc < 1.2: #Filename name="clus_"+str(proxc)+"_"+str(proxZs)+"_"+str(helixc)+".txt" filename=args.file+name code=100*code_proxc+10*code_proxZs+code_helixc print code #Open and read file if os.path.isfile(filename) == True: Infile=open(filename,"read") data=[] for i in Infile: data.append(float(i)) Infile.close() #Histogramms tracksplitting=data[0] completeness=data[1] purity=data[2] factor=tracksplitting*completeness*purity hfactor.Fill(code,factor) htrackspl.Fill(code,tracksplitting) hcomple.Fill(code,completeness) hpurity.Fill(code,purity) if code==423 or code==424 or code==425 or code==433 or code==434 or code==435 or code==523 or code==524 or code==525 or code==533 or code==534 or code==535: hfactor_b.Fill(code,factor) htrackspl_b.Fill(code,tracksplitting) hcomple_b.Fill(code,completeness) hpurity_b.Fill(code,purity) if tracksplitting < trk_min: trk_min = tracksplitting if completeness < com_min: com_min=completeness if purity < pur_min: pur_min=purity if factor < fac_min: fac_min=factor helixc += 0.2 code_helixc+=1 proxZs += 0.2 code_proxZs+=1 helixc=0.2 code_helixc=1 proxZs=1.2 code_proxZs=1 proxc+=0.5 code_proxc+=1 hfactor.GetYaxis().SetRangeUser(0.9*fac_min, 1.0) htrackspl.GetYaxis().SetRangeUser(0.9*trk_min, 1.0) hcomple.GetYaxis().SetRangeUser(0.9*com_min, 1.0) hpurity.GetYaxis().SetRangeUser(0.9*pur_min, 1.0) c1.cd() hfactor.Draw() c1.Update() c2.cd() htrackspl.Draw() c2.Update() c3.cd() hcomple.Draw() c3.Update() c4.cd() hpurity.Draw() c4.Update() hfactor_b.SetFillColor(2) htrackspl_b.SetFillColor(3) hcomple_b.SetFillColor(4) hpurity_b.SetFillColor(5) hfactor_b.SetFillStyle(3003) htrackspl_b.SetFillStyle(3003) hcomple_b.SetFillStyle(3003) hpurity_b.SetFillStyle(3003) leg = ROOT.TLegend(0.6,0.7,0.90,0.9) leg.AddEntry(hfactor_b,"factor","f") leg.AddEntry(htrackspl_b,"tracksplitting","f") leg.AddEntry(hcomple_b,"completeness","f") leg.AddEntry(hpurity_b,"purity","f") c5.cd() hpurity_b.Draw() #hfactor.Draw("SAME") hcomple_b.Draw("SAME") htrackspl_b.Draw("SAME") #hpurity.Draw("SAME") hfactor_b.Draw("SAME") leg.Draw("SAME") c5.Update() if args.pdir!="not": c1.SaveAs(args.pdir+"factor.eps") c2.SaveAs(args.pdir+"tracksplitting.eps") c3.SaveAs(args.pdir+"completeness.eps") c4.SaveAs(args.pdir+"purity.eps") u = raw_input() if u == "q": exit()