Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ana::CrossSectionAnalysis Class Reference

Generic organizational class for a cross section analysis. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-02/CAFAna/XSec/CrossSectionAnalysis.h"

Inheritance diagram for ana::CrossSectionAnalysis:
ana::NumuCC2p2hAnalysis ana::NumuCCIncAnalysis ana::SingleNucAnalysis

Public Member Functions

 CrossSectionAnalysis (SpectrumLoaderBase &lMC, SpectrumLoaderBase &lDA, HistAxis axisreco, NuTruthHistAxis axistrue, Binning EBins, Cut sel, NuTruthCut isSig, IBkgdEstimator *bkgdest, TVector3 min, TVector3 max, double unfoldReg, UnfoldMethod_t unfoldmethod=kIterative, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftDA=kNoShift, const NuTruthVar &wei=kNuTruthUnweighted, const Var &weiDA=kUnweighted)
 
 CrossSectionAnalysis (SpectrumLoaderBase &lMC, SpectrumLoaderBase &lDA, HistAxis axisreco, NuTruthHistAxis axistrue, Binning EBins, Cut sel, NuTruthCut isSig, IBkgdEstimator *bkgdest, TVector3 min, TVector3 max, double nTargets, double unfoldReg, UnfoldMethod_t unfoldmethod=kIterative, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftDA=kNoShift, const NuTruthVar &wei=kNuTruthUnweighted, const Var &weiDA=kUnweighted)
 
virtual ~CrossSectionAnalysis ()
 
TH1 * Result ()
 
TH1 * PlotEfficiency ()
 
TH1 * PlotSignalEstimate ()
 
TH1 * PlotUnfoldedSignal ()
 
TH1 * PlotFluxEstimate ()
 
TH1 * PlotBackgroundEstimate ()
 
TH1 * PlotData ()
 
TH2D * PlotRecoToTrueMatrix ()
 
virtual double NTargets ()
 Default implementation returns number of nucleons. Override if needed. More...
 
void SaveTo (TDirectory *dir, const std::string &name) const
 

Static Public Member Functions

static std::unique_ptr< CrossSectionAnalysisLoadFrom (TDirectory *dir, const std::string &name, UnfoldMethod_t unfoldmethod=kIterative)
 
static std::unique_ptr< CrossSectionAnalysisLoadFrom (TDirectory *dir, const std::string &name, UnfoldMethod_t unfoldmethod, double nTargets)
 

Protected Member Functions

 CrossSectionAnalysis (Spectrum data, Spectrum mc, Spectrum *mcsig, Spectrum *mcsignutree, ReweightableSpectrum rt, IBkgdEstimator *bkgdest, double unfoldreg, UnfoldMethod_t unfoldmethod, TVector3 min, TVector3 max, Spectrum *flux)
 
 CrossSectionAnalysis (Spectrum data, Spectrum mc, Spectrum *mcsig, Spectrum *mcsignutree, ReweightableSpectrum rt, IBkgdEstimator *bkgdest, double nTargets, double unfoldreg, UnfoldMethod_t unfoldmethod, TVector3 min, TVector3 max, Spectrum *flux)
 
Spectrum SignalEst (Spectrum bkgd)
 
Spectrum UnfoldedSignal (Spectrum signal, ReweightableSpectrum *rt=NULL)
 
Ratio Efficiency ()
 
double NucleonCount ()
 
double NucleusCount (int Z=-1, int A=-1)
 

Protected Attributes

Spectrum fData
 
Spectrum fMC
 
SpectrumfMCSig
 
SpectrumfMCSigNuTree
 
ReweightableSpectrum fRecoTrue
 
IBkgdEstimatorfBkgdEst
 
double fNTargets
 
double fUnfoldReg
 
UnfoldMethod_t fUnfoldMethod
 
TVector3 fFidMin
 
TVector3 fFidMax
 
TargetCount fTarget
 
SpectrumfFlux
 

Detailed Description

Generic organizational class for a cross section analysis.

