1 #include "CAFAna/Core/Binning.h" 5 #include "CAFAna/Core/Var.h" 77 {
"periph_presel", kNue2020PeripheralPresel_MRBrem},
80 {
"periph_preselbdt", kNue2020PeripheralPresel_MRBrem &&
kCosPIDPeriBDT > 0.57},
81 {
"periph_preselcvn", kNue2020PeripheralPresel_MRBrem &&
kCVNe_looseptp >= 0.97},
82 {
"periph_preselen", kNue2020PeripheralPresel_MRBrem &&
kShwE > 1},
90 for(
int selIdx = 0; selIdx <
kNumSels; ++selIdx){
91 const char* selName = sels[selIdx].
name.c_str();
92 for (
int varIdx=0; varIdx<
kNumVars;varIdx++){
93 const char* varName = defs[varIdx].
name.c_str();
101 double pot = spec_genie_fd[0][0]->
POT();
107 for (
int selIdx = 0; selIdx <
kNumSels; ++selIdx){
108 for (
int varIdx=0; varIdx<
kNumVars;varIdx++){
109 hspec_mrbrem_data[selIdx][varIdx] = spec_mrbrem_data[selIdx][varIdx]->
ToTH1(livetime,
kLivetime);
110 hspec_mrbrem_cry[selIdx][varIdx] = spec_mrbrem_cry[selIdx][varIdx]->
ToTH1(livetime,
kLivetime);
111 hspec_genie_fd[selIdx][varIdx] = spec_genie_fd[selIdx][varIdx]->
ToTH1(pot);
115 TH1D* hgenie_core_presel = (TH1D*)hspec_genie_fd[0][0]->
Clone();
116 TH1D* hgenie_peri_presel = (TH1D*)hspec_genie_fd[1][0]->
Clone();
117 TH1D* hgenie_peri_preselbdt = (TH1D*)hspec_genie_fd[4][0]->
Clone();
118 TH1D* hgenie_peri_preselcvn = (TH1D*)hspec_genie_fd[5][0]->
Clone();
119 TH1D* hgenie_peri_preselen = (TH1D*)hspec_genie_fd[6][0]->
Clone();
120 TH1D* hgenie_core_presel_data = (TH1D*)hspec_genie_fd[0][0]->
Clone();
121 TH1D* hgenie_peri_presel_data = (TH1D*)hspec_genie_fd[1][0]->
Clone();
122 TH1D* hgenie_peri_preselbdt_data = (TH1D*)hspec_genie_fd[4][0]->
Clone();
123 TH1D* hgenie_peri_preselcvn_data = (TH1D*)hspec_genie_fd[5][0]->
Clone();
124 TH1D* hgenie_peri_preselen_data = (TH1D*)hspec_genie_fd[6][0]->
Clone();
126 hgenie_core_presel->Scale(hspec_mrbrem_cry[0][0]->
Integral()/hspec_genie_fd[0][0]->
Integral());
127 hgenie_core_presel->Divide(hspec_mrbrem_cry[0][0]);
129 hgenie_peri_presel->Scale(hspec_mrbrem_cry[1][0]->
Integral()/hspec_genie_fd[1][0]->
Integral());
130 hgenie_peri_presel->Divide(hspec_mrbrem_cry[1][0]);
132 hgenie_peri_preselbdt->Scale(hspec_mrbrem_cry[4][0]->
Integral()/hspec_genie_fd[4][0]->
Integral());
133 hgenie_peri_preselbdt->Divide(hspec_mrbrem_cry[4][0]);
135 hgenie_peri_preselcvn->Scale(hspec_mrbrem_cry[5][0]->
Integral()/hspec_genie_fd[5][0]->
Integral());
136 hgenie_peri_preselcvn->Divide(hspec_mrbrem_cry[5][0]);
138 hgenie_peri_preselen->Scale(hspec_mrbrem_cry[6][0]->
Integral()/hspec_genie_fd[6][0]->
Integral());
139 hgenie_peri_preselen->Divide(hspec_mrbrem_cry[6][0]);
141 hgenie_core_presel_data->Scale(hspec_mrbrem_data[0][0]->
Integral()/hspec_genie_fd[0][0]->
Integral());
142 hgenie_core_presel_data->Divide(hspec_mrbrem_data[0][0]);
144 hgenie_peri_presel_data->Scale(hspec_mrbrem_data[1][0]->
Integral()/hspec_genie_fd[1][0]->
Integral());
145 hgenie_peri_presel_data->Divide(hspec_mrbrem_data[1][0]);
147 hgenie_peri_preselbdt_data->Scale(hspec_mrbrem_data[4][0]->
Integral()/hspec_genie_fd[4][0]->
Integral());
148 hgenie_peri_preselbdt_data->Divide(hspec_mrbrem_data[4][0]);
150 hgenie_peri_preselcvn_data->Scale(hspec_mrbrem_data[5][0]->
Integral()/hspec_genie_fd[5][0]->
Integral());
151 hgenie_peri_preselcvn_data->Divide(hspec_mrbrem_data[5][0]);
153 hgenie_peri_preselen_data->Scale(hspec_mrbrem_data[6][0]->
Integral()/hspec_genie_fd[6][0]->
Integral());
154 hgenie_peri_preselen_data->Divide(hspec_mrbrem_data[6][0]);
156 std::string filenameCosmicsData =
"prod_mrbremcaf_R19-11-18-prod5reco.i_fd_cosmic_fhc_full_v1_goodruns_underP9";
157 std::string filenameCRYMC =
"prod_mrbremcaf_R19-11-18-prod5reco.m_fd_cry_fhc_full_v3";
158 std::string filenameGENIEFluxswap =
"prod_caf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_fluxswap_fhc_nova_v08_full_v1";
161 filenameCosmicsData =
"prod_mrbremcaf_R19-11-18-prod5reco.i_fd_cosmic_rhc_full_v1_goodruns";
162 filenameCRYMC =
"prod_mrbremcaf_R19-11-18-prod5reco.m_fd_cry_rhc_full_v3";
163 filenameGENIEFluxswap =
"prod_caf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_fluxswap_rhc_nova_v08_full_v1";
167 const Var kShwAngleCorePresel1Dweights( [hgenie_core_presel](
const caf::SRProxy*
sr)
169 double myweight = 1.0;
171 int bin = hgenie_core_presel->FindBin(myShwAngle);
172 myweight = hgenie_core_presel->GetBinContent(bin);
173 if(myweight>0)
return myweight;
178 const Var kShwAnglePeripheralPresel1Dweights( [hgenie_peri_presel](
const caf::SRProxy* sr)
180 double myweight = 1.0;
182 int bin = hgenie_peri_presel->FindBin(myShwAngle);
183 myweight = hgenie_peri_presel->GetBinContent(bin);
184 if(myweight>0)
return myweight;
188 const Var kShwAnglePeripheralPreselBDT1Dweights( [hgenie_peri_preselbdt](
const caf::SRProxy* sr)
190 double myweight = 1.0;
192 int bin = hgenie_peri_preselbdt->FindBin(myShwAngle);
193 myweight = hgenie_peri_preselbdt->GetBinContent(bin);
194 if(myweight>0)
return myweight;
198 const Var kShwAnglePeripheralPreselCVN1Dweights( [hgenie_peri_preselcvn](
const caf::SRProxy* sr)
200 double myweight = 1.0;
202 int bin = hgenie_peri_preselcvn->FindBin(myShwAngle);
203 myweight = hgenie_peri_preselcvn->GetBinContent(bin);
204 if(myweight>0)
return myweight;
208 const Var kShwAnglePeripheralPreselEn1Dweights( [hgenie_peri_preselen](
const caf::SRProxy* sr)
210 double myweight = 1.0;
212 int bin = hgenie_peri_preselen->FindBin(myShwAngle);
213 myweight = hgenie_peri_preselen->GetBinContent(bin);
214 if(myweight>0)
return myweight;
218 const Var kShwAngleCorePreselData1Dweights( [hgenie_core_presel_data](
const caf::SRProxy* sr)
220 double myweight = 1.0;
222 int bin = hgenie_core_presel_data->FindBin(myShwAngle);
223 myweight = hgenie_core_presel_data->GetBinContent(bin);
224 if(myweight>0)
return myweight;
229 const Var kShwAnglePeripheralPreselData1Dweights( [hgenie_peri_presel_data](
const caf::SRProxy* sr)
231 double myweight = 1.0;
233 int bin = hgenie_peri_presel_data->FindBin(myShwAngle);
234 myweight = hgenie_peri_presel_data->GetBinContent(bin);
235 if(myweight>0)
return myweight;
239 const Var kShwAnglePeripheralPreselBDTData1Dweights( [hgenie_peri_preselbdt_data](
const caf::SRProxy* sr)
241 double myweight = 1.0;
243 int bin = hgenie_peri_preselbdt_data->FindBin(myShwAngle);
244 myweight = hgenie_peri_preselbdt_data->GetBinContent(bin);
245 if(myweight>0)
return myweight;
249 const Var kShwAnglePeripheralPreselCVNData1Dweights( [hgenie_peri_preselcvn_data](
const caf::SRProxy* sr)
251 double myweight = 1.0;
253 int bin = hgenie_peri_preselcvn_data->FindBin(myShwAngle);
254 myweight = hgenie_peri_preselcvn_data->GetBinContent(bin);
255 if(myweight>0)
return myweight;
259 const Var kShwAnglePeripheralPreselEnData1Dweights( [hgenie_peri_preselen_data](
const caf::SRProxy* sr)
261 double myweight = 1.0;
263 int bin = hgenie_peri_preselen_data->FindBin(myShwAngle);
264 myweight = hgenie_peri_preselen_data->GetBinContent(bin);
265 if(myweight>0)
return myweight;
275 const int kNumVars2 = 14;
276 const HistDef defs_2round[kNumVars2] = {
305 {
"periph_presel", kNue2020PeripheralPresel_MRBrem, kShwAnglePeripheralPresel1Dweights, kShwAnglePeripheralPreselData1Dweights},
306 {
"core_full",
kNue2020FD_MRBrem, kShwAngleCorePresel1Dweights, kShwAngleCorePreselData1Dweights },
308 {
"periph_preselbdt", kNue2020PeripheralPresel_MRBrem &&
kCosPIDPeriBDT > 0.57, kShwAnglePeripheralPreselBDT1Dweights, kShwAnglePeripheralPreselBDTData1Dweights},
310 {
"periph_preselcvn", kNue2020PeripheralPresel_MRBrem &&
kCVNe_looseptp >= 0.97, kShwAnglePeripheralPreselCVN1Dweights, kShwAnglePeripheralPreselCVNData1Dweights},
312 {
"periph_preselen", kNue2020PeripheralPresel_MRBrem &&
kShwE > 1, kShwAnglePeripheralPreselEn1Dweights, kShwAnglePeripheralPreselEnData1Dweights},
323 for(
int selIdx = 0; selIdx <
kNumSels2; ++selIdx){
324 for (
int varIdx=0; varIdx<kNumVars2;varIdx++){
334 loaderCosmicsData.Go();
336 loaderGENIEFluxswap.
Go();
338 TFile *
file =
new TFile((
"MRbrem_spectra_with_weights_"+
mode+
".root").c_str(),
"recreate");
339 for(
int selIdx = 0; selIdx <
kNumSels2; ++selIdx){
340 TDirectory*
d = file->mkdir(sels2[selIdx].
name.c_str());
341 for (
int varIdx=0; varIdx<kNumVars2;varIdx++){
342 const char*
name = defs_2round[varIdx].
name.c_str();
346 spec_mrbrem_data_w_weight[selIdx][varIdx]->
SaveTo(d,
TString::Format(
"mrbrem_data_w_weight_%s", name));
const SpillCut kStandardSpillCuts_FD_Prod4MotivatedDQ
const Var kShwE([](const caf::SRProxy *sr){double maxe=-99.0;if(!sr->vtx.elastic.IsValid) return-99999.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-99999.0;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.npng;i++){if(maxe< sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){maxe=sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;}}return maxe;})
Cuts and Vars for the 2020 FD DiF Study.
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
const Cut kNue2020FD_MRBrem
double Integral(const Spectrum &s, const double pot, int cvnregion)
const Cut kNue2020CorePresel_MRBrem
Proxy for caf::StandardRecord.
std::vector< double > Spectrum
const Var kDistNearestWall([](const caf::SRProxy *sr){float disttonearestwall=std::min(float(kDistAllTop(sr)), float(kDistNotTop(sr)));return disttonearestwall;})
void SetSpillCut(const SpillCut &cut)
const Var kSparsenessAsymm
Representation of a spectrum in any variable, with associated POT.
const Var kPtP
Transverse momentum fraction in slice.
void mrbrem_get_reweighted_spectra(std::string mode="fhc")
Struct to hold cut information.
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
const HistDef defs[kNumVars]
const Cut kNue2020FDPeripheral_MRBrem(kNue2020FDPeripheralFunc_MRBrem)
const SystShifts kNoShift
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Cut kInCosmicTimingWindow_FD_MR
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
const Var kShwAngle([](const caf::SRProxy *sr){double maxe=-99.0;double cosz=-1.0;if(!sr->vtx.elastic.IsValid) return-99999.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-99999.0;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.npng;i++){if(maxe< sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){maxe=sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;cosz=sr->vtx.elastic.fuzzyk.png[i].shwlid.dir.z;}}return cosz;})
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
double Livetime() const
Seconds. For informational purposes only. No calculations use this.
const Var kCosPIDCoreBDT
2020 nue cosmic rejection BDT variable - core
const Var kCosPIDPeriBDT
2020 nue cosmic rejection BDT variable - peripheral