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

NuFCGridPoint Class Reference

Controls the Feldman-cousins process for a single gridpoint Currently only works with the antineutrino oscillation fitting, though this should be relatively easy to change. More...

#include <NuFCGridPoint.h>

List of all members.

Public Member Functions

 NuFCGridPoint (Double_t sin, Double_t dm2, const NuMatrixSpectrum &ndNQData, const NuMatrixSpectrum &ndPQData, const NuMMHelperCPT &helper)
virtual ~NuFCGridPoint ()
void PredictSpectrum (Double_t POT)
 Generates far detector data, by extrapolating the near detector.
void UsePrediction (const NuMatrixSpectrum &fdNQData, const NuMatrixSpectrum &fdPQData)
 Uses an already existing far detector spectrum for far data.
void Run (UInt_t num)
 Runs a specified number of experiments.
const vector< Double_t > & GetChi2 ()
 Returns the list of Delta Chi2 values.
const NuMMParametersGetPars ()
void SetPars (const NuMMParameters &pars)
 Sets the fitting parameters for this fitter to use.
void SetRandom (TRandom3 *ranGen)
 Sets the random number generator for the fitting to use.
void SetSeed (UInt_t seed)
 Sets the seed that the internal random number generator uses.
const NuMatrixSpectrumGetBarSpectrum ()
 Retrieves the far antineutrino prediction.
const NuMatrixSpectrumGetNuSpectrum ()
 Retrieves the far neutrino prediction.
void AlwaysArchive (std::string filename)
 Call if you want to write out every experiment.
void ArchiveTo (std::string filename)

Private Member Functions

 NuFCGridPoint (const NuFCGridPoint &)
NuFCGridPointoperator= (const NuFCGridPoint &)
 ClassDef (NuFCGridPoint, 0)

Private Attributes

Double_t fsin2
 The grid point this class is evaluating.
Double_t fdm2
 The grid point this class is evaluating.
NuMMHelperCPT fHelper
 Storage to the helper file class.
std::vector< Double_t > fdeltaChi2
NuMatrixSpectrumffdPredictionNQ
 Pointer to FD neutrino data.
NuMatrixSpectrumffdPredictionPQ
 Pointer to FD antineutrino data.
NuMatrixSpectrum fndNQ
 ND neutrino spectrum.
NuMatrixSpectrum fndPQ
 ND antineutrino spectrum.
NuMMParameters fmmPars
 Standard fitting parameters to use.
TRandom3 * fRandy
 Random generator.
Bool_t fArchive
 Do we want to archive every experiment?
std::string fArchiveFilename
NuFCExperimentFactoryfExperimentFactory


Detailed Description

Controls the Feldman-cousins process for a single gridpoint Currently only works with the antineutrino oscillation fitting, though this should be relatively easy to change.

Author:
Nick Devenish, Last checkin
Author
nickd
Version:
Revision
1.6
Date:
Date
2009/01/20 11:11:08
Created on: Sat Aug 16, 2008

Definition at line 34 of file NuFCGridPoint.h.


Constructor & Destructor Documentation

NuFCGridPoint::NuFCGridPoint Double_t  sin,
Double_t  dm2,
const NuMatrixSpectrum ndNQData,
const NuMatrixSpectrum ndPQData,
const NuMMHelperCPT helper
 

Initisalises the class.

Parameters:
sin The value of sin22theta (or bar) for the grid point that wishes to be evaluated.
dm2 The corresponding value for dm2.
ndNQData The Near detector neutrino spectrum
ndPQData The Near detector antineutrino spectrum
helper The helper file object to use.

Definition at line 28 of file NuFCGridPoint.cxx.

References NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), fdm2, fExperimentFactory, NuMMParameters::FixDm2(), NuFCConfig::FixedSin(), NuMMParameters::FixNCBackground(), NuMMParameters::FixNorm(), NuMMParameters::FixShwScale(), NuMMParameters::FixSn2(), NuMMParameters::FixSn2Bar(), fmmPars, fRandy, fsin2, NuFCConfig::GetConfig(), NuFCConfig::GetEventsFD(), NuFCConfig::GetEventsND(), NuFCConfig::GetEventsTau(), NuFCExperimentFactory::NoSystematics(), NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), and NuFCConfig::Systematics().

00030   : fsin2(sin),
00031     fdm2(dm2),
00032     fHelper(helper),
00033     ffdPredictionNQ(0),
00034     ffdPredictionPQ(0),
00035     fndNQ(ndNQData),
00036     fndPQ(ndPQData),
00037     fRandy(0),
00038     fArchive(false),
00039     fArchiveFilename("archive.root"),
00040     fExperimentFactory(0)
00041 { 
00042   // Initialise the NuMMParameters object
00043   // Use default parameters for neutrinos, even though this is bad
00044   fmmPars.Dm2(2.43e-3);
00045   fmmPars.Sn2(1.0);
00046 
00047   // Set the neutrino parameters
00048   fmmPars.Dm2Bar(fdm2);
00049   fmmPars.Sn2Bar(fsin2);
00050   // Fix everything except antineutrino fitting
00051   fmmPars.FixNorm();
00052   fmmPars.FixShwScale();
00053   fmmPars.FixNCBackground();
00054   fmmPars.FixDm2();
00055   fmmPars.FixSn2();
00056 
00057   // Set up the random number generator
00058   fRandy = new TRandom3(0);
00059   
00060   // Load the configuration
00061   NuFCConfig &cfg = NuFCConfig::GetConfig();
00062   // Set up the experiment factory... if we want to
00063 
00064   // We always use the experiment factory now
00065   string near_events = cfg.GetEventsND();
00066   string far_events = cfg.GetEventsFD();
00067   string tau_events = cfg.GetEventsTau();
00068   fExperimentFactory = new NuFCExperimentFactory(fRandy, near_events, far_events, tau_events);
00069   
00070   // Turn off systematics if we've said we don't want them
00071   if (cfg.Systematics() == false) fExperimentFactory->NoSystematics();
00072   
00073   // Are we doing a one-parameter fit?
00074   if (cfg.FixedSin()) {
00075     fmmPars.FixSn2Bar();
00076   }
00077 }

NuFCGridPoint::~NuFCGridPoint  )  [virtual]
 

Definition at line 81 of file NuFCGridPoint.cxx.

References ffdPredictionNQ, and ffdPredictionPQ.

00082 {
00083   // Delete the far detector predictions
00084   if (ffdPredictionNQ) delete ffdPredictionNQ;
00085   if (ffdPredictionPQ) delete ffdPredictionPQ;
00086   ffdPredictionNQ = ffdPredictionPQ = 0;
00087   
00088   // // Delete the near detector spectra
00089   // if (fndNQ) delete fndNQ;
00090   // if (fndPQ) delete fndPQ;
00091   // fndNQ = fndPQ = 0;
00092 
00093 }

NuFCGridPoint::NuFCGridPoint const NuFCGridPoint  )  [private]
 


Member Function Documentation

void NuFCGridPoint::AlwaysArchive std::string  filename  )  [inline]
 

Call if you want to write out every experiment.

Definition at line 78 of file NuFCGridPoint.h.

00078                                          {
00079     fArchiveFilename = filename;
00080     fArchive = true;
00081   }

void NuFCGridPoint::ArchiveTo std::string  filename  )  [inline]
 

Definition at line 83 of file NuFCGridPoint.h.

00083                                      {
00084     fArchiveFilename = filename;
00085   }

NuFCGridPoint::ClassDef NuFCGridPoint  ,
[private]
 

const NuMatrixSpectrum & NuFCGridPoint::GetBarSpectrum  ) 
 

Retrieves the far antineutrino prediction.

