Functions | Variables
make_nueFDprediction_kinematics_FHC_REW.C File Reference
#include "CAFAna/Analysis/Exposures.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/Prod5Loaders.h"
#include "CAFAna/Analysis/Style.h"
#include "CAFAna/Core/Binning.h"
#include "CAFAna/Core/Cut.h"
#include "CAFAna/Core/HistAxis.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/SpectrumLoaderBase.h"
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Cuts/NumuCuts.h"
#include "CAFAna/Cuts/NumuCuts2020.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/NueCuts2020.h"
#include "CAFAna/Decomp/ProportionalDecomp.h"
#include "CAFAna/Decomp/BENDecomp.h"
#include "CAFAna/Decomp/MichelDecomp.h"
#include "CAFAna/Decomp/NumuDecomp.h"
#include "CAFAna/Extrap/ModularExtrap.h"
#include "CAFAna/Prediction/PredictionExtrap.h"
#include "CAFAna/Prediction/PredictionGenerator.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "CAFAna/Prediction/PredictionExtendToPeripheral.h"
#include "CAFAna/Systs/Systs.h"
#include "CAFAna/Vars/XsecTunes.h"
#include "CAFAna/Vars/TruthVars.h"
#include "CAFAna/Vars/HistAxes.h"
#include "CAFAna/Vars/NueVars.h"
#include "CAFAna/Vars/Vars.h"
#include "CAFAna/Vars/NueVarsExtra.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "OscLib/func/OscCalculatorDumb.h"
#include "StandardRecord/Proxy/SRProxy.h"
#include <iostream>
#include <iomanip>

Go to the source code of this file.

Functions

void make_nueFDprediction_kinematics_FHC_REW (const std::string sample, const std::string wfile)
 

Variables

osc::OscCalculatorDumb calc
 

Function Documentation

void make_nueFDprediction_kinematics_FHC_REW ( const std::string  sample,
const std::string  wfile 
)

Definition at line 62 of file make_nueFDprediction_kinematics_FHC_REW.C.

References ana::bins, om::cout, caf::Proxy< caf::SRHeader >::det, dir, allTimeWatchdog::endl, exit(), file, gens, ana::Loaders::Go(), make_syst_table_plots::h, caf::Proxy< caf::StandardRecord >::hdr, MECModelEnuComparisons::i, makeTrainCVSamples::int, caf::kFARDET, ana::Loaders::kFHC, ana::kNoShift, ana::kNue2020Axis, ana::kNue2020FDAllSamples, ana::kNueConcat, ana::kNumu2020ND, ana::kNumuCCOptimisedAxis2020, ana::kPPFXFluxCVWgt, ana::kRecoQ2, ana::kStandardSpillCuts, ana::kXSecCVWgt2020, loaders, nbins, make_template_knob_config::outfilename, ana::Loaders::SetSpillCut(), and Munits::sr.

63 {
64  const std::string outfilename = ("FDprediction_kinematics_FHC_REW_"+sample+".root").c_str();
65 
66  //For grid
67  // std::string wfile_name = ("/pnfs/nova/scratch/users/zvallari/AcceptSyst/"+wfile).c_str();
68  // TFile *weight_file = TFile::Open(pnfs2xrootd(wfile_name).c_str() );
69 
70  //For non-grid
71  std::string wfile_name = ("/nova/ana/users/zvallari/AcceptSyst2020/"+wfile).c_str();
72  TFile *weight_file = TFile::Open(wfile_name.c_str());
73 
74  // construction of trueQ2 weight
75  TH1 *h;
76  gDirectory->GetObject(("trueQ2_weight_"+sample).c_str(),h);
77 
78  std::cout << h->GetNbinsX() << endl;
79  int nbins = h->GetNbinsX();
80  double bins[nbins], binslow[nbins], binshigh[nbins];
81  for(int i = 1; i <= nbins; ++i){
82  bins[i-1] = h->GetBinContent(i);
83  binslow[i-1] = h->GetBinLowEdge(i);
84  binshigh[i-1] = h->GetBinLowEdge(i) + h->GetBinWidth(i);
85  }
86 
87  const Var kTrueQ2Weight([nbins, &binslow, &binshigh, &bins](const caf::SRProxy *sr){
88  if(sr->hdr.det == caf::kFARDET) return 1.0;
89  if(!kNumu2020ND(sr)) {
90  std::cout << "THERE IS AN EVENT WHICH DOES NOT PASS NUMU ND CUT IN NUE SIGNAL EXTRAP!!!!" << std::endl;
91  exit(0);
92  return 1.0;
93  }
94  for(int i = 0; i < nbins; ++i){
95  if((kRecoQ2(sr) > binslow[i]) && (kRecoQ2(sr) < binshigh[i])){
96  return bins[i];
97  }
98  }
99  return 1.0;
100  }
101  );
102 
103  //construction of PtP weight
104  TH1 *hptp;
105  gDirectory->GetObject(("PtP_weight_"+sample).c_str(),hptp);
106 
107  std::cout << hptp->GetNbinsX() << endl;
108  int nbins_ptp = hptp->GetNbinsX();
109  double bins_ptp[nbins_ptp], binslow_ptp[nbins_ptp], binshigh_ptp[nbins_ptp];
110  for(int i = 1; i <= nbins_ptp; ++i){
111  bins_ptp[i-1] = hptp->GetBinContent(i);
112  binslow_ptp[i-1] = hptp->GetBinLowEdge(i);
113  binshigh_ptp[i-1] = hptp->GetBinLowEdge(i) + hptp->GetBinWidth(i);
114  }
115 
116  const Var kPtPWeight([nbins_ptp, &binslow_ptp, &binshigh_ptp, &bins_ptp](const caf::SRProxy *sr){
117  if(sr->hdr.det == caf::kFARDET) return 1.0;
118  for(int i = 0; i < nbins_ptp; ++i){
119  if((kPtP(sr) > binslow_ptp[i]) && (kPtP(sr) < binshigh_ptp[i])){return bins_ptp[i];}
120  }
121  return 1.0;
122  }
123  );
124 
125  //construction of Cos weight
126  TH1 *hcos;
127  gDirectory->GetObject(("CosNumi_weight_"+sample).c_str(),hcos);
128 
129  std::cout << hcos->GetNbinsX() << endl;
130  int nbins_cos = hptp->GetNbinsX();
131  double bins_cos[nbins_cos], binslow_cos[nbins_cos], binshigh_cos[nbins_cos];
132  for(int i = 1; i <= nbins_cos; ++i){
133  bins_cos[i-1] = hcos->GetBinContent(i);
134  binslow_cos[i-1] = hcos->GetBinLowEdge(i);
135  binshigh_cos[i-1] = hcos->GetBinLowEdge(i) + hcos->GetBinWidth(i);
136  }
137 
138  const Var kCosWeight([nbins_cos, &binslow_cos, &binshigh_cos, &bins_cos](const caf::SRProxy *sr){
139  if(sr->hdr.det == caf::kFARDET) return 1.0;
140  for(int i = 0; i < nbins_cos; ++i){
141  if((kCosNumi(sr) > binslow_cos[i]) && (kCosNumi(sr) < binshigh_cos[i])){return bins_cos[i];}
142  }
143  return 1.0;
144  }
145  );
146 
147  // close weights file
148  weight_file->Close();
149 
151  loaders.SetSpillCut(kStandardSpillCuts);
152 
153  struct GenDef{
154  const IPredictionGenerator *gen;
155  const TString cutname;
156  const TString varname;
157  };
158 
159  std::vector <GenDef> gens;
160  std::vector <IPrediction * > predictions;
161 
163  sample.c_str(), "nueAxis_NoExtrap"});
164 
165 
166  gens.push_back({new NueSignalExtrapGenerator( kNue2020Axis,
169  kNumu2020ND,
170  kNoShift,
171  kXSecCVWgt2020*kPPFXFluxCVWgt*kTrueQ2Weight),
172  sample.c_str(), "nueAxis_NueSignalExtrap_Q2Weight"});
173 
174  gens.push_back({new NueSignalExtrapGenerator( kNue2020Axis,
177  kNumu2020ND,
178  kNoShift,
179  kXSecCVWgt2020*kPPFXFluxCVWgt*kCosWeight),
180  sample.c_str(), "nueAxis_NueSignalExtrap_CosWeight"});
181 
182  gens.push_back({new NueSignalExtrapGenerator( kNue2020Axis,
185  kNumu2020ND,
186  kNoShift,
187  kXSecCVWgt2020*kPPFXFluxCVWgt*kPtPWeight),
188  sample.c_str(), "nueAxis_NueSignalExtrap_PtPWeight"});
189 
190 
191  for(auto & gen:gens){
192  predictions.push_back(gen.gen->Generate(loaders).release());
193  }
194 
195  loaders.Go();
196 
197  TFile* file = new TFile(outfilename.c_str(),"RECREATE");
198  for (int i = 0 ; i < (int)gens.size(); ++i){
199  auto dir = file->GetDirectory(gens[i].cutname);
200  if(!dir) dir = file->mkdir(gens[i].cutname);
201  predictions[i]->SaveTo(dir->mkdir(gens[i].varname));
202  }
203 
204  file->Close();
205 
206 }
const ana::Var kRecoQ2([](const caf::SRProxy *sr){const double M_mu_sqrd=util::sqr(0.1056);double E_mu=kMuE(sr);double p_mu=sqrt(util::sqr(E_mu)-M_mu_sqrd);return 2 *kCCE(sr)*(E_mu-p_mu *kCosNumi(sr))-M_mu_sqrd;})
Reconstructed four-momentum transfer invariant (Q^2)
Definition: NumuVars.h:130
Far Detector at Ash River.
Definition: SREnums.h:11
std::map< TString, IPredictionGenerator * > gens
Definition: syst_header.h:386
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:1980
Proxy for caf::StandardRecord.
Definition: SRProxy.h:1969
const Cut kNumu2020ND
Definition: NumuCuts2020.h:57
const HistAxis kNumuCCOptimisedAxis2020("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kNumuE2020)
Definition: HistAxes.h:41
Generates FD-only predictions (no extrapolation)
string outfilename
knobs that need extra care
const int nbins
Definition: cellShifts.C:15
For nominal spectra and reweighting systs (xsec/flux)
Definition: Prod5Loaders.h:101
const HistAxis kNue2020Axis("NuE Energy / Analysis Bin", kNue2020Binning, kNue2020AnaBin)
Use this Axis for Ana2020, official Axis.
Definition: NueCuts2020.h:195
Generates extrapolated Nue signal-only predictions.
const Binning bins
const SystShifts kNoShift
Definition: SystShifts.h:112
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TDirectory * dir
Definition: macro.C:5
std::vector< Loaders * > loaders
Definition: syst_header.h:385
exit(0)
TFile * file
Definition: cellShifts.C:17
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:46
Given loaders and an MC shift, Generate() generates an IPrediction.
const Cut kNue2020FDAllSamples
Definition: NueCuts2020.h:84
static constexpr Double_t sr
Definition: Munits.h:164
const Var kXSecCVWgt2020
Definition: XsecTunes.h:106
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:226

Variable Documentation

Definition at line 59 of file make_nueFDprediction_kinematics_FHC_REW.C.

Referenced by ana::MultiExperiment::Add(), ana::AddErrorInQuadrature(), FDPredictionHandler::AddSystematics(), NDPredictionHandler::AddSystematics(), AnalyzeNus18Pred(), BackPredict(), Beam(), bicount(), bicount_2018(), bin_composition_pie_chart(), ana::CovarianceMatrix::BuildFullCovMx(), CAF_makeCAFSensitivities_for_FNEX(), caf_numu_sensitivity(), caf_numu_sensitivity_no_tau(), cafe_FD_predictions(), CalcRWithSysts(), CalcRWithSystsNus17(), calculateComponentsNumu(), calculateWrongSignNue(), calculateWrongSignNumuQ1(), calculateWrongSignNumuQ2(), calculateWrongSignNumuQ3(), calculateWrongSignNumuQ4(), cc(), check_predinterp(), check_predinterp_numu(), ana::CompareNDDataMCFromVector(), ana::CompareOneShiftPred(), ana::CompareTwoShiftPred(), ComparisonPlots_MC(), ana::ComparisonTableNbins(), ana::CovMxManager::CovMxManager(), CutFlow_MC(), CutTableAna(), CVNCuts(), default_calc(), demo3(), demo4(), demo5(), demo_nueNumuSysts(), demo_numuOnly(), demoBarChart(), demoFitContours(), demoFitSlices(), demoPlotSystBands(), demoStarPlots(), ana::SolarConstraints::Derivative(), ana::T2KToyExperiment::Derivative(), osc::DowncastToNSI(), osc::DowncastToSterile(), osc::DowncastToSterileBeam(), Draw2DSurface(), draw_decomp_plots(), DrawCovMx(), drawPlot(), DrawSurface(), ana::CovMxSurface::DrawSurfacePoint(), drawSystsShiftingNDdata(), drawSystsShiftingNDdata_updatedAna(), efficiency(), efficiencySA(), fake_future_data(), FCTutorial2020(), FD_Data_PosComp(), fd_plot(), FD_plots(), FDDataMC(), FDDataMCSystBandAna(), FDDataMCSystBandLoad(), fiducial_accounting(), fill_col(), ana::FrequentistSurface::FillSurfacePoint(), FitSystEffectsLoad(), futureSig_reach_singlePOTcombo_syst(), generate_fake_data(), genie_contours(), genie_preds_make(), ana::GetBG(), GetBkgd(), GetCalculator(), getContProf(), getContProf_Sensitivity(), ana::GetFDMCComponents(), GetHist(), getHists_FNEX(), GetHistVectors(), ana::MinuitFitter::GetMINUITPrecision(), ana::GetNC(), ana::GetNDComponents(), test::GetNumuPrediction(), GetNumuPredictions2017(), GetNumuPredictions2018(), GetNumuPredictions2019(), ana::GetNumuPredictions2020(), GetNumuPredictionsFuture(), getPredictions(), getPredictions_updatedAna(), GetSig(), ana::GetSpectrum(), GetSpectToHist(), goodness_of_fit(), SystEntry::hDm(), SystEntry::hDmDcp(), SystEntry::hSin(), SystEntry::hSinDcp(), joint_fit_2017_contours(), joint_fit_2017_make_fc_slice(), joint_fit_2017_make_fc_surf(), joint_fit_2017_slices(), joint_fit_2018_contours(), joint_fit_2018_slices(), joint_fit_2019_bestfit(), joint_fit_2019_contours(), joint_fit_2019_slices(), joint_fit_future_bestfit_univ(), joint_fit_future_contour_univ(), jointsensitivity(), LoadFakeDataFromPred(), LOverEPlot(), make_expt_profile(), make_extrap_figure(), make_extrap_figure_hists(), make_fc_mass_and_oct_nersc_2018(), make_fc_mass_and_oct_nersc_2019(), make_fc_mh_nersc_2018(), make_fc_mh_nersc_2019(), make_fc_nus_surfs_nersc_2019(), make_fc_oct_nersc_2018(), make_fc_oct_nersc_2019(), make_fc_slices_nersc_2018(), make_fc_slices_nersc_2018_stats(), make_fc_slices_nersc_2019(), make_fc_surfaces_2020(), make_fc_surfaces_2020_validation(), make_fc_surfaces_nersc_2018(), make_fc_surfaces_nersc_2018_stats(), make_fc_surfaces_nersc_2019(), make_mass_and_oct_fc_input_2019(), make_mockdata_syst_contours(), make_nom_expt(), make_prediction(), make_prediction_extrap(), make_prediction_noextrap(), make_prediction_rhc(), make_prediction_tables(), make_qstop(), make_starplots(), make_surfprof(), make_surfprof_sensitivity(), MakeCAFSensitivities_for_FNEX(), MakeCovarSim(), MakeCovMx(), MakeExtrapSurface(), MakeFakeData(), MakeFileSystMatrix(), MakeGENIEMatrix(), MakeLegend(), MakeNus18CovarSim(), MakeNus18ExtrapPred(), MakePeriCutPlot(), makePredTables(), MakeSurface(), makeSystTable(), makeSystTable_reduced(), MakeTable(), MatrixValidation(), mec_tuning(), mec_tuning_fitter_2020(), MichelDecompTest(), modularextrap_demo_nue(), modularextrap_demo_numu(), monoprob(), nue_fd_mc_validation(), nue_pid_effs(), nue_pid_effs_miniprod(), nue_pid_effs_paper_numu_neweff(), NuMu2020_TrimCAFs(), numu_cut_flow(), numu_demo_split_plot(), numu_sig_nonmax(), nus17_fiducial_accounting(), osc::OscCalculatorCPT::OscCalculatorCPT(), ana::OscCovMxExperiment::OscCovMxExperiment(), ana::OscillatableSpectrum::Oscillated(), osc::_OscCalculatorPMNSOpt< T >::P(), PeripheralCuts(), plot_DataMCComp_numu(), plot_datapredictions(), plot_joint_fit_2020_contours(), plot_nominal_spectra(), plot_nuCrystalBall(), plot_nue_xsec_pred(), plot_oscprob(), plot_prediction_systs(), plot_predictions(), plot_rationoosc(), plot_recoE_numu(), plot_shifts(), plot_spectra_2dplots(), PlotComp(), plotDataPred(), plotDataPred_SplitCanvas(), PlotMCComponentsErrorBand(), PlotNus18Sideband(), plots(), ana::PlotSpectra(), Plotting_DataAndPrediction(), ana::FDPredictionSterile::Predict(), ana::PredictionXSecTuning::Predict(), ana::NDPredictionSterile::Predict(), ana::PredictionNoOsc::Predict(), ana::FDPredictionSterile::PredictComponent(), ana::PredictionExtrap::PredictComponent(), ana::NDPredictionSterile::PredictComponent(), ana::PredictionInterp::PredictComponentSyst(), ana::PrintOscilationParameters(), prob_biprob_pedagogical(), reach_2018_dCPfractions(), ana::RefineSeeds(), run_joint_fit_2020_bestfit(), run_joint_fit_2020_contours(), run_joint_fit_2020_slices(), saveContours_addExpt(), saveContours_complete(), saveContours_oscpar(), saveContours_simple(), saveContours_systs(), saveFDMCHists(), savePrediction_addExpt(), savePrediction_complete(), savePrediction_extrap(), savePrediction_simple(), savePrediction_systs(), selection_story_plots(), sensitivity2018(), sensitivity2020(), ana::Seed::Set(), ana::PredictionInterp::ShiftedComponent(), caf::CAFMaker::SimpleOscProb(), ana::SingleSampleExperiment::SingleSampleExperiment(), ana::SolarConstraintsNu::SolarConstraintsNu(), ana::SolarConstraintsNubar::SolarConstraintsNubar(), starPlot(), sterile_demo(), ana::MinuitFitter::SupportsDerivatives(), syst_plot_test(), syst_table_fit(), syst_table_fit_new(), syst_test(), template_basic(), template_GENIE_systs(), template_nonGENIE_systs(), test_ana(), test_external_constraints(), test_genie_systs(), test_mockdata(), test_nue2017Prediction(), test_nue2018_fitter(), test_nue2018_surface(), test_nueextrapsyst(), test_numu_summed_genie_systs(), test_numupred2017(), test_prediction_interp(), test_saloaders(), test_stanfit_statsonly(), test_stanfit_systpulls(), test_stanfit_withsysts(), TestPred(), Toy_analyses(), jw::TrivialPrediction::TrivialPrediction(), ana::TrivialPrediction::TrivialPrediction(), ana::OscillatableSpectrum::TrueEnergy(), Tutorial2019Fit(), Tutorial2019FitContours(), Tutorial2019FitSlices(), ana::CovarianceMatrix::~CovarianceMatrix(), ana::IPrediction::~IPrediction(), osc::OscCalculatorSterileTrivial::~OscCalculatorSterileTrivial(), and SystEntry::~SystEntry().