Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

NCExtrapolationNone Class Reference

"Extrapolation" that simply uses FD MC More...

#include <NCExtrapolationNone.h>

Inheritance diagram for NCExtrapolationNone:

NCExtrapolation List of all members.

Public Member Functions

 NCExtrapolationNone ()
virtual ~NCExtrapolationNone ()
void Prepare (const Registry &r)
void WriteResources (const NC::OscProb::OscPars *trueOscPars)
virtual TString GetShortName () const
 This is the name used to name things in the output file etc.
virtual TString GetLongName () const
 This is the name the extrapolation is known under on plots and such.
virtual void AddEvent (NCEventInfo eventInfo, bool useMCAsData, NCType::EFileType fileType, NCBeam::Info beamInfo)
virtual void FindSpectraForPars (const NC::OscProb::OscPars *oscPars, const NC::SystPars &systPars, std::vector< NCBeam::Info > beamsToUse, std::vector< TH1 * > &exps, std::vector< TH1 * > &obss)
 Override this in the derived class.
virtual void CleanupSpectra (std::vector< TH1 * > expvec, std::vector< TH1 * > obsvec)
 Called after FindSpectraForPars() to delete necessary spectra.

Static Public Member Functions

const RegistryDefaultConfig ()
 Return a default config that will be merged with the NCExtrapolationModule DefaultConfig.

Private Types

typedef void(NCEnergyBin::* InfoFunction )(double &, double &, double &, double &, int &, int) const
 The type signature of the NCEnergyBin::GetMC*Information functions.

Private Member Functions

void FillMCSpectrum (TH1 *exp, const NCEnergyBin *bin, InfoFunction func, int size, const NC::OscProb::OscPars *pars, NCType::EEventType nccc, NCType::EOscMode oscmode)

Private Attributes

int nCalls
 Counts number of calls to the method.
TTree * fEventsTree
TString fSelEvtsFname

Detailed Description

"Extrapolation" that simply uses FD MC

Definition at line 25 of file NCExtrapolationNone.h.


Member Typedef Documentation

typedef void(NCEnergyBin::* NCExtrapolationNone::InfoFunction)(double &, double &, double &, double &, int &, int) const [private]
 

The type signature of the NCEnergyBin::GetMC*Information functions.

Definition at line 59 of file NCExtrapolationNone.h.


Constructor & Destructor Documentation

NCExtrapolationNone::NCExtrapolationNone  ) 
 

Definition at line 33 of file NCExtrapolationNone.cxx.

00034 {
00035   nCalls = 0;
00036 
00037   fEventsTree = new TTree("sel_evts", "sel_evts");
00038 
00039   fEventsTree->Branch("header.",   "ANtpHeaderInfo",   (void**)0);
00040   fEventsTree->Branch("beam.",     "ANtpBeamInfo",     (void**)0);
00041   fEventsTree->Branch("reco.",     "ANtpRecoInfo",     (void**)0);
00042   fEventsTree->Branch("analysis.", "ANtpAnalysisInfo", (void**)0);
00043 }

NCExtrapolationNone::~NCExtrapolationNone  )  [virtual]
 

Definition at line 48 of file NCExtrapolationNone.cxx.

References MSG, and nCalls.

00049 {
00050   MSG("NCExtrapolationNone", Msg::kInfo) << nCalls << " calls in total to NCExtrapolationNone" << endl;
00051 
00052   if(fEventsTree) delete fEventsTree;
00053 }


Member Function Documentation

void NCExtrapolationNone::AddEvent NCEventInfo  eventInfo,
bool  useMCAsData,
NCType::EFileType  fileType,
NCBeam::Info  beamInfo
[virtual]
 

Reimplemented from NCExtrapolation.

Definition at line 80 of file NCExtrapolationNone.cxx.

References NCExtrapolation::AddEvent(), NCEventInfo::analysis, NCEventInfo::beam, ANtpHeaderInfo::dataType, ANtpHeaderInfo::detector, fEventsTree, NCEventInfo::header, ANtpRecoInfo::inFiducialVolume, ANtpRecoInfo::isSimpleCutsClean, and NCEventInfo::reco.

00084 {
00085   // Chain up to base-class's implementation so the NCBeam objects get filled
00086   NCExtrapolation::AddEvent(info, useMCAsData, fileType, beamInfo);
00087 
00088   // Then go ahead and put the events in the selected events tree too
00089 
00090   if(info.reco->inFiducialVolume < 1 ||
00091      (info.header->detector == int(Detector::kNear) &&
00092       info.reco->isSimpleCutsClean < 1))
00093      return;
00094 
00095   if(info.header->dataType != int(SimFlag::kData)) return;
00096 
00097   assert(fEventsTree);
00098   fEventsTree->SetBranchAddress("header.", &info.header);
00099   fEventsTree->SetBranchAddress("beam.", &info.beam);
00100   fEventsTree->SetBranchAddress("reco.", &info.reco);
00101   fEventsTree->SetBranchAddress("analysis.", &info.analysis);
00102 
00103   fEventsTree->Fill();
00104 }

void NCExtrapolationNone::CleanupSpectra std::vector< TH1 * >  expvec,
std::vector< TH1 * >  obsvec
[virtual]
 

Called after FindSpectraForPars() to delete necessary spectra.

Parameters:
exps The expected spectra just returned from FindSpectraForPars()
obss The observed spectra just returned from FindSpectraForPars()

Reimplemented from NCExtrapolation.

Definition at line 217 of file NCExtrapolationNone.cxx.

00219 {
00220   for(unsigned int n = 0; n < expvec.size(); ++n) delete expvec[n];
00221 }

const Registry & NCExtrapolationNone::DefaultConfig  )  [static]
 

Return a default config that will be merged with the NCExtrapolationModule DefaultConfig.

Reimplemented from NCExtrapolation.

Definition at line 56 of file NCExtrapolationNone.cxx.

References Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00057 {
00058   static Registry r;
00059 
00060   r.UnLockValues();
00061 
00062   r.Set("SelectedEventsFilename", "/tmp/sel_evts.root");
00063 
00064   r.LockValues();
00065   return r;
00066 }

void NCExtrapolationNone::FillMCSpectrum TH1 *  exp,
const NCEnergyBin bin,
InfoFunction  func,
int  size,
const NC::OscProb::OscPars pars,
NCType::EEventType  nccc,
NCType::EOscMode  oscmode
[private]
 

Definition at line 107 of file NCExtrapolationNone.cxx.

References NC::OscProb::OscPars::TransitionProbability().

Referenced by FindSpectraForPars().

00114 {
00115   for(int e = 0; e < size; ++e){
00116     double trueE, showerE, trackE, weight;
00117     int flavour;
00118 
00119     // Call the member function specified by func
00120     (bin->*func)(trueE, showerE, trackE, weight, flavour, e);
00121 
00122     const double oscweight = pars->TransitionProbability(oscmode,
00123                                                          nccc,
00124                                                          NCType::kBaseLineFar,
00125                                                          trueE);
00126 
00127      exp->Fill(showerE+trackE, weight*oscweight);
00128   }
00129 }

void NCExtrapolationNone::FindSpectraForPars const NC::OscProb::OscPars oscPars,
const NC::SystPars systPars,
std::vector< NCBeam::Info beamsToUse,
std::vector< TH1 * > &  exps,
std::vector< TH1 * > &  obss
[virtual]
 

Override this in the derived class.

Parameters:
oscPars Oscillation parameters
systPars Systematic shifts
beamsToUse Only fill exps and obss with spectra from beams with these indices
[out] exps To be filled with expected spectra
[out] obss To be filled with the corresponding observed spectra

Implements NCExtrapolation.

Definition at line 134 of file NCExtrapolationNone.cxx.

References FillMCSpectrum(), NCExtrapolation::GetBeam(), NCEnergyBin::GetDataInformation(), NCEnergyBin::GetDataVectorSize(), NCBeam::GetEnergyBin(), NCEnergyBin::GetMCBackgroundVectorSize(), NCEnergyBin::GetMCBeamNuEVectorSize(), NCEnergyBin::GetMCNuTauVectorSize(), NCEnergyBin::GetMCSignalVectorSize(), NCBeam::GetNumberEnergyBins(), kNumEnergyBinsFar, and NC::SystPars::NormScale().

00139 {
00140   ++nCalls;
00141 
00142   const double norm = systPars.NormScale();
00143 
00144   static TH1D* obsCache[2] = {0, 0};
00145 
00146 
00147   // For the moment just hardcode the beam here
00148   NCBeam* beam = GetBeam(Detector::kFar,
00149                          NCBeam::Info(BeamType::kL010z185i,
00150                                       NC::RunUtil::kRunAll));
00151 
00152   for(int nccci = 0; nccci < 2; ++nccci){
00153     NCType::EEventType nccc;
00154     if(nccci == 0) nccc = NCType::kNC; else nccc = NCType::kCC;
00155 
00156     if(nccc == NCType::kNC && !fUseNC) continue;
00157     if(nccc == NCType::kCC && !fUseCC) continue;
00158 
00159     if(!obsCache[nccci]){
00160       obsCache[nccci] = new TH1D("", "", kNumEnergyBinsFar,
00161                                  kEnergyBinsFar);
00162       for(int b = 0; b < beam->GetNumberEnergyBins(nccc); ++b){
00163         const NCEnergyBin* bin = beam->GetEnergyBin(b, nccc);
00164 
00165         const int dataSize = bin->GetDataVectorSize();
00166 
00167         for(int e = 0; e < dataSize; ++e){
00168           double energy, weight;
00169           bin->GetDataInformation(energy, weight, e);
00170 
00171           obsCache[nccci]->Fill(energy, weight);
00172         }
00173       } // end for b
00174     } // end if no cache
00175 
00176     TH1D* obs = obsCache[nccci];
00177 
00178     TH1D* exp = new TH1D("", "", kNumEnergyBinsFar,
00179                          kEnergyBinsFar);
00180 
00181     for(int b = 0; b < beam->GetNumberEnergyBins(nccc); ++b){
00182       const NCEnergyBin* bin = beam->GetEnergyBin(b, nccc);
00183 
00184       FillMCSpectrum(exp, bin, &NCEnergyBin::GetMCInformation,
00185                      bin->GetMCSignalVectorSize(),
00186                      oscPars, nccc, NCType::kNuMuToNuMu);
00187 
00188       const NCType::EEventType bgtype = (nccc == NCType::kNC) ? NCType::kCC : NCType::kNC;
00189 
00190       FillMCSpectrum(exp, bin, &NCEnergyBin::GetMCBackgroundInformation,
00191                      bin->GetMCBackgroundVectorSize(),
00192                      oscPars, bgtype, NCType::kNuMuToNuMu);
00193 
00194       FillMCSpectrum(exp, bin, &NCEnergyBin::GetMCNuTauInformation,
00195                      bin->GetMCNuTauVectorSize(),
00196                      oscPars, nccc, NCType::kNuMuToNuTau);
00197 
00198       FillMCSpectrum(exp, bin, &NCEnergyBin::GetMCBeamNuEInformation,
00199                      bin->GetMCBeamNuEVectorSize(),
00200                      oscPars, nccc, NCType::kNuEToNuE);
00201 
00202       // Not handling nu_e appearance
00203 
00204       exp->Scale(norm);
00205 
00206     } // end for b
00207 
00208     expvec.push_back(exp);
00209     obsvec.push_back(obs);
00210   } // end for nccci
00211 
00212   assert(expvec.size() == obsvec.size());
00213 }

virtual TString NCExtrapolationNone::GetLongName  )  const [inline, virtual]
 

This is the name the extrapolation is known under on plots and such.

Implements NCExtrapolation.

Definition at line 39 of file NCExtrapolationNone.h.

00039 {return "No Extrapolation";}

virtual TString NCExtrapolationNone::GetShortName  )  const [inline, virtual]
 

This is the name used to name things in the output file etc.

Implements NCExtrapolation.

Definition at line 38 of file NCExtrapolationNone.h.

00038 {return "None";}

void NCExtrapolationNone::Prepare const Registry r  )  [virtual]
 

Read whatever values you need out of the registry to initialize yourself. Please remember to chain up to the NCExtrapolation implementation too.

Reimplemented from NCExtrapolation.

Definition at line 68 of file NCExtrapolationNone.cxx.

References fSelEvtsFname, Registry::Get(), and NCExtrapolation::Prepare().

00069 {
00070   NCExtrapolation::Prepare(r);
00071 
00072   const char* tmps;
00073   if(r.Get("SelectedEventsFilename", tmps)) fSelEvtsFname = tmps;
00074 }

void NCExtrapolationNone::WriteResources const NC::OscProb::OscPars trueOscPars  )  [virtual]
 

gDirectory will point to the output file. Please remember to chain up to the NCExtrapolation implementation.

trueOscPars may be zero (eg obviously in case of fit to real data)

Reimplemented from NCExtrapolation.

Definition at line 226 of file NCExtrapolationNone.cxx.

References fEventsTree, fSelEvtsFname, and NCExtrapolation::WriteResources().

00227 {
00228   NCExtrapolation::WriteResources(trueOscPars);
00229 
00230   TDirectory* fileDir = gDirectory;
00231 
00232   TFile f(fSelEvtsFname, "RECREATE");
00233   fEventsTree->Write();
00234   f.Close();
00235 
00236   fileDir->cd();
00237 }


Member Data Documentation

TTree* NCExtrapolationNone::fEventsTree [private]
 

Definition at line 70 of file NCExtrapolationNone.h.

Referenced by AddEvent(), and WriteResources().

TString NCExtrapolationNone::fSelEvtsFname [private]
 

Definition at line 71 of file NCExtrapolationNone.h.

Referenced by Prepare(), and WriteResources().

int NCExtrapolationNone::nCalls [private]
 

Counts number of calls to the method.

Definition at line 56 of file NCExtrapolationNone.h.

Referenced by ~NCExtrapolationNone().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:09:40 2010 for loon by  doxygen 1.3.9.1