-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_erec_comp.py
More file actions
152 lines (115 loc) · 7.73 KB
/
make_erec_comp.py
File metadata and controls
152 lines (115 loc) · 7.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import ROOT
import os
from ROOT import gStyle, TGaxis, TPad, TLine, gROOT, TH1, TColor, TCanvas, TFile, TH1D, gPad, TLegend, kWhite, gDirectory, gEnv
from glob import glob
from plotting_functions import make_generator_comp
## Use double precision for TTree draw
gEnv.SetValue("Hist.Precision.1D", "double")
## No need to see the plots appear here
gROOT.SetBatch(1)
gStyle.SetLineWidth(3)
gStyle.SetOptStat(0)
gStyle.SetOptTitle(0)
gStyle.SetOptFit(0)
TGaxis.SetMaxDigits(4)
gStyle.SetTextSize(0.05)
gStyle.SetLabelSize(0.05,"xyzt")
gStyle.SetTitleSize(0.05,"xyzt")
gStyle.SetPadTickX(1)
gStyle.SetPadTickY(1)
gStyle.SetNdivisions(505, "XY")
gROOT .ForceStyle()
TH1.SetDefaultSumw2()
gStyle.SetLineWidth(3)
## Sort out the position of the y axis exponent...
TGaxis.SetExponentOffset(-0.06, 0., "y")
def make_T2K_erec_plots(inputDir="inputs/"):
nameList = ["GENIE 10a",\
"CRPA",\
"NEUT",\
"NEUT DCC",\
"NuWro 19",\
"NuWro 25",\
"GiBUU"\
]
colzList = [8000, 8003, 8004, 8005, 8006, 8007, 8001]
lineList = [1, 1, 1, 7, 1, 7, 1]
## QE reco
qe_cut = "cc==1 && Sum$(abs(pdg) > 100 && abs(pdg) < 2000)==0 && Sum$(abs(pdg) > 2300 && abs(pdg) < 100000)==0"
## Special pion < 100 MeV cut
base_qe_cut = "cc==1 && Sum$(abs(pdg) == 111)==0 && Sum$(abs(pdg)>111 && abs(pdg) < 211)==0 && Sum$(abs(pdg)>211 && abs(pdg) < 2000)==0 && Sum$(abs(pdg) > 2300 && abs(pdg) < 100000)==0"
pion_qe_cut = base_qe_cut + "&& Sum$(abs(pdg)==211 && (E - 0.1395703918)>0.100)==0"
## Loop over configs
for det in ["T2KND", "T2KSK_osc"]:
for flux in ["FHC_numu", "RHC_numubar"]:
## Change to Enu_QE to use a binding energy of 27 MeV! Not 34 like the NUISANCE default...
binding = 27/1000.
m1 = 0.93956536
m2 = 0.93827203
ml = 0.10565837
## For antineutrino the nucleons are reversed
if "numubar" in flux:
m2 = 0.93956536
m1 = 0.93827203
mod_enuqe = "(2*("+str(m1)+"-"+str(binding)+")*ELep -"+str(ml)+"*"+str(ml)+" + "+str(m2)+"*"+str(m2)+" - ("+str(m1)+"-"+str(binding)+")*("+str(m1)+"-"+str(binding)+"))/" \
+"(2*(("+str(m1)+"-"+str(binding)+") - ELep + sqrt(ELep*ELep - "+str(ml)+"*"+str(ml)+")*CosLep))"
## These files can be found here (no login required): https://portal.nersc.gov/project/dune/data/2x2/simulation
targ = "H2O"
inFileList = [inputDir+"/"+det+"_"+flux+"_"+targ+"_GENIEv3_G18_10a_00_000_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_GENIEv3_CRPA21_04a_00_000_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NEUT580_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NEUTDCC_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NUWRO_LFGRPA_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NUWROv25.3.1_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_GiBUU_1M_*_NUISFLAT.root"\
]
make_generator_comp("plots/"+det+"_"+flux+"_H2O_EnuQE_gencomp.pdf", inFileList, nameList, colzList, lineList, mod_enuqe, "40,0,2", qe_cut, \
"E_{#nu}^{rec, QE} (GeV); d#sigma/dE_{#nu}^{rec, QE} (#times 10^{-38} cm^{2}/nucleon)")
make_generator_comp("plots/"+det+"_"+flux+"_H2O_EnuQEbias_gencomp.pdf", inFileList, nameList, colzList, lineList, "("+mod_enuqe+" - Enu_true)/Enu_true", "60,-0.9,0.5", qe_cut, \
"(E_{#nu}^{rec, QE} - E_{#nu}^{true})/E_{#nu}^{true}; Arb. norm.", norm="shape", lineStyle="][", legDim=[0.22, 0.5, 0.42, 0.93], yRatLimits=[0,2.2])
make_generator_comp("plots/"+det+"_"+flux+"_H2O_EnuQEabsbias_gencomp.pdf", inFileList, nameList, colzList, lineList, mod_enuqe+" - Enu_true", "60,-0.9,0.5", qe_cut, \
"E_{#nu}^{rec, QE} - E_{#nu}^{true} (GeV); Arb. norm.", norm="shape", lineStyle="][", legDim=[0.22, 0.5, 0.42, 0.93], yRatLimits=[0,2.2])
## Add a pion cut
if det == "T2KSK_osc":
make_generator_comp("plots/"+det+"_"+flux+"_H2O_EnuQEbias_gencomp_pion100MeV.pdf", inFileList, nameList, colzList, lineList, "("+mod_enuqe+" - Enu_true)/Enu_true", "60,-0.9,0.5", pion_qe_cut, \
"(E_{#nu}^{rec, QE} - E_{#nu}^{true})/E_{#nu}^{true}; Arb. norm.", norm="shape", lineStyle="][", legDim=[0.22, 0.5, 0.42, 0.93], yRatLimits=[0,2.2])
make_generator_comp("plots/"+det+"_"+flux+"_H2O_EnuQEabsbias_gencomp_pion100MeV.pdf", inFileList, nameList, colzList, lineList, mod_enuqe+" - Enu_true", "60,-0.9,0.5", pion_qe_cut, \
"E_{#nu}^{rec, QE} - E_{#nu}^{true} (GeV); Arb. norm.", norm="shape", lineStyle="][", legDim=[0.22, 0.5, 0.42, 0.93], yRatLimits=[0,2.2])
def make_DUNE_erec_plots(inputDir="inputs/"):
nameList = ["GENIE 10a",\
"CRPA",\
"NEUT",\
"NEUT DCC",\
"NuWro 19",\
"NuWro 25",\
"GiBUU"\
]
colzList = [8000, 8003, 8004, 8005, 8006, 8007, 8001]
lineList = [1, 1, 1, 7, 1, 7, 1]
## QE reco
ehad_cut = "cc==1"
enuhad = "ELep + Sum$((abs(pdg)==11 || (abs(pdg)>17 && abs(pdg)<2000))*E) + Sum$((abs(pdg)>2300 &&abs(pdg)<10000)*E) + Sum$((abs(pdg)==2212)*(E - sqrt(E*E - px*px - py*py - pz*pz)))"
## Loop over configs
for det in ["DUNEND", "DUNEFD_osc"]:
for flux in ["FHC_numu", "RHC_numubar"]:
## These files can be found here (no login required): https://portal.nersc.gov/project/dune/data/2x2/simulation
targ = "Ar40"
inFileList = [inputDir+"/"+det+"_"+flux+"_"+targ+"_GENIEv3_G18_10a_00_000_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_GENIEv3_CRPA21_04a_00_000_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NEUT580_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NEUTDCC_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NUWRO_LFGRPA_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_NUWROv25.3.1_1M_*_NUISFLAT.root",\
inputDir+"/"+det+"_"+flux+"_"+targ+"_GiBUU_1M_*_NUISFLAT.root"\
]
make_generator_comp("plots/"+det+"_"+flux+"_Ar40_Enurec_gencomp.pdf", inFileList, nameList, colzList, lineList, enuhad, "80,0,8", ehad_cut, \
"E_{#nu}^{rec, had} (GeV); d#sigma/dE_{#nu}^{rec, had} (#times 10^{-38} cm^{2}/nucleon)")
make_generator_comp("plots/"+det+"_"+flux+"_Ar40_Enurecbias_gencomp.pdf", inFileList, nameList, colzList, lineList, "("+enuhad+" - Enu_true)/Enu_true", "60,-0.5,0.1", ehad_cut, \
"(E_{#nu}^{rec, had} - E_{#nu}^{true})/E_{#nu}^{true}; Arb. norm.", [0.25, 0.5, 0.45, 0.93], yRatLimits=[0,2.2], norm="shape", lineStyle="][")
make_generator_comp("plots/"+det+"_"+flux+"_Ar40_Enurecabsbias_gencomp.pdf", inFileList, nameList, colzList, lineList, enuhad+" - Enu_true", "60,-0.5,0.1", ehad_cut, \
"E_{#nu}^{rec, had} - E_{#nu}^{true} (GeV); Arb. norm.", [0.25, 0.5, 0.45, 0.93], yRatLimits=[0,2.2], norm="shape", lineStyle="][")
if __name__ == "__main__":
inputDir="/pscratch/sd/c/cwilk/MC_IOP_review/*/"
# inputDir="/global/cfs/cdirs/dune/users/cwilk/MC_IOP_review/*/"
make_T2K_erec_plots(inputDir)
make_DUNE_erec_plots(inputDir)