NuFCExperiment Class Reference

Runs a single FC experiment. More...

#include <NuFCExperiment.h>

List of all members.

Public Member Functions

 NuFCExperiment (UInt_t id, const NuMatrixSpectrum &pdf, TRandom3 *rgen=0)
 Creates the experiment. Note: The passed in PDF is used to set the correct POT, and for the average eventcount. So make sure that it is set up correctly.
 NuFCExperiment (UInt_t id, const NuMatrixSpectrum &fdNQ, const NuMatrixSpectrum &fdPQ)
 Creates the experiment from existing spectra. This creates a NuFCExperiment, but from an existing NuMatrixSpectrum pair.
virtual ~NuFCExperiment ()
const NuMatrixSpectrumGetPQSpectrum () const
 Retrieves the experiments PQ spectrum.
const NuMatrixSpectrumGetNQSpectrum () const
 Retrieves a blank spectrum, with the correct POT.
const std::string & GetName () const
 Retrieves the experiments name.

Private Member Functions

void GenerateExperiment (const NuMatrixSpectrum &pdf)
 Actually does the calculation to make a random experiment.
void SetId (UInt_t id)
 Sets the ID, and generates the histogram name.
 ClassDef (NuFCExperiment, 0)

Private Attributes

NuMatrixSpectrum fPQHist
 The experiments spectrum.
NuMatrixSpectrum fNQHist
TRandom * fRandy
 Pointer to the random number generator.
UInt_t fId
 Numeric ID of this experiment.
std::string fName
 String name of this experiment.

Detailed Description

Runs a single FC experiment.

Author:
Nick Devenish, Last checkin
Author
bckhouse
Version:
Revision
1.10
Date:
Date
2010/09/17 18:01:51

Created on: Sat Aug 16, 2008

Definition at line 29 of file NuFCExperiment.h.


Constructor & Destructor Documentation

NuFCExperiment::NuFCExperiment ( UInt_t  id,
const NuMatrixSpectrum pdf,
TRandom3 *  rgen = 0 
)

Creates the experiment. Note: The passed in PDF is used to set the correct POT, and for the average eventcount. So make sure that it is set up correctly.

Parameters:
id The 'id' of the experiment i.e. what number to use as a label
pdf A far detector histogram to use as a PDF, at the desired POT
rgen (Optional) the random number generator to use. If zero, gRandom is used.

Definition at line 22 of file NuFCExperiment.cxx.

References fRandy, GenerateExperiment(), and SetId().

00024   : fPQHist(pdf), fNQHist(pdf.GetPOT()), fRandy(rgen), fId(id)
00025 {
00026   // Check if our random number generator is correctly setup
00027   if (!fRandy) {
00028     // If not, just use gRandom
00029     fRandy = gRandom;
00030   }
00031 
00032   // Set our ID, and build the name
00033   SetId(id);
00034 
00035   // Now, fill our histogram
00036   GenerateExperiment(pdf);
00037 }

NuFCExperiment::NuFCExperiment ( UInt_t  id,
const NuMatrixSpectrum fdNQ,
const NuMatrixSpectrum fdPQ 
)

Creates the experiment from existing spectra. This creates a NuFCExperiment, but from an existing NuMatrixSpectrum pair.

Definition at line 41 of file NuFCExperiment.cxx.

References SetId().

00043   : fPQHist(fdPQ), fNQHist(fdNQ), fRandy(0), fId(id)
00044 {
00045   // Reset the histogram names
00046   SetId(id);
00047 }

virtual NuFCExperiment::~NuFCExperiment (  )  [inline, virtual]

Definition at line 48 of file NuFCExperiment.h.

00048 {}


Member Function Documentation

NuFCExperiment::ClassDef ( NuFCExperiment  ,
 
) [private]
void NuFCExperiment::GenerateExperiment ( const NuMatrixSpectrum pdf  )  [private]

