Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ana::FluxReweight Class Referenceabstract

Extrapolation for flux true space reweight. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/3FlavorAna/Extrap/FluxReweight.h"

Inheritance diagram for ana::FluxReweight:
ana::ModularExtrapComponent

Public Member Functions

 FluxReweight (SpectrumLoaderBase &ndloader, const HistAxis &axis, const Cut &fdcut, const SystShifts &shiftMC, const Var &weight, std::string label, std::string latex, const Cut &ndcut, const FluxDecomp &decomposition, SpectrumLoaderBase &fdloader, const Cut &flavors, SpectrumLoaderBase &extrafdloaderswap=kNullLoader, SpectrumLoaderBase &extrafdloadertau=kNullLoader)
 
 ~FluxReweight ()
 
OscillatableSpectrum Eval () const override
 Core extrapolation math. More...
 
void SaveTo (TDirectory *dir, const std::basic_string< char > &name) const override
 
void SavePlots (TDirectory *dir, double potFD) const override
 
TH1 * OptimalBinning (double potMCFD, double potMCND) const
 
TH1 * OptimalBinningFit (double potMCFD, double potMCND) const
 
const FluxDecompGetDecomp () const override
 
virtual void SaveTo (TDirectory *dir, const std::string &name) const =0
 
const OscillatableSpectrumReturn () const
 Interface so that result of Eval() is called only once and cached. More...
 

Static Public Member Functions

static std::unique_ptr< FluxReweightLoadFrom (TDirectory *dir, const std::basic_string< char > &name)
 
static TH1 * OptimalBinningHelper (TH1 *, TH1 *)
 
static void SetQuiet (bool quiet=true)
 

Static Protected Member Functions

static Spectrum GetDecompResult (const IDecomp &, DecompResult)
 Helper function to pick out single Spectrum from a decomposition. More...
 
static std::string DRToString (DecompResult)
 Helper function to turn a DecompResult into a string (for storage). More...
 
static DecompResult StringToDR (std::string)
 Helper function to turn a string into a DecompResult (for loading). More...
 
static Ratio FormSmartRatio (const Spectrum &num, const Spectrum &denom, std::string component, std::string location, const Spectrum &mult)
 Form Ratio, but be aware of zero division. More...
 
static void ComparisonPlot (Spectrum mc, Spectrum notMC, double pot, std::string notMCLabel, int notMCColor, std::string latex, std::string title, std::string saveAs, bool restrictRange=false)
 

Private Member Functions

 FluxReweight (Spectrum recoNDPi, Spectrum recoNDOther, OscillatableSpectrum trueToRecoFDPi, OscillatableSpectrum trueToRecoFDOther, const FluxDecomp &decomp, std::basic_string< char > label, std::basic_string< char > latex)
 

Private Attributes

Spectrum fRecoNDPi
 
Spectrum fRecoNDOther
 
OscillatableSpectrum fTrueToRecoFDPi
 
OscillatableSpectrum fTrueToRecoFDOther
 
const FluxDecompfDecomp
 
bool fOwnDecomp
 
std::basic_string< char > fLabel
 
std::basic_string< char > fLatex
 
OscillatableSpectrum fReturnFDPi = OscillatableSpectrum::Uninitialized()
 
OscillatableSpectrum fReturnFDOther = OscillatableSpectrum::Uninitialized()
 

Friends

class ModularExtrap
 

Detailed Description

Extrapolation for flux true space reweight.

Definition at line 16 of file FluxReweight.h.

Constructor & Destructor Documentation

ana::FluxReweight::FluxReweight ( SpectrumLoaderBase ndloader,
const HistAxis axis,
const Cut fdcut,
const SystShifts shiftMC,
const Var weight,
std::string  label,
std::string  latex,
const Cut ndcut,
const FluxDecomp decomposition,
SpectrumLoaderBase fdloader,
const Cut flavors,
SpectrumLoaderBase extrafdloaderswap = kNullLoader,
SpectrumLoaderBase extrafdloadertau = kNullLoader 
)

Definition at line 24 of file FluxReweight.cxx.

