snoutStudy2.py
Go to the documentation of this file.
1 import ROOT,sys
2 from array import array
3 
4 ROOT.TGaxis.SetMaxDigits(3)
5 
6 
7 #Draw
8 canvas = ROOT.TCanvas("canvas","canvas");
9 
10 f_1 = ROOT.TFile("/pnfs/dune/persistent/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017/neutrino/flux/dk2nu/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_neutrino_00250.dk2nu.root");
11 
12 tree = f_1.Get("dk2nuTree");
13 #tree.SetBranchStatus("*",0)
14 #tree.SetBranchStatus("ancestor",1)
15 
16 for event in tree:
17  print len(event.ancestor)
18 
19 """
20 
21 
22 tree.Print()
23 
24 ROOT.gStyle.SetOptStat(0)
25 
26 myhist = ROOT.TH1D("","myhist",20,0,10);
27 tree.Draw("360/(2*pi)*acos(ancestor.startpz[1]/sqrt(ancestor.startpx[1]*ancestor.startpx[1]+ancestor.startpy[1]*ancestor[1].startpy[1]+ancestor.startpz[1]*ancestor.startpz[1]))>>myhist","decay.nimpwt*nuray.wgt[1]");
28 #/(ancestor.startpx*ancestor.startpx+ancestor.startpy*ancestor.startpy+ancestory.startpz*ancestor.startpz))","decay.nimpwt*nuray.wgt[1]");
29 
30 myhist.GetXaxis().SetTitle("Angle WRT Beam Axis (Degrees)")
31 myhist.GetYaxis().SetTitle("Number of Particles / 0.5 Degree")
32 
33 myhist.Draw()
34 
35 myhist2 = ROOT.TH2D("myhist2","",500,-1000,1000,500,-1000,1000);
36 #tree.Draw("ancestor.starty:ancestor.startx","decay.nimpwt*nuray.wgt[1]*ancestor.startz<20");
37 tree.Draw("ancestor.startx+(2100-ancestor.startz)*ancestor.startpx/ancestor.startpz:ancestor.starty+(2100-ancestor.startz)*ancestor.startpy/ancestor.startpz>>myhist2","decay.nimpwt*nuray.wgt[1]*ancestor.startz<2100")
38 
39 myhist2.GetXaxis().SetTitle("X position (cm) at z = 21 cm")
40 myhist2.GetYaxis().SetTitle("Y position (cm) at z = 21 cm")
41 
42 myhist2.Draw("colz")
43 
44 
45 myhist3 = ROOT.TH1D("myhist3","",50,-100,100);
46 tree.Draw("ancestor.startx+(2100-ancestor.startz)*ancestor.startpx/ancestor.startpz>>myhist3","decay.nimpwt*nuray.wgt[1]*ancestor.startz<21000")
47 
48 myhist3.GetXaxis().SetTitle("X position (cm) at z = 21 cm")
49 
50 canvas.Print("test.eps");
51 canvas.Print("test.png");
52 
53 
54 """