futureSig_getNueNumuSyst.C
Go to the documentation of this file.
1 // make three predictions, one for each period
2 
3 #include "CAFAna/Cuts/Cuts.h"
6 #include "CAFAna/Core/Loaders.h"
7 #include "CAFAna/Core/Binning.h"
11 #include "CAFAna/Systs/Systs.h"
14 #include "OscLib/OscCalcDumb.h"
15 #include "TFile.h"
16 #include "TString.h"
17 
18 #include "futureSig_systs.h"
19 
20 using namespace ana;
21 
24 void setPathsRHC( Loaders& loadersRHC);
25 void SavePrediction (const TString part, const TString period, PredictionInterp * pred,
26  const TString predName, const TString version);
27 
28 void futureSig_getNueNumuSyst(const TString version="v01", const TString options = "fhc1 fhc2 rhc")
29 {
30  bool getFHC1 = options.Contains("fhc1");
31  bool getFHC2 = options.Contains("fhc2");
32  bool getRHC = options.Contains("rhc");
33 
34  ////////////////////////////////////////////////////////////
35  /// Setup loaders
36  ////////////////////////////////////////////////////////////
37  Loaders loadersp123b, loadersp3c;
38  loadersp123b.SetSpillCut(kStandardSpillCuts);
39  loadersp3c.SetSpillCut(kStandardSpillCuts);
40  setPathsFNALP123b(loadersp123b);
41  setPathsFNALP3c(loadersp3c);
42 
43  Loaders loadersRHC;
44  setPathsRHC(loadersRHC);
45 
46  osc::OscCalcDumb dumb;
47 
48  ////////////////////////////////////////////////////////////
49  /// Predictions: nue, numu; FHC P123b, FHC P3c,RHC
50  ////////////////////////////////////////////////////////////
51  // Nue FHC
52  const NuePropExtrapGenerator kNueFHCExtrap (kNueAxisSecondAnaCVN, kNumuCCAxis, kNueSAFDCVNSsb,kNueNDCVNSsb, kNumuND, kNoShift, kTuftsWeightCC);
53  PredictionInterp predNue_123b (systsNueFHC,dumb.Copy(),kNueFHCExtrap,loadersp123b);
54  PredictionInterp predNue_3c (systsNueFHC,dumb.Copy(),kNueFHCExtrap,loadersp3c);
55 
56  // Nue RHC
57  const NoExtrapGenerator kNueRHCExtrap(kNueAxisSecondAnaCVN, kNueSAFDCVNSsb);
58  PredictionInterp predNue_RHC (systsNueRHC,dumb.Copy(),kNueRHCExtrap,loadersRHC);
59 
60  // Numu FHC
62  PredictionInterp predNumu_123b_full (systsNumuFHC,dumb.Copy(),kNumuFHCExtrap_full,loadersp123b);
63  PredictionInterp predNumu_3c_full (systsNumuFHC,dumb.Copy(),kNumuFHCExtrap_full,loadersp3c);
64 
65  //Numu RHC
66  const NoExtrapGenerator kNumuRHCExtrap_full(kNumuCCAxis, kNumuFD);
67  PredictionInterp predNumu_RHC_full (systsNumuRHC,dumb.Copy(),kNumuRHCExtrap_full,loadersRHC);
68 
69  // Test: Numu FHC RHC with half the background
71  PredictionInterp predNumu_123b_half (systsNumuFHC,dumb.Copy(),kNumuFHCExtrap_half,loadersp123b);
72  PredictionInterp predNumu_3c_half (systsNumuFHC,dumb.Copy(),kNumuFHCExtrap_half,loadersp3c);
73 
74  const NoExtrapGenerator kNumuRHCExtrap_half(kNumuCCAxis, kNumuFD, kkNumuBkgHalf);
75  PredictionInterp predNumu_RHC_half (systsNumuRHC,dumb.Copy(),kNumuRHCExtrap_half,loadersRHC);
76 
77  ////////////////////////////////////////////////////////////
78  /// Go! Save everything
79  ////////////////////////////////////////////////////////////
80 
81  if(getFHC1) {
82  loadersp123b.Go();
83  SavePrediction("nue", "FHC1", &predNue_123b, "nue_fhcPrediction_p123b", version);
84  SavePrediction("numu", "FHC1_full", &predNumu_123b_full, "numu_fhcPrediction_p123b_full", version);
85  SavePrediction("numu", "FHC1_half", &predNumu_123b_half, "numu_fhcPrediction_p123b_half", version);
86  }
87 
88  if(getFHC2) {
89  loadersp3c.Go();
90  SavePrediction("nue", "FHC2", &predNue_3c, "nue_fhcPrediction_p3c", version);
91  SavePrediction("numu", "FHC2_full", &predNumu_3c_full, "numu_fhcPrediction_p3c_full", version);
92  SavePrediction("numu", "FHC2_half", &predNumu_3c_half, "numu_fhcPrediction_p3c_half", version);
93  }
94  if(getRHC) {
95  loadersRHC.Go();
96  SavePrediction("nue", "RHC", &predNue_RHC, "nue_rhcPrediction", version);
97  SavePrediction("numu", "RHC_full", &predNumu_RHC_full, "numu_rhcPrediction_full", version);
98  SavePrediction("numu", "RHC_half", &predNumu_RHC_half, "numu_rhcPrediction_half", version);
99  }
100 
101 }
102 
103 
105 {
106 
107  std::string path = "/pnfs/nova/persistent/production/concat/R16-03-03-prod2reco.f/";
108  std::string pathd= "/pnfs/nova/persistent/production/concat/R16-03-03-prod2reco.d/";
109 
110  std::string fname1(path+"period1/prod_decaf_R16-03-03-prod2reco.f_fd_genie_nonswap_fhc_nova_v08_period1_nue_or_numu_contain_v1_prod2-snapshot.root");
111  std::string fnameSwap1(path+"period1/prod_decaf_R16-03-03-prod2reco.f_fd_genie_fluxswap_fhc_nova_v08_period1_nue_or_numu_contain_v1_prod2-snapshot.root");
112  std::string fnameTau1(path+"period1/prod_decaf_R16-03-03-prod2reco.f_fd_genie_tau_fhc_nova_v08_period1_nue_or_numu_contain_v1_prod2-snapshot.root");
113  std::string fnameNDData(pathd+"prod_decaf_R16-03-03-prod2reco.d_nd_numi_fhc_full_nue_or_numu_contain_v1_goodruns_prod2-snapshot.root");
114  std::string fnameNDMC(pathd+"prod_decaf_R16-03-03-prod2reco.d_nd_genie_nonswap_genierw_fhc_nova_v08_epoch1-3c_nue_or_numu_contain_v1_prod2-snapshot/*.root");
115 
116  std::string fname2(path+"period2/prod_decaf_R16-03-03-prod2reco.f_fd_genie_nonswap_fhc_nova_v08_period2_nue_or_numu_contain_v1_prod2-snapshot.root");
117  std::string fnameSwap2(path+"period2/prod_decaf_R16-03-03-prod2reco.f_fd_genie_fluxswap_fhc_nova_v08_period2_nue_or_numu_contain_v1_prod2-snapshot.root");
118  std::string fnameTau2(path+"period2/prod_decaf_R16-03-03-prod2reco.f_fd_genie_tau_fhc_nova_v08_period2_nue_or_numu_contain_v1_prod2-snapshot.root");
119 
120  std::string fname3b(path+"epoch3b/prod_decaf_R16-03-03-prod2reco.f_fd_genie_nonswap_fhc_nova_v08_epoch3b_nue_or_numu_contain_v1_prod2-snapshot.root");
121  std::string fnameSwap3b(path+"epoch3b/prod_decaf_R16-03-03-prod2reco.f_fd_genie_fluxswap_fhc_nova_v08_epoch3b_nue_or_numu_contain_v1_prod2-snapshot.root");
122  std::string fnameTau3b(path+"epoch3b/prod_decaf_R16-03-03-prod2reco.f_fd_genie_tau_fhc_nova_v08_epoch3b_nue_or_numu_contain_v1_prod2-snapshot.root");
123 
124  loaders.SetLoaderFiles({fname1, fname2, fname3b}, caf::kFARDET, Loaders::kMC,
126  loaders.SetLoaderFiles({fnameSwap1,fnameSwap2, fnameSwap3b}, caf::kFARDET, Loaders::kMC,
128  loaders.SetLoaderFiles({fnameTau1, fnameTau2, fnameTau3b}, caf::kFARDET, Loaders::kMC,
130  loaders.SetLoaderPath(fnameNDData, caf::kNEARDET, Loaders::kData);
131  loaders.SetLoaderPath(fnameNDMC, caf::kNEARDET, Loaders::kMC);
132 }
133 
135 {
136  std::string path = "/pnfs/nova/persistent/production/concat/R16-03-03-prod2reco.f/";
137  std::string pathd= "/pnfs/nova/persistent/production/concat/R16-03-03-prod2reco.d/";
138 
139  std::string fname3c(path+"epoch3c/prod_decaf_R16-03-03-prod2reco.f_fd_genie_nonswap_fhc_nova_v08_epoch3c_nue_or_numu_contain_v1_prod2-snapshot.root");
140  std::string fnameSwap3c(path+"epoch3c/prod_decaf_R16-03-03-prod2reco.f_fd_genie_fluxswap_fhc_nova_v08_epoch3c_nue_or_numu_contain_v1_prod2-snapshot.root");
141  std::string fnameTau3c(path+"epoch3c/prod_decaf_R16-03-03-prod2reco.f_fd_genie_tau_fhc_nova_v08_epoch3c_nue_or_numu_contain_v1_prod2-snapshot.root");
142  std::string fnameNDData(pathd+"prod_decaf_R16-03-03-prod2reco.d_nd_numi_fhc_full_nue_or_numu_contain_v1_goodruns_prod2-snapshot.root");
143  std::string fnameNDMC(pathd+"prod_decaf_R16-03-03-prod2reco.d_nd_genie_nonswap_genierw_fhc_nova_v08_epoch1-3c_nue_or_numu_contain_v1_prod2-snapshot/*.root");
144 
145  loaders.SetLoaderPath(fname3c, caf::kFARDET, Loaders::kMC,
147  loaders.SetLoaderPath(fnameSwap3c, caf::kFARDET, Loaders::kMC,
149  loaders.SetLoaderPath(fnameTau3c, caf::kFARDET, Loaders::kMC,
151  loaders.SetLoaderPath(fnameNDData, caf::kNEARDET, Loaders::kData);
152  loaders.SetLoaderPath(fnameNDMC, caf::kNEARDET, Loaders::kMC);
153 }
154 
155 void setPathsRHC( Loaders& loadersRHC){
156  std::string fname = "prod_decaf_R16-03-03-prod2reco.e_fd_genie_nonswap_nogenierw_rhc_nova_v08_full_nue_or_numu_contain_v1";
157  std::string fswap ="prod_decaf_R16-03-03-prod2reco.e_fd_genie_fluxswap_nogenierw_rhc_nova_v08_full_nue_or_numu_contain_v1";
158 
159  //Unofficial concats
160  fname = "/pnfs/nova/users/ecatanom/concat/prod_decaf_R16-03-03-prod2reco.e_fd_genie_nonswap_nogenierw_rhc_nova_v08_full_nue_or_numu_contain_v1.root";
161  fswap = "/pnfs/nova/users/ecatanom/concat/prod_decaf_R16-03-03-prod2reco.e_fd_genie_fluxswap_nogenierw_rhc_nova_v08_full_nue_or_numu_contain_v1.root";
162 
166 }
167 
168 void SavePrediction (const TString part, const TString period, PredictionInterp * pred, const TString predName, const TString version){
169  TString dir = "root_predictions/";
170  gSystem->mkdir(dir);
171  TFile * output = new TFile (dir+"predInterp_"+part+"_" + period + "_"+ version +".root", "RECREATE");
172  pred->SaveTo(output, predName);
173  std::cout << "Wrote prediction to " << output->GetName() << std::endl;
174  delete output;
175 }
Near Detector underground.
Definition: SREnums.h:10
ofstream output
Implements systematic errors by interpolation between shifted templates.
Far Detector at Ash River.
Definition: SREnums.h:11
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
std::vector< const ISyst * > systsNumuFHC
void DisableLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Definition: Loaders.cxx:65
const Cut kNumuFD
Definition: NumuCuts.h:53
Generates FD-only predictions (no extrapolation)
const Var kkNumuBkgHalf([](const caf::SRProxy *sr){if((kkIsFD &&!kIsNumuCC)(sr)) return 0.5;return 1.;})
Generates extrapolated Numu predictions.
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
Generates extrapolated Nue predictions using ProportionalDecomp.
TString part[npart]
Definition: Style.C:32
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
Definition: HistAxes.h:8
std::vector< const ISyst * > systsNueFHC
const Cut kNumuND
Definition: NumuCuts.h:55
Simple oscillation probability calculator that has no solar term or mass hierarchy or delta so it&#39;s s...
Definition: OscCalcDumb.h:16
void setPathsRHC(Loaders &loadersRHC)
void setPathsFNALP3c(Loaders &loaders)
std::vector< const ISyst * > systsNumuRHC
const SystShifts kNoShift
Definition: SystShifts.cxx:21
OStream cout
Definition: OStream.cxx:6
std::vector< const ISyst * > systsNueRHC
const XML_Char * version
Definition: expat.h:187
const std::string path
Definition: plot_BEN.C:43
void SetLoaderFiles(const std::vector< std::string > &files, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via explicit file list.
Definition: Loaders.cxx:45
void SavePrediction(const TString part, const TString period, PredictionInterp *pred, const TString predName, const TString version)
const Var kTuftsWeightCC
Definition: XsecTunes.h:31
TDirectory * dir
Definition: macro.C:5
std::vector< Loaders * > loaders
Definition: syst_header.h:386
void futureSig_getNueNumuSyst(const TString version="v01", const TString options="fhc1 fhc2 rhc")
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
void setPathsFNALP123b(Loaders &loaders)
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
virtual IOscCalc * Copy() const override
Definition: OscCalcDumb.h:19
enum BeamMode string