References ana::SpectrumLoaderBase::AddReweightableSpectrum(), fTrueToRecoFDOther, fTrueToRecoFDPi, ana::_HistAxis< T >::GetVar1D(), ana::kIsAllFromPions, ana::kTrueE, and ana::weight.

Referenced by LoadFrom().

39  : fRecoNDPi(ndloader, axis, ndcut && flavors && kIsAllFromPions, shiftMC, weight),
40  fRecoNDOther(ndloader, axis, ndcut && flavors && !kIsAllFromPions, shiftMC, weight),
41  fTrueToRecoFDPi(fdloader, axis, fdcut && flavors && kIsAllFromPions, shiftMC, weight),
42  fTrueToRecoFDOther(fdloader, axis, fdcut && flavors && !kIsAllFromPions, shiftMC, weight),
43  // can remove beamnue and antinu cut
44 // fNueCCFromPiPtPz(fdloader, ktpzAxis, ktpTAxis, axis, fdcut && kIsBeamNue && kIsAllFromPions&& kIsAntiNu, shiftMC, weight),
45 // fNueCCFromOther(fdloader, ktpzAxis, ktpTAxis, axis, fdcut && kIsBeamNue && !kIsAllFromPions&& kIsAntiNu, shiftMC, weight),
46  fDecomp(&decomposition),
47  fOwnDecomp(false),
48  fLabel(label),
49  fLatex(latex)
50  {
51 /* extrafdloaderswap.AddReweightableSpectrum(
52  fNueCCFromPiPtPz, axis.GetVar1D(), fdcut && fdflavors && kIsAllFromPions, shiftMC, weight);
53  extrafdloadertau.AddReweightableSpectrum(
54  fNueCCFromPiPtPz, axis.GetVar1D(), fdcut && fdflavors && kIsAllFromPions, shiftMC, weight);
55 
56  extrafdloaderswap.AddReweightableSpectrum(
57  fNueCCFromOther, axis.GetVar1D(), fdcut && fdflavors && !kIsAllFromPions, shiftMC, weight);
58  extrafdloadertau.AddReweightableSpectrum(
59  fNueCCFromOther, axis.GetVar1D(), fdcut && fdflavors && !kIsAllFromPions, shiftMC, weight);
60 */
61  extrafdloaderswap.AddReweightableSpectrum(
62  fTrueToRecoFDPi, axis.GetVar1D(), kTrueE, fdcut && flavors && kIsAllFromPions, shiftMC, weight);
63  extrafdloadertau.AddReweightableSpectrum(
64  fTrueToRecoFDPi, axis.GetVar1D(), kTrueE, fdcut && flavors && kIsAllFromPions, shiftMC, weight);
65  extrafdloaderswap.AddReweightableSpectrum(
66  fTrueToRecoFDOther, axis.GetVar1D(), kTrueE, fdcut && flavors && !kIsAllFromPions, shiftMC, weight);
67  extrafdloadertau.AddReweightableSpectrum(
68  fTrueToRecoFDOther, axis.GetVar1D(), kTrueE, fdcut && flavors && !kIsAllFromPions, shiftMC, weight);
69 
70  }
void latex(double x, double y, std::string txt, double ang=0, int align=22, double size=0.042)
OscillatableSpectrum fTrueToRecoFDPi
Definition: FluxReweight.h:66
std::basic_string< char > fLatex
Definition: FluxReweight.h:73
const Var weight
Spectrum fRecoNDOther
Definition: FluxReweight.h:65
Spectrum fRecoNDPi
Definition: FluxReweight.h:64
const char * label
const Var kTrueE([](const caf::SRProxy *sr){assert(sr->mc.nnu==1);return sr->mc.nu[0].E;})
Definition: Vars.cxx:85
std::vector< std::string > flavors
OscillatableSpectrum fTrueToRecoFDOther
Definition: FluxReweight.h:67
std::basic_string< char > fLabel
Definition: FluxReweight.h:72
const Cut kIsAllFromPions([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return( (sr->mc.nu[0].beam.ndecay==11|| sr->mc.nu[0].beam.ndecay==12|| sr->mc.nu[0].beam.ndecay==13|| sr->mc.nu[0].beam.ndecay==14)&& ((abs(sr->mc.nu[0].beam.tptype)==211)|| (abs(sr->mc.nu[0].beam.tptype)==3122)|| (abs(sr->mc.nu[0].beam.tptype)==3222)|| (abs(sr->mc.nu[0].beam.tptype)==3112)|| (abs(sr->mc.nu[0].beam.tptype)==3212)) );})
Definition: BeamCuts.h:35
const FluxDecomp * fDecomp
Definition: FluxReweight.h:70
ana::FluxReweight::~FluxReweight ( )