Definition at line 162 of file NuFCGridPoint.cxx.

00163 {
00164   if (!ffdPredictionPQ) {
00165     // We are backed into a corner... throw an exception as this is
00166     // a better alternative than a segfault!
00167     ostringstream err;
00168     err << "NuFCGridPoint::GetBarSpectrum(): Asking for reference to prediction\n"
00169         << "    before it is calculated. Try calling NuFCGridPoint::PredictSpectrum\n"
00170         << "    or NuFCGridPoint::UsePrediction first.";
00171     throw runtime_error(err.str().c_str());
00172   }
00173    return *ffdPredictionPQ;
00174 }

const vector<Double_t>& NuFCGridPoint::GetChi2  )  [inline]
 

Returns the list of Delta Chi2 values.

Definition at line 58 of file NuFCGridPoint.h.

00058 { return fdeltaChi2; }

const NuMatrixSpectrum & NuFCGridPoint::GetNuSpectrum  ) 
 

Retrieves the far neutrino prediction.

Definition at line 176 of file NuFCGridPoint.cxx.

00177 {
00178   if (!ffdPredictionPQ) {
00179     // Also backed into a corner here. Nothing left but an exception!
00180     ostringstream err;
00181     err << "NuFCGridPoint::GetNuSpectrum(): Asking for reference to prediction\n"
00182         << "    before it is calculated. Try calling NuFCGridPoint::PredictSpectrum\n"
00183         << "    or NuFCGridPoint::UsePrediction first.";
00184     throw runtime_error(err.str().c_str());
00185   }
00186   
00187   return *ffdPredictionPQ;
00188 }

const NuMMParameters& NuFCGridPoint::GetPars  )  [inline]
 

Returns the parameters structure that the class is using for fitting. All access should go through this, so that the object cannot be randomly modified.

Definition at line 63 of file NuFCGridPoint.h.

00063 { return fmmPars; }

NuFCGridPoint& NuFCGridPoint::operator= const NuFCGridPoint  )  [private]
 

void NuFCGridPoint::PredictSpectrum Double_t  POT  ) 
 

Generates far detector data, by extrapolating the near detector.

Definition at line 116 of file NuFCGridPoint.cxx.

References NuMMParameters::Dm2Bar(), ffdPredictionNQ, ffdPredictionPQ, fHelper, fmmPars, fndNQ, fndPQ, NuMMRunFC::MakeFDPred(), MSG, NuMMRun::QuietModeOn(), and NuMMParameters::Sn2Bar().

00117 {
00118   // We want to make an extrapolation of the near detector data
00119   MSG("NuFCGridPoint", Msg::kInfo) << "Generating Extrapolated Near Detector\n"
00120     << "Using Oscillation Parameters sn2bar: " << fmmPars.Sn2Bar()
00121     << ", dm2bar: " << fmmPars.Dm2Bar() << endl;
00122   
00123   // Give blank prediction spectra, as we won't be checking the far data
00124   NuMatrixSpectrum blankpot(POT);
00125   // Make the extrapolator
00126   NuMMRunFC mmFakeFar(&fHelper, &fndNQ, &fndPQ, &blankpot, &blankpot);
00127   mmFakeFar.QuietModeOn();
00128   
00129   // Now, grab the extrapolations, and pretend they are far detector data
00130   pair<NuMatrixSpectrum,NuMatrixSpectrum> fakefar = mmFakeFar.MakeFDPred(fmmPars);
00131 
00132   // Tell the user what POT we got out
00133   MSG("NuFCGridPoint", Msg::kInfo) << "Far extrapolation is at POT "
00134     << fakefar.second.PoT() << " (" << fakefar.second.Spectrum()->Integral()
00135     << " events)" << endl;
00136 
00137   // Grab a copy of these Spectra
00138   // ffdPredictionNQ = static_cast<TH1*>( fakefar.first.Spectrum()->Clone() );
00139   // ffdPredictionPQ = static_cast<TH1*>( fakefar.second.Spectrum()->Clone() );
00140   ffdPredictionNQ = new NuMatrixSpectrum(fakefar.first);
00141   ffdPredictionPQ = new NuMatrixSpectrum(fakefar.second);
00142 }

