simpleFluxPlot.py
Go to the documentation of this file.
1 import ROOT, sys, os
2 
3 
4 ##### PARSE INPUT ARGUMENT #####
5 
6 if not len(sys.argv) > 1:
7  print "Please specify a flux file or directory path"
8  sys.exit()
9 
10 fluxpath = sys.argv[1]
11 
12 
13 
14 ##### MAKE VECTOR OF FLUX FILES ####
15 
16 fluxfiles = []
17 if os.path.isdir(fluxpath):
18  print "The path you specified ("+fluxpath+") appears to be a directory... looking for flux files in that directory."
19 
20  for root,dirs,files in os.walk(fluxpath):
21  for file in files:
22  temppath = os.path.join(root,file)
23 
24  if file.startswith("g4lbne_") and file.endswith(".root"):
25  fluxfiles.append(temppath)
26  print "Found ",len(fluxfiles)," flux files to consider"
27 else:
28  print "Drawing fluxes from file:",fluxpath
29  fluxfiles.append(fluxpath)
30 
31 
32 ##### CREATE A CHAIN OF FLUX NTUPLES #####
33 
34 FluxChain = ROOT.TChain("nudata")
35 for file in fluxfiles:
36  FluxChain.Add(file)
37 
38 
39 canv = ROOT.TCanvas("NeutrinoEnergyFar","NeutrinoEnergyFar")
40 canv.cd()
41 H_NeutrinoEnergyFar = ROOT.TH1F("H_NeutrinoEnergyFar","H_NeutrinoEnergyFar",40,0,20);
42 FluxChain.Draw("NenergyF[0]>>H_NeutrinoEnergyFar","Nimpwt/3.1415*NWtFar[0]")
43 #FluxChain.Draw("Nimpwt");
44 
45 canv.Print("NeutrinoEnergyFar.png");
46 canv.Print("NeutrinoEnergyFar.eps");