Definition at line 72 of file FluxReweight.cxx.

References fDecomp, and fOwnDecomp.

73  {
74  if(fOwnDecomp) delete fDecomp;
75  }
const FluxDecomp * fDecomp
Definition: FluxReweight.h:70
ana::FluxReweight::FluxReweight ( Spectrum  recoNDPi,
Spectrum  recoNDOther,
OscillatableSpectrum  trueToRecoFDPi,
OscillatableSpectrum  trueToRecoFDOther,
const FluxDecomp decomp,
std::basic_string< char >  label,
std::basic_string< char >  latex 
)
inlineprivate

Definition at line 49 of file FluxReweight.h.

59  : fRecoNDPi(recoNDPi), fRecoNDOther(recoNDOther), fTrueToRecoFDPi(trueToRecoFDPi), fTrueToRecoFDOther(trueToRecoFDOther),
60 // fNueCCFromPiPtPz(nuefrompi),fNueCCFromOther(nuefromother),
61  fDecomp(&decomp),fOwnDecomp(false),
62  fLabel(label), fLatex(latex) {}
void latex(double x, double y, std::string txt, double ang=0, int align=22, double size=0.042)
OscillatableSpectrum fTrueToRecoFDPi
Definition: FluxReweight.h:66
std::basic_string< char > fLatex
Definition: FluxReweight.h:73
Spectrum fRecoNDOther
Definition: FluxReweight.h:65
Spectrum fRecoNDPi
Definition: FluxReweight.h:64
const char * label
OscillatableSpectrum fTrueToRecoFDOther
Definition: FluxReweight.h:67
std::basic_string< char > fLabel
Definition: FluxReweight.h:72
const FluxDecomp * fDecomp
Definition: FluxReweight.h:70

Member Function Documentation

void ana::ModularExtrapComponent::ComparisonPlot ( Spectrum  mc,
Spectrum  notMC,
double  pot,
std::string  notMCLabel,
int  notMCColor,
std::string  latex,
std::string  title,
std::string  saveAs,
bool  restrictRange = false 
)
staticprotectedinherited

Definition at line 17 of file ModularExtrapComponentPlot.cxx.

References plot_validation_datamc::c, kRed, make_mec_shifts_plots::legend, and ana::Spectrum::ToTH1().

Referenced by SavePlots(), ana::TruthReweight::SavePlots(), and ana::RecoReweight::SavePlots().

27  {
28  TH1* histMC( mc.ToTH1(pot) );
29  TH1* histNotMC( notMC.ToTH1(pot) );
30  histMC->SetLineColor( kRed );
31  histNotMC->SetLineColor( notMCColor );
32  TCanvas c;
33  histMC->SetMaximum( 1.5 * histMC->GetMaximum() );
34  if (restrictRange) histMC->GetXaxis()->SetRangeUser( 0.5, 3.5);
35  histMC->SetTitle( (latex+" "+title).c_str() );
36  histMC->Draw("hist");
37  histNotMC->Draw("same");
38  TLegend legend( .15, .7, .4, .85 );
39  legend.SetTextSize(0.05);
40  legend.AddEntry( histNotMC, notMCLabel.c_str() );
41  legend.AddEntry( histMC, "MC" );
42  legend.SetFillStyle(0);
43  legend.Draw();
44  histMC->Write( (TString)"MC"+saveAs.c_str());
45  histNotMC->Write( (TString)notMCLabel.c_str() + saveAs.c_str());
46 
47  c.Write( saveAs.c_str() );
48  delete histMC;
49  delete histNotMC;
50  }
void latex(double x, double y, std::string txt, double ang=0, int align=22, double size=0.042)
enum BeamMode kRed
#define pot
std::string ana::ModularExtrapComponent::DRToString ( DecompResult  dr)
staticprotectedinherited