Definition at line 29 of file CrossSectionAnalysis.h.

Constructor & Destructor Documentation

ana::CrossSectionAnalysis::CrossSectionAnalysis ( SpectrumLoaderBase lMC,
SpectrumLoaderBase lDA,
HistAxis  axisreco,
NuTruthHistAxis  axistrue,
Binning  EBins,
Cut  sel,
NuTruthCut  isSig,
IBkgdEstimator bkgdest,
TVector3  min,
TVector3  max,
double  unfoldReg,
UnfoldMethod_t  unfoldmethod = kIterative,
const SystShifts shiftMC = kNoShift,
const SystShifts shiftDA = kNoShift,
const NuTruthVar wei = kNuTruthUnweighted,
const Var weiDA = kUnweighted 
)

Definition at line 24 of file CrossSectionAnalysis.cxx.

References ana::DeriveFlux(), nd_projection_maker::eff, ana::Efficiency(), fFidMax, fFidMin, fFlux, fMCSig, and fMCSigNuTree.

Referenced by LoadFrom().

41  : fData(lDA, axisreco, sel, shiftDA, weiDA),
42  fMC(lMC, axisreco, sel, shiftMC, VarFromNuTruthVar(wei, 1) ),
43  fRecoTrue(lMC,
44  axisreco, HistAxisFromNuTruthHistAxis(axistrue),
45  sel && CutFromNuTruthCut(isSig),
46  shiftMC, VarFromNuTruthVar(wei)),
47  fBkgdEst(bkgdest),
48  fNTargets(0),
49  fUnfoldReg(unfoldReg),
50  fUnfoldMethod(unfoldmetod),
51  fFidMin(min),
52  fFidMax(max),
53  fTarget(min,max,1e6)
54  {
55  std::pair<Spectrum*,Spectrum*> eff = ana::Efficiency(lMC, axistrue,
56  sel, isSig, shiftMC, wei);
57  fMCSig = eff.first;
58  fMCSigNuTree = eff.second;
59  fFlux = DeriveFlux(lMC, EBins, 14, &fFidMin, &fFidMax, shiftMC, wei);
60  }
HistAxis HistAxisFromNuTruthHistAxis(NuTruthHistAxis ntha, double _default)
Definition: HistAxis.cxx:9
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
std::pair< Spectrum *, Spectrum * > Efficiency(SpectrumLoaderBase &loader, const NuTruthHistAxis &axis, const Cut &seln, const NuTruthCut &truthSeln, const SystShifts &shift, const NuTruthVar &weight)
Definition: Efficiency.cxx:10
Var VarFromNuTruthVar(const NuTruthVar &stv, double _default)
Definition: Var.cxx:7
Spectrum * DeriveFlux(SpectrumLoaderBase &loader, const Binning &bins, int pdg, const TVector3 *min, const TVector3 *max, const SystShifts &shift, const NuTruthVar weight)
Definition: Flux.cxx:58
ReweightableSpectrum fRecoTrue
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
Cut CutFromNuTruthCut(const NuTruthCut &stc)
Definition: Cut.cxx:7
ana::CrossSectionAnalysis::CrossSectionAnalysis ( SpectrumLoaderBase lMC,
SpectrumLoaderBase lDA,
HistAxis  axisreco,
NuTruthHistAxis  axistrue,
Binning  EBins,
Cut  sel,
NuTruthCut  isSig,
IBkgdEstimator bkgdest,
TVector3  min,
TVector3  max,
double  nTargets,
double  unfoldReg,
UnfoldMethod_t  unfoldmethod = kIterative,
const SystShifts shiftMC = kNoShift,
const SystShifts shiftDA = kNoShift,
const NuTruthVar wei = kNuTruthUnweighted,
const Var weiDA = kUnweighted 
)

Definition at line 62 of file CrossSectionAnalysis.cxx.

References ana::DeriveFlux(), nd_projection_maker::eff, ana::Efficiency(), fFidMax, fFidMin, fFlux, fMCSig, and fMCSigNuTree.

80  : fData(lDA, axisreco, sel, shiftDA, weiDA),
81  fMC(lMC, axisreco, sel, shiftMC, VarFromNuTruthVar(wei, 1) ),
82  fRecoTrue(lMC,
83  axisreco, HistAxisFromNuTruthHistAxis(axistrue),
84  sel && CutFromNuTruthCut(isSig),
85  shiftMC, VarFromNuTruthVar(wei)),
86  fBkgdEst(bkgdest),
87  fNTargets(nTargets),
88  fUnfoldReg(unfoldReg),
89  fUnfoldMethod(unfoldmetod),
90  fFidMin(min),
91  fFidMax(max)
92  {
93  std::pair<Spectrum*,Spectrum*> eff = ana::Efficiency(lMC, axistrue,
94  sel, isSig, shiftMC, wei);
95  fMCSig = eff.first;
96  fMCSigNuTree = eff.second;
97  fFlux = DeriveFlux(lMC, EBins, 14, &fFidMin, &fFidMax, shiftMC, wei);
98  }
HistAxis HistAxisFromNuTruthHistAxis(NuTruthHistAxis ntha, double _default)
Definition: HistAxis.cxx:9
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
std::pair< Spectrum *, Spectrum * > Efficiency(SpectrumLoaderBase &loader, const NuTruthHistAxis &axis, const Cut &seln, const NuTruthCut &truthSeln, const SystShifts &shift, const NuTruthVar &weight)
Definition: Efficiency.cxx:10
Var VarFromNuTruthVar(const NuTruthVar &stv, double _default)
Definition: Var.cxx:7
Spectrum * DeriveFlux(SpectrumLoaderBase &loader, const Binning &bins, int pdg, const TVector3 *min, const TVector3 *max, const SystShifts &shift, const NuTruthVar weight)
Definition: Flux.cxx:58
ReweightableSpectrum fRecoTrue
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
Cut CutFromNuTruthCut(const NuTruthCut &stc)
Definition: Cut.cxx:7
virtual ana::CrossSectionAnalysis::~CrossSectionAnalysis ( )
inlinevirtual
ana::CrossSectionAnalysis::CrossSectionAnalysis ( Spectrum  data,
Spectrum  mc,
Spectrum mcsig,
Spectrum mcsignutree,
ReweightableSpectrum  rt,
IBkgdEstimator bkgdest,
double  unfoldreg,
UnfoldMethod_t  unfoldmethod,
TVector3  min,
TVector3  max,
Spectrum flux 
)
inlineprotected

Definition at line 88 of file CrossSectionAnalysis.h.

94  : fData(data),
95  fMC(mc),
96  fMCSig(mcsig),
97  fMCSigNuTree(mcsignutree),
98  fRecoTrue(rt),
99  fBkgdEst(bkgdest),
100  fNTargets(0),
101  fUnfoldReg(unfoldreg),
102  fUnfoldMethod(unfoldmethod),
103  fFidMin(min),
104  fFidMax(max),
105  fTarget(min,max,1e6),
106  fFlux(flux)
107  {}
Loaders::FluxType flux
const XML_Char const XML_Char * data
Definition: expat.h:268
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
ReweightableSpectrum fRecoTrue
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
ana::CrossSectionAnalysis::CrossSectionAnalysis ( Spectrum  data,
Spectrum  mc,
Spectrum mcsig,
Spectrum mcsignutree,
ReweightableSpectrum  rt,
IBkgdEstimator bkgdest,
double  nTargets,
double  unfoldreg,
UnfoldMethod_t  unfoldmethod,
TVector3  min,
TVector3  max,
Spectrum flux 
)
inlineprotected

Definition at line 109 of file CrossSectionAnalysis.h.

References genie::units::A, Efficiency(), NucleonCount(), NucleusCount(), SignalEst(), UnfoldedSignal(), and Z.

116  : fData(data),
117  fMC(mc),
118  fMCSig(mcsig),
119  fMCSigNuTree(mcsignutree),
120  fRecoTrue(rt),
121  fBkgdEst(bkgdest),
122  fNTargets(nTargets),
123  fUnfoldReg(unfoldreg),
124  fUnfoldMethod(unfoldmethod),
125  fFidMin(min),
126  fFidMax(max),
127  fFlux(flux)
128  {}
Loaders::FluxType flux
const XML_Char const XML_Char * data
Definition: expat.h:268
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
ReweightableSpectrum fRecoTrue
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68

Member Function Documentation

Ratio ana::CrossSectionAnalysis::Efficiency ( )
protected
std::unique_ptr< CrossSectionAnalysis > ana::CrossSectionAnalysis::LoadFrom ( TDirectory *  dir,
const std::string name,
UnfoldMethod_t  unfoldmethod = kIterative 
)
static

Definition at line 263 of file CrossSectionAnalysis.cxx.

References ana::assert(), CrossSectionAnalysis(), dir, flux, ana::LoadFrom< IBkgdEstimator >(), cet::sqlite::max(), mc, min(), and runNovaSAM::release.

Referenced by test_xsecanalysis(), and ~CrossSectionAnalysis().

264  {
265  dir = dir->GetDirectory(name.c_str()); // switch to subdir
266  assert(dir);
267 
268  Spectrum* data = ana::LoadFrom<Spectrum>(dir, "fData").release();
269  Spectrum* mc = ana::LoadFrom<Spectrum>(dir, "fMC").release();
270  Spectrum* mcsig= ana::LoadFrom<Spectrum>(dir, "fMCSig").release();
271  Spectrum* mcsignutree = ana::LoadFrom<Spectrum>(dir, "fMCSigNuTree").release();
272  ReweightableSpectrum* rt = ana::LoadFrom<ReweightableSpectrum>(dir, "fRecoTrue").release();
273 
274  IBkgdEstimator* bkgdest = ana::LoadFrom<IBkgdEstimator>(dir, "fBkgdEst").release();
275 
276  TVectorD* unfoldreg = (TVectorD*)dir->Get("fUnfoldReg");
277  TVector3* min = (TVector3*)dir->Get("fFidMin");
278  TVector3* max = (TVector3*)dir->Get("fFidMax");
279 
280  Spectrum* flux = ana::LoadFrom<Spectrum>(dir, "fFlux").release();
281 
282  delete dir;
283 
284  return std::unique_ptr<CrossSectionAnalysis>(
285  new CrossSectionAnalysis(*data, *mc, mcsig, mcsignutree, *rt, bkgdest,
286  (*unfoldreg)[0], unfoldmethod, *min, *max, flux));
287  }
const XML_Char * name
Definition: expat.h:151
Loaders::FluxType flux
const XML_Char const XML_Char * data
Definition: expat.h:268
std::vector< float > Spectrum
Definition: Constants.h:610
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
std::unique_ptr< IBkgdEstimator > LoadFrom< IBkgdEstimator >(TDirectory *dir, const std::string &label)
CrossSectionAnalysis(SpectrumLoaderBase &lMC, SpectrumLoaderBase &lDA, HistAxis axisreco, NuTruthHistAxis axistrue, Binning EBins, Cut sel, NuTruthCut isSig, IBkgdEstimator *bkgdest, TVector3 min, TVector3 max, double unfoldReg, UnfoldMethod_t unfoldmethod=kIterative, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftDA=kNoShift, const NuTruthVar &wei=kNuTruthUnweighted, const Var &weiDA=kUnweighted)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
std::unique_ptr< CrossSectionAnalysis > ana::CrossSectionAnalysis::LoadFrom ( TDirectory *  dir,
const std::string name,
UnfoldMethod_t  unfoldmethod,
double  nTargets 
)
static

Definition at line 290 of file CrossSectionAnalysis.cxx.

References ana::assert(), CrossSectionAnalysis(), dir, flux, ana::LoadFrom< IBkgdEstimator >(), cet::sqlite::max(), mc, min(), and runNovaSAM::release.

294  {
295  dir = dir->GetDirectory(name.c_str()); // switch to subdir
296  assert(dir);
297 
298  Spectrum* data = ana::LoadFrom<Spectrum>(dir, "fData").release();
299  Spectrum* mc = ana::LoadFrom<Spectrum>(dir, "fMC").release();
300  Spectrum* mcsig= ana::LoadFrom<Spectrum>(dir, "fMCSig").release();
301  Spectrum* mcsignutree = ana::LoadFrom<Spectrum>(dir, "fMCSigNuTree").release();
302  ReweightableSpectrum* rt = ana::LoadFrom<ReweightableSpectrum>(dir, "fRecoTrue").release();
303 
304  IBkgdEstimator* bkgdest = ana::LoadFrom<IBkgdEstimator>(dir, "fBkgdEst").release();
305 
306  TVectorD* unfoldreg = (TVectorD*)dir->Get("fUnfoldReg");
307  TVector3* min = (TVector3*)dir->Get("fFidMin");
308  TVector3* max = (TVector3*)dir->Get("fFidMax");
309 
310  Spectrum* flux = ana::LoadFrom<Spectrum>(dir, "fFlux").release();
311 
312  delete dir;
313 
314  return std::unique_ptr<CrossSectionAnalysis>(
315  new CrossSectionAnalysis(*data, *mc, mcsig, mcsignutree, *rt, bkgdest, nTargets,
316  (*unfoldreg)[0], unfoldmethod, *min, *max, flux));
317  }
const XML_Char * name
Definition: expat.h:151
Loaders::FluxType flux
const XML_Char const XML_Char * data
Definition: expat.h:268
std::vector< float > Spectrum
Definition: Constants.h:610
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
std::unique_ptr< IBkgdEstimator > LoadFrom< IBkgdEstimator >(TDirectory *dir, const std::string &label)
CrossSectionAnalysis(SpectrumLoaderBase &lMC, SpectrumLoaderBase &lDA, HistAxis axisreco, NuTruthHistAxis axistrue, Binning EBins, Cut sel, NuTruthCut isSig, IBkgdEstimator *bkgdest, TVector3 min, TVector3 max, double unfoldReg, UnfoldMethod_t unfoldmethod=kIterative, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftDA=kNoShift, const NuTruthVar &wei=kNuTruthUnweighted, const Var &weiDA=kUnweighted)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
double ana::CrossSectionAnalysis::NTargets ( )
virtual

Default implementation returns number of nucleons. Override if needed.

Reimplemented in ana::SingleNucAnalysis.

Definition at line 159 of file CrossSectionAnalysis.cxx.

References fNTargets, and NucleonCount().

Referenced by Result(), ana::NumuCC2p2hAnalysis::Result1DFluxInt(), ana::NumuCC2p2hAnalysis::Result2D(), and ~CrossSectionAnalysis().

160  {
161  if (fNTargets!=0) return fNTargets;
162  else return NucleonCount();
163  }
double ana::CrossSectionAnalysis::NucleonCount ( )
protected

Definition at line 165 of file CrossSectionAnalysis.cxx.

References fTarget, and ana::TargetCount::NNucleons().

Referenced by CrossSectionAnalysis(), and NTargets().

166  {
167  return fTarget.NNucleons();
168  }
double NNucleons() const
Number of nucleons (mass * avogadro&#39;s number)
Definition: TargetCount.h:31
double ana::CrossSectionAnalysis::NucleusCount ( int  Z = -1,
int  A = -1 
)
protected

Definition at line 170 of file CrossSectionAnalysis.cxx.

References fTarget, and ana::TargetCount::NNuclei().

Referenced by CrossSectionAnalysis(), and ana::SingleNucAnalysis::NTargets().

171  {
172  return fTarget.NNuclei(Z, A);
173  }
Float_t Z
Definition: plot.C:38
double NNuclei(int Z=-1, int A=-1) const
Number of nuclei, optionally restricted to a particular element or isotope.
static const double A
Definition: Units.h:82
TH1 * ana::CrossSectionAnalysis::PlotBackgroundEstimate ( )

Definition at line 211 of file CrossSectionAnalysis.cxx.

References ana::IBkgdEstimator::Background(), fBkgdEst, fData, ana::Spectrum::POT(), and ana::Spectrum::ToTH1().

Referenced by ~CrossSectionAnalysis().

212  {
213  Spectrum bkgd = fBkgdEst->Background();
214  return bkgd.ToTH1(fData.POT());
215  }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
virtual Spectrum Background() const =0
std::vector< float > Spectrum
Definition: Constants.h:610
double POT() const
Definition: Spectrum.h:227
TH1 * ana::CrossSectionAnalysis::PlotData ( )

Definition at line 219 of file CrossSectionAnalysis.cxx.

References fData, ana::Spectrum::POT(), and ana::Spectrum::ToTH1().

Referenced by ~CrossSectionAnalysis().

220  {
221  return fData.ToTH1(fData.POT());
222  }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
double POT() const
Definition: Spectrum.h:227
TH1 * ana::CrossSectionAnalysis::PlotEfficiency ( )

Definition at line 179 of file CrossSectionAnalysis.cxx.

References Efficiency(), and ana::Ratio::ToTH1().

Referenced by test_xsecanalysis(), and ~CrossSectionAnalysis().

180  {
181  return Efficiency().ToTH1();
182  }
TH1D * ToTH1(Color_t col=kBlack, Style_t style=kSolid) const
Definition: Ratio.cxx:67
TH1 * ana::CrossSectionAnalysis::PlotFluxEstimate ( )

Definition at line 201 of file CrossSectionAnalysis.cxx.

References fFlux, make_syst_table_plots::h, and ana::Spectrum::ToTH1().

Referenced by test_xsecanalysis(), and ~CrossSectionAnalysis().

202  {
203  TH1 *h = fFlux->ToTH1(1);
204  //h->Scale(1e-4);
205  h->GetYaxis()->SetTitle("Flux / POT / m^{2}");
206  return h;
207  }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
TH2D * ana::CrossSectionAnalysis::PlotRecoToTrueMatrix ( )

Definition at line 226 of file CrossSectionAnalysis.cxx.

References fData, fRecoTrue, ana::Spectrum::POT(), and ana::ReweightableSpectrum::ToTH2().

Referenced by test_xsecanalysis(), and ~CrossSectionAnalysis().

227  {
228  return fRecoTrue.ToTH2(fData.POT());
229  }
double POT() const
Definition: Spectrum.h:227
ReweightableSpectrum fRecoTrue
TH2D * ToTH2(double pot) const
TH1 * ana::CrossSectionAnalysis::PlotSignalEstimate ( )

Definition at line 186 of file CrossSectionAnalysis.cxx.

References ana::IBkgdEstimator::Background(), fBkgdEst, fData, ana::Spectrum::POT(), and SignalEst().

Referenced by ~CrossSectionAnalysis().

187  {
188  return SignalEst(fBkgdEst->Background()).ToTH1(fData.POT());
189  }
virtual Spectrum Background() const =0
Spectrum SignalEst(Spectrum bkgd)
double POT() const
Definition: Spectrum.h:227
TH1 * ana::CrossSectionAnalysis::PlotUnfoldedSignal ( )

Definition at line 193 of file CrossSectionAnalysis.cxx.

References ana::IBkgdEstimator::Background(), fBkgdEst, fData, ana::Spectrum::POT(), SignalEst(), ana::Spectrum::ToTH1(), and UnfoldedSignal().

Referenced by test_xsecanalysis(), and ~CrossSectionAnalysis().

194  {
195  Spectrum bkgd = fBkgdEst->Background();
196  return UnfoldedSignal(SignalEst(bkgd)).ToTH1(fData.POT());
197  }
Spectrum UnfoldedSignal(Spectrum signal, ReweightableSpectrum *rt=NULL)
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
virtual Spectrum Background() const =0
Spectrum SignalEst(Spectrum bkgd)
std::vector< float > Spectrum
Definition: Constants.h:610
double POT() const
Definition: Spectrum.h:227
TH1 * ana::CrossSectionAnalysis::Result ( )

Definition at line 100 of file CrossSectionAnalysis.cxx.

References ana::IBkgdEstimator::Background(), e, nd_projection_maker::eff, Efficiency(), fBkgdEst, fData, fFlux, hflux, NTargets(), ntargs, ana::Spectrum::POT(), SignalEst(), ana::Spectrum::ToTH1(), UnfoldedSignal(), and xsec.

Referenced by genie_syst(), test_xsecanalysis(), and ~CrossSectionAnalysis().

101  {
102  Spectrum bkgd = fBkgdEst->Background();
103  Spectrum sig = SignalEst(bkgd);
104  Spectrum sig_unfolded = UnfoldedSignal(sig);
105  Ratio eff = Efficiency();
106  double ntargs = NTargets();
107  //double flux = fFlux->Integral(fData.POT());
108  TH1* hflux = fFlux->ToTH1(fData.POT());
109 
110  TH1* xsec = (sig_unfolded/eff).ToTH1(fData.POT());
111  hflux->Scale(1e-4); // Convert nu/m^2 to nu/cm^2
112  xsec->Divide(hflux);
113  xsec->Scale(1./ntargs);
114  //xsec->Scale(1./(nnuc*flux));
115 
116  return xsec;
117  }
Spectrum UnfoldedSignal(Spectrum signal, ReweightableSpectrum *rt=NULL)
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
virtual Spectrum Background() const =0
virtual double NTargets()
Default implementation returns number of nucleons. Override if needed.
TH1F * hflux
Definition: Xdiff_gwt.C:121
Spectrum SignalEst(Spectrum bkgd)
const double ntargs
std::vector< float > Spectrum
Definition: Constants.h:610
double POT() const
Definition: Spectrum.h:227
Double_t xsec[nknots]
Definition: testXsec.C:47
Float_t e
Definition: plot.C:35
void ana::CrossSectionAnalysis::SaveTo ( TDirectory *  dir,
const std::string name 
) const

Definition at line 232 of file CrossSectionAnalysis.cxx.

References dir, fBkgdEst, fData, fFidMax, fFidMin, fFlux, fMC, fMCSig, fMCSigNuTree, fRecoTrue, fUnfoldReg, ana::IBkgdEstimator::SaveTo(), ana::ReweightableSpectrum::SaveTo(), ana::Spectrum::SaveTo(), and tmp.

Referenced by ana::NumuCCIncAnalysis::SaveTo(), test_xsecanalysis(), and ~CrossSectionAnalysis().

232  {
233  TDirectory *tmp = gDirectory;
234 
235  dir = dir->mkdir(name.c_str()); // switch to subdir
236  dir->cd();
237 
238  TObjString("CrossSectionAnlaysis").Write("type");
239 
240  fData.SaveTo(dir, "fData");
241  fMC.SaveTo(dir, "fMC");
242  fMCSig->SaveTo(dir, "fMCSig");
243  fMCSigNuTree->SaveTo(dir, "fMCSigNuTree");
244  fRecoTrue.SaveTo(dir, "fRecoTrue");
245 
246  fBkgdEst->SaveTo(dir, "fBkgdEst");
247 
248  TVectorD unfoldreg(1);
249  unfoldreg[0] = fUnfoldReg;
250  unfoldreg.Write("fUnfoldReg");
251 
252  fFidMin.Write("fFidMin");
253  fFidMax.Write("fFidMax");
254  fFlux->SaveTo(dir, "fFlux");
255 
256  dir->Write();
257  delete dir;
258 
259  tmp->cd();
260  }
const XML_Char * name
Definition: expat.h:151
Float_t tmp
Definition: plot.C:36
virtual void SaveTo(TDirectory *dir, const std::string &name) const =0
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
TDirectory * dir
Definition: macro.C:5
void SaveTo(TDirectory *dir, const std::string &name) const
ReweightableSpectrum fRecoTrue
Spectrum ana::CrossSectionAnalysis::SignalEst ( Spectrum  bkgd)
protected
Spectrum ana::CrossSectionAnalysis::UnfoldedSignal ( Spectrum  signal,
ReweightableSpectrum rt = NULL 
)
protected

Definition at line 124 of file CrossSectionAnalysis.cxx.

References fRecoTrue, fUnfoldMethod, fUnfoldReg, ana::kMaxEnt, ana::kSVD, ana::kTikhonov, ana::UnfoldIterative::Truth(), ana::UnfoldSVD::Truth(), and ana::UnfoldTikhonov::Truth().

Referenced by CrossSectionAnalysis(), PlotUnfoldedSignal(), ana::SingleNucAnalysis::PlotUnfoldedSignal2D(), ana::NumuCC2p2hAnalysis::PlotUnfoldedSignal2D(), Result(), ana::NumuCC2p2hAnalysis::Result1DFluxInt(), ana::NumuCC2p2hAnalysis::Result2D(), ana::SingleNucAnalysis::Result2D(), and ana::NumuCCIncAnalysis::UnfoldedSignal().

126  {
127 
128  if(rt == NULL)
129  rt = &fRecoTrue;
130 
131  switch(fUnfoldMethod){
132  case(UnfoldMethod_t::kTikhonov) : {
133  UnfoldTikhonov unfold(*rt, fUnfoldReg);
134  return unfold.Truth(sig);
135  }
136  case(UnfoldMethod_t::kSVD) : {
137  UnfoldSVD unfold(*rt, fUnfoldReg);
138  return unfold.Truth(sig);
139  }
140  case(UnfoldMethod_t::kMaxEnt) : {
141  UnfoldMaxEnt unfold(*rt, fUnfoldReg);
142  return unfold.Truth(sig);
143  }
144  default : {
145  UnfoldIterative unfold(*rt, fUnfoldReg);
146  return unfold.Truth(sig);
147  }
148 
149  }// end of switch-case
150 
151  }
ReweightableSpectrum fRecoTrue

Member Data Documentation

IBkgdEstimator* ana::CrossSectionAnalysis::fBkgdEst
protected
Spectrum ana::CrossSectionAnalysis::fData
protected
TVector3 ana::CrossSectionAnalysis::fFidMax
protected

Definition at line 154 of file CrossSectionAnalysis.h.

Referenced by CrossSectionAnalysis(), and SaveTo().

TVector3 ana::CrossSectionAnalysis::fFidMin
protected

Definition at line 153 of file CrossSectionAnalysis.h.

Referenced by CrossSectionAnalysis(), and SaveTo().

Spectrum* ana::CrossSectionAnalysis::fFlux
protected
Spectrum ana::CrossSectionAnalysis::fMC
protected

Definition at line 139 of file CrossSectionAnalysis.h.

Referenced by ana::NumuCCIncAnalysis::PlotMCReco(), and SaveTo().

Spectrum* ana::CrossSectionAnalysis::fMCSig
protected
Spectrum* ana::CrossSectionAnalysis::fMCSigNuTree
protected
double ana::CrossSectionAnalysis::fNTargets
protected

Definition at line 147 of file CrossSectionAnalysis.h.

Referenced by NTargets().

ReweightableSpectrum ana::CrossSectionAnalysis::fRecoTrue
protected
TargetCount ana::CrossSectionAnalysis::fTarget
protected

Definition at line 156 of file CrossSectionAnalysis.h.

Referenced by NucleonCount(), and NucleusCount().

UnfoldMethod_t ana::CrossSectionAnalysis::fUnfoldMethod
protected
double ana::CrossSectionAnalysis::fUnfoldReg
protected

Definition at line 150 of file CrossSectionAnalysis.h.

Referenced by SaveTo(), and UnfoldedSignal().


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