All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrivialExtrap.cxx
Go to the documentation of this file.
2 
6 
7 #include "TDirectory.h"
8 #include "TObjString.h"
9 
10 namespace ana
11 {
12  //----------------------------------------------------------------------
14  SpectrumLoaderBase& loaderNue,
15  SpectrumLoaderBase& loaderNuTau,
16  SpectrumLoaderBase& loaderIntrinsic,
17  const HistAxis& axis,
18  const SpillCut& spillcut,
19  const Cut& cut,
20  const SystShifts& shift,
21  const Var& wei)
22  :
23  fNueApp (loaderNue, axis, spillcut, cut && kIsNueApp && !kIsAntiNu, shift, wei),
24  fNueAppAnti (loaderNue, axis, spillcut, cut && kIsNueApp && kIsAntiNu, shift, wei),
25 
26  fNumuSurv (loaderNonswap, axis, spillcut, cut && kIsNumuCC && !kIsAntiNu, shift, wei),
27  fNumuSurvAnti (loaderNonswap, axis, spillcut, cut && kIsNumuCC && kIsAntiNu, shift, wei),
28 
29  fNumuApp (loaderNuTau, axis, spillcut, cut && kIsNumuApp && !kIsAntiNu, shift, wei),
30  fNumuAppAnti (loaderNuTau, axis, spillcut, cut && kIsNumuApp && kIsAntiNu, shift, wei),
31 
32  fNueSurv (loaderIntrinsic, axis, spillcut, cut && kIsBeamNue && !kIsAntiNu, shift, wei),
33  fNueSurvAnti (loaderIntrinsic, axis, spillcut, cut && kIsBeamNue && kIsAntiNu, shift, wei),
34 
35  fTauFromE (loaderNue, axis, spillcut, cut && kIsTauFromE && !kIsAntiNu, shift, wei),
36  fTauFromEAnti (loaderNue, axis, spillcut, cut && kIsTauFromE && kIsAntiNu, shift, wei),
37 
38  fTauFromMu (loaderNuTau, axis, spillcut, cut && kIsTauFromMu && !kIsAntiNu, shift, wei),
39  fTauFromMuAnti(loaderNuTau, axis, spillcut, cut && kIsTauFromMu && kIsAntiNu, shift, wei),
40 
41  fNCFromNumu (loaderNonswap, axis, spillcut, cut && kIsNCFromNumu, shift, wei),
42  fNCFromNue (loaderNonswap, axis, spillcut, cut && kIsNCFromNue, shift, wei)
43  {
44  // All swapped files are equally valid as a source of NCs. This
45  // approximately doubles/triples our statistics. SpectrumLoader just adds
46  // events and POT for both cases, which is the right thing to do.
47 
48  loaderNue .AddReweightableSpectrum(fNCFromNumu, axis.GetMultiDVar(), spillcut, cut && kIsNCFromNumu, shift, wei);
49  loaderNuTau.AddReweightableSpectrum(fNCFromNumu, axis.GetMultiDVar(), spillcut, cut && kIsNCFromNumu, shift, wei);
50 
51  loaderNue .AddReweightableSpectrum(fNCFromNue, axis.GetMultiDVar(), spillcut, cut && kIsNCFromNue, shift, wei);
52  loaderNuTau.AddReweightableSpectrum(fNCFromNue, axis.GetMultiDVar(), spillcut, cut && kIsNCFromNue, shift, wei);
53 
54  //Also load in intrinsic nues from nonswap file
55  loaderNonswap.AddReweightableSpectrum(fNueSurv, axis.GetMultiDVar(), spillcut, cut && kIsBeamNue && !kIsAntiNu, shift, wei);
56  loaderNonswap.AddReweightableSpectrum(fNueSurvAnti, axis.GetMultiDVar(), spillcut, cut && kIsBeamNue && kIsAntiNu, shift, wei);
57 
58  }
59 
60 
61  //----------------------------------------------------------------------
63  SpectrumLoaderBase& loaderNue,
64  SpectrumLoaderBase& loaderNuTau,
65  SpectrumLoaderBase& loaderIntrinsic,
66  std::string label,
67  const Binning& bins,
68  const Var& var,
69  const SpillCut& spillcut,
70  const Cut& cut,
71  const SystShifts& shift,
72  const Var& wei)
73  :
74  TrivialExtrap(loaderNonswap, loaderNue, loaderNuTau, loaderIntrinsic,
75  HistAxis(label, bins, var),
76  spillcut, cut, shift, wei)
77  {
78  }
79 
80  //----------------------------------------------------------------------
82  std::string label,
83  const Binning& bins,
84  const Var& var,
85  const SpillCut& spillcut,
86  const Cut& cut,
87  const SystShifts& shift,
88  const Var& wei)
89  : TrivialExtrap(loaders, HistAxis(label, bins, var), spillcut, cut, shift, wei)
90  {
91  }
92 
93  //----------------------------------------------------------------------
95  const HistAxis& axis,
96  const SpillCut& spillcut,
97  const Cut& cut,
98  const SystShifts& shift,
99  const Var& wei)
100  : TrivialExtrap(loaders.GetLoader(Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
101  loaders.GetLoader(Loaders::kMC, ana::kBeam, Loaders::kNueSwap),
102  loaders.GetLoader(Loaders::kMC, ana::kBeam, Loaders::kNuTauSwap),
103  loaders.GetLoader(Loaders::kMC, ana::kBeam, Loaders::kIntrinsic),
104  axis, spillcut, cut, shift, wei)
105  {
106  }
107 
108  //----------------------------------------------------------------------
109  void TrivialExtrap::SaveTo(TDirectory* dir) const
110  {
111  TDirectory* tmp = gDirectory;
112 
113  dir->cd();
114 
115  TObjString("TrivialExtrap").Write("type");
116 
117  fNueApp.SaveTo(dir->mkdir("nue_app"));
118  fNueAppAnti.SaveTo(dir->mkdir("nue_app_anti"));
119  fNCFromNumu.SaveTo(dir->mkdir("nc_from_numu"));
120  fNCFromNue.SaveTo(dir->mkdir("nc_from_nue"));
121  fNumuSurv.SaveTo(dir->mkdir("numu_surv"));
122  fNumuSurvAnti.SaveTo(dir->mkdir("numu_surv_anti"));
123  fNumuApp.SaveTo(dir->mkdir("numu_app"));
124  fNumuAppAnti.SaveTo(dir->mkdir("numu_app_anti"));
125  fNueSurv.SaveTo(dir->mkdir("nue_surv"));
126  fNueSurvAnti.SaveTo(dir->mkdir("nue_surv_anti"));
127  fTauFromE.SaveTo(dir->mkdir("nutau_from_nue"));
128  fTauFromEAnti.SaveTo(dir->mkdir("nutau_from_nue_anti"));
129  fTauFromMu.SaveTo(dir->mkdir("nutau_from_numu"));
130  fTauFromMuAnti.SaveTo(dir->mkdir("nutau_from_numu_anti"));
131 
132  tmp->cd();
133  }
134 
135  //----------------------------------------------------------------------
136  std::unique_ptr<TrivialExtrap> TrivialExtrap::LoadFrom(TDirectory* dir)
137  {
138  std::unique_ptr<TrivialExtrap> ret(new TrivialExtrap);
139 
140  // This is a lot of repetitive typing. Define some macros
141 #define LOAD_OSC(FIELD, LABEL) assert(dir->GetDirectory(LABEL)); ret->FIELD = *OscillatableSpectrum::LoadFrom(dir->GetDirectory(LABEL));
142 #define LOAD_SPECT(FIELD, LABEL) assert(dir->GetDirectory(LABEL)); ret->FIELD = *Spectrum::LoadFrom(dir->GetDirectory(LABEL));
143 
144  LOAD_OSC(fNueApp, "nue_app");
145  LOAD_OSC(fNueAppAnti, "nue_app_anti");
146  LOAD_OSC(fNumuSurv, "numu_surv");
147  LOAD_OSC(fNumuSurvAnti, "numu_surv_anti");
148  LOAD_OSC(fNumuApp, "numu_app");
149  LOAD_OSC(fNumuAppAnti, "numu_app_anti");
150  LOAD_OSC(fNueSurv, "nue_surv");
151  LOAD_OSC(fNueSurvAnti, "nue_surv_anti");
152  LOAD_OSC(fTauFromE, "nutau_from_nue");
153  LOAD_OSC(fTauFromEAnti, "nutau_from_nue_anti");
154  LOAD_OSC(fTauFromMu, "nutau_from_numu");
155  LOAD_OSC(fTauFromMuAnti, "nutau_from_numu_anti");
156  LOAD_OSC(fNCFromNumu, "nc_from_numu");
157  LOAD_OSC(fNCFromNue, "nc_from_nue");
158 
159  return ret;
160  }
161 }
OscillatableSpectrum fTauFromMuAnti
Definition: TrivialExtrap.h:91
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
OscillatableSpectrum fNueAppAnti
Definition: TrivialExtrap.h:86
OscillatableSpectrum fNueSurvAnti
Definition: TrivialExtrap.h:89
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:18
OscillatableSpectrum fNCFromNue
Definition: TrivialExtrap.h:92
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
OscillatableSpectrum fTauFromE
Definition: TrivialExtrap.h:90
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:12
const Cut kIsBeamNue(CCFlavSel(12, 12))
Select CC .
const Cut kIsNumuApp(CCFlavSel(14, 12))
Select CC .
OscillatableSpectrum fNCFromNumu
Definition: TrivialExtrap.h:92
OscillatableSpectrum fNueApp
Definition: TrivialExtrap.h:86
OscillatableSpectrum fNumuAppAnti
Definition: TrivialExtrap.h:88
process_name opflashCryoW ana
shift
Definition: fcl_checks.sh:26
OscillatableSpectrum fNumuSurvAnti
Definition: TrivialExtrap.h:87
virtual void SaveTo(TDirectory *dir) const
&quot;Extrapolation&quot; that simply returns the MC prediction
Definition: TrivialExtrap.h:10
const Cut kIsTauFromE(CCFlavSel(16, 12))
Select CC .
const Cut kIsNCFromNue(NCFlavOrig(12))
const Cut kIsTauFromMu(CCFlavSel(16, 14))
Select CC .
virtual void AddReweightableSpectrum(ReweightableSpectrum &spect, const Var &var, const Cut &cut, const SystShifts &shift, const Var &wei)
For use by the constructors of ReweightableSpectrum subclasses.
const Cut kIsNCFromNumu(NCFlavOrig(14))
static std::unique_ptr< TrivialExtrap > LoadFrom(TDirectory *dir)
OscillatableSpectrum fTauFromMu
Definition: TrivialExtrap.h:91
OscillatableSpectrum fNueSurv
Definition: TrivialExtrap.h:89
OscillatableSpectrum fNumuApp
Definition: TrivialExtrap.h:88
OscillatableSpectrum fTauFromEAnti
Definition: TrivialExtrap.h:90
tuple dir
Definition: dropbox.py:28
Base class for the various types of spectrum loader.
T GetMultiDVar() const
Definition: HistAxis.cxx:66
OscillatableSpectrum fNumuSurv
Definition: TrivialExtrap.h:87
#define LOAD_OSC(FIELD, LABEL)
const Cut kIsAntiNu([](const caf::SRSliceProxy *slc){return kHasMatchedNu(slc)&&slc->truth.pdg< 0;})
Is this truly an antineutrino?
const Cut kIsNueApp(CCFlavSel(12, 14))
Select CC .
void SaveTo(TDirectory *dir) const