Helper function to turn a DecompResult into a string (for storage).

Definition at line 98 of file ModularExtrapComponent.cxx.

References ana::assert(), ana::NC, ana::NCbar, ana::NCtot, ana::nue, ana::nuebar, ana::numu, and ana::numubar.

Referenced by ana::TruthReweight::SaveTo(), and ana::RecoReweight::SaveTo().

100  {
101  switch (dr){
102  case DecompResult::nue : return "Nue";
103  case DecompResult::numu : return "Numu";
104  case DecompResult::nuebar : return "NueBar";
105  case DecompResult::numubar : return "NumuBar";
106  case DecompResult::NC : return "NC";
107  case DecompResult::NCbar : return "NCbar";
108  case DecompResult::NCtot : return "NCtot";
109  }
110  assert( 0 && "Bad DecompResult" );
111  }
assert(nhit_max >=nhit_nbins)
ana::OscillatableSpectrum ana::FluxReweight::Eval ( ) const
overridevirtual

Core extrapolation math.

Implements ana::ModularExtrapComponent.

Definition at line 77 of file FluxReweight.cxx.

References fDecomp, fLabel, ana::ModularExtrapComponent::FormSmartRatio(), fRecoNDOther, fRecoNDPi, fReturnFDOther, fReturnFDPi, fTrueToRecoFDOther, fTrueToRecoFDPi, ana::FluxDecomp::NueKaEstimate(), ana::FluxDecomp::NuePiEstimate(), ana::ReweightableSpectrum::ReweightToRecoSpectrum(), and ana::OscillatableSpectrum::Unoscillated().