void NuFCGridPoint::Run UInt_t  num  ) 
 

Runs a specified number of experiments.

Definition at line 192 of file NuFCGridPoint.cxx.

References NuFCFitter::AlwaysArchive(), NuFCFitter::ArchiveTo(), fArchiveFilename, fdeltaChi2, fExperimentFactory, ffdPredictionPQ, fHelper, NuFCFitter::Fit(), fmmPars, fndNQ, fndPQ, NuFCExperimentFactory::GenerateNewExperiment(), NuFCExperimentFactory::GetNQSpectrum(), NuFCExperimentFactory::GetNQSpectrumND(), NuFCExperimentFactory::GetPQSpectrum(), NuFCExperimentFactory::GetPQSpectrumND(), MSG, NuMatrixSpectrum::PoT(), and NuMMRun::QuietModeOn().

00193 {
00194   for (UInt_t i = 0; i < number; i++)
00195   {
00196     // Say we are starting!
00197     MSG("NuFCGridPoint", Msg::kInfo) << "Running experiment " << i << endl;
00198     
00199     // Create a new experiment
00200     // NuFCExperiment fcexp(i, *ffdPredictionPQ, fRandy);
00201 
00202     // Make a blank extrapolator for predictions
00203     NuMatrixSpectrum blankpot(ffdPredictionPQ->PoT());
00204     NuMMRunFC extrapolator(&fHelper, &fndNQ, &fndPQ, &blankpot, &blankpot);
00205     extrapolator.QuietModeOn();
00206 
00207     // Generte the fake experiment
00208     fExperimentFactory->GenerateNewExperiment(&extrapolator, fmmPars);
00209     NuFCExperiment fcexp(i, fExperimentFactory->GetNQSpectrum(), fExperimentFactory->GetPQSpectrum());
00210     
00211     // Grab the (possibly shifted) near detector histograms
00212     NuMatrixSpectrum ndNQ = fExperimentFactory->GetNQSpectrumND();
00213     NuMatrixSpectrum ndPQ = fExperimentFactory->GetPQSpectrumND();
00214     
00215     // Create the fitter
00216     NuFCFitter fitter(&fcexp, &fHelper, &ndNQ, &ndPQ, fmmPars);
00217     
00218     // Do we want to archive every fit?
00219     if (fArchive) fitter.AlwaysArchive(fArchiveFilename);
00220     else fitter.ArchiveTo(fArchiveFilename);
00221     
00222     // Run the fit
00223     Double_t fitDeltachi = fitter.Fit(fmmPars);
00224     
00225     // Store the delta chi2
00226     fdeltaChi2.push_back(fitDeltachi);
00227   }
00228 }

void NuFCGridPoint::SetPars const NuMMParameters pars  ) 
 

Sets the fitting parameters for this fitter to use.

Definition at line 230 of file NuFCGridPoint.cxx.

References fmmPars.

00231 {
00232     fmmPars = pars;    
00233 }

void NuFCGridPoint::SetRandom TRandom3 *  ranGen  ) 
 

Sets the random number generator for the fitting to use.

Definition at line 146 of file NuFCGridPoint.cxx.

References fRandy.

00147 {
00148   // Reassign our random number generator, deleting if needed
00149   if (fRandy) delete fRandy;
00150   fRandy = ranGen;
00151 }

void NuFCGridPoint::SetSeed UInt_t  seed  ) 
 

Sets the seed that the internal random number generator uses.

Definition at line 155 of file NuFCGridPoint.cxx.

References fRandy.

00156 {
00157   fRandy->SetSeed(seed);
00158 }

void NuFCGridPoint::UsePrediction const NuMatrixSpectrum fdNQData,
const NuMatrixSpectrum fdPQData
 

Uses an already existing far detector spectrum for far data.

Definition at line 98 of file NuFCGridPoint.cxx.

References ffdPredictionNQ, and ffdPredictionPQ.

00100 {
00101   // Delete the far spectra if they exist
00102   if (ffdPredictionNQ) delete ffdPredictionNQ;
00103   if (ffdPredictionPQ) delete ffdPredictionPQ;
00104 
00105   // Make a copy of the passed in data spectra
00106   // this->ffdPredictionNQ = static_cast<TH1*>( fdNQData.Spectrum()->Clone() );
00107   // this->ffdPredictionPQ = static_cast<TH1*>( fdPQData.Spectrum()->Clone() );
00108   // ffdPredictionNQ->SetDirectory(0);
00109   // ffdPredictionPQ->SetDirectory(0);
00110   ffdPredictionNQ = new NuMatrixSpectrum(fdNQData);
00111   ffdPredictionPQ = new NuMatrixSpectrum(fdPQData);
00112 }


Member Data Documentation

Bool_t NuFCGridPoint::fArchive [private]
 

Do we want to archive every experiment?

Definition at line 116 of file NuFCGridPoint.h.

std::string NuFCGridPoint::fArchiveFilename [private]
 

Definition at line 117 of file NuFCGridPoint.h.

Referenced by Run().

std::vector<Double_t> NuFCGridPoint::fdeltaChi2 [private]
 

Definition at line 99 of file NuFCGridPoint.h.

Referenced by Run().

Double_t NuFCGridPoint::fdm2 [private]
 

The grid point this class is evaluating.

Definition at line 94 of file NuFCGridPoint.h.

Referenced by NuFCGridPoint().

NuFCExperimentFactory* NuFCGridPoint::fExperimentFactory [private]
 

Definition at line 119 of file NuFCGridPoint.h.

Referenced by NuFCGridPoint(), and Run().

NuMatrixSpectrum* NuFCGridPoint::ffdPredictionNQ [private]
 

Pointer to FD neutrino data.

Definition at line 101 of file NuFCGridPoint.h.

Referenced by PredictSpectrum(), UsePrediction(), and ~NuFCGridPoint().

NuMatrixSpectrum* NuFCGridPoint::ffdPredictionPQ [private]
 

Pointer to FD antineutrino data.

Definition at line 103 of file NuFCGridPoint.h.

Referenced by PredictSpectrum(), Run(), UsePrediction(), and ~NuFCGridPoint().

NuMMHelperCPT NuFCGridPoint::fHelper [private]
 

Storage to the helper file class.

Definition at line 97 of file NuFCGridPoint.h.

Referenced by PredictSpectrum(), and Run().

NuMMParameters NuFCGridPoint::fmmPars [private]
 

Standard fitting parameters to use.

Definition at line 110 of file NuFCGridPoint.h.

Referenced by NuFCGridPoint(), PredictSpectrum(), Run(), and SetPars().

NuMatrixSpectrum NuFCGridPoint::fndNQ [private]
 

ND neutrino spectrum.

Definition at line 105 of file NuFCGridPoint.h.

Referenced by PredictSpectrum(), and Run().

NuMatrixSpectrum NuFCGridPoint::fndPQ [private]
 

ND antineutrino spectrum.

Definition at line 107 of file NuFCGridPoint.h.

Referenced by PredictSpectrum(), and Run().

TRandom3* NuFCGridPoint::fRandy [private]
 

Random generator.

Definition at line 113 of file NuFCGridPoint.h.

Referenced by NuFCGridPoint(), SetRandom(), and SetSeed().

Double_t NuFCGridPoint::fsin2 [private]
 

The grid point this class is evaluating.

Definition at line 94 of file NuFCGridPoint.h.

Referenced by NuFCGridPoint().


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