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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/NDAna/numucc_2p2h/SingleNucAnalysis.h"

Inheritance diagram for ana::SingleNucAnalysis:
ana::CrossSectionAnalysis

Public Member Functions

TH2 * Result2D ()
 
TH2 * PlotEfficiency2D ()
 
TH2 * PlotSignalEstimate2D ()
 
TH2 * PlotUnfoldedSignal2D ()
 
TH1 * PlotFluxEstimate2D ()
 
TH2 * PlotBackgroundEstimate2D ()
 
TH2 * PlotData2D ()
 
TH2D * PlotRecoToTrueMatrix2D ()
 
TH1 * Result ()
 
TH1 * PlotEfficiency ()
 
TH1 * PlotSignalEstimate ()
 
TH1 * PlotUnfoldedSignal ()
 
TH1 * PlotFluxEstimate ()
 
TH1 * PlotBackgroundEstimate ()
 
TH1 * PlotData ()
 
TH2D * PlotRecoToTrueMatrix ()
 
void SaveTo (TDirectory *dir, const std::string &name) const
 

Static Public Member Functions

static std::unique_ptr< SingleNucAnalysisLoadFrom (TDirectory *dir)
 
static std::unique_ptr< SingleNucAnalysisLoadFrom (TDirectory *dir, UnfoldMethod_t unfoldmethod)
 
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

double NTargets ()
 Default implementation returns number of nucleons. Override if needed. More...
 
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

Definition at line 26 of file SingleNucAnalysis.h.

Member Function Documentation

Ratio ana::CrossSectionAnalysis::Efficiency ( )
protectedinherited
std::unique_ptr< SingleNucAnalysis > ana::SingleNucAnalysis::LoadFrom ( TDirectory *  dir)
static

Definition at line 105 of file SingleNucAnalysis.cxx.

References ana::kIterative.

105  {
106  return LoadFrom(dir, kIterative);
107  }
static std::unique_ptr< SingleNucAnalysis > LoadFrom(TDirectory *dir)
TDirectory * dir
Definition: macro.C:5
std::unique_ptr< SingleNucAnalysis > ana::SingleNucAnalysis::LoadFrom ( TDirectory *  dir,
UnfoldMethod_t  unfoldmethod 
)
static

Definition at line 110 of file SingleNucAnalysis.cxx.

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

112  {
113  Spectrum* data = ana::LoadFrom<Spectrum>
114  (dir->GetDirectory("fData")).release();
115  Spectrum* mc = ana::LoadFrom<Spectrum>
116  (dir->GetDirectory("fMC")).release();
117  Spectrum* mcsig= ana::LoadFrom<Spectrum>
118  (dir->GetDirectory("fMCSig")).release();
119  Spectrum* mcsignutree = ana::LoadFrom<Spectrum>
120  (dir->GetDirectory("fMCSigNuTree")).release();
121  ReweightableSpectrum* rt = ana::LoadFrom<ReweightableSpectrum>
122  (dir->GetDirectory("fRecoTrue")).release();
123 
124  IBkgdEstimator* bkgdest = ana::LoadFrom<IBkgdEstimator>
125  (dir->GetDirectory("fBkgdEst")).release();
126 
127  TVectorD* unfoldreg = (TVectorD*)dir->Get("fUnfoldReg");
128  TVector3* min = (TVector3*)dir->Get("fFidMin");
129  TVector3* max = (TVector3*)dir->Get("fFidMax");
130 
131  Spectrum* flux = ana::LoadFrom<Spectrum>
132  (dir->GetDirectory("fFlux")).release();
133 
134  return std::unique_ptr<SingleNucAnalysis>(
135  new SingleNucAnalysis(*data, *mc, mcsig, mcsignutree, *rt, bkgdest,
136  (*unfoldreg)[0], unfoldmethod, *min, *max, flux));
137  }
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
std::unique_ptr< IBkgdEstimator > LoadFrom< IBkgdEstimator >(TDirectory *dir, const std::string &label)
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 = kIterative 
)
staticinherited

Definition at line 263 of file CrossSectionAnalysis.cxx.

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

Referenced by test_xsecanalysis(), and ana::CrossSectionAnalysis::~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 
)
staticinherited

Definition at line 290 of file CrossSectionAnalysis.cxx.

References ana::assert(), ana::CrossSectionAnalysis::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::SingleNucAnalysis::NTargets ( )
inlineprotectedvirtual

Default implementation returns number of nucleons. Override if needed.

Reimplemented from ana::CrossSectionAnalysis.

Definition at line 46 of file SingleNucAnalysis.h.

References ana::CrossSectionAnalysis::NucleusCount().

Referenced by Result2D().

46 { return NucleusCount(6, 12); };
double NucleusCount(int Z=-1, int A=-1)
double ana::CrossSectionAnalysis::NucleonCount ( )
protectedinherited

Definition at line 165 of file CrossSectionAnalysis.cxx.

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

Referenced by ana::CrossSectionAnalysis::CrossSectionAnalysis(), and ana::CrossSectionAnalysis::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 
)
protectedinherited

Definition at line 170 of file CrossSectionAnalysis.cxx.

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

Referenced by ana::CrossSectionAnalysis::CrossSectionAnalysis(), and 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 ( )
inherited

Definition at line 211 of file CrossSectionAnalysis.cxx.

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

Referenced by ana::CrossSectionAnalysis::~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
TH2 * ana::SingleNucAnalysis::PlotBackgroundEstimate2D ( )

Definition at line 84 of file SingleNucAnalysis.cxx.

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

85  {
86  Spectrum bkgd = fBkgdEst->Background();
87  return bkgd.ToTH2(fData.POT());
88  }
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:165
virtual Spectrum Background() const =0
std::vector< float > Spectrum
Definition: Constants.h:610
double POT() const
Definition: Spectrum.h:227
TH1 * ana::CrossSectionAnalysis::PlotData ( )
inherited

Definition at line 219 of file CrossSectionAnalysis.cxx.

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

Referenced by ana::CrossSectionAnalysis::~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
TH2 * ana::SingleNucAnalysis::PlotData2D ( )

Definition at line 92 of file SingleNucAnalysis.cxx.

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

93  {
94  return fData.ToTH2(fData.POT());
95  }
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:165
double POT() const
Definition: Spectrum.h:227
TH1 * ana::CrossSectionAnalysis::PlotEfficiency ( )
inherited

Definition at line 179 of file CrossSectionAnalysis.cxx.

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

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

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

Definition at line 53 of file SingleNucAnalysis.cxx.

References ana::CrossSectionAnalysis::Efficiency(), and ana::Ratio::ToTH2().

54  {
55  return Efficiency().ToTH2();
56  }
TH2 * ToTH2() const
Definition: Ratio.cxx:78
TH1 * ana::CrossSectionAnalysis::PlotFluxEstimate ( )
inherited

Definition at line 201 of file CrossSectionAnalysis.cxx.

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

Referenced by test_xsecanalysis(), and ana::CrossSectionAnalysis::~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
TH1 * ana::SingleNucAnalysis::PlotFluxEstimate2D ( )

Definition at line 74 of file SingleNucAnalysis.cxx.

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

75  {
76  TH1 *h = fFlux->ToTH1(1);
77  //h->Scale(1e-4);
78  h->GetYaxis()->SetTitle("Flux / POT / m^{2}");
79  return h;
80  }
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 ( )
inherited
TH2D * ana::SingleNucAnalysis::PlotRecoToTrueMatrix2D ( )
TH1 * ana::CrossSectionAnalysis::PlotSignalEstimate ( )
inherited
TH2 * ana::SingleNucAnalysis::PlotSignalEstimate2D ( )

Definition at line 59 of file SingleNucAnalysis.cxx.

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

60  {
62  }
virtual Spectrum Background() const =0
Spectrum SignalEst(Spectrum bkgd)
double POT() const
Definition: Spectrum.h:227
TH2 * ToTH2(const Spectrum &s, double exposure, ana::EExposureType expotype, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
For use with Var2D.
Definition: UtilsExt.cxx:115
TH1 * ana::CrossSectionAnalysis::PlotUnfoldedSignal ( )
inherited

Definition at line 193 of file CrossSectionAnalysis.cxx.

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

Referenced by test_xsecanalysis(), and ana::CrossSectionAnalysis::~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
TH2 * ana::SingleNucAnalysis::PlotUnfoldedSignal2D ( )

Definition at line 66 of file SingleNucAnalysis.cxx.

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

67  {
68  Spectrum bkgd = fBkgdEst->Background();
69  return UnfoldedSignal(SignalEst(bkgd)).ToTH2(fData.POT());
70  }
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:165
Spectrum UnfoldedSignal(Spectrum signal, ReweightableSpectrum *rt=NULL)
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 ( )
inherited

Definition at line 100 of file CrossSectionAnalysis.cxx.

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

Referenced by genie_syst(), test_xsecanalysis(), and ana::CrossSectionAnalysis::~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
TH2 * ana::SingleNucAnalysis::Result2D ( )

Definition at line 24 of file SingleNucAnalysis.cxx.

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

25  {
26  Spectrum bkgd = fBkgdEst->Background();
27  Spectrum sig = SignalEst(bkgd);
28  Spectrum sig_unfolded = UnfoldedSignal(sig);
29  Ratio eff = Efficiency();
30  double ntargs = NTargets();
31  //double flux = fFlux->Integral(fData.POT());
32  TH1* hflux = fFlux->ToTH1(fData.POT());
33  double flux = hflux->Integral();
34  TH2* xsec = (sig_unfolded/eff).ToTH2(fData.POT());
35  for(int iBinX = 1; iBinX<=xsec->GetXaxis()->GetNbins(); iBinX++)
36  {
37  for(int iBinY = 1; iBinY<=xsec->GetYaxis()->GetNbins(); iBinY++)
38  {
39  double binwidth = xsec->GetXaxis()->GetBinWidth(iBinX)*xsec->GetYaxis()->GetBinWidth(iBinY);
40  double newcontent = xsec->GetBinContent(iBinX,iBinY)/binwidth;
41  xsec->SetBinContent(iBinX,iBinY,newcontent);
42  }
43  }
44  hflux->Scale(1e-4); // Convert nu/m^2 to nu/cm^2
45  //xsec->Divide(hflux);
46  xsec->Scale(1./ntargs);
47  xsec->Scale(1./flux);
48  //xsec->Scale(1./(nnuc*flux));
49 
50  return xsec;
51  }
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
Loaders::FluxType flux
TH1F * hflux
Definition: Xdiff_gwt.C:121
double NTargets()
Default implementation returns number of nucleons. Override if needed.
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
TH2 * ToTH2(const Spectrum &s, double exposure, ana::EExposureType expotype, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
For use with Var2D.
Definition: UtilsExt.cxx:115
void ana::CrossSectionAnalysis::SaveTo ( TDirectory *  dir,
const std::string name 
) const
inherited

Definition at line 232 of file CrossSectionAnalysis.cxx.

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

Referenced by ana::NumuCCIncAnalysis::SaveTo(), test_xsecanalysis(), and ana::CrossSectionAnalysis::~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)
protectedinherited
Spectrum ana::CrossSectionAnalysis::UnfoldedSignal ( Spectrum  signal,
ReweightableSpectrum rt = NULL 
)
protectedinherited

Definition at line 124 of file CrossSectionAnalysis.cxx.

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

Referenced by ana::CrossSectionAnalysis::CrossSectionAnalysis(), ana::CrossSectionAnalysis::PlotUnfoldedSignal(), PlotUnfoldedSignal2D(), ana::NumuCC2p2hAnalysis::PlotUnfoldedSignal2D(), ana::CrossSectionAnalysis::Result(), ana::NumuCC2p2hAnalysis::Result1DFluxInt(), Result2D(), ana::NumuCC2p2hAnalysis::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
protectedinherited
Spectrum ana::CrossSectionAnalysis::fData
protectedinherited
TVector3 ana::CrossSectionAnalysis::fFidMax
protectedinherited
TVector3 ana::CrossSectionAnalysis::fFidMin
protectedinherited
Spectrum* ana::CrossSectionAnalysis::fFlux
protectedinherited
Spectrum ana::CrossSectionAnalysis::fMC
protectedinherited
Spectrum* ana::CrossSectionAnalysis::fMCSig
protectedinherited
Spectrum* ana::CrossSectionAnalysis::fMCSigNuTree
protectedinherited
double ana::CrossSectionAnalysis::fNTargets
protectedinherited

Definition at line 147 of file CrossSectionAnalysis.h.

Referenced by ana::CrossSectionAnalysis::NTargets().

ReweightableSpectrum ana::CrossSectionAnalysis::fRecoTrue
protectedinherited
TargetCount ana::CrossSectionAnalysis::fTarget
protectedinherited
UnfoldMethod_t ana::CrossSectionAnalysis::fUnfoldMethod
protectedinherited
double ana::CrossSectionAnalysis::fUnfoldReg
protectedinherited

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