78  {
79  OscillatableSpectrum resultPi(fTrueToRecoFDPi);
80  OscillatableSpectrum resultOther(fTrueToRecoFDOther);
81 // ReweightableSpectrum PiPtPz(fNueCCFromPiPtPz);
82 
83  // Pi weight ratio as a TH2D
84  Spectrum pidecompresult(fDecomp->NuePiEstimate());
85  // reweight fd pipz
86 // PiPtPz.ReweightByRecoRatio(pidecompresult);
87  Spectrum otherdecompresult(fDecomp->NueKaEstimate());
88 
89 // TH1* piweight = (TH1*) ((TH3*)PiPtPz.ToTH3(1e20))->ProjectionZ();
90 
91  Ratio pidataMC = FormSmartRatio(
92  pidecompresult, fRecoNDPi,
93  fLabel, "MC ND Pi Reco",
95 
96  resultPi.ReweightToRecoSpectrum( fTrueToRecoFDPi.Unoscillated() * pidataMC );
97 
98  Ratio otherdataMC = FormSmartRatio(
99  otherdecompresult, fRecoNDOther,
100  fLabel, "MC ND Other Reco",
102 
103  resultOther.ReweightToRecoSpectrum( fTrueToRecoFDOther.Unoscillated() * otherdataMC );
104 
105 /*
106  resultPi.ReweightByRecoRatio(piweight);
107  // normalization for now, later use ptpz weight
108  Spectrum kadecompresult(fDecomp->NueKaEstimate());
109  Ratio dataMC = FormSmartRatio(
110  kadecompresult, fRecoND,
111  fLabel, "MC ND Reco",
112  fTrueToRecoFDOther.Unoscillated() );
113 
114  resultOther.ReweightToRecoSpectrum( fTrueToRecoFDOther.Unoscillated() * dataMC );
115 */
116  fReturnFDPi = resultPi;
117  fReturnFDOther = resultOther;
118 
119  return (resultPi + resultOther);
120 
121  }
OscillatableSpectrum fTrueToRecoFDPi
Definition: FluxReweight.h:66
Spectrum fRecoNDOther
Definition: FluxReweight.h:65
Spectrum fRecoNDPi
Definition: FluxReweight.h:64
OscillatableSpectrum fReturnFDPi
Definition: FluxReweight.h:74
Spectrum NueKaEstimate() const
Definition: FluxDecomp.h:104
OscillatableSpectrum fTrueToRecoFDOther
Definition: FluxReweight.h:67
std::basic_string< char > fLabel
Definition: FluxReweight.h:72
std::vector< float > Spectrum
Definition: Constants.h:610
OscillatableSpectrum fReturnFDOther
Definition: FluxReweight.h:75
const FluxDecomp * fDecomp
Definition: FluxReweight.h:70
static Ratio FormSmartRatio(const Spectrum &num, const Spectrum &denom, std::string component, std::string location, const Spectrum &mult)
Form Ratio, but be aware of zero division.
Spectrum NuePiEstimate() const
Definition: FluxDecomp.h:103
Ratio ana::ModularExtrapComponent::FormSmartRatio ( const Spectrum num,
const Spectrum denom,
std::string  component,
std::string  location,
const Spectrum mult 
)
staticprotectedinherited

Form Ratio, but be aware of zero division.

Necessary because root thinks n/0==0, so we lose events when low stats cause empty bins. If zero division occurs, ratio is set to 1 and warning is issued. If numerator is 0 and ratio will be multiplied by 0 later, the warning is suppressed.

Definition at line 130 of file ModularExtrapComponent.cxx.

References ana::assert(), bin, hadd_many_files::counter, ana::ModularExtrapComponent::DivByZeroCounter::fBins, ana::ModularExtrapComponent::fQuiet, ana::Spectrum::GetBinnings(), ana::Spectrum::GetEigen(), and ana::Spectrum::GetLabels().

Referenced by Eval(), ana::TruthReweight::Eval(), and ana::RecoReweight::Eval().

136  {
137  const Eigen::ArrayXd numa = num.GetEigen(1e20);
138  const Eigen::ArrayXd denoma = denom.GetEigen(1e20);
139  const Eigen::ArrayXd multa = mult.GetEigen(1e20);
140 
141  Eigen::ArrayXd ratioa = numa;
142  ratioa.setZero();
143 
144  assert( (numa.size() == denoma.size()) && "Bin Mismatch" );
145  assert( (numa.size() == multa.size()) && "Bin Mismatch" );
146 
147  static DivByZeroCounter counter;
148  for (int bin = 0; bin < numa.size(); ++bin)
149  {
150  if ( denoma[bin] != 0 ){
151  ratioa[bin] = numa[bin] / denoma[bin];
152  } else {
153  ratioa[bin] = 1;
154  if ( numa[bin] != 0
155  || multa[bin] != 0 )
156  counter.fBins.insert(std::make_tuple(component, location, bin));
157  }
158  }
159 
160  return Ratio( std::move(ratioa), num.GetLabels(), num.GetBinnings() );
161  }
#define location
float bin[41]
Definition: plottest35.C:14
int num
Definition: f2_nu.C:119
assert(nhit_max >=nhit_nbins)
const FluxDecomp* ana::FluxReweight::GetDecomp ( ) const
inlineoverridevirtual

Implements ana::ModularExtrapComponent.

Definition at line 45 of file FluxReweight.h.

References fDecomp.

45 {return fDecomp;}
const FluxDecomp * fDecomp
Definition: FluxReweight.h:70
Spectrum ana::ModularExtrapComponent::GetDecompResult ( const IDecomp decomp,
DecompResult  dr 
)
staticprotectedinherited
std::unique_ptr< FluxReweight > ana::FluxReweight::LoadFrom ( TDirectory *  dir,
const std::basic_string< char > &  name 
)
static

Definition at line 149 of file FluxReweight.cxx.

References ana::assert(), dir, FluxReweight(), fOwnDecomp, label, latex(), ana::OscillatableSpectrum::LoadFrom(), ana::Spectrum::LoadFrom(), runNovaSAM::release, and runNovaSAM::ret.

150  {
151  dir = dir->GetDirectory(name.c_str()); // switch to subdir
152  assert(dir);
153 
154 // TObjString* dr = (TObjString*)dir->Get("DecompRes");
155 // assert(dr);
156  TObjString* label = (TObjString*)dir->Get("Label");
157  TObjString* latex = (TObjString*)dir->Get("Latex");
158  assert(label);
159  assert(latex);
160 
162  *(Spectrum::LoadFrom(dir, "RecoNDPi")),
163  *(Spectrum::LoadFrom(dir, "RecoNDOther")),
164  *(OscillatableSpectrum::LoadFrom(dir, "TrueToRecoFDPi")),
165  *(OscillatableSpectrum::LoadFrom(dir, "TrueToRecoFDOther")),
166 // *(ReweightableSpectrum::LoadFrom(dir, "NueCCFromPiPtPz")),
167 // *(ReweightableSpectrum::LoadFrom(dir, "NueCCFromOther")),
168  *(ana::LoadFrom<FluxDecomp>(dir, "Decomp").release()),
169  label->GetString().Data(),
170  latex->GetString().Data()
171  );
172 
173  ret->fOwnDecomp = true;
174 // delete dr;
175  delete dir;
176  delete label;
177  delete latex;
178  return std::unique_ptr<FluxReweight>(ret);
179  }
static std::unique_ptr< OscillatableSpectrum > LoadFrom(TDirectory *dir, const std::string &name)
const XML_Char * name
Definition: expat.h:151
void latex(double x, double y, std::string txt, double ang=0, int align=22, double size=0.042)
const char * label
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
FluxReweight(SpectrumLoaderBase &ndloader, const HistAxis &axis, const Cut &fdcut, const SystShifts &shiftMC, const Var &weight, std::string label, std::string latex, const Cut &ndcut, const FluxDecomp &decomposition, SpectrumLoaderBase &fdloader, const Cut &flavors, SpectrumLoaderBase &extrafdloaderswap=kNullLoader, SpectrumLoaderBase &extrafdloadertau=kNullLoader)
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
TH1* ana::FluxReweight::OptimalBinning ( double  potMCFD,
double  potMCND 
) const
TH1* ana::FluxReweight::OptimalBinningFit ( double  potMCFD,
double  potMCND 
) const
static TH1* ana::FluxReweight::OptimalBinningHelper ( TH1 *  ,
TH1 *   
)
static
const OscillatableSpectrum & ana::ModularExtrapComponent::Return ( ) const
inherited

Interface so that result of Eval() is called only once and cached.

Definition at line 68 of file ModularExtrapComponent.cxx.

References ana::ModularExtrapComponent::Eval(), ana::ModularExtrapComponent::fCache, and ana::ModularExtrapComponent::fEvaluated.

Referenced by SavePlots(), ana::TruthReweight::SavePlots(), and ana::RecoReweight::SavePlots().

69  {
70  if (!fEvaluated)
71  {
72  fCache = Eval();
73  fEvaluated = true;
74  }
75  return fCache;
76  }
virtual OscillatableSpectrum Eval() const =0
Core extrapolation math.
void ana::FluxReweight::SavePlots ( TDirectory *  dir,
double  potFD 
) const
overridevirtual

Implements ana::ModularExtrapComponent.

Definition at line 181 of file FluxReweight.cxx.

References ana::ModularExtrapComponent::ComparisonPlot(), Draw(), fDecomp, fLatex, fRecoNDOther, fRecoNDPi, fReturnFDOther, fReturnFDPi, fTrueToRecoFDOther, fTrueToRecoFDPi, kBlue, ana::FluxDecomp::NueKaEstimate(), ana::FluxDecomp::NuePiEstimate(), ana::ModularExtrapComponent::Return(), tmp, ana::Spectrum::ToTH1(), ana::OscillatableSpectrum::Unoscillated(), and Write().

182  {
183  TDirectory* tmp = gDirectory;
184  dir->cd();
185 
186  Spectrum fdExtReco( Return().Unoscillated() );
187 
188  Spectrum fdMCRecoPi( fTrueToRecoFDPi.Unoscillated() );
189  Spectrum fdMCRecoOther( fTrueToRecoFDOther.Unoscillated() );
190 
191  Spectrum fdExtRecoPi( fReturnFDPi.Unoscillated() );
192  Spectrum fdExtRecoOther( fReturnFDOther.Unoscillated() );
193 
194  Spectrum decomppiresult( fDecomp->NuePiEstimate());
195  Spectrum decompotherresult( fDecomp->NueKaEstimate());
196 
197  double potND(decomppiresult.POT());
198 
200  fRecoNDPi, decomppiresult, potND,
201  "Data", kBlack, fLatex, "ND Reco Spectrum From Pi", "NDPi");
202 
204  fRecoNDOther, decompotherresult, potND,
205  "Data", kBlack, fLatex, "ND Reco Spectrum From Other", "NDOther");
206 
208  fdMCRecoPi, fdExtRecoPi, potFD,
209  "Extrapolated", kBlue, fLatex, "FD Reco Spectrum From Pi", "FDPi" );
210 
212  fdMCRecoOther, fdExtRecoOther, potFD,
213  "Extrapolated", kBlue, fLatex, "FD Reco Spectrum From Other", "FDOther" );
214 
215  TH1* hreturn = fdExtReco.ToTH1(potFD);
216  hreturn -> Draw("hist");
217  hreturn -> Write("FDReco");
218  tmp->cd();
219 
220  }
tree Draw("slc.nhit")
OscillatableSpectrum fTrueToRecoFDPi
Definition: FluxReweight.h:66
std::basic_string< char > fLatex
Definition: FluxReweight.h:73
const OscillatableSpectrum & Return() const
Interface so that result of Eval() is called only once and cached.
Float_t tmp
Definition: plot.C:36
Spectrum fRecoNDOther
Definition: FluxReweight.h:65
Spectrum fRecoNDPi
Definition: FluxReweight.h:64
OscillatableSpectrum fReturnFDPi
Definition: FluxReweight.h:74
Spectrum NueKaEstimate() const
Definition: FluxDecomp.h:104
OscillatableSpectrum fTrueToRecoFDOther
Definition: FluxReweight.h:67
std::vector< float > Spectrum
Definition: Constants.h:610
OscillatableSpectrum fReturnFDOther
Definition: FluxReweight.h:75
TDirectory * dir
Definition: macro.C:5
const FluxDecomp * fDecomp
Definition: FluxReweight.h:70
Spectrum NuePiEstimate() const
Definition: FluxDecomp.h:103
enum BeamMode kBlue
static void ComparisonPlot(Spectrum mc, Spectrum notMC, double pot, std::string notMCLabel, int notMCColor, std::string latex, std::string title, std::string saveAs, bool restrictRange=false)
gm Write()
virtual void ana::ModularExtrapComponent::SaveTo ( TDirectory *  dir,
const std::string name 
) const
pure virtualinherited
void ana::FluxReweight::SaveTo ( TDirectory *  dir,
const std::basic_string< char > &  name 
) const
override

