make_prediction_rhc.C
Go to the documentation of this file.
1 // WARNING datasets correspond to old files (SA ideal condition RHC)
2 // Tested in release R17-02-22-legacy-cafs-v1 - UPDATED TO MC PROD3
3 
4 #ifdef __CINT__
6 {
7  std::cout << "Sorry, you must run in compiled mode" << std::endl;
8 }
9 #else
10 
11 #include "CAFAna/Analysis/Calcs.h"
12 #include "CAFAna/Core/Loaders.h"
13 #include "CAFAna/Cuts/NueCutsSecondAna.h"
14 #include "CAFAna/Cuts/NumuCuts.h"
15 #include "CAFAna/Cuts/SpillCuts.h"
19 #include "CAFAna/Systs/Systs.h"
20 #include "CAFAna/Systs/NumuSysts.h"
21 //#include "CAFAna/Systs/NueSystsSecondAna.h"
22 //#include "CAFAna/Systs/NueSysts.h"
23 #include "CAFAna/Systs/NueExtrapSysts.h"
26 #include "CAFAna/Vars/HistAxes.h"
27 #include "OscLib/IOscCalc.h"
28 #include "TFile.h"
29 
30 using namespace ana;
31 
32 
34 {
35 
36  //std::cerr << "\n\n WARNING datasets correspond to old files (SA ideal condition RHC)"
37  //<<"\n Tested in release R17-02-22-legacy-cafs-v1 \n \n ";
38 
39  TString fileName = "pred_tutorial_nue_numu_rhc-test.root";
40 
41  ////////////////////////////////////////////////////////////
42  // Set up loaders
43  ////////////////////////////////////////////////////////////
45 
46  //std::string ldrFDNonSwap = "prod_decaf_R16-03-03-prod2reco.e_fd_genie_nonswap_nogenierw_rhc_nova_v08_full_nue_or_numu_contain_v1";//6028 files
47  std::string ldrFDNonSwap = "prod_decaf_R17-03-01-prod3reco.l_fd_genie_nonswap_rhc_nova_v08_full_nue_or_numu_or_nus_contain_v1"; //6085 files
48  //std::string ldrFDFlxSwap = "prod_decaf_R16-03-03-prod2reco.e_fd_genie_fluxswap_nogenierw_rhc_nova_v08_full_nue_or_numu_contain_v1"; //5994
49  std::string ldrFDFlxSwap = "prod_decaf_R17-03-01-prod3reco.l_fd_genie_fluxswap_rhc_nova_v08_full_nue_or_numu_or_nus_contain_v1"; //6029 files
50 
51  ldrFDNonSwap = "def_snapshot " + ldrFDNonSwap + " with stride 100";//New synonym for 'dataset_def_name_newest_snapshot'
52  ldrFDFlxSwap = "defname: "+ldrFDFlxSwap + " with stride 100";//What if returns not snapshots?? // Can't find with stride 100?? //limit 100??
53 
56 
58 
59  ////////////////////////////////////////////////////////////
60  // Set up variables, cuts, etc
61  ////////////////////////////////////////////////////////////
62 
63  // Note: Redundancies here for readability and future-proofing.
64  // You can use the kXXX directly in constructors
65 
66  const Var weight = kTuftsWeightCC;
67  const HistAxis numuAxis = kNumuCCAxis;
68  const HistAxis nueAxis = kNueAxisSecondAnaCVN;
69  const Cut numuCutFD = kNumuFD;
70  const Cut nueCutFD = kNueSAFDCVNSsb;
71 
72  //These are silly
73  //std::vector< const ISyst * > numuSysts = {&kMECScaleSyst, &kSARelHadESyst, &kBeamAll}; //ORIGINAL-OLD
74  std::vector< const ISyst * > numuSysts = {kMECScaleSystSA, &kFDHadEnergyScaleSyst, &kBeamAll}; //Note first one doesn't have ampersand '&'
75  //std::vector< const ISyst * > numuSysts(1, &kNumuNormSyst); // Note syntaxis for single-element vector
76 
77  //std::vector< const ISyst * > nueSysts = {&kMECScaleSyst, &kBeamAllTransport, &kNA49};// ORIGINAL-OLD
78  std::vector< const ISyst * > nueSysts = {kMECScaleSystSA, &kBeamAllTransport, &kNA49SA}; //Note first one doesn't have ampersand '&'
79 
80  ////////////////////////////////////////////////////////////
81  //Set up the predictions
82  ////////////////////////////////////////////////////////////
83 
84  NoExtrapGenerator numuGenerator (numuAxis, numuCutFD, weight);
85  NoExtrapGenerator nueGenerator (nueAxis, nueCutFD, weight);
86 
87  auto numuPrediction = numuGenerator.Generate(loaders);
88  auto nuePrediction = nueGenerator.Generate(loaders);
89 
90  auto calc = DefaultOscCalc();
91 
92  NoExtrapGenerator numuGeneratorCopy (numuAxis, numuCutFD, weight);
93  NoExtrapGenerator nueGeneratorCopy (nueAxis, nueCutFD, weight);
94  auto numuPredSysts = new PredictionInterp (numuSysts,calc->Copy(),
95  numuGeneratorCopy,loaders);
96  auto nuePredSysts = new PredictionInterp (nueSysts,calc->Copy(),
97  nueGeneratorCopy,loaders);
98  ////////////////////////////////////////////////////////////
99  // Go! And save everything
100  ////////////////////////////////////////////////////////////
101 
102  loaders.Go();
103 
104  TFile * file = new TFile (fileName,"recreate");
105 
106  numuPrediction->SaveTo(file->mkdir("prediction_numu"));
107  nuePrediction->SaveTo(file->mkdir("prediction_nue"));
108  numuPredSysts->SaveTo(file->mkdir("prediction_systs_numu"));
109  nuePredSysts->SaveTo(file->mkdir("prediction_systs_nue"));
110 
111 }
112 #endif
Implements systematic errors by interpolation between shifted templates.
fileName
Definition: plotROC.py:78
Far Detector at Ash River.
Definition: SREnums.h:11
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const FDHadEnergyScaleSyst kFDHadEnergyScaleSyst(.05)
Definition: EnergySysts.h:75
const Var weight
void make_prediction_rhc()
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
const Cut kNumuFD
Definition: NumuCuts.h:53
const NOvARwgtSyst kMECScaleSystSA("mecScale","MEC Scale", novarwgt::kMECScaleSystSA)
Definition: MECSysts.h:48
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
Generates FD-only predictions (no extrapolation)
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
Definition: HistAxes.h:8
virtual IOscCalc * Copy() const
Definition: OscCalcDumb.h:19
const BeamSyst kBeamAllTransport((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"totErr","beamTransportComb","Combined Beam Transport Systematics")
All Beam Transport systematics combined in quadratures.
Definition: BeamSysts.h:125
static const BeamSyst & kBeamAll
Definition: BeamSysts.h:127
OStream cout
Definition: OStream.cxx:6
std::unique_ptr< IPrediction > Generate(Loaders &loaders, const SystShifts &shiftMC=kNoShift) const override
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Var kTuftsWeightCC
Definition: XsecTunes.h:31
std::vector< Loaders * > loaders
Definition: syst_header.h:386
TFile * file
Definition: cellShifts.C:17
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:46
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