1 import ROOT, os, array, sys, OptimizationUtils, shutil
3 templatefhcfile =
"/lbne/data/users/ljf26/fluxfiles/g4lbne/v3r2p4/QGSP_BERT/Nominal/200kA/flux/histos_g4lbne_v3r2p4_QGSP_BERT_Nominal_200kA_LBNEFD_fastmc.root" 4 templaterhcfile =
"/lbne/data/users/ljf26/fluxfiles/g4lbne/v3r2p4/QGSP_BERT/Nominal/-200kA/flux/histos_g4lbne_v3r2p4_QGSP_BERT_Nominal_-200kA_LBNEFD_fastmc.root" 5 for flux
in [
"fhc_numu",
"fhc_numubar",
"fhc_nue",
"rhc_numu",
"rhc_numubar",
"rhc_nuebar"]:
6 for var
in [
"0",
"50",
"90",
"100",
"110",
"200",
"500",
"1000"]:
8 nu_type = flux.split(
"_")[1]
9 mode = flux.split(
"_")[0]
10 newfile = ROOT.TFile(
"temp/"+mode+
"_"+flux+var+
".root",
"RECREATE")
11 if(flux.startswith(
"fhc")):
12 oldfile = ROOT.TFile(templatefhcfile)
14 oldfile = ROOT.TFile(templaterhcfile)
15 dirList = ROOT.gDirectory.GetListOfKeys()
18 if "flux" in stuff.GetName()
and "osc" not in stuff.GetName():
19 temp = oldfile.Get(stuff.GetName()).Clone()
20 if ((nu_type==
"numu" and stuff.GetName()==
"numu_flux")
or (nu_type==
"numubar" and stuff.GetName()==
"numubar_flux")
or (
"nue" in nu_type
and "nue" in stuff.GetName())):
21 temp.Scale(float(var)/100.0)
25 if(flux.startswith(
"fhc")):
26 newrhcfile =
"temp/rhc_"+flux+var+
".root" 27 shutil.copyfile(templaterhcfile,newrhcfile)
29 newfhcfile =
"temp/fhc_"+flux+var+
".root" 30 shutil.copyfile(templatefhcfile,newfhcfile)