Definition at line 123 of file FluxReweight.cxx.

References dir, fDecomp, fLabel, fLatex, fRecoNDOther, fRecoNDPi, fTrueToRecoFDOther, fTrueToRecoFDPi, ana::FluxDecomp::SaveTo(), ana::OscillatableSpectrum::SaveTo(), ana::Spectrum::SaveTo(), tmp, and Write().

124  {
125  TDirectory* tmp = gDirectory;
126 
127  dir = dir->mkdir(name.c_str()); // switch to subdir
128  dir->cd();
129 
130  TObjString("FluxReweight").Write("type");
131  fRecoNDPi.SaveTo(dir, "RecoNDPi");
132  fRecoNDOther.SaveTo(dir, "RecoNDOther");
133  fTrueToRecoFDPi.SaveTo(dir, "TrueToRecoFDPi");
134  fTrueToRecoFDOther.SaveTo(dir, "TrueToRecoFDOther");
135 
136 // fNueCCFromPiPtPz.SaveTo(, "NueCCFromPiPtPz"));
137 // fNueCCFromOther.SaveTo(, "NueCCFromOther"));
138  fDecomp->SaveTo(dir, "Decomp");
139  TObjString(fLabel.c_str()).Write("Label");
140  TObjString(fLatex.c_str()).Write("Latex");
141 
142  dir->Write();
143  delete dir;
144 
145  tmp->cd();
146  }
const XML_Char * name
Definition: expat.h:151
OscillatableSpectrum fTrueToRecoFDPi
Definition: FluxReweight.h:66
std::basic_string< char > fLatex
Definition: FluxReweight.h:73
Float_t tmp
Definition: plot.C:36
Spectrum fRecoNDOther
Definition: FluxReweight.h:65
Spectrum fRecoNDPi
Definition: FluxReweight.h:64
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
OscillatableSpectrum fTrueToRecoFDOther
Definition: FluxReweight.h:67
std::basic_string< char > fLabel
Definition: FluxReweight.h:72
TDirectory * dir
Definition: macro.C:5
const FluxDecomp * fDecomp
Definition: FluxReweight.h:70
void SaveTo(TDirectory *dir, const std::string &name) const
void SaveTo(TDirectory *dir, const std::string &name) const override
Definition: FluxDecomp.cxx:330
gm Write()
static void ana::ModularExtrapComponent::SetQuiet ( bool  quiet = true)
inlinestaticinherited
DecompResult ana::ModularExtrapComponent::StringToDR ( std::string  str)
staticprotectedinherited

Helper function to turn a string into a DecompResult (for loading).

Definition at line 115 of file ModularExtrapComponent.cxx.

References ana::assert(), ana::NC, ana::NCbar, ana::NCtot, ana::nue, ana::nuebar, ana::numu, and ana::numubar.

Referenced by ana::TruthReweight::LoadFrom(), and ana::RecoReweight::LoadFrom().

117  {
118  if (str=="Nue") return DecompResult::nue;
119  else if (str=="Numu") return DecompResult::numu;
120  else if (str=="NueBar") return DecompResult::nuebar;
121  else if (str=="NumuBar") return DecompResult::numubar;
122  else if (str=="NC") return DecompResult::NC;
123  else if (str=="NCbar") return DecompResult::NCbar;
124  else if (str=="NCtot") return DecompResult::NCtot;
125  else assert( 0 && "Bad DecompResult String" );
126  }
assert(nhit_max >=nhit_nbins)

Friends And Related Function Documentation

friend class ModularExtrap
friend

Definition at line 47 of file FluxReweight.h.

Member Data Documentation

const FluxDecomp* ana::FluxReweight::fDecomp
private

Definition at line 70 of file FluxReweight.h.

Referenced by Eval(), GetDecomp(), SavePlots(), SaveTo(), and ~FluxReweight().

std::basic_string<char> ana::FluxReweight::fLabel
private

Definition at line 72 of file FluxReweight.h.

Referenced by Eval(), and SaveTo().

std::basic_string<char> ana::FluxReweight::fLatex
private

Definition at line 73 of file FluxReweight.h.

Referenced by SavePlots(), and SaveTo().

bool ana::FluxReweight::fOwnDecomp
private

Definition at line 71 of file FluxReweight.h.

Referenced by LoadFrom(), and ~FluxReweight().

Spectrum ana::FluxReweight::fRecoNDOther
private

Definition at line 65 of file FluxReweight.h.

Referenced by Eval(), SavePlots(), and SaveTo().

Spectrum ana::FluxReweight::fRecoNDPi
private

Definition at line 64 of file FluxReweight.h.

Referenced by Eval(), SavePlots(), and SaveTo().

OscillatableSpectrum ana::FluxReweight::fReturnFDOther = OscillatableSpectrum::Uninitialized()
mutableprivate

Definition at line 75 of file FluxReweight.h.

Referenced by Eval(), and SavePlots().

OscillatableSpectrum ana::FluxReweight::fReturnFDPi = OscillatableSpectrum::Uninitialized()
mutableprivate

Definition at line 74 of file FluxReweight.h.

Referenced by Eval(), and SavePlots().

OscillatableSpectrum ana::FluxReweight::fTrueToRecoFDOther
private

Definition at line 67 of file FluxReweight.h.

Referenced by Eval(), FluxReweight(), SavePlots(), and SaveTo().

OscillatableSpectrum ana::FluxReweight::fTrueToRecoFDPi
private

Definition at line 66 of file FluxReweight.h.

Referenced by Eval(), FluxReweight(), SavePlots(), and SaveTo().


The documentation for this class was generated from the following files: