import ROOT, argparse, operator, numpy, math, sys sys.path.append('$PANDAPATH/macro/tpc/FOPI/mberger') from functions import * parser=argparse.ArgumentParser(description='Plot stuff along a track') parser.add_argument('filename',help='filename of the reco file',type=str) parser.add_argument('--rootfilename', help='name of the root file', type=str, default="not") parser.add_argument('--cut', help='Real Data?', type=str, default="not") #parser.add_argument('--doallmode',help='if you want to do more', type=str) parser.add_argument("--nEvts",help='number of events to analyze',default=-1,type=int) parser.add_argument('--zcut',help='zcut',type=int,default=-80) parser.add_argument('--pdir',help='the picture print directory',type=str,default="not") parser.add_argument('--step', help='step1 oder sqrt', 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+") rfile=ROOT.TFile.Open(args.filename,"read") if rfile.IsOpen()==ROOT.kTRUE: tree = rfile.Get("cbmsim") if tree==None: print "No cbmsim found" if type(Rfile)==ROOT.TFile: Rfile.Close() exit() #Histogramms #{ Slices = [ -48.0, -36.0, -24.0, -12.0, 0.0, 20.0] resbins = 40 htrkl1 = ROOT.TH1D("htrkl", "left - 1st sector", resbins,0,resbins) htrkr1 = ROOT.TH1D("htrkr", "right - 1st sector", resbins,0,resbins) hclsl1 = ROOT.TH1D("hclsl", "Clustercount - left - 1st sector", resbins,0,resbins) hclsr1 = ROOT.TH1D("hclsr", "Clustercount - right - 1st sector", resbins,0,resbins) htrk1 = ROOT.TH1D("htrkr", "1st sector", resbins,0,resbins) hcls1 = ROOT.TH1D("hclsl", "Clustercount-1st sector", resbins,0,resbins) htrkl2 = ROOT.TH1D("htrkl", "left - 2nd sector", resbins,0,resbins) htrkr2 = ROOT.TH1D("htrkr", "right - 2nd sector", resbins,0,resbins) hclsl2 = ROOT.TH1D("hclsl", "Clustercount - left - 2nd sector", resbins,0,resbins) hclsr2 = ROOT.TH1D("hclsr", "Clustercount - right - 2nd sector", resbins,0,resbins) htrk2 = ROOT.TH1D("htrkr", "2nd sector", resbins,0,resbins) hcls2 = ROOT.TH1D("hclsl", "Clustercount-2nd sector", resbins,0,resbins) htrkl3 = ROOT.TH1D("htrkl", "left - 3rd sector", resbins,0,resbins) htrkr3 = ROOT.TH1D("htrkr", "right - 3rd sector", resbins,0,resbins) hclsl3 = ROOT.TH1D("hclsl", "Clustercount - left - 3rd sector", resbins,0,resbins) hclsr3 = ROOT.TH1D("hclsr", "Clustercount - right - 3rd sector", resbins,0,resbins) htrk3 = ROOT.TH1D("htrkr", "3rd sector", resbins,0,resbins) hcls3 = ROOT.TH1D("hclsl", "Clustercount-3rd sector", resbins,0,resbins) htrkl4 = ROOT.TH1D("htrkl", "left - 4th sector", resbins,0,resbins) htrkr4 = ROOT.TH1D("htrkr", "right - 4th sector", resbins,0,resbins) hclsl4 = ROOT.TH1D("hclsl", "Clustercount - left - 4th sector", resbins,0,resbins) hclsr4 = ROOT.TH1D("hclsr", "Clustercount - right - 4th sector", resbins,0,resbins) htrk4 = ROOT.TH1D("htrkr", "4th sector", resbins,0,resbins) hcls4 = ROOT.TH1D("hclsl", "Clustercount-4th sector", resbins,0,resbins) htrkl5 = ROOT.TH1D("htrkl", "left - 5th sector", resbins,0,resbins) htrkr5 = ROOT.TH1D("htrkr", "right - 5th sector", resbins,0,resbins) hclsl5 = ROOT.TH1D("hclsl", "Clustercount - left - 5th sector", resbins,0,resbins) hclsr5 = ROOT.TH1D("hclsr", "Clustercount - right - 5th sector", resbins,0,resbins) htrk5 = ROOT.TH1D("htrkr", "5th sector", resbins,0,resbins) hcls5 = ROOT.TH1D("hclsl", "Clustercount-5th sector", resbins,0,resbins) htrkl6 = ROOT.TH1D("htrkl", "left - 6th sector", resbins,0,resbins) htrkr6 = ROOT.TH1D("htrkr", "right - 6th sector", resbins,0,resbins) hclsl6 = ROOT.TH1D("hclsl", "Clustercount - left - 6th sector", resbins,0,resbins) hclsr6 = ROOT.TH1D("hclsr", "Clustercount - right - 6th sector", resbins,0,resbins) htrk6 = ROOT.TH1D("htrkr", "6th sector", resbins,0,resbins) hcls6 = ROOT.TH1D("hclsl", "Clustercount-6th sector", resbins,0,resbins) bins = 60 clbins = 15 hclpos1 = ROOT.TH2D("hclpos1", "Clusterpos xy - right", 60,-15,15,60,-15,15) hclpos2 = ROOT.TH2D("hclpos2", "Clusterpos xy - left", 60,-15,15,60,-15,15) c1 = ROOT.TCanvas("c1", "Plot 1", 1000,700) c2 = ROOT.TCanvas("c2", "Plot 2", 1000,700) c3 = ROOT.TCanvas("c3", "Plot 3", 1000,700) c4 = ROOT.TCanvas("c4", "Plot 4", 700,1000) c1.Divide(3,2) c2.Divide(3,2) c3.Divide(3,2) c4.Divide(1,2) #} #cloose divide #{ if args.step=="sqrt": div1=0.87 div2=0.83 div3=0.77 div4=0.74 div5=0.72 div6=0.70 if args.step=="step1": div1=1.08 div2=1.08 div3=1.08 div4=1.08 div5=1.08 div6=1.08 #} #Loop over tree #{ tree.SetBranchStatus("*", 0) #tree.SetBranchStatus(args.branch+".*",1) tree.SetBranchStatus("CutCosmics.*",1) trackbranch=ROOT.TBranch() evt=-1 done=0 olddone=0 if args.nEvts==-1: todoev=tree.GetEntriesFast() else: todoev=args.nEvts for e in tree: evt+=1 if args.nEvts!=-1 and args.nEvtsdiv6: hclpos1.Fill(cl_X[cl],cl_Y[cl]) if cpc