NuShiftableBinnedSpectrum Class Reference

#include <NuShiftableBinnedSpectrum.h>

Inheritance diagram for NuShiftableBinnedSpectrum:
NuShiftableSpectrum

List of all members.

Public Member Functions

 NuShiftableBinnedSpectrum ()
 NuShiftableBinnedSpectrum (const Double_t pot)
 NuShiftableBinnedSpectrum (const std::string name)
virtual const TH1D Spectrum (const NuMMParameters &pars) const
virtual void push_back (const Double_t shift, const TH1D &spectrum, const Double_t pot)
virtual void push_back (const Double_t shift, const TH1D &spectrum)
virtual void push_back (const Double_t shift, const std::string filename)

Private Member Functions

virtual const TH1D Spectrum (const Double_t shift) const
 ClassDef (NuShiftableBinnedSpectrum, 0)

Private Attributes

std::map< Double_t, TH1D > fSpectra

Detailed Description

Definition at line 8 of file NuShiftableBinnedSpectrum.h.


Constructor & Destructor Documentation

NuShiftableBinnedSpectrum::NuShiftableBinnedSpectrum (  ) 

Definition at line 14 of file NuShiftableBinnedSpectrum.cxx.

00015   : NuShiftableSpectrum()
00016 {
00017 }

NuShiftableBinnedSpectrum::NuShiftableBinnedSpectrum ( const Double_t  pot  ) 

Definition at line 20 of file NuShiftableBinnedSpectrum.cxx.

00021   : NuShiftableSpectrum(pot)
00022 {
00023 }

NuShiftableBinnedSpectrum::NuShiftableBinnedSpectrum ( const std::string  name  ) 

Definition at line 26 of file NuShiftableBinnedSpectrum.cxx.

00027   : NuShiftableSpectrum(name)
00028 {
00029 }


Member Function Documentation

NuShiftableBinnedSpectrum::ClassDef ( NuShiftableBinnedSpectrum  ,
 
) [private]

Reimplemented from NuShiftableSpectrum.

void NuShiftableBinnedSpectrum::push_back ( const Double_t  shift,
const std::string  filename 
) [virtual]

Definition at line 50 of file NuShiftableBinnedSpectrum.cxx.

References push_back().

00052 {
00053   TFile file(filename.c_str(),"READ");
00054   TH1D* histogram = (TH1D*) file.Get(this->Name().c_str());
00055   histogram->SetDirectory(0);
00056   TH1D* hPoT = (TH1D*) file.Get("hTotalPot");
00057   hPoT->SetDirectory(0);
00058   this->push_back(shift,
00059                   *histogram,
00060                   hPoT->Integral());
00061 }

void NuShiftableBinnedSpectrum::push_back ( const Double_t  shift,
const TH1D &  spectrum 
) [virtual]

Definition at line 42 of file NuShiftableBinnedSpectrum.cxx.

References fSpectra.

00044 {
00045   fSpectra[shift] = spectrum;
00046   fSpectra[shift].SetDirectory(0);
00047 }

void NuShiftableBinnedSpectrum::push_back ( const Double_t  shift,
const TH1D &  spectrum,
const Double_t  pot 
) [virtual]

Definition at line 32 of file NuShiftableBinnedSpectrum.cxx.

References fSpectra, and NuShiftableSpectrum::PoT().

Referenced by push_back().

00035 {
00036   fSpectra[shift] = spectrum;
00037   this->PoT(pot);
00038   fSpectra[shift].SetDirectory(0);
00039 }

const TH1D NuShiftableBinnedSpectrum::Spectrum ( const Double_t  shift  )  const [private, virtual]

Implements NuShiftableSpectrum.

Definition at line 70 of file NuShiftableBinnedSpectrum.cxx.

References count, and fSpectra.

00071 {
00072   std::map<Double_t,TH1D>::const_iterator spectraIt = fSpectra.begin();
00073   TH1D outSpectrum(spectraIt->second);
00074   if (1 == fSpectra.size()){
00075     return outSpectrum;
00076   }
00077   for (Int_t bin = 1; bin<=outSpectrum.GetNbinsX(); ++bin){
00078     TGraph gInterpolate(fSpectra.size());
00079     Int_t count=0;
00080     for (spectraIt = fSpectra.begin();
00081          spectraIt != fSpectra.end();
00082          ++spectraIt){
00083       gInterpolate.SetPoint(count,
00084                             spectraIt->first,
00085                             spectraIt->second.GetBinContent(bin));
00086       ++count;
00087     }
00088     gInterpolate.Fit("pol2","Q");
00089     Double_t par0 = gInterpolate.GetFunction("pol2")->GetParameter(0);
00090     Double_t par1 = gInterpolate.GetFunction("pol2")->GetParameter(1);
00091     Double_t par2 = gInterpolate.GetFunction("pol2")->GetParameter(2);
00092     Double_t binContent = par0 + shift*par1 + shift*shift*par2;
00093 
00094     if (binContent<0.0){binContent=0.0;}
00095     outSpectrum.SetBinContent(bin,binContent);
00096   }
00097   return outSpectrum;
00098 }

const TH1D NuShiftableBinnedSpectrum::Spectrum ( const NuMMParameters pars  )  const [virtual]

Implements NuShiftableSpectrum.

Definition at line 64 of file NuShiftableBinnedSpectrum.cxx.

References NuMMParameters::ShwEnScale().

00065 {
00066   return this->Spectrum(pars.ShwEnScale());
00067 }


Member Data Documentation

std::map<Double_t, TH1D> NuShiftableBinnedSpectrum::fSpectra [private]

Definition at line 26 of file NuShiftableBinnedSpectrum.h.

Referenced by push_back(), and Spectrum().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1