ModularExtrap.cxx
Go to the documentation of this file.
2 
5 #include "CAFAna/Core/Loaders.h"
7 
8 #include "TObjString.h"
9 #include "TDirectory.h"
10 
11 namespace ana
12 {
13  REGISTER_LOADFROM("ModularExtrap", IExtrap, ModularExtrap);
14 
15  //---------------------------------------------------------------------------
16 
17  void ModularExtrap::SaveTo(TDirectory* dir, const std::string& name) const
18  {
19  TDirectory* tmp = gDirectory;
20 
21  dir = dir->mkdir(name.c_str()); // switch to subdir
22  dir->cd();
23 
24  TObjString("ModularExtrap").Write("type");
25 
26  fEEextrap->SaveTo(dir, "EEextrap");
27  fEMextrap->SaveTo(dir, "EMextrap");
28  fMEextrap->SaveTo(dir, "MEextrap");
29  fMMextrap->SaveTo(dir, "MMextrap");
30  fEEAntiextrap->SaveTo(dir, "EEAntiextrap");
31  fEMAntiextrap->SaveTo(dir, "EMAntiextrap");
32  fMEAntiextrap->SaveTo(dir, "MEAntiextrap");
33  fMMAntiextrap->SaveTo(dir, "MMAntiextrap");
34  fMTextrap->SaveTo(dir, "MTextrap");
35  fETextrap->SaveTo(dir, "ETextrap");
36  fMTAntiextrap->SaveTo(dir, "MTAntiextrap");
37  fETAntiextrap->SaveTo(dir, "ETAntiextrap");
38  //nc
39  fNCTotalextrap->SaveTo(dir, "NCTotalextrap");
40  fNCAntiextrap->SaveTo(dir, "NCAntiextrap");
41  fNCextrap->SaveTo(dir, "NCextrap");
42  //end nc
43 
44  dir->Write();
45  delete dir;
46 
47  tmp->cd();
48  }
49 
50  //---------------------------------------------------------------------------
51 
52  void ModularExtrap::SavePlotsNue( TDirectory* dir, double potFD ) const
53  {
54  TDirectory* tmp = gDirectory;
55  dir->cd();
56  fMEextrap->SavePlots( dir->mkdir("MEextrap"), potFD );
57  fMEAntiextrap->SavePlots( dir->mkdir("MEAntiextrap"), potFD );
58  fEEextrap->SavePlots( dir->mkdir("EEextrap"), potFD );
59  fMMextrap->SavePlots( dir->mkdir("MMextrap"), potFD );
60  fNCTotalextrap->SavePlots( dir->mkdir("NCTotalextrap"), potFD );
61  tmp->cd();
62  }
63 
64  //---------------------------------------------------------------------------
65 
66  void ModularExtrap::SavePlotsNueRHC( TDirectory* dir, double potFD ) const
67  {
68  TDirectory* tmp = gDirectory;
69  dir->cd();
70  fMEextrap->SavePlots( dir->mkdir("MEextrap"), potFD );
71  fMEAntiextrap->SavePlots( dir->mkdir("MEAntiextrap"), potFD );
72  fEEextrap->SavePlots( dir->mkdir("EEextrap"), potFD );
73  fEEAntiextrap->SavePlots( dir->mkdir("EEAntiextrap"), potFD );
74  fMMextrap->SavePlots( dir->mkdir("MMextrap"), potFD );
75  fMMAntiextrap->SavePlots( dir->mkdir("MMAntiextrap"), potFD );
76  fNCextrap->SavePlots( dir->mkdir("NCextrap"), potFD );
77  fNCAntiextrap->SavePlots( dir->mkdir("NCAntiextrap"), potFD );
78  tmp->cd();
79  }
80 
81  //---------------------------------------------------------------------------
82 
83  void ModularExtrap::SavePlotsNumu( TDirectory* dir, double potFD ) const
84  {
85  TDirectory* tmp = gDirectory;
86  dir->cd();
87  fMMextrap->SavePlots( dir->mkdir("MMextrap"), potFD );
88  fMMAntiextrap->SavePlots( dir->mkdir("MMAntiextrap"), potFD );
89  tmp->cd();
90  }
91 
92  //---------------------------------------------------------------------------
93 
94  std::unique_ptr<ModularExtrap> ModularExtrap::LoadFrom(TDirectory* dir, const std::string& name)
95  {
96  dir = dir->GetDirectory(name.c_str()); // switch to subdir
97  assert(dir);
98 
99  std::unique_ptr<ModularExtrap> ret(new ModularExtrap);
100 
101  ret->fEEextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "EEextrap");
102  ret->fEMextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "EMextrap");
103  ret->fMEextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "MEextrap");
104  ret->fMMextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "MMextrap");
105  ret->fEEAntiextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "EEAntiextrap");
106  ret->fEMAntiextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "EMAntiextrap");
107  ret->fMEAntiextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "MEAntiextrap");
108  ret->fMMAntiextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "MMAntiextrap");
109  ret->fNCTotalextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "NCTotalextrap");
110  ret->fNCextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "NCextrap");
111  ret->fNCAntiextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "NCAntiextrap");
112  ret->fMTextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "MTextrap");
113  ret->fETextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "ETextrap");
114  ret->fMTAntiextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "MTAntiextrap");
115  ret->fETAntiextrap = ana::LoadFrom<ModularExtrapComponent>(dir, "ETAntiextrap");
116 
117  delete dir;
118 
119  return ret;
120  }
121 
122  //---------------------------------------------------------------------------
123 
125  SpectrumLoaderBase& farMCswap,
126  SpectrumLoaderBase& farMCnonswap,
127  SpectrumLoaderBase& farMCtauswap,
128  const HistAxis& axis,
129  const Cut& fdcut,
130  const SystShifts& shiftMC,
131  const Var& weight
132  ) :
133 
134  // e -> e ----
136  farMCnonswap, axis, fdcut, shiftMC, weight, kIsBeamNue&&!kIsAntiNu)),
138  farMCnonswap, axis, fdcut, shiftMC, weight, kIsBeamNue&&kIsAntiNu)),
139 
140  // mu -> mu ----
142  farMCnonswap, axis, fdcut, shiftMC, weight, kIsNumuCC&&!kIsAntiNu)),
144  farMCnonswap, axis, fdcut, shiftMC, weight, kIsNumuCC&&kIsAntiNu)),
145 
146  // mu -> e ----
148  farMCswap, axis, fdcut, shiftMC, weight, kIsSig&&!kIsAntiNu)),
150  farMCswap, axis, fdcut, shiftMC, weight, kIsSig&&kIsAntiNu)),
151 
152  // e -> mu ----
154  farMCswap, axis, fdcut, shiftMC, weight, kIsNumuApp&&!kIsAntiNu)),
156  farMCswap, axis, fdcut, shiftMC, weight, kIsNumuApp&&kIsAntiNu)),
157 
158  // NC -> NC ----
160  farMCnonswap, axis, fdcut, shiftMC, weight, kIsNC, farMCswap, farMCtauswap)),
162  farMCnonswap, axis, fdcut, shiftMC, weight, kIsNC&&!kIsAntiNu, farMCswap, farMCtauswap)),
164  farMCnonswap, axis, fdcut, shiftMC, weight, kIsNC&&kIsAntiNu, farMCswap, farMCtauswap)),
165 
166  // mu -> tau ----
168  farMCtauswap, axis, fdcut, shiftMC, weight, kIsTauFromMu&&!kIsAntiNu)),
170  farMCtauswap, axis, fdcut, shiftMC, weight, kIsTauFromMu&&kIsAntiNu)),
171 
172  // e -> tau ----
174  farMCtauswap, axis, fdcut, shiftMC, weight, kIsTauFromE&&!kIsAntiNu)),
176  farMCtauswap, axis, fdcut, shiftMC, weight, kIsTauFromE&&kIsAntiNu))
177 
178  {}
179 
180  //---------------------------------------------------------------------------
181 
183  {return fEEextrap->Return();}
184 
186  {return fEEAntiextrap->Return();}
187 
189  {return fMMextrap->Return();}
190 
192  {return fMMAntiextrap->Return();}
193 
195  {return fMEextrap->Return();}
196 
198  {return fMEAntiextrap->Return();}
199 
201  {return fEMextrap->Return();}
202 
204  {return fEMAntiextrap->Return();}
205 
207  {return fNCextrap->Return().Unoscillated();}
208 
210  {return fNCAntiextrap->Return().Unoscillated();}
211 
213  {return NCComponent() + NCAntiComponent() ;}
214 
216  {return fMTextrap->Return();}
217 
219  {return fMTAntiextrap->Return();}
220 
222  {return fETextrap->Return();}
223 
225  {return fETAntiextrap->Return();}
226 
227 }
OscillatableSpectrum AntiTauFromEComponent() override
Charged current tau antineutrino appearance from electron antineutrino ( )
const XML_Char * name
Definition: expat.h:151
OscillatableSpectrum NueAppComponent() override
Charged current electron neutrino appearance ( )
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
std::unique_ptr< ModularExtrapComponent > fMMextrap
Definition: ModularExtrap.h:92
std::unique_ptr< ModularExtrapComponent > LoadFrom< ModularExtrapComponent >(TDirectory *dir, const std::string &label)
void SaveTo(TDirectory *dir, const std::string &name) const override
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var weight
"Extrapolates" component by returning FD Monte Carlo.
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
Spectrum NCTotalComponent() override
Neutral currents.
std::unique_ptr< ModularExtrapComponent > fMEextrap
Definition: ModularExtrap.h:94
OscillatableSpectrum AntiNueSurvComponent() override
Charged current electron antineutrino survival ( )
void SavePlotsNueRHC(TDirectory *dir, double potFD) const
const Cut kIsAntiNu([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return sr->mc.nu[0].pdg< 0;})
Is this truly an antineutrino?
Definition: TruthCuts.h:53
const Cut kIsBeamNue(CCFlavSel(12, 12))
Select CC .
const Cut kIsNumuApp(CCFlavSel(14, 12))
Select CC .
std::unique_ptr< ModularExtrapComponent > fEMAntiextrap
Definition: ModularExtrap.h:97
OscillatableSpectrum TauFromMuComponent() override
Charged current tau neutrino appearance from muon neutrino ( )
Float_t tmp
Definition: plot.C:36
OscillatableSpectrum NumuSurvComponent() override
Charged current muon neutrino survival ( )
void SavePlotsNue(TDirectory *dir, double potFD) const
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
std::unique_ptr< ModularExtrapComponent > fNCextrap
std::unique_ptr< ModularExtrapComponent > fMTAntiextrap
std::unique_ptr< ModularExtrapComponent > fNCTotalextrap
Definition: ModularExtrap.h:99
const Cut kIsTauFromE(CCFlavSel(16, 12))
Select CC .
std::unique_ptr< ModularExtrapComponent > fMEAntiextrap
Definition: ModularExtrap.h:95
OscillatableSpectrum NueSurvComponent() override
Charged current electron neutrino survival ( )
void SavePlotsNumu(TDirectory *dir, double potFD) const
const Cut kIsTauFromMu(CCFlavSel(16, 14))
Select CC .
const Cut kIsNC([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return!sr->mc.nu[0].iscc;})
Is this a Neutral Current event?
Definition: TruthCuts.h:8
const Cut kIsSig(CCFlavSel(12, 14))
Select CC .
OscillatableSpectrum AntiNumuSurvComponent() override
Charged current muon antineutrino survival ( )
std::unique_ptr< ModularExtrapComponent > fEMextrap
Definition: ModularExtrap.h:96
std::unique_ptr< ModularExtrapComponent > fEEAntiextrap
Definition: ModularExtrap.h:91
static std::unique_ptr< ModularExtrap > LoadFrom(TDirectory *dir, const std::string &name)
OscillatableSpectrum NumuAppComponent() override
Charged current muon neutrino appearance ( )
Base class for the various types of spectrum loader.
std::unique_ptr< ModularExtrapComponent > fNCAntiextrap
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
OscillatableSpectrum TauFromEComponent() override
Charged current tau neutrino appearance from electron neutrino ( )
OscillatableSpectrum AntiTauFromMuComponent() override
Charged current tau antineutrino appearance from muon antineutrino ( )
std::unique_ptr< ModularExtrapComponent > fMMAntiextrap
Definition: ModularExtrap.h:93
TDirectory * dir
Definition: macro.C:5
REGISTER_LOADFROM("BENDecomp", IDecomp, BENDecomp)
Spectrum NCAntiComponent() override
assert(nhit_max >=nhit_nbins)
Spectrum NCComponent() override
OscillatableSpectrum AntiNumuAppComponent() override
Charged current muon antineutrino appearance ( )
OscillatableSpectrum AntiNueAppComponent() override
Charged current electron antineutrino appearance ( )
std::unique_ptr< ModularExtrapComponent > fETAntiextrap
Spectrum with true energy information, allowing it to be oscillated
Extrapolate each component using a separate ModularExtrapComponent.
Definition: ModularExtrap.h:23
std::unique_ptr< ModularExtrapComponent > fEEextrap
Definition: ModularExtrap.h:90
std::unique_ptr< ModularExtrapComponent > fMTextrap
std::unique_ptr< ModularExtrapComponent > fETextrap