import sys, os sys.path.append('/home/vwalbr/fopiroot/fopiroot_dev/macro/tpc/FOPI/vwalbre') import ROOT,glob,math,argparse from anaFile import anaFile from functions import * parser=argparse.ArgumentParser(description="plot the length") parser.add_argument('path',help='path to the anafiles',type=str) args=parser.parse_args() ROOT.gROOT.ProcessLine(".x rootlogon.C") #ROOT.gROOT.ProcessLine('gStyle->SetPalette(1)') set_palette() ROOT.gROOT.ProcessLine('gROOT->SetStyle("Plain")') c1=ROOT.TCanvas("c1","Length") FileList = os.listdir(args.path) FileList.sort() name=[] anafiles=[] for i in FileList: Anafile=args.path+i anafiles.append(Anafile) name.append(i) TrackLength=[] rfiles=[] for ifile in range(len(anafiles)): rfiles.append(anaFile(anafiles[ifile])) TrackLength.append(rfiles[-1].getHist("htracklen1")) leg1 = ROOT.TLegend(0.6,0.7,0.90,0.9) count=0 for hist in TrackLength: ROOT.gStyle.SetOptStat(0) c1.cd() hist.SetLineColor(count+1) #hist.SetFillColor(count+1) #hist.SetFillStyle(3003) leg1.AddEntry(hist,name[count][-14:],"f") hist.GetXaxis().SetRangeUser(0.,40.) hist.GetYaxis().SetRangeUser(0.,450) if count==0: hist.Draw() else: hist.Draw("SAME") count+=1 leg1.Draw("SAME") c1.Update() u=raw_input("Done?")