snoutStudy.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 #Draw
7 canvas = ROOT.TCanvas("canvas","canvas");
8 
9 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");
10 
11 tree = f_1.Get("dk2nuTree");
12 
13 tree.Print()
14 
15 ROOT.gStyle.SetOptStat(0)
16 
17 myhist = ROOT.TH1D("","myhist",20,0,10);
18 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]");
19 #/(ancestor.startpx*ancestor.startpx+ancestor.startpy*ancestor.startpy+ancestory.startpz*ancestor.startpz))","decay.nimpwt*nuray.wgt[1]");
20 
21 myhist.GetXaxis().SetTitle("Angle WRT Beam Axis (Degrees)")
22 myhist.GetYaxis().SetTitle("Number of Particles / 0.5 Degree")
23 
24 myhist.Draw()
25 
26 myhist2 = ROOT.TH2D("myhist2","",500,-1000,1000,500,-1000,1000);
27 #tree.Draw("ancestor.starty:ancestor.startx","decay.nimpwt*nuray.wgt[1]*ancestor.startz<20");
28 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")
29 
30 myhist2.GetXaxis().SetTitle("X position (cm) at z = 21 cm")
31 myhist2.GetYaxis().SetTitle("Y position (cm) at z = 21 cm")
32 
33 myhist2.Draw("colz")
34 
35 
36 myhist3 = ROOT.TH1D("myhist3","",50,-100,100);
37 tree.Draw("ancestor.startx+(2100-ancestor.startz)*ancestor.startpx/ancestor.startpz>>myhist3","decay.nimpwt*nuray.wgt[1]*ancestor.startz<21000")
38 
39 myhist3.GetXaxis().SetTitle("X position (cm) at z = 21 cm")
40 
41 canvas.Print("test.eps");
42 canvas.Print("test.png");