import ROOT,os, sys pandapath=os.environ.get('PANDAPATH') sys.path.append(pandapath+'/macro/tpc/FOPI/python/argparse-1.2.1') sys.path.append(pandapath+'/macro/tpc/FOPI/mberger') import argparse from functions import * parser=argparse.ArgumentParser(description="plot the dEdx") parser.add_argument("infile",help='the reco file',type=str) args=parser.parse_args() print sys.argv[0], "called with these args" for arg, value in vars(args).items(): print arg,": ", value ROOT.gROOT.ProcessLine(".x rootlogon.C") rfile=ROOT.TFile(args.infile,"r") tree=rfile.Get("cbmsim") tree.SetBranchStatus("*",1) tree.SetBranchStatus("dEdx",1) tree.SetBranchStatus("FopiTrackPostFit",1) counter=-1 good=0 for e in tree: for tr in e.FopiTrackPostFit: counter+=1 #print "mom",tr.getMom() #print "nreps",tr.getNumReps() #print "cardrepid",tr.getCardinalRepID() #print "trackrep",tr.getTrackRep(0) print "statflag",tr.getTrackRep(0).getStatusFlag() if tr.getTrackRep(0).getStatusFlag()==0: good+=1 #print "stat flag:",tr.getCardinalRep()#.getStatusFlag() for tr in e.dEdx: print "num dE:",tr.nEntries() for i in range(tr.nEntries()): print tr.getdE(i),tr.getdx(i) print "tracks: {0}, good: {1}".format(counter,good)