mec_tuning_preds_2020.C
Go to the documentation of this file.
1 /*
2  * Fill the useful spectra and prediction for mec tuning fit
3  * either with 2D gaussian (MINERvA-style),
4  * two 2D gaussians with / without overall normalization
5  * or lots of normalization bin shifts (like 2018/9 analyses )
6  *
7  */
8 
9 #include "TCanvas.h"
10 #include "TGraphErrors.h"
11 #include "TH1D.h"
12 #include "TH2D.h"
13 #include "THStack.h"
14 #include "TLegend.h"
15 
16 #include "CAFAna/Core/Loaders.h"
17 #include "CAFAna/Core/Spectrum.h"
19 #include "CAFAna/Cuts/SpillCuts.h"
20 #include "CAFAna/Cuts/TruthCuts.h"
27 
28 #include "CAFAna/Systs/Systs.h"
29 #include "CAFAna/Systs/XSecSysts.h"
30 #include "CAFAna/Systs/RPASysts.h"
31 #include "CAFAna/Systs/RESSysts.h"
33 
36 
37 
40 
41 #include "OscLib/OscCalcPMNSOpt.h"
42 
43 
44 #include <fstream>
45 
47  {
48  return Form( "/nova/ana/users/%s/mec_tuning_2020_systs", getenv( "USER" ) );
49  }
50 
53  {
54  std::string numu_mec_weights_file_name = "/pnfs/nova/persistent/users/mcasales/prod5/mec_fit_hists_fhc_bins_2020_chis100_ext.root";
55  //miniprod5/mec_fit_hists_fhc_bins_mp5.root" ;
56  std::cout << "Loading FHC MEC weights from file:\n" << numu_mec_weights_file_name << std::endl;
57  TFile *numu_mec_weights_file = TFile::Open( ana::pnfs2xrootd(numu_mec_weights_file_name).c_str());
58  hist_input_mec_weights_numu = (TH2D*)numu_mec_weights_file->Get( "mec_weights_smoothed" );
59  }
60 
61  const ana::Var kWeightTunedNumuMEC( []( const caf::SRProxy * sr )
62  {
63  if ( !ana::kIsDytmanMEC( sr ) || !sr->mc.nu[0].iscc ) return 1.0;
64  if ( sr->mc.nu[0].pdg != 14 ) return 1.0;
65  if ( hist_input_mec_weights_numu == NULL ) throw std::runtime_error( "FHC MEC true (q0,q3) weights histogram is NULL" );
66 
67  double q0 = ana::kTrueQ0( sr );
68  double q3 = ana::kTrueQ3( sr );
69 
70  if ( q0 < hist_input_mec_weights_numu->GetYaxis()->GetXmin() ||
71  q0 > hist_input_mec_weights_numu->GetYaxis()->GetXmax() ||
72  q3 < hist_input_mec_weights_numu->GetXaxis()->GetXmin() ||
73  q3 > hist_input_mec_weights_numu->GetXaxis()->GetXmax() ) return 1.0;
74 
75  double weight = hist_input_mec_weights_numu->Interpolate( q3, q0 );
76  //double weight = hist_input_mec_weights_numu->GetBinContent( hist_input_mec_weights_numu->FindFixBin( q3, q0 ) );
77  if ( weight < 0 ) weight = 0.0;
78  return weight;
79  });
80 
81 
82  const ana::Cut kNumu2020PIDLoosePTP( [](const caf::SRProxy* sr)
83  {
84  return (sr->sel.remid.pid > 0.7 && sr->sel.cvnloosepreselptp.numuid > 0.82);
85  });
86 
87 
88 
90 (
91  const std::string beam = "rhc", // so far only fhc
92  const int test = 1,
93  const std::string def="prod5",
94  const std::string fit="doublegaussB", // gauss (for 2D gaussian only), gausssupp (2D gaussian + RPA/QE suppression) , bins (2018-style 200-norm bins)
95  const std::string shift_non_mec = "" //up, down
96 )
97 {
98  if ( beam != "fhc" && beam != "rhc" ) throw std::runtime_error( "Beam must be \"fhc\" or \"rhc\"" );
99  if ( fit!="gausssupp" && fit != "gauss" && fit != "bins" && fit != "doublegauss" && fit != "doublegaussB"
100  && fit != "doublegaussB1" && fit!= "doublegaussSupp" && fit!= "doublegaussSupp2" ) throw std::runtime_error( "Fit must be \"gauss\", \"bins\" or \"doublegauss\" " );
101  const bool isRHC = beam == "rhc";
102  const bool MECbins= isRHC && fit=="bins";
103  if ( MECbins ) LoadWeightsTunedNumuMEC();
104  const bool Gauss2 = ( fit == "doublegauss" || fit== "doublegaussSupp" || fit=="doublegaussSupp2" || fit=="doublegaussB" || fit=="doublegaussB1" );
105  const bool Gauss = fit =="gauss";
106 
107  ana::SystShifts kShiftsNonMEC;
108  ana::GaussParams InitialGaussParams = ana::InitialProd5nominal;
109  if ( shift_non_mec != "down" && shift_non_mec != "up" )
110  {
111  kShiftsNonMEC = ana::kNoShift;
112 
113  }
114  else if ( shift_non_mec == "down" )
115  {
116  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZNormCCQE), +1);
117  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA1CCQE), +1);
118  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA2CCQE), +1);
119  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA3CCQE), +1);
120  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA4CCQE), +1);
121  kShiftsNonMEC.SetShift( &ana::kRPACCQESuppSyst2020, +1 );
122  kShiftsNonMEC.SetShift( &ana::kRPACCQEEnhSyst2020, +1 );
123  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst( rwgt::fReweightMaCCRES ), -1 );
124  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst( rwgt::fReweightMvCCRES ), -1 );
125  kShiftsNonMEC.SetShift( &ana::kRESLowQ2SuppressionSyst2020, +1 );
126  InitialGaussParams = ana::InitialProd5DOWN;
127  }
128  else if ( shift_non_mec == "up" )
129  {
130  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZNormCCQE), -1);
131  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA1CCQE), -1);
132  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA2CCQE), -1);
133  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA3CCQE), -1);
134  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst(rwgt::fReweightZExpA4CCQE), -1);
135  kShiftsNonMEC.SetShift( &ana::kRPACCQESuppSyst2020, -1 );
136  kShiftsNonMEC.SetShift( &ana::kRPACCQEEnhSyst2020, -1 );
137  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst( rwgt::fReweightMaCCRES ), +1 );
138  kShiftsNonMEC.SetShift( ana::GetGenieKnobSyst( rwgt::fReweightMvCCRES ), +1 );
139  kShiftsNonMEC.SetShift( &ana::kRESLowQ2SuppressionSyst2020, -1 );
140  InitialGaussParams = ana::InitialProd5UP;
141  }
142 
143  else throw std::runtime_error( Form( "Unrecognized shift: \"%s\"", shift_non_mec.c_str() ) );
144 
145 
146 
147  const ana::Var wgt_non_mec = ana::kUnweighted; // * ana::kMinosResSupp;
148  const ana::Var wgt_shift_non_mec = !shift_non_mec.empty() ? ana::GetWeightFromShifts( kShiftsNonMEC ) : ana::kUnweighted;
149  const ana::Var wgt_mec_numu = MECbins ? kWeightTunedNumuMEC : ana::kUnweighted;
150  const ana::Var wgt_mec_2gauss = Gauss2 ? ana::kMECDoubleGaussEnh(InitialGaussParams) : ana::kUnweighted;
151  const ana::Var wgt_mec_gauss = Gauss ? ana::kMECGaussEnh : ana::kUnweighted;
152  const ana::Var wgt_fit = ana::kPPFXFluxCVWgt * wgt_non_mec * wgt_shift_non_mec * wgt_mec_numu
153  * wgt_mec_gauss * wgt_mec_2gauss;
154 
156 // const ana::Cut kSelCuts = ana::kNumu2020ND;
157  const ana::Cut kSelCuts = kNumu2020NDLoosePTP;
158 
159 // --------------------------- could be more adaptable -----------------------------------------
160  std::vector<const ana::ISyst*> systs_ptrs;
161  // need a less awkward way to declare this // extended range
162  std::vector<std::unique_ptr<const ana::CompNormSyst>> systs= ana::systsQ3Q0(24, 0.0, 1.2, 24, 0.0, 1.2,
163  ana::GetCutIsFitMEC( isRHC ) && kSelCuts);
164  if (fit=="bins"){
165  for ( const auto & s : systs ){
166  systs_ptrs.push_back( s.get() );
167  }
168  }
169  if (fit=="gauss"){ systs_ptrs=ana::systs_params_gauss();}
170  if (fit=="gausssupp"){ systs_ptrs=ana::systs_params_gauss_supp(); }
171  if (fit=="doublegauss"){ systs_ptrs=ana::systs_params_double_gauss(InitialGaussParams); }
172  if (fit=="doublegaussB" || fit=="doublegaussB1"){
173  // if (shift_non_mec=="up") systs_ptrs=ana::systs_params_double_gauss_extra(InitialProd5UP);
174  // else if (shift_non_mec=="down") systs_ptrs=ana::systs_params_double_gauss_extra(InitialProd5DOWN);
175  //else
176  systs_ptrs=ana::systs_params_double_gauss_extra(InitialGaussParams);
177  }
178  if (fit== "doublegaussSupp" || fit== "doublegaussSupp2") { systs_ptrs= ana::systs_params_double_gauss_supp(InitialGaussParams);}
179 
180 
181  std::cout << "Fitting (systs_ptrs.size()) "<< systs_ptrs.size()<< " systematic parameters" << std::endl;
182 // -------------------------------------------------------------------------------------------
183 // datasets
184  int strided=0;
185  int stridem=0;
186  std::string defn_data = "";
187  std::string defn_mc = "";
188 if ( beam == "fhc" )
189  {
190  defn_data = "defname: prod_sumdecaf_R19-11-18-prod5reco.d.f.h.l_nd_numi_fhc_full_v1_goodruns_numu2020";
191  defn_mc = "def_snapshot prod_sumdecaf_R19-11-18-prod5reco.d.h.l_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_numu2020";
192  if (def=="mcnp") defn_mc = "defname: prod_caf_R19-11-18-prod5reco.muremove-hotfix.a_nd_genie_N1810j0211a_nonswap_genierw_fhc_nova_v08_full_mcnp_v1";
193  }
194  else if ( beam == "rhc" )
195  {
196  defn_data = "def_snapshot prod_sumdecaf_R19-11-18-prod5reco.g_nd_numi_rhc_full_v1_goodruns_numu2020";
197  defn_mc = "def_snapshot prod_sumdecaf_R19-11-18-prod5reco.d_nd_genie_N1810j0211a_nonswap_rhc_nova_v08_full_v1_numu2020";
198  if (def=="mcnp") defn_mc = "def_snapshot prod_caf_R19-11-18-prod5reco.muremove-hotfix.a_nd_genie_N1810j0211a_nonswap_genierw_rhc_nova_v08_full_mcnp_v1";
199  }
200 
201  defn_data += test ? " with limit 1" : " with stride "+ std::to_string(strided);
202  defn_mc += test ? " with limit 1" : " with stride "+std::to_string(stridem);
203 
204  if ( defn_data.empty() ) throw std::runtime_error( "Data SAM Definition is empty" );
205  if ( defn_mc .empty() ) throw std::runtime_error( "MC SAM Definition is empty" );
206 
208  loaders.SetLoaderPath( defn_mc , caf::kNEARDET, ana::Loaders::kMC );
209  loaders.SetLoaderPath( defn_data, caf::kNEARDET, ana::Loaders::kData );
211 
212  //Define range for data-mc agreement comparison;
213  double q0_max=0;
214  double q3_max=0;
215  double q0_min=0;
216  double q3_min=0;
217  int binsq0=0;
218  int binsq3=0;
219  if (fit=="bins" ){
220  q3_max=1.4; binsq3=28;
221  q0_max=0.4; binsq0=20;
222  }
223  if (fit=="gauss" || fit=="gausssupp" || fit=="doublegauss" || fit=="doublegaussB" || fit=="doublegaussSupp" || fit=="doublegaussSupp2"){
224  q3_max=1.4; binsq3=28;
225  q0_max=0.4; binsq0=20;//-1;
226  // q0_min=0.02;
227  }
228  // removing first bin of ehad which never agrees >:(
229  if (fit=="doublegaussB1"){
230  q3_max=1.4; binsq3=28;
231  q0_max=0.4; binsq0=20-2;
232  q0_min=0.02*2;
233  }
234  ana::HistAxis axis_fit( "Reco |#vec{q}| (GeV)" , ana::Binning::Simple( binsq3, q3_min, q3_max ), ana::kRecoQmag,
235  "Reco E_{had, vis} (GeV)", ana::Binning::Simple( binsq0, q0_min, q0_max ), ana::kNumuHadVisE );
236 
237  ana::Spectrum spec_fit_data
238  (
240  axis_fit,
241  kSelCuts
242  );
243 
244  ana::Spectrum spec_fit_mc_raw
245  (
247  axis_fit,
248  kSelCuts,
250  wgt_fit
251  );
252 
253  ana::Spectrum spec_fit_non_mec_raw
254  (
256  axis_fit,
257  kSelCuts && !ana::kIsDytmanMEC,
258  ana::kNoShift,
259  wgt_fit
260  );
261 
262  ana::Spectrum spec_fit_mec_raw
263  (
265  axis_fit,
266  kSelCuts && ana::kIsDytmanMEC,
267  ana::kNoShift,
268  wgt_fit
269  );
270 
271  ana::Spectrum spec_fit_mc_flux
272  (
274  axis_fit,
275  kSelCuts,
278  );
279 
280 
281  osc::NoOscillations no_osc_calc;
282  ana::NoOscPredictionGenerator pred_gen( loaders.GetLoader(caf::kNEARDET,ana::Loaders::kMC), axis_fit, kSelCuts , wgt_fit);
283  // create a prediction that only has MEC events to see the how MEC only changes
284  ana::NoOscPredictionGenerator pred_genMEC( loaders.GetLoader(caf::kNEARDET,ana::Loaders::kMC), axis_fit, kSelCuts && ana::kIsDytmanMEC , wgt_fit);
285 
286  ana::PredictionInterp pred_interp( systs_ptrs, &no_osc_calc, pred_gen, loaders );
287  ana::PredictionInterp pred_interpMEC( systs_ptrs, &no_osc_calc, pred_genMEC, loaders );
288 
289  loaders.Go();
290 
291  const std::string out_dir = GetMECTuningDirectory();
292  if ( gSystem->AccessPathName( out_dir.c_str() ) ) gSystem->mkdir( out_dir.c_str(), true );
293 
294  std::string file_name = "mec_tuning_predictions_"+beam+"_"+fit+"_"+shift_non_mec+"2020";
295  if (def=="mcnp") file_name = "mec_tuning_predictions_"+beam+"_"+fit+"_"+shift_non_mec+"2020_mcnp_genierw";
296  if(test==1) file_name=out_dir +"/"+ file_name + "_test";
297  file_name=file_name + ".root";
298 
299  TFile file( file_name.c_str(), "recreate" );
300  file.cd();
301  spec_fit_data.SaveTo( & file, "spec_data" ) ;
302  spec_fit_non_mec_raw.SaveTo( & file,"spec_mc_nonmec_raw") ;
303  spec_fit_mec_raw.SaveTo( & file,"spec_mc_mec_raw") ;
304  spec_fit_mc_raw.SaveTo( & file,"spec_mc_raw") ;
305  pred_interp.SaveTo( & file,"pred_interp") ;
306  pred_interpMEC.SaveTo( & file,"pred_interpMEC") ;
307  spec_fit_mc_flux.SaveTo( & file, "spec_mc_flux");
308 
309  // store your parameters
310  TH1D * init_h = new TH1D( "initial pars", "Gaussian parameters",
311  systs_ptrs.size() , 0., systs_ptrs.size());
312 
313 if (fit=="doublegaussB1" || fit=="doublegaussB" || fit=="doublegauss" || fit=="doublegaussSupp" || fit=="doublegaussSupp2" ){
314  int bin=1;
315  std::string initial_pars_file_name = out_dir + "/mec_fit_initial_" + beam + "_" + fit + "_"+shift_non_mec+"2020.txt";//_bigchisq.txt";
316  if (def=="mcnp") initial_pars_file_name = out_dir + "/mec_fit_initial_" + beam + "_" + fit + "_"+shift_non_mec+"2020_mcnp.txt";
317  std::ofstream fit_initial_file( initial_pars_file_name.c_str(), std::ofstream::out );
318  for ( auto & syst : systs_ptrs )
319  {
320  fit_initial_file << syst->ShortName() << "old param = " <<
321  ana::CalcMECDoubleGaussEnhShiftedParam( syst->ShortName(), 0 , InitialGaussParams)<< std::endl;
322  init_h->SetBinContent(bin, ana::CalcMECDoubleGaussEnhShiftedParam( syst->ShortName(), 0 , InitialGaussParams ));
323  init_h->GetXaxis()->SetBinLabel(bin,(syst->ShortName()).c_str());
324  bin++;
325  }
326  }
327 
328  init_h->Write("initial_gauss");
329 
330  file.Close();
331  std::cout << "Wrote file: "<< file_name << std::endl;
332 
333 
334 }
caf::Proxy< caf::SRCVNResult > cvnloosepreselptp
Definition: SRProxy.h:1254
Near Detector underground.
Definition: SREnums.h:10
GaussParams InitialProd5UP
Pass neutrinos through unchanged.
Definition: IOscCalc.h:45
Implements systematic errors by interpolation between shifted templates.
void mec_tuning_preds_2020(const std::string beam="rhc", const int test=1, const std::string def="prod5", const std::string fit="doublegaussB", const std::string shift_non_mec="")
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
correl_xv GetYaxis() -> SetDecimals()
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const Var weight
TH2D * hist_input_mec_weights_numu
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
const Var kRecoQmag([](const caf::SRProxy *sr){return sqrt(kRecoQ2(sr)+util::sqr(kHadE(sr)));})
Reconstructed three-momentum transfer.
Definition: NumuVars.h:149
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
caf::Proxy< float > pid
Definition: SRProxy.h:1136
std::vector< const ISyst * > systs_params_double_gauss(const GaussParams init, std::string suffix="")
double CalcMECDoubleGaussEnhShiftedParam(std::string shift_param, double shift_sigma, const GaussParams initialParams)
std::string pnfs2xrootd(std::string loc, bool unauth)
Definition: UtilsExt.cxx:237
const Var kTrueQ0
Definition: TruthVars.h:32
const Var kMECGaussEnh([](const caf::SRProxy *sr){if(!kIsNumuCC(sr)||sr->mc.nu[0].mode!=caf::kMEC) return 1.0;double q0=kTrueQ0(sr);double q3=kTrueQ3(sr);return CalcMECGaussEnh(q0, q3, kGauss2DNorm, 0);})
const Var kNumuHadVisE([](const caf::SRProxy *sr){return kNumuHadCalE(sr)+kNumuHadTrkE(sr);})
Definition: NumuVars.h:124
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
const Cut kIsDytmanMEC
Definition: TruthCuts.cxx:187
const XML_Char * s
Definition: expat.h:262
std::string GetMECTuningDirectory()
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
const ana::Var kWeightTunedNumuMEC([](const caf::SRProxy *sr){if(!ana::kIsDytmanMEC(sr)||!sr->mc.nu[0].iscc) return 1.0;if(sr->mc.nu[0].pdg!=14) return 1.0;if(hist_input_mec_weights_numu==NULL) throw std::runtime_error("FHC MEC true (q0,q3) weights histogram is NULL");double q0=ana::kTrueQ0(sr);double q3=ana::kTrueQ3(sr);if(q0< hist_input_mec_weights_numu->GetYaxis() ->GetXmin()|| q0 > hist_input_mec_weights_numu->GetYaxis() ->GetXmax()|| q3< hist_input_mec_weights_numu->GetXaxis() ->GetXmin()|| q3 > hist_input_mec_weights_numu->GetXaxis() ->GetXmax()) return 1.0;double weight=hist_input_mec_weights_numu->Interpolate(q3, q0);if(weight< 0) weight=0.0;return weight;})
const Var kTrueQ3
Definition: TruthVars.h:38
if(dump)
std::vector< const ISyst * > systs_params_gauss()
SpectrumLoaderBase & GetLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Retrieve a specific loader.
Definition: Loaders.cxx:129
std::string getenv(std::string const &name)
caf::StandardRecord * sr
std::vector< const ISyst * > systs_params_double_gauss_extra(const GaussParams init, std::string suffix)
caf::Proxy< caf::SRRemid > remid
Definition: SRProxy.h:1269
std::vector< std::unique_ptr< const CompNormSyst > > systsQ3Q0(int nbinsQ3=20, float fitMinQ3=0.0, float fitMaxQ3=1.0, int nbinsQ0=16, float fitMinQ0=0.0, float fitMaxQ0=0.8, Cut cut=GetCutIsFitMEC(false))
float bin[41]
Definition: plottest35.C:14
std::vector< const ISyst * > systs_params_double_gauss_supp(const GaussParams init, std::string suffix="")
const NOvARwgtSyst kRPACCQEEnhSyst2020("RPAShapeenh2020","RPA shape: higher-Q^{2} enhancement (2020)", novarwgt::kRPACCQEEnhSyst2020)
Definition: RPASysts.h:17
const NOvARwgtSyst kRESLowQ2SuppressionSyst2020("LowQ2RESSupp2020","RES low-Q^2 suppression", novarwgt::kRESLowQ2SuppressionSyst2020)
Definition: RESSysts.h:10
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
GaussParams InitialProd5nominal
const Var kMECDoubleGaussEnh(const GaussParams initial_params)
const Cut GetCutIsFitMEC(const bool isRHC)
const NOvARwgtSyst kRPACCQESuppSyst2020("RPAShapesupp2020","RPA shape: low-Q^{2} suppression (2020)", novarwgt::kRPACCQESuppSyst2020)
Definition: RPASysts.h:18
std::vector< Loaders * > loaders
Definition: syst_header.h:386
GaussParams InitialProd5DOWN
TFile * file
Definition: cellShifts.C:17
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
const Cut kNumuQuality
Definition: NumuCuts.h:18
const ana::Cut kNumu2020PIDLoosePTP([](const caf::SRProxy *sr){return(sr->sel.remid.pid > 0.7 &&sr->sel.cvnloosepreselptp.numuid > 0.82);})
const NOvARwgtSyst * GetGenieKnobSyst(rwgt::ReweightLabel_t knobIdx, std::string altName, std::string altLabel)
Convenience function to get a GENIE knob syst. (Allows using the GENIE knob name & description as the...
Definition: XSecSysts.cxx:119
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Cut kNumuContainND2020([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.nshwlid;++i){const caf::SRVector3DProxy &start=sr->vtx.elastic.fuzzyk.png[i].shwlid.start;const caf::SRVector3DProxy &stop=sr->vtx.elastic.fuzzyk.png[i].shwlid.stop;if(std::min(start.X(), stop.X())< -180.0) return false;if(std::max(start.X(), stop.X()) > 180.0) return false;if(std::min(start.Y(), stop.Y())< -180.0) return false;if(std::max(start.Y(), stop.Y()) > 180.0) return false;if(std::min(start.Z(), stop.Z())< 40.0) return false;if(std::max(start.Z(), stop.Z()) > 1525.0) return false;}if(sr->trk.kalman.ntracks< 1) return false;for(unsigned int i=0;i< sr->trk.kalman.ntracks;++i){if(i==sr->trk.kalman.idxremid) continue;else if(sr->trk.kalman.tracks[i].start.Z() > 1275||sr->trk.kalman.tracks[i].stop.Z() > 1275) return false;}return(sr->trk.kalman.ntracks > sr->trk.kalman.idxremid &&sr->slc.firstplane > 1 &&sr->slc.lastplane< 212 &&sr->trk.kalman.tracks[0].start.Z()< 1100 &&(sr->trk.kalman.tracks[0].stop.Z()< 1275 ||sr->sel.contain.kalyposattrans< 55) &&sr->sel.contain.kalfwdcellnd > 5 &&sr->sel.contain.kalbakcellnd > 10);})
Definition: NumuCuts2020.h:31
const Var kUnweighted
The simplest possible Var, always 1. Used as a default weight.
Definition: Var.h:96
void SetShift(const ISyst *syst, double shift, bool force=false)
Definition: SystShifts.cxx:81
caf::Proxy< float > numuid
Definition: SRProxy.h:907
void LoadWeightsTunedNumuMEC()
std::vector< const ISyst * > systs_params_gauss_supp()
const Var GetWeightFromShifts(const SystShifts &sys_shifts)
enum BeamMode string