5 fluxpaths = [
"/lbne/data/users/kirby/g4lbne_output/test2_300k_B_011.root",
"/lbne/data/users/ljf26/fluxfiles/g4lbne/v3r2p4/QGSP_BERT/Nominal/200kA/flux/"]
9 for i
in range(0,len(fluxpaths)):
11 if os.path.isdir(fluxpaths[i]):
12 print "The path you specified ("+fluxpaths[i]+
") appears to be a directory... looking for flux files in that directory." 14 for root,dirs,files
in os.walk(fluxpaths[i]):
16 temppath = os.path.join(root,file)
18 if file.startswith(
"g4lbne_")
and file.endswith(
".root"):
19 fluxfiles[i].append(temppath)
20 print "Found ",len(fluxfiles[i]),
" flux files to consider" 22 print "Drawing fluxes from file:",fluxpaths[i]
23 fluxfiles[i].append(fluxpaths[i])
28 fluxchains.append(ROOT.TChain(
"nudata"))
29 for file
in fluxfiles[i]:
30 fluxchains[i].Add(file)
32 vars_to_draw1 = [
"beamX",
"beamY",
"protonX",
"protonY",
"protonPx",
"protonPy",
"protonPz",
"nuTarZ",
"hornCurrent",
"Ndxdz",
"Ndydz",
"Npz",
"Nenergy",
"NdxdzNear[0]",
"NdydzNear[0]",
"NenergyN[0]",
"NWtNear[0]",
"NdxdzFar[0]",
"NdydzFar[0]",
"NenergyF[0]",
"NWtFar[0]",
"Norig",
"Ndecay",
"Ntype",
"Vx",
"Vy",
"Vz",
"ppdxdz",
"ppdydz",
"pppz",
"ppenergy",
"ptype",
"ppvx",
"ppvy",
"ppvz",
"muparpx",
"muparpy",
"muparpz",
"Necm",
"Nimpwt",
"tvx",
"tvy",
"tvz",
"tpx",
"tpy",
"tpz",
"tptype",
"tgen"]
33 vars_to_draw2 = [
"beamX",
"beamY",
"protonX",
"protonY",
"protonPx",
"protonPy",
"protonPz",
"nuTarZ",
"hornCurrent",
"Ndxdz",
"Ndydz",
"Npz",
"Nenergy",
"NdxdzNear[0]",
"NdydzNear[0]",
"NenergyN[0]",
"NWtNear[0]",
"NdxdzFar[0]",
"NdydzFar[0]",
"NenergyF[0]",
"NWtFar[0]",
"Norig",
"Ndecay",
"Ntype",
"Vx",
"Vy",
"Vz",
"ppdxdz",
"ppdydz",
"pppz",
"ppenergy",
"ptype",
"ppvx",
"ppvy",
"ppvz",
"muparpx",
"muparpy",
"muparpz",
"Necm",
"Nimpwt",
"tvx",
"tvy",
"tvz",
"tpx",
"tpy",
"tpz",
"tptype",
"tgen"]
36 canv = ROOT.TCanvas(
"canvas",
"canvas")
39 for i
in range(0,len(vars_to_draw1)):
40 fluxchains[0].Draw(vars_to_draw1[i]+
">>"+vars_to_draw1[i]+
"_1");
41 hists1.append(ROOT.gDirectory.Get(vars_to_draw1[i]+
"_1"))
42 hists2.append(hists1[i].Clone(vars_to_draw2[i]+
"_2"))
43 fluxchains[1].Draw(vars_to_draw1[i]+
">>"+vars_to_draw2[i]+
"_2");
45 hists2[i].
Scale(3.0/190.0);
47 hists1[i].SetLineColor(4)
48 hists1[i].SetLineWidth(2)
50 hists2[i].SetLineColor(2);
51 hists2[i].Draw(
"SAME")
53 canv.Print(
"plots/"+vars_to_draw1[i]+
".eps")
54 canv.Print(
"plots/"+vars_to_draw2[i]+
".png")
56 os.system(
"mkdir ~/public_html/temp/ntuple_comps/")
57 os.system(
"cp plots/*.png ~/public_html/temp/ntuple_comps/")
58 os.system(
"cp dirindex.sh ~/public_html/temp/ntuple_comps/")
59 os.system(
"chmod u+x ~/public_html/temp/ntuple_comps/dirindex.sh")
60 os.system(
"cd plots/; ~/public_html/temp/ntuple_comps/dirindex.sh | tee ~/public_html/temp/ntuple_comps/index.html")
63 canv = ROOT.TCanvas("NeutrinoTheta","NeutrinoTheta") 65 H_NeutrinoTheta = ROOT.TH1F("H_NeutrinoTheta","H_NeutrinoTheta",100,0,0.5); 66 FluxChain.Draw("360.0/(2*TMath::Pi())*TMath::ACos(TMath::Sqrt(1/(1+pow(NdxdzNear[0],2)+pow(NdydzNear[0],2))))>>H_NeutrinoTheta","Nimpwt*NWtNear[0]") 67 #FluxChain.Draw("Nimpwt"); 69 canv.Print("NeutrinoTheta.png"); 70 canv..Print("NeutrinoTheta.eps"); 73 H_NeutrinoDxdz = ROOT.TH1F("H_NeutrinoDxdz","H_NeutrinoDxdz",200,-0.03,0.03); 74 FluxChain.Draw("NdxdzNear[0]>>H_NeutrinoDxdz","Nimpwt*NWtNear[0]") 76 canv.Print("NeutrinoDxdz.png"); 77 canv.Print("NeutrinoDxdz.eps"); 80 H_NeutrinoDydz = ROOT.TH1F("H_NeutrinoDyDz","H_NeutrinoDyDz",200,-0.03,0.03); 81 FluxChain.Draw("NdydzNear[0]>>H_NeutrinoDxdz","Nimpwt*NWtNear[0]") 83 canv.Print("NeutrinoDydz.png"); 84 canv.Print("NeutrinoDydz.eps"); 87 H_NeutrinoEnergy = ROOT.TH1F("H_NeutrinoEnergy","H_NeutrinoEnergy",100,0,20); 88 FluxChain.Draw("NenergyN[0]>>H_NeutrinoEnergy","Nimpwt*NWtNear[0]") 89 H_NeutrinoEnergy.Draw(); 91 canv.Print("NeutrinoEnergy.png"); 92 canv.Print("NeutrinoEnergy.eps"); Scale(size_t pos, T factor) -> Scale< T >