NuShiftableUnbinnedSpectrum Class Reference

#include <NuShiftableUnbinnedSpectrum.h>

Inheritance diagram for NuShiftableUnbinnedSpectrum:
NuShiftableSpectrum

List of all members.

Public Member Functions

 NuShiftableUnbinnedSpectrum ()
 NuShiftableUnbinnedSpectrum (const std::string filename)
virtual void Charge (const Int_t charge)
virtual Int_t Charge () const
virtual const TH1D Spectrum (const NuMMParameters &pars) const

Private Member Functions

virtual const TH1D Spectrum (const Double_t shift) const

Private Attributes

Int_t fCharge
NuBinningScheme::NuBinningScheme_t fBinningScheme
std::vector< NuMiniEventfEventList

Detailed Description

Definition at line 18 of file NuShiftableUnbinnedSpectrum.h.


Constructor & Destructor Documentation

NuShiftableUnbinnedSpectrum::NuShiftableUnbinnedSpectrum (  ) 

Definition at line 18 of file NuShiftableUnbinnedSpectrum.cxx.

NuShiftableUnbinnedSpectrum::NuShiftableUnbinnedSpectrum ( const std::string  filename  ) 

Definition at line 27 of file NuShiftableUnbinnedSpectrum.cxx.

References NuFCEvent::charge, NuFCEvent::energy, Msg::kInfo, MSG, NuMiniEvent::recoNuEnergy, NuMiniEvent::recoTrackEnergy, and NuFCEvent::trkEn.

00028   : NuShiftableSpectrum(),
00029     fCharge(1)
00030 {
00031   /*
00032   const NuTreeWrapper dst(filename);
00033   this->PoT(dst.GetPoT());
00034   Int_t numEntries = dst.GetEntries();
00035   for (Int_t entry=0; entry<numEntries; ++entry){
00036     NuEvent event = dst.GetInfoObject(entry);
00037     if (event.charge == fCharge || 0==fCharge){
00038       NuMiniEvent miniEvent;
00039       miniEvent.recoTrackEnergy = event.trkEn;
00040       miniEvent.recoNuEnergy = event.energy;
00041       fEventList.push_back(miniEvent);
00042     }
00043   }
00044   */
00045   TChain fcDST("FCTree");
00046   fcDST.Add(filename.c_str());
00047   NuFCEvent* fcEvent = 0;
00048   fcDST.SetBranchAddress("NuFCEvent",&fcEvent);
00049   Int_t numEntries = fcDST.GetEntries();
00050   for (Int_t entry=0; entry<numEntries; ++entry){
00051     fcDST.GetEvent(entry);
00052     if (this->Charge() == fcEvent->charge || 0==this->Charge()){
00053       NuMiniEvent miniEvent;
00054       miniEvent.recoTrackEnergy = fcEvent->trkEn;
00055       miniEvent.recoNuEnergy = fcEvent->energy;
00056       fEventList.push_back(miniEvent);
00057     }
00058   }
00059 
00060   TObjArray* fileList = fcDST.GetListOfFiles();
00061   Double_t totPoT = 0.0;
00062   for (Int_t counter=0; counter<fileList->GetEntries(); ++counter){
00063     TChainElement* chainElement =
00064       dynamic_cast<TChainElement*> (fileList->At(counter));
00065     if (chainElement){
00066       string fileName = chainElement->GetTitle();
00067       TFile f(fileName.c_str(),"READ");
00068       TH1F* hTotalPot = (TH1F*) f.Get("hTotalPot");
00069       if (hTotalPot){
00070         totPoT += hTotalPot->Integral();
00071       }
00072       f.Close();
00073     }
00074   }
00075   this->PoT(totPoT);
00076   MSG("NuTreeWrapper.cxx",Msg::kInfo)
00077     << "PoT: " << totPoT << endl;
00078 }


Member Function Documentation

virtual Int_t NuShiftableUnbinnedSpectrum::Charge (  )  const [inline, virtual]

Definition at line 24 of file NuShiftableUnbinnedSpectrum.h.

References fCharge.

00024 {return fCharge;};

virtual void NuShiftableUnbinnedSpectrum::Charge ( const Int_t  charge  )  [inline, virtual]

Definition at line 23 of file NuShiftableUnbinnedSpectrum.h.

References fCharge.

00023 {fCharge=charge;};

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

Implements NuShiftableSpectrum.

Definition at line 87 of file NuShiftableUnbinnedSpectrum.cxx.

References fBinningScheme, fEventList, it, and NuUtilities::RecoBins().

00088 {
00089   const NuUtilities utils;
00090   const vector<Double_t> recoBins = utils.RecoBins(fBinningScheme);
00091   const Int_t numRecoBins = recoBins.size()-1;
00092   Float_t *recoBinsArray;
00093   recoBinsArray=new Float_t[numRecoBins+1];
00094   {
00095     Int_t i=0;
00096     for (vector<Double_t>::const_iterator itBin = recoBins.begin();
00097          itBin != recoBins.end();
00098          ++itBin, ++i){
00099       recoBinsArray[i] = *itBin;
00100     }
00101   }
00102   TH1D outSpectrum("RecoEnergy_FD","",
00103                    numRecoBins,recoBinsArray);
00104 
00105   for (vector<NuMiniEvent>::const_iterator it = fEventList.begin();
00106        it != fEventList.end();
00107        ++it){
00108     Double_t energy = it->recoNuEnergy;
00109     Double_t trkEn = it->recoTrackEnergy;
00110     Double_t shiftedEnergy = energy + shift*trkEn;
00111     outSpectrum.Fill(shiftedEnergy);
00112   }
00113 
00114   return outSpectrum;
00115 }

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

Implements NuShiftableSpectrum.

Definition at line 81 of file NuShiftableUnbinnedSpectrum.cxx.

References NuMMParameters::ShwEnScale().

00082 {
00083   return this->Spectrum(pars.ShwEnScale());
00084 }


Member Data Documentation

Definition at line 29 of file NuShiftableUnbinnedSpectrum.h.

Referenced by Spectrum().

Definition at line 28 of file NuShiftableUnbinnedSpectrum.h.

Referenced by Charge().

Definition at line 30 of file NuShiftableUnbinnedSpectrum.h.

Referenced by Spectrum().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1