Actually does the calculation to make a random experiment.

Definition at line 52 of file NuFCExperiment.cxx.

References fPQHist, fRandy, and NuMatrixSpectrum::Spectrum().

Referenced by NuFCExperiment().

00053 {
00054   // Get the average events by integrating the PDF
00055   Double_t average_events = pdf.Spectrum()->Integral();
00056 
00057   // Get the number of events to generate
00058   Int_t nevents = fRandy->Poisson(average_events);
00059 
00060   // cout << "Average Events: " << average_events << ", This: " << nevents << endl;
00061 
00062   // Scale our copy of the histogram to zero, so we have a blank,
00063   // correctly binned histogram
00064   fPQHist.Spectrum()->Scale(0);
00065   fPQHist.Spectrum()->SetDirectory(0);
00066 
00067   // Fill our histogram with random events
00068   fPQHist.Spectrum()->FillRandom(pdf.Spectrum(), nevents);
00069 }

const std::string& NuFCExperiment::GetName ( void   )  const [inline]

Retrieves the experiments name.

Definition at line 56 of file NuFCExperiment.h.

References fName.

00056 { return fName; }

const NuMatrixSpectrum& NuFCExperiment::GetNQSpectrum (  )  const [inline]

Retrieves a blank spectrum, with the correct POT.

Definition at line 53 of file NuFCExperiment.h.

References fNQHist.

Referenced by NuFCFitter::NuFCFitter(), NuFCFitterNSI::NuFCFitterNSI(), NuFCFitterNSINu::NuFCFitterNSINu(), and NuFCFitterNSINubar::NuFCFitterNSINubar().

00053 { return fNQHist; }

const NuMatrixSpectrum& NuFCExperiment::GetPQSpectrum (  )  const [inline]

Retrieves the experiments PQ spectrum.

Definition at line 51 of file NuFCExperiment.h.

References fPQHist.

Referenced by NuFCFitter::NuFCFitter(), NuFCFitterNSI::NuFCFitterNSI(), NuFCFitterNSINu::NuFCFitterNSINu(), and NuFCFitterNSINubar::NuFCFitterNSINubar().

00051 { return fPQHist; }

void NuFCExperiment::SetId ( UInt_t  id  )  [private]

Sets the ID, and generates the histogram name.

Definition at line 73 of file NuFCExperiment.cxx.

References fId, fName, fPQHist, and NuMatrixSpectrum::Spectrum().

Referenced by NuFCExperiment().

00074 {
00075   // Assign the id..
00076   fId = id;
00077 
00078   // Now, make the name
00079   ostringstream expname;
00080   expname << "fchist_" << fId;
00081   fName = expname.str();
00082 
00083   expname << "_PQ";
00084   // Set the histograms name
00085   fPQHist.Spectrum()->SetName(expname.str().c_str());
00086 
00087   // Now do NQ
00088 //  ostringstream expnameNQ;
00089 //  expnameNQ << "fchist_" << fId << "_NQ";
00090 //  fNQHist.Spectrum()->SetName(expnameNQ.str().c_str());
00091 }


Member Data Documentation

UInt_t NuFCExperiment::fId [private]

Numeric ID of this experiment.

Definition at line 71 of file NuFCExperiment.h.

Referenced by SetId().

std::string NuFCExperiment::fName [private]

String name of this experiment.

Definition at line 73 of file NuFCExperiment.h.

Referenced by GetName(), and SetId().

Definition at line 67 of file NuFCExperiment.h.

Referenced by GetNQSpectrum().

The experiments spectrum.

Definition at line 66 of file NuFCExperiment.h.

Referenced by GenerateExperiment(), GetPQSpectrum(), and SetId().

TRandom* NuFCExperiment::fRandy [private]

Pointer to the random number generator.

Definition at line 69 of file NuFCExperiment.h.

Referenced by GenerateExperiment(), and NuFCExperiment().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1