NuMMRunFC Class Reference

#include <NuMMRunFC.h>

Inheritance diagram for NuMMRunFC:
NuMMRunNuBar NuMMRun

List of all members.

Public Member Functions

 NuMMRunFC (NuMMHelperCPT *helper, const NuMatrixSpectrum *ndNuData, const NuMatrixSpectrum *ndBarData, double pot)
 NuMMRunFC (NuMMHelperCPT *helper, const NuMatrixSpectrum *ndNuData, const NuMatrixSpectrum *ndBarData, const NuMatrixSpectrum *fdNuData, const NuMatrixSpectrum *fdBarData)
 NuMMRunFC (const NuMMRunFC &old)
 ~NuMMRunFC ()
virtual Double_t ComparePredWithData (const NuMMParameters &pars)
virtual std::pair
< NuMatrixSpectrum,
NuMatrixSpectrum
MakeFDPred (const NuMMParameters &pars)
 Return a pair (NQ,PQ) of NuMatrixSpectra of the far detector prediction with oscillation parameters described in pars. Pure virtual.
virtual std::vector< TH1D > MakeFDPredBackgrounds (const NuMMParameters &pars)
virtual std::vector< TH1D > WriteFDPredHistos (const NuMMParameters &pars) const
virtual NuMatrixSpectrum TrueComponents (const NuMMParameters &pars, Sample_t s) const
 Return the individual true energy prediction of the far detector sub sample s with oscillation parameters described in pars. Default implementation just drops an error.
virtual NuMatrixSpectrum TrueComponents (const NuMMParameters &pars, Sample_t s)
void OscillateNuMu (NuMatrixSpectrum &numu, const NuMMParameters &pars) const
 Helper. Oscillates, decays or decoheres a true energy numu spectrum.
void InverseOscillateNuTau (NuMatrixSpectrum &nutau, const NuMMParameters &pars) const
 Helper. Inverse oscillates a true energy nutau spectrum.
void OscillateNuBar (NuMatrixSpectrum &numu, const NuMMParameters &pars) const
 Helper. Oscillates, decays or decoheres a true energy nubar spectrum.
void InverseOscillateTauBar (NuMatrixSpectrum &nutau, const NuMMParameters &pars) const
 Helper. Inverse oscillates a true energy taubar spectrum.
virtual void PredictNus (Bool_t predict)
 Will the neutrino prediction be calculated?
virtual void PredictNuBars (Bool_t predict)
 Will the antineutrino prediction be calculated?
virtual Bool_t PredictNus ()
virtual Bool_t PredictNuBars ()
Bool_t PreCalcWrongSign (const NuMMParameters &pars)
void ResetCache ()
virtual void ResetNDData (const NuMatrix &nddata)
 Replace the ND data used in extrapolation.
virtual void ResetFDData (const NuMatrix &fddata)
 Replace the FD data used in extrapolation.
virtual std::auto_ptr< NuMatrixGetNDData (void) const
 Returns the ND data used in extrapolation.
virtual std::auto_ptr< NuMatrixGetFDData (void) const
 Return the FD data used in extrapolation.

Private Member Functions

void Init (NuMMHelperCPT *helper, const NuMatrixSpectrum *ndNuData, const NuMatrixSpectrum *ndBarData, const NuMatrixSpectrum *fdNuData, const NuMatrixSpectrum *fdBarData)
NuMMRunFCoperator= (const NuMMRunFC &rhs)
 Disallow assignment: This is broken, so don't let people do it.
void CacheExtrapolation (void)

Private Attributes

NuMatrixSpectrumPreCalcnuPrediction
NuMatrixSpectrumPreCalcbarPrediction
NuMatrixSpectrumPreCalcpotentialNuTaus
NuMatrixSpectrumPreCalcpotentialTauBars
NuMatrixSpectrumPreCalcnuNCBackground
NuMatrixSpectrumPreCalcbarNCBackground
NuMatrixSpectrumPreCalcwrongSignNuMus
NuMatrixSpectrumPreCalcwrongSignNuBars
Bool_t fDoneWsNeutrinos
 Flags to remember if the wrong sign has been precalculated.
Bool_t fDoneWsAntineutrinos

Detailed Description

Definition at line 17 of file NuMMRunFC.h.


Constructor & Destructor Documentation

NuMMRunFC::NuMMRunFC ( NuMMHelperCPT helper,
const NuMatrixSpectrum ndNuData,
const NuMatrixSpectrum ndBarData,
double  pot 
)

Definition at line 26 of file NuMMRunFC.cxx.

References Msg::kError, and MSG.

00030                : NuMMRunNuBar()
00031 {
00032   // Duplicate this test here, as we try to use the helper before moving to init
00033   if (!helper) {
00034     MSG("NuMMRunFC",Msg::kError) << "Passed a null pointer for helper" << endl;
00035     assert(helper);
00036   }
00037   
00038   // We haven't been passed a FD histogram yet, but we know what the binning
00039   // will be because we know the algorithm.
00040   assert(helper->FDNuPurity());
00041   TH1D hBlank(*reinterpret_cast<const TH1D*>(helper->FDNuPurity()));
00042   hBlank.SetNameTitle("herror", "Blank default FD data: Something went wrong");
00043 
00044   NuMatrixSpectrum *tmpNu = new NuMatrixSpectrum(hBlank, pot);
00045   NuMatrixSpectrum *tmpBar = new NuMatrixSpectrum(hBlank, pot);
00046   Init(helper, ndNuData, ndBarData, tmpNu, tmpBar);
00047   // Delete these temporary histograms - they should have been copied by the function
00048   delete tmpNu;
00049   delete tmpBar;
00050 }

NuMMRunFC::NuMMRunFC ( NuMMHelperCPT helper,
const NuMatrixSpectrum ndNuData,
const NuMatrixSpectrum ndBarData,
const NuMatrixSpectrum fdNuData,
const NuMatrixSpectrum fdBarData 
)

Definition at line 68 of file NuMMRunFC.cxx.

References Init().

00073                    : NuMMRunNuBar()
00074 {
00075   Init(helper, ndNuData, ndBarData, fdNuData, fdBarData);
00076 }

NuMMRunFC::NuMMRunFC ( const NuMMRunFC old  ) 

Definition at line 176 of file NuMMRunFC.cxx.

References fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMRunNuBar::ffdBarData, NuMMRunNuBar::ffdNuData, NuMMRunNuBar::fHelper, NuMMRunNuBar::fndBarData, NuMMRunNuBar::fndNuData, NuMMRunNuBar::fPredictAntiNeutrinos, NuMMRunNuBar::fPredictNeutrinos, PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, and PreCalcwrongSignNuMus.

00176                                          : NuMMRunNuBar(old)
00177 {
00178   // Copy all the old histograms
00179   fndNuData =  new NuMatrixSpectrum(*old.fndNuData);
00180   fndBarData = new NuMatrixSpectrum(*old.fndBarData);
00181   ffdNuData =  new NuMatrixSpectrum(*old.ffdNuData);
00182   ffdBarData = new NuMatrixSpectrum(*old.ffdBarData);
00183 
00184   fHelper = old.fHelper;
00185   
00186   // Blank out all the Precache variables before reassignment
00187   PreCalcnuPrediction   = PreCalcbarPrediction      = 0;
00188   PreCalcpotentialNuTaus= PreCalcpotentialTauBars   = 0;
00189   PreCalcnuNCBackground = PreCalcbarNCBackground    = 0;
00190   PreCalcwrongSignNuMus = PreCalcwrongSignNuBars    = 0;
00191     
00192   // Make copies of all the precalculations frmo the old runner
00193   if (old.PreCalcnuPrediction)
00194     PreCalcnuPrediction = new NuMatrixSpectrum(*old.PreCalcnuPrediction);
00195   if (old.PreCalcbarPrediction)
00196     PreCalcbarPrediction = new NuMatrixSpectrum(*old.PreCalcbarPrediction);
00197   if (old.PreCalcpotentialNuTaus)
00198     PreCalcpotentialNuTaus = new NuMatrixSpectrum(*old.PreCalcpotentialNuTaus);
00199   if (old.PreCalcpotentialTauBars)
00200     PreCalcpotentialTauBars = new NuMatrixSpectrum(*old.PreCalcpotentialTauBars);
00201   
00202   if (old.PreCalcnuNCBackground)
00203     PreCalcnuNCBackground = new NuMatrixSpectrum(*old.PreCalcnuNCBackground);
00204   if (old.PreCalcbarNCBackground)
00205     PreCalcbarNCBackground = new NuMatrixSpectrum(*old.PreCalcbarNCBackground);
00206 
00207   if (old.PreCalcwrongSignNuMus)
00208     PreCalcwrongSignNuMus = new NuMatrixSpectrum(*old.PreCalcwrongSignNuMus);
00209   if (old.PreCalcwrongSignNuBars)
00210     PreCalcwrongSignNuBars = new NuMatrixSpectrum(*old.PreCalcwrongSignNuBars);
00211   
00212   fPredictNeutrinos = old.fPredictNeutrinos;
00213   fPredictAntiNeutrinos = old.fPredictAntiNeutrinos;
00214   
00215   // Set the wrong sign to false however - this copy may want different
00216   // oscillation parameters!
00217   fDoneWsNeutrinos = fDoneWsAntineutrinos = false;
00218 }

NuMMRunFC::~NuMMRunFC (  ) 

Definition at line 222 of file NuMMRunFC.cxx.

References NuMMRunNuBar::ffdBarData, NuMMRunNuBar::ffdNuData, NuMMRunNuBar::fndBarData, NuMMRunNuBar::fndNuData, and ResetCache().

00223 {
00224   ResetCache();
00225   
00226   // We now take copies of the data histograms - clean them up
00227   if (fndNuData)  delete fndNuData;   fndNuData   = 0;
00228   if (fndBarData) delete fndBarData;  fndBarData  = 0;
00229   if (ffdNuData)  delete ffdNuData;   ffdNuData   = 0;
00230   if (ffdBarData) delete ffdBarData;  ffdBarData  = 0;
00231 }


Member Function Documentation

void NuMMRunFC::CacheExtrapolation ( void   )  [private]

Pre-calculate much of the extrapolation. Most of the matrix method extrapolation does not depend on the oscillation parameters. This includes lots of complicated matrix multiplications and histogram divisions. This function seperates out this code, and is called from the constructor (as everything it needs should exist with a validly called constructor)

Definition at line 461 of file NuMMRunFC.cxx.

References NuMMHelperCPT::BarBeamMatrix(), NuMMHelperCPT::BarBeamMatrixNuMuCCXSec(), NuMMHelperCPT::BarBeamMatrixTauCCXSec(), NuMMHelperCPT::BarXSecGraph(), NuMatrixSpectrum::Divide(), NuMMHelperCPT::DoTaus(), NuMatrixSpectrum::ExtrapolateNDToFD(), NuMMRunNuBar::fCached, NuMMHelperCPT::FDBarEfficiency(), NuMMHelperCPT::FDBarNCContamination(), NuMMHelperCPT::FDBarPurity(), NuMMHelperCPT::FDBarRecoVsTrue(), NuMMHelperCPT::FDNuEfficiency(), NuMMHelperCPT::FDNuNCContamination(), NuMMHelperCPT::FDNuPurity(), NuMMHelperCPT::FDNuRecoVsTrue(), NuMMHelperCPT::FDNuTauEfficiency(), fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMHelperCPT::FDTauBarEfficiency(), NuMMHelperCPT::FDWrongSignBarEfficiency(), NuMMHelperCPT::FDWrongSignNuEfficiency(), NuMMRunNuBar::ffdBarData, NuMMRun::fFDFidMass, NuMMRunNuBar::ffdNuData, NuMMRunNuBar::fHelper, NuMMRunNuBar::fndBarData, NuMMRun::fNDFidMass, NuMMRunNuBar::fndNuData, NuMatrix::GetPOT(), Msg::kWarning, MAXMSG, NuMatrixSpectrum::Multiply(), NuMMHelperCPT::NDBarEfficiency(), NuMMHelperCPT::NDBarPurity(), NuMMHelperCPT::NDBarRecoVsTrue(), NuMMHelperCPT::NDNuEfficiency(), NuMMHelperCPT::NDNuPurity(), NuMMHelperCPT::NDNuRecoVsTrue(), NuMMHelperCPT::NuBeamMatrix(), NuMMHelperCPT::NuBeamMatrixNuMuCCXSec(), NuMMHelperCPT::NuBeamMatrixTauCCXSec(), NuMMHelperCPT::NuXSecGraph(), PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, PreCalcwrongSignNuMus, NuMatrixSpectrum::RecoToTrue(), ResetCache(), NuMatrix::ResetPOT(), NuMatrixSpectrum::SetName(), NuMatrixSpectrum::TrueToReco(), NuMMHelperCPT::XSecGraphNuTaus(), and NuMMHelperCPT::XSecGraphTauBars().

Referenced by Init(), MakeFDPred(), MakeFDPredBackgrounds(), PredictNuBars(), PredictNus(), ResetFDData(), ResetNDData(), and TrueComponents().

00462 {
00463     // Only cache once.
00464     if (fCached) return;
00465   
00466     ResetCache();
00467   
00468     // Disable this output for now - this process should be fast anyway!
00469     // if (!fQuietMode)
00470     //     cout << "Pre-calculating static extrapolation variables..." << endl;
00471     
00472     // Caching variables, to reduce the workload of each step of the fitter
00473     // Initialise these the way they would be before
00474     PreCalcnuPrediction = new NuMatrixSpectrum(*fndNuData);
00475     PreCalcbarPrediction = new NuMatrixSpectrum(*fndBarData);
00476     
00477     // Be lazy and just alias the pointers to references so can keep
00478     // the code the same
00479     NuMatrixSpectrum &nuPrediction = *PreCalcnuPrediction;
00480     NuMatrixSpectrum &barPrediction = *PreCalcbarPrediction;
00481     
00482     // Now we have prepared the extrapolation variables, calculate them
00483     // Get the neutrinos to ND Flux x Xsec
00484     nuPrediction.Multiply(fHelper->NDNuPurity());
00485     nuPrediction.RecoToTrue(fHelper->NDNuRecoVsTrue());
00486     nuPrediction.Divide(fHelper->NDNuEfficiency());
00487     nuPrediction.Divide(fndNuData->GetPOT());
00488     nuPrediction.Divide(fNDFidMass);
00489     
00490     // Get the antineutrinos to ND Flux x Xsec
00491     barPrediction.Multiply(fHelper->NDBarPurity());
00492     barPrediction.RecoToTrue(fHelper->NDBarRecoVsTrue());
00493     barPrediction.Divide(fHelper->NDBarEfficiency());
00494     barPrediction.Divide(fndBarData->GetPOT());
00495     barPrediction.Divide(fNDFidMass);
00496     
00497     // Create and link to the Tau components, before we include the
00498     // cross section in the predictions (tau Xsec is different)
00499     PreCalcpotentialNuTaus = new NuMatrixSpectrum(nuPrediction);
00500     PreCalcpotentialTauBars = new NuMatrixSpectrum(barPrediction);
00501     NuMatrixSpectrum &potentialNuTaus = *PreCalcpotentialNuTaus;
00502     NuMatrixSpectrum &potentialTauBars = *PreCalcpotentialTauBars;
00503 
00504     
00505     // Get the Neutrinos to the FD
00506     nuPrediction.ExtrapolateNDToFD(fHelper->NuBeamMatrixNuMuCCXSec());
00507     nuPrediction.Multiply(fFDFidMass);
00508     nuPrediction.Multiply(ffdNuData->GetPOT());
00509     // Reset the spectrum to the new POT
00510     nuPrediction.ResetPOT(ffdNuData->GetPOT());
00511     
00512     // Get the Antineutrinos to the FD
00513     barPrediction.ExtrapolateNDToFD(fHelper->BarBeamMatrixNuMuCCXSec());
00514     barPrediction.Multiply(fFDFidMass);
00515     barPrediction.Multiply(ffdBarData->GetPOT());
00516     // Reset the spectrum to the new PoT
00517     barPrediction.ResetPOT(ffdBarData->GetPOT());
00518     
00519     if (fHelper->DoTaus()) {
00520         // Get the Neutrinos to the FD
00521         if (fHelper->NuBeamMatrixTauCCXSec()) {
00522             potentialNuTaus.ExtrapolateNDToFD(fHelper->NuBeamMatrixTauCCXSec());
00523             potentialTauBars.ExtrapolateNDToFD(fHelper->BarBeamMatrixTauCCXSec());
00524         }
00525         else {
00526             MAXMSG("NuMMRunFC",Msg::kWarning,10) << "Doing tau extrapolation the old way." << endl;
00527             potentialNuTaus.Divide(fHelper->NuXSecGraph());
00528             potentialNuTaus.ExtrapolateNDToFD(fHelper->NuBeamMatrix());
00529             potentialNuTaus.Multiply(fHelper->XSecGraphNuTaus());
00530             potentialTauBars.Divide(fHelper->BarXSecGraph());
00531             potentialTauBars.ExtrapolateNDToFD(fHelper->BarBeamMatrix());
00532             potentialTauBars.Multiply(fHelper->XSecGraphTauBars());
00533         }
00534             
00535         potentialNuTaus.Multiply(fFDFidMass);
00536         potentialNuTaus.Multiply(ffdNuData->GetPOT());
00537         // Reset the spectrum to the new PoT
00538         potentialNuTaus.ResetPOT(ffdNuData->GetPOT());
00539         potentialNuTaus.Multiply(fHelper->FDNuTauEfficiency());
00540         
00541         // Get the Antineutrinos to the FD
00542         potentialTauBars.Multiply(fFDFidMass);
00543         potentialTauBars.Multiply(ffdBarData->GetPOT());
00544         // Reset the spectrum to the new PoT
00545         potentialTauBars.ResetPOT(ffdBarData->GetPOT());
00546         potentialTauBars.Multiply(fHelper->FDTauBarEfficiency());
00547     }
00548     else {
00549         PreCalcpotentialNuTaus->Multiply(0.0);
00550         PreCalcpotentialTauBars->Multiply(0.0);
00551     }
00552   
00553     // Now build the NC Spectrum, after the cross section calculation!
00554     PreCalcnuNCBackground = new NuMatrixSpectrum(*PreCalcnuPrediction);;
00555     PreCalcbarNCBackground = new NuMatrixSpectrum(*PreCalcbarPrediction);
00556     NuMatrixSpectrum &nuNCBackground = *PreCalcnuNCBackground;
00557     NuMatrixSpectrum &barNCBackground = *PreCalcbarNCBackground;  
00558 
00559     //Get the neutrino NC background
00560     nuNCBackground.Multiply(fHelper->FDNuEfficiency());
00561     nuNCBackground.TrueToReco(fHelper->FDNuRecoVsTrue());
00562     nuNCBackground.Divide(fHelper->FDNuPurity());
00563     nuNCBackground.Multiply(fHelper->FDNuNCContamination());
00564 
00565     //Get the antineutrino NC background
00566     barNCBackground.Multiply(fHelper->FDBarEfficiency());
00567     barNCBackground.TrueToReco(fHelper->FDBarRecoVsTrue());
00568     barNCBackground.Divide(fHelper->FDBarPurity());
00569     barNCBackground.Multiply(fHelper->FDBarNCContamination());
00570     
00571     // Now build the wrong sign spectrum
00572     PreCalcwrongSignNuMus = new NuMatrixSpectrum(*PreCalcnuPrediction);
00573     PreCalcwrongSignNuBars = new NuMatrixSpectrum(*PreCalcbarPrediction);
00574     NuMatrixSpectrum &wrongSignNuMus = *PreCalcwrongSignNuMus;
00575     NuMatrixSpectrum &wrongSignNuBars = *PreCalcwrongSignNuBars;
00576     
00577     // Do the Neutrino background for the antineutrino spectrum
00578     wrongSignNuMus.Multiply(fHelper->FDWrongSignNuEfficiency());
00579     
00580     // Do the Antineutrino background for the neutrino spectrum
00581     wrongSignNuBars.Multiply(fHelper->FDWrongSignBarEfficiency());
00582     
00583     // Apply the efficiency to the predictions
00584     barPrediction.Multiply(fHelper->FDBarEfficiency());
00585     nuPrediction.Multiply(fHelper->FDNuEfficiency());
00586       
00587     nuPrediction.SetName("NuMus");
00588     barPrediction.SetName("NuMuBars");
00589     
00590     if (fHelper->DoTaus()) {
00591       potentialNuTaus.SetName("NuTaus");
00592       potentialTauBars.SetName("NuTauBars");
00593     }
00594     
00595     wrongSignNuMus.SetName("WrongSign_NuMus");
00596     wrongSignNuBars.SetName("WrongSign_NuMuBars");
00597     
00598     nuNCBackground.SetName("NC_NuMus");
00599     barNCBackground.SetName("NC_NuMuBars");
00600   
00601     fCached = true;
00602   
00603     // If we have precalculated the wrong sign oscillations,
00604     // then we need to recalculate them next time we are given
00605     // the oscilaltion parameters. Reset the flags used to
00606     // control this  
00607     fDoneWsNeutrinos = fDoneWsAntineutrinos = false;
00608 }

Double_t NuMMRunFC::ComparePredWithData ( const NuMMParameters pars  )  [virtual]

Implements NuMMRun.

Definition at line 1026 of file NuMMRunFC.cxx.

01027 {
01028   // Generate a prediction
01029   const pair<NuMatrixSpectrum,NuMatrixSpectrum> predictions =
01030     this->MakeFDPred(pars);
01031   Double_t like = 0;
01032   // Now, only count a likelihood for components we want - this is just
01033   // a constant offset, but should help speed things up a little.
01034   if (fPredictNeutrinos)
01035   {
01036     like += this->StatsLikelihood(predictions.first.Spectrum(),
01037         ffdNuData->Spectrum());
01038   }
01039   if (fPredictAntiNeutrinos) {
01040     like += this->StatsLikelihood(predictions.second.Spectrum(),
01041         ffdBarData->Spectrum());
01042   }
01043   return like;
01044 }

auto_ptr< NuMatrix > NuMMRunFC::GetFDData ( void   )  const [virtual]

Return the FD data used in extrapolation.

Reimplemented from NuMMRun.

Definition at line 1246 of file NuMMRunFC.cxx.

References NuMMRunNuBar::ffdBarData, NuMMRunNuBar::ffdNuData, and Munits::nm.

01247 {
01248   // NOTE: The data objects are stored as protected data members in the
01249   // NuMMRunNuBar class. However, the way the data is dealt with is very
01250   // specific to each extrapolation, so it turns out to be easier to 
01251   // do this here, in this leaf class than centrally.
01252   
01253   // Convert to a NuMatrixCPT, as charge-signs are separated internally
01254   NuMatrixCPT *nm = new NuMatrixCPT(ffdNuData, ffdBarData);
01255   return auto_ptr<NuMatrix>(nm);
01256 }

auto_ptr< NuMatrix > NuMMRunFC::GetNDData ( void   )  const [virtual]

Returns the ND data used in extrapolation.

Reimplemented from NuMMRun.

Definition at line 1232 of file NuMMRunFC.cxx.

References NuMMRunNuBar::fndBarData, NuMMRunNuBar::fndNuData, and Munits::nm.

01233 {
01234   // NOTE: The data objects are stored as protected data members in the
01235   // NuMMRunNuBar class. However, the way the data is dealt with is very
01236   // specific to each extrapolation, so it turns out to be easier to 
01237   // do this here, in this leaf class than centrally.
01238   
01239   // Convert to a NuMatrixCPT, as charge-signs are separated internally
01240   NuMatrixCPT *nm = new NuMatrixCPT(fndNuData, fndBarData);
01241   return auto_ptr<NuMatrix>(nm);
01242 }

void NuMMRunFC::Init ( NuMMHelperCPT helper,
const NuMatrixSpectrum ndNuData,
const NuMatrixSpectrum ndBarData,
const NuMatrixSpectrum fdNuData,
const NuMatrixSpectrum fdBarData 
) [private]

Definition at line 96 of file NuMMRunFC.cxx.

References NuMMHelperCPT::BarBeamMatrixNuMuCCXSec(), CacheExtrapolation(), NuMMHelperCPT::FDBarEfficiency(), NuMMHelperCPT::FDNuEfficiency(), fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMRunNuBar::ffdBarData, NuMMRunNuBar::ffdNuData, NuMMRunNuBar::fHelper, NuMMRunNuBar::fndBarData, NuMMRunNuBar::fndNuData, NuMMRunNuBar::fPredictAntiNeutrinos, NuMMRunNuBar::fPredictNeutrinos, Msg::kError, MSG, NuMMHelperCPT::NuBeamMatrixNuMuCCXSec(), NuMMHelperCPT::NuBeamMatrixTauCCXSec(), PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, PreCalcwrongSignNuMus, and NuMatrixSpectrum::Spectrum().

Referenced by NuMMRunFC().

00101 {
00102   fDoneWsNeutrinos = false;
00103   fDoneWsAntineutrinos = false;  
00104   fPredictNeutrinos = true;
00105   fPredictAntiNeutrinos = true;
00106   
00107   if (!helper) {
00108     MSG("NuMMRunFC",Msg::kError) << "Passed a null pointer for helper" << endl;
00109     assert(helper);
00110   }
00111   if (!ndNuData) {
00112     MSG("NuMMRunFC",Msg::kError) << "Passed a null pointer for ndNuData" << endl;
00113     assert(ndNuData);
00114   }
00115   if (!ndBarData) {
00116     MSG("NuMMRunFC",Msg::kError) << "Passed a null pointer for ndBarData" << endl;
00117     assert(ndBarData);
00118   }
00119   if (!fdNuData) {
00120     MSG("NuMMRunFC",Msg::kError) << "Passed a null pointer for fdNuData" << endl;
00121     assert(fdNuData);
00122   }
00123   if (!fdBarData) {
00124     MSG("NuMMRunFC",Msg::kError) << "Passed a null pointer for fdBarData" << endl;
00125     assert(fdBarData);
00126   }  
00127   
00128   
00129   fndNuData   = new NuMatrixSpectrum(*ndNuData);
00130   fndBarData  = new NuMatrixSpectrum(*ndBarData);
00131   ffdNuData   = new NuMatrixSpectrum(*fdNuData);
00132   ffdBarData  = new NuMatrixSpectrum(*fdBarData);
00133 
00134   fHelper = helper;
00135   
00136   // Protect against cases where the FD data is not the same
00137   // binning as the prediction would be. Use the helper file
00138   // as a guide to what this should be...
00139   // Only perform this check if the passed in data has a spectrum
00140   if (fdNuData->Spectrum()) {
00141     if (fdNuData->Spectrum()->GetNbinsX() != fHelper->FDNuEfficiency()->GetNbinsX()) {
00142       MSG("NuMMRunFC",Msg::kError) << "Nu Binning Mismatch: fdNuData # bins: " << fdNuData->Spectrum()->GetNbinsX() 
00143       << " and fHelper # bins: " << fHelper->FDNuEfficiency()->GetNbinsX() << endl;
00144       assert(fdNuData->Spectrum()->GetNbinsX() == fHelper->FDNuEfficiency()->GetNbinsX());
00145     }
00146   }
00147   if (fdBarData->Spectrum()) {
00148     if (fdBarData->Spectrum()->GetNbinsX() != fHelper->FDBarEfficiency()->GetNbinsX()) {
00149       MSG("NuMMRunFC",Msg::kError) << "Bar Binning Mismatch: fdNuData # bins: " << fdBarData->Spectrum()->GetNbinsX() 
00150       << " and fHelper # bins: " << fHelper->FDBarEfficiency()->GetNbinsX() << endl;
00151       assert(fdBarData->Spectrum()->GetNbinsX() == fHelper->FDBarEfficiency()->GetNbinsX());
00152     }
00153   }
00154   
00155   // Protect against being passed an ancient helper
00156   if ( !fHelper->NuBeamMatrixNuMuCCXSec()
00157        || !fHelper->BarBeamMatrixNuMuCCXSec()
00158        || !fHelper->NuBeamMatrixTauCCXSec()) {
00159          throw runtime_error("Have been passed an ancient helper without cross-section histograms");
00160        }
00161   
00162   // Blank out all the Precache variables
00163   PreCalcnuPrediction   = PreCalcbarPrediction      = 0;
00164   PreCalcpotentialNuTaus= PreCalcpotentialTauBars   = 0;
00165   PreCalcnuNCBackground = PreCalcbarNCBackground    = 0;
00166   PreCalcwrongSignNuMus = PreCalcwrongSignNuBars    = 0;
00167   
00168   // We should now be completely capable of calculating the
00169   // halfway point of the prediction. Do so now.
00170   CacheExtrapolation();
00171 }

void NuMMRunFC::InverseOscillateNuTau ( NuMatrixSpectrum nutau,
const NuMMParameters pars 
) const

Helper. Inverse oscillates a true energy nutau spectrum.

Does nothing if the model is decay or decoherence

Definition at line 1074 of file NuMMRunFC.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayMuToTau(), NuMMParameters::Delta1(), NuMMParameters::Dm2(), NuMMParameters::Dm221(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMatrix1D::InverseDecohere(), NuMatrixSpectrum::InverseOscillate(), NuMatrixSpectrum::InverseOscillateNSI(), NuMMParameters::Mu2(), NuMatrixSpectrum::Oscillate_3flavour(), NuMMParameters::Sn2(), NuMMParameters::Theta12(), NuMMParameters::Theta13(), and NuMMParameters::Theta23().

Referenced by MakeFDPred(), MakeFDPredBackgrounds(), TrueComponents(), and WriteFDPredHistos().

01076 {
01077   if(fDisappearanceModel == 0) {
01078     nutau.InverseOscillate(pars.Dm2(), pars.Sn2());
01079   }
01080   if(fDisappearanceModel == 1)
01081     nutau.DecayMuToTau(pars.Dm2(), pars.Sn2(), pars.Alpha());
01082   if(fDisappearanceModel == 2)
01083     nutau.InverseDecohere(pars.Dm2(), pars.Sn2(), pars.Mu2());
01084   if(fDisappearanceModel == 3)
01085     nutau.InverseOscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), 1.0);
01086   if(fDisappearanceModel == 4)
01087     nutau.Oscillate_3flavour(pars.Dm2(), pars.Theta23(), pars.Dm221(), pars.Theta12(), pars.Theta13(), pars.Delta1(), 16);
01088 }

void NuMMRunFC::InverseOscillateTauBar ( NuMatrixSpectrum nutau,
const NuMMParameters pars 
) const

Helper. Inverse oscillates a true energy taubar spectrum.

Does nothing if the model is decay or decoherence

Definition at line 1117 of file NuMMRunFC.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayMuToTau(), NuMMParameters::Delta1(), NuMMParameters::Dm2(), NuMMParameters::Dm221(), NuMMParameters::Dm2Bar(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMatrix1D::InverseDecohere(), NuMatrixSpectrum::InverseOscillate(), NuMatrixSpectrum::InverseOscillateNSI(), NuMMParameters::Mu2(), NuMatrixSpectrum::Oscillate_3flavour(), NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), NuMMParameters::Theta12(), NuMMParameters::Theta13(), and NuMMParameters::Theta23().

Referenced by MakeFDPred(), MakeFDPredBackgrounds(), TrueComponents(), and WriteFDPredHistos().

01119 {
01120   if(fDisappearanceModel == 0) {
01121     nutau.InverseOscillate(pars.Dm2Bar(), pars.Sn2Bar());
01122   }
01123   if(fDisappearanceModel == 1)
01124     nutau.DecayMuToTau(pars.Dm2Bar(), pars.Sn2Bar(), pars.Alpha());
01125   if(fDisappearanceModel == 2)
01126     nutau.InverseDecohere(pars.Dm2Bar(), pars.Sn2Bar(), pars.Mu2());
01127   if(fDisappearanceModel == 3)
01128     nutau.InverseOscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), -1.0);
01129   if(fDisappearanceModel == 4)
01130     nutau.Oscillate_3flavour(pars.Dm2(), pars.Theta23(), pars.Dm221(), pars.Theta12(), pars.Theta13(), pars.Delta1(), -16);
01131 }

pair< NuMatrixSpectrum, NuMatrixSpectrum > NuMMRunFC::MakeFDPred ( const NuMMParameters pars  )  [virtual]

Return a pair (NQ,PQ) of NuMatrixSpectra of the far detector prediction with oscillation parameters described in pars. Pure virtual.

Implements NuMMRunNuBar.

Definition at line 649 of file NuMMRunFC.cxx.

References NuMatrix1D::Add(), CacheExtrapolation(), NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMHelperCPT::DoTaus(), NuMMParameters::Epsilon(), NuMMHelperCPT::FDBarRecoVsTrue(), NuMMHelperCPT::FDNuRecoVsTrue(), NuMMHelperCPT::FDNuTauRecoVsTrue(), fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMHelperCPT::FDTauBarRecoVsTrue(), NuMMHelperCPT::FDWrongSignBarRecoVsTrue(), NuMMHelperCPT::FDWrongSignNuRecoVsTrue(), NuMMRunNuBar::fHelper, NuMMRunNuBar::fPredictAntiNeutrinos, NuMMRunNuBar::fPredictNeutrinos, NuMMRun::fQuietMode, InverseOscillateNuTau(), InverseOscillateTauBar(), OscillateNuBar(), OscillateNuMu(), PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, PreCalcwrongSignNuMus, NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), NuMatrixSpectrum::Spectrum(), and NuMatrixSpectrum::TrueToReco().

Referenced by NuFCGridPoint::PredictSpectrum().

00650 {
00651   // Precache extrap, but only if needed
00652   CacheExtrapolation(); 
00653   
00654   // Output the oscillation settings!
00655   if (!fQuietMode) {
00656       //pars.PrintStatus();
00657     cout << "sn2: " << pars.Sn2() << "; dm2: " << pars.Dm2() 
00658     << "; sn2bar: " << pars.Sn2Bar() << "; dm2bar: " << pars.Dm2Bar()
00659        << "; epsilon: " << pars.Epsilon() << endl;
00660   }
00661   
00663   // For all neutrinos
00664 
00665   // Make copies of the prepared extrapolation variables, so that
00666   // we can alter them locally with the oscillation parameters
00667   NuMatrixSpectrum nuPrediction(*PreCalcnuPrediction);
00668   NuMatrixSpectrum barPrediction(*PreCalcbarPrediction);
00669   
00670   NuMatrixSpectrum potentialNuTaus(*PreCalcpotentialNuTaus);
00671   NuMatrixSpectrum potentialTauBars(*PreCalcpotentialTauBars);
00672 
00673   NuMatrixSpectrum nuNCBackground(*PreCalcnuNCBackground);
00674   NuMatrixSpectrum barNCBackground(*PreCalcbarNCBackground);
00675   
00676   NuMatrixSpectrum wrongSignNuMus(*PreCalcwrongSignNuMus);
00677   NuMatrixSpectrum wrongSignNuBars(*PreCalcwrongSignNuBars);
00678 
00680   // Processes for neutrinos
00681   
00682   if (fPredictNeutrinos)
00683   {  
00684     if (fHelper->DoTaus()) {
00685       // Oscillate the taus
00686       InverseOscillateNuTau(potentialNuTaus,pars);
00687       potentialNuTaus.TrueToReco(fHelper->FDNuTauRecoVsTrue());
00688     }
00689 
00690     // If we have pre-oscillated the wrong sign, do not do so again
00691     if (!fDoneWsAntineutrinos) {
00692         // Antineutrinos in the neutrino spectrum
00693         OscillateNuBar(wrongSignNuBars,pars);
00694         wrongSignNuBars.TrueToReco(fHelper->FDWrongSignBarRecoVsTrue());
00695     }
00696 
00697     // Oscillate the Neutrino spectrum!
00698     OscillateNuMu(nuPrediction,pars);
00699 
00700     // True to Reco
00701     nuPrediction.TrueToReco(fHelper->FDNuRecoVsTrue());
00702 
00703     //Add in backgrounds
00704     nuPrediction.Add(wrongSignNuBars);
00705     nuPrediction.Add(nuNCBackground);
00706     if (fHelper->DoTaus()) nuPrediction.Add(potentialNuTaus);
00707   } else {
00708       // Scale the histogram to zero, so as not to confuse people
00709       // if they look at the spectrum with neutrinos turned off
00710       nuPrediction.Spectrum()->Scale(0);
00711   }
00712   
00714   // Processes for Antineutrinos
00715   
00716   if (fPredictAntiNeutrinos)
00717   {
00718       if (fHelper->DoTaus()) {
00719         // Oscillate the taubars
00720         InverseOscillateTauBar(potentialTauBars,pars);
00721         potentialTauBars.TrueToReco(fHelper->FDTauBarRecoVsTrue());
00722       }
00723 
00724       // Only oscillate the wrong sign if it hasn't been done already
00725       if (!fDoneWsNeutrinos) {
00726           // Oscillate the wrong sign component
00727           // Neutrinos for the antineutrino spectrum
00728           OscillateNuMu(wrongSignNuMus,pars);
00729           wrongSignNuMus.TrueToReco(fHelper->FDWrongSignNuRecoVsTrue());
00730       }
00731       // Oscillate the antineutrino spectrum!
00732       OscillateNuBar(barPrediction,pars);
00733 
00734       // True to reco
00735      barPrediction.TrueToReco(fHelper->FDBarRecoVsTrue());
00736       
00737       // Add in backgrounds
00738       barPrediction.Add(wrongSignNuMus);
00739       barPrediction.Add(barNCBackground);
00740       if (fHelper->DoTaus()) barPrediction.Add(potentialTauBars);
00741   } else {
00742       // Scale the histogram to zero, so as not to confuse people
00743       barPrediction.Spectrum()->Scale(0);
00744   }
00745   
00746   // Return the two predictions, as a pair
00747   pair<NuMatrixSpectrum,NuMatrixSpectrum>
00748     predictions(nuPrediction,barPrediction);
00749   return predictions;
00750 }

std::vector< TH1D > NuMMRunFC::MakeFDPredBackgrounds ( const NuMMParameters pars  )  [virtual]

Definition at line 756 of file NuMMRunFC.cxx.

References NuMatrix1D::Add(), CacheExtrapolation(), NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMHelperCPT::DoTaus(), NuMMParameters::Epsilon(), NuMMHelperCPT::FDBarRecoVsTrue(), NuMMHelperCPT::FDNuRecoVsTrue(), NuMMHelperCPT::FDNuTauRecoVsTrue(), fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMHelperCPT::FDTauBarRecoVsTrue(), NuMMHelperCPT::FDWrongSignBarRecoVsTrue(), NuMMHelperCPT::FDWrongSignNuRecoVsTrue(), NuMMRunNuBar::ffdBarData, NuMMRunNuBar::ffdNuData, NuMMRunNuBar::fHelper, NuMMRunNuBar::fndBarData, NuMMRunNuBar::fndNuData, NuMMRun::fQuietMode, InverseOscillateNuTau(), InverseOscillateTauBar(), OscillateNuBar(), OscillateNuMu(), PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, PreCalcwrongSignNuMus, NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), NuMatrixSpectrum::Spectrum(), and NuMatrixSpectrum::TrueToReco().

00757 {
00758   cout << "Making FD predictions, including background predictions" << endl << endl;
00759   //Set up a vector to push the histograms into.
00760   vector<TH1D> vHistos;
00761 
00762   //Put the ND data in the vector:
00763   TH1D hNDNuData(*(fndNuData->Spectrum()));
00764   hNDNuData.SetName("ndDataNQ");
00765   hNDNuData.SetTitle("ndDataNQ");
00766   vHistos.push_back(*(new TH1D(hNDNuData)));
00767   TH1D hNDBarData(*(fndBarData->Spectrum()));
00768   hNDBarData.SetName("ndDataPQ");
00769   hNDBarData.SetTitle("ndDataPQ");
00770   vHistos.push_back(*(new TH1D(hNDBarData)));
00771 
00772 
00773   // Precache extrap, but only if needed
00774   CacheExtrapolation(); 
00775   
00776   // Output the oscillation settings!
00777   if (!fQuietMode) {
00778       //pars.PrintStatus();
00779     cout << "sn2: " << pars.Sn2() << "; dm2: " << pars.Dm2() 
00780     << "; sn2bar: " << pars.Sn2Bar() << "; dm2bar: " << pars.Dm2Bar()
00781        << "; epsilon: " << pars.Epsilon() << endl;
00782   }
00783   
00785   // For all neutrinos
00786 
00787   // Make copies of the prepared extrapolation variables, so that
00788   // we can alter them locally with the oscillation parameters
00789   NuMatrixSpectrum nuPrediction(*PreCalcnuPrediction);
00790   NuMatrixSpectrum barPrediction(*PreCalcbarPrediction);
00791   
00792   NuMatrixSpectrum potentialNuTaus(*PreCalcpotentialNuTaus);
00793   NuMatrixSpectrum potentialTauBars(*PreCalcpotentialTauBars);
00794 
00795   NuMatrixSpectrum nuNCBackground(*PreCalcnuNCBackground);
00796   NuMatrixSpectrum barNCBackground(*PreCalcbarNCBackground);
00797   
00798   NuMatrixSpectrum wrongSignNuMus(*PreCalcwrongSignNuMus);
00799   NuMatrixSpectrum wrongSignNuBars(*PreCalcwrongSignNuBars);
00800 
00802   // Processes for neutrinos
00803   
00804   if (fHelper->DoTaus()) {
00805     // Oscillate the taus
00806     InverseOscillateNuTau(potentialNuTaus,pars);
00807     potentialNuTaus.TrueToReco(fHelper->FDNuTauRecoVsTrue());
00808   }
00809 
00810   // If we have pre-oscillated the wrong sign, do not do so again
00811   if (!fDoneWsAntineutrinos) {
00812     // Antineutrinos in the neutrino spectrum
00813     OscillateNuBar(wrongSignNuBars,pars);
00814     wrongSignNuBars.TrueToReco(fHelper->FDWrongSignBarRecoVsTrue());
00815   }
00816   
00817   // Oscillate the Neutrino spectrum!
00818   OscillateNuMu(nuPrediction,pars);
00819   
00820   // True to Reco
00821   nuPrediction.TrueToReco(fHelper->FDNuRecoVsTrue());
00822   
00823   // Write out the spectra for the prediction components
00824   // before we add in backgrounds
00825   TH1D hFDNoBackTrueNQ(*(nuPrediction.Spectrum()));
00826   hFDNoBackTrueNQ.SetName("fdBasePredictionNQ");
00827   vHistos.push_back(hFDNoBackTrueNQ);
00828   
00829   //Add in backgrounds
00830   nuPrediction.Add(wrongSignNuBars);
00831   nuPrediction.Add(nuNCBackground);
00832   if (fHelper->DoTaus()) nuPrediction.Add(potentialNuTaus);
00833 
00834   // Write out the wrong sign spectrum
00835   TH1D hFDWrongSignNQ(*(wrongSignNuBars.Spectrum()));
00836   hFDWrongSignNQ.SetName("fdWrongSignNQ");
00837   vHistos.push_back(hFDWrongSignNQ);
00838   
00839   // Write out the tau spectrum
00840   TH1D hFDTausNuMu(*(potentialNuTaus.Spectrum()));
00841   hFDTausNuMu.SetName("fdTausNQ");
00842   vHistos.push_back(hFDTausNuMu);
00843 
00844   // Write out the NC spectrum
00845   TH1D hFDNCNQ(*(nuNCBackground.Spectrum()));
00846   hFDNCNQ.SetName("fdNCNQ");
00847   vHistos.push_back(hFDNCNQ);
00848 
00849   // Write out the FD data spectrum
00850   TH1D hFDDataNQ(*(ffdNuData->Spectrum()));
00851   hFDDataNQ.SetName("fdDataNQ");
00852   vHistos.push_back(hFDDataNQ);
00853 
00854   // Write out the FD predicted spectrum
00855   TH1D hFDPredictionNQ(*(nuPrediction.Spectrum()));
00856   hFDPredictionNQ.SetName("fdPredictionNQ");
00857   vHistos.push_back(hFDPredictionNQ);
00858 
00860   // Processes for Antineutrinos
00861   
00862   if (fHelper->DoTaus()) {
00863     // Oscillate the taubars
00864     InverseOscillateTauBar(potentialTauBars,pars);
00865     potentialTauBars.TrueToReco(fHelper->FDTauBarRecoVsTrue());
00866   }
00867   
00868   // Only oscillate the wrong sign if it hasn't been done already
00869   if (!fDoneWsNeutrinos) {
00870     // Oscillate the wrong sign component
00871     // Neutrinos for the antineutrino spectrum
00872     OscillateNuMu(wrongSignNuMus,pars);
00873     wrongSignNuMus.TrueToReco(fHelper->FDWrongSignNuRecoVsTrue());
00874   }
00875   
00876   // Oscillate the antineutrino spectrum!
00877   OscillateNuBar(barPrediction,pars);
00878   
00879   // True to reco
00880   barPrediction.TrueToReco(fHelper->FDBarRecoVsTrue());
00881   
00882   // Write out the antineutrino spectrum, without backgrounds
00883   TH1D hFDNoBackTruePQ(*(barPrediction.Spectrum()));
00884   hFDNoBackTruePQ.SetName("fdBasePredictionPQ");
00885   vHistos.push_back(hFDNoBackTruePQ);
00886   
00887   // Add in backgrounds
00888   barPrediction.Add(wrongSignNuMus);
00889   barPrediction.Add(barNCBackground);
00890   if (fHelper->DoTaus()) barPrediction.Add(potentialTauBars);
00891 
00892   // write out the wrong sign spectrum
00893   TH1D hFDWrongSignPQ(*(wrongSignNuMus.Spectrum()));
00894   hFDWrongSignPQ.SetName("fdWrongSignPQ");
00895   vHistos.push_back(hFDWrongSignPQ);
00896 
00897   // Write out the tau spectrum
00898   TH1D hFDTausNuBar(*(potentialTauBars.Spectrum()));
00899   hFDTausNuBar.SetName("fdTausPQ");
00900   vHistos.push_back(hFDTausNuBar);
00901 
00902   // Write out the NC spectrum
00903   TH1D hFDNCPQ(*(barNCBackground.Spectrum()));
00904   hFDNCPQ.SetName("fdNCPQ");
00905   vHistos.push_back(hFDNCPQ);
00906 
00907   // Write out the FD data spectrum
00908   TH1D hFDDataPQ(*(ffdBarData->Spectrum()));
00909   hFDDataPQ.SetName("fdDataPQ");
00910   vHistos.push_back(hFDDataPQ);
00911 
00912   // Write out the total predicted spectrum
00913   TH1D hFDPredictionPQ(*(barPrediction.Spectrum()));
00914   hFDPredictionPQ.SetName("fdPredictionPQ");
00915   vHistos.push_back(hFDPredictionPQ);
00916 
00917 
00918   return vHistos;
00919 }

NuMMRunFC& NuMMRunFC::operator= ( const NuMMRunFC rhs  )  [private]

Disallow assignment: This is broken, so don't let people do it.

void NuMMRunFC::OscillateNuBar ( NuMatrixSpectrum numu,
const NuMMParameters pars 
) const

Helper. Oscillates, decays or decoheres a true energy nubar spectrum.

Definition at line 1091 of file NuMMRunFC.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayCC(), NuMatrix1D::Decohere(), NuMMParameters::Delta1(), NuMMParameters::Dm2(), NuMMParameters::Dm221(), NuMMParameters::Dm2Bar(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMMParameters::Mu2(), NuMatrixSpectrum::Oscillate(), NuMatrixSpectrum::Oscillate_3flavour(), NuMatrixSpectrum::OscillateNSI(), NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), NuMMParameters::Theta12(), NuMMParameters::Theta13(), and NuMMParameters::Theta23().

Referenced by MakeFDPred(), MakeFDPredBackgrounds(), PreCalcWrongSign(), TrueComponents(), and WriteFDPredHistos().

01093 {
01094   switch(fDisappearanceModel){
01095   case 0:
01096     numu.Oscillate(pars.Dm2Bar(), pars.Sn2Bar());
01097     return;
01098   case 1:
01099     numu.DecayCC(pars.Dm2Bar(), pars.Sn2Bar(), pars.Alpha());
01100     return;
01101   case 2:
01102     numu.Decohere(pars.Dm2Bar(), pars.Sn2Bar(), pars.Mu2());
01103     return;
01104   case 3: 
01105     numu.OscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), -1.0);
01106     return;
01107   case 4:
01108     numu.Oscillate_3flavour(pars.Dm2(), pars.Theta23(), pars.Dm221(), pars.Theta12(), pars.Theta13(), pars.Delta1(), -14);
01109     return;
01110   default:
01111     assert(0 && "Badly configured disappearance model");
01112   }
01113 }   

void NuMMRunFC::OscillateNuMu ( NuMatrixSpectrum numu,
const NuMMParameters pars 
) const

Helper. Oscillates, decays or decoheres a true energy numu spectrum.

Definition at line 1047 of file NuMMRunFC.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayCC(), NuMatrix1D::Decohere(), NuMMParameters::Delta1(), NuMMParameters::Dm2(), NuMMParameters::Dm221(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMMParameters::Mu2(), NuMatrixSpectrum::Oscillate(), NuMatrixSpectrum::Oscillate_3flavour(), NuMatrixSpectrum::OscillateNSI(), NuMMParameters::Sn2(), NuMMParameters::Theta12(), NuMMParameters::Theta13(), and NuMMParameters::Theta23().

Referenced by MakeFDPred(), MakeFDPredBackgrounds(), PreCalcWrongSign(), TrueComponents(), and WriteFDPredHistos().

01049 {
01050   switch(fDisappearanceModel){
01051   case 0:
01052     numu.Oscillate(pars.Dm2(), pars.Sn2());
01053     cout<<"NuMu2"<<endl;
01054     return;
01055   case 1:
01056     numu.DecayCC(pars.Dm2(), pars.Sn2(), pars.Alpha());
01057     return;
01058   case 2:
01059     numu.Decohere(pars.Dm2(), pars.Sn2(), pars.Mu2());
01060     return;
01061   case 3:
01062     numu.OscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), 1.0);
01063     return;
01064   case 4:
01065     numu.Oscillate_3flavour(pars.Dm2(), pars.Theta23(), pars.Dm221(), pars.Theta12(), pars.Theta13(), pars.Delta1(), 14);
01066     return;
01067   default:
01068     assert(0 && "Badly configured disappearance model");
01069   }
01070 }

Bool_t NuMMRunFC::PreCalcWrongSign ( const NuMMParameters pars  ) 

Pre-calculate the wrong sign oscillation. This is a valid action in cases where, for instance, the neutrino prediction has been turned off. It is assumed that if you are not predicting neutrinos, then the neutrino mixing parameters remain constant throughout the fit. Returns false if everything has already been precalculated.

Definition at line 612 of file NuMMRunFC.cxx.

References fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMHelperCPT::FDWrongSignBarRecoVsTrue(), NuMMHelperCPT::FDWrongSignNuRecoVsTrue(), NuMMRunNuBar::fHelper, NuMMRunNuBar::fPredictAntiNeutrinos, NuMMRunNuBar::fPredictNeutrinos, NuMMRun::fQuietMode, OscillateNuBar(), OscillateNuMu(), PreCalcwrongSignNuBars, PreCalcwrongSignNuMus, and NuMatrixSpectrum::TrueToReco().

00613 {
00614     // Did we change anything in this run?
00615     Bool_t change = false;
00616     
00617     // Precalculate the wrong sign, if we have disabled predictions
00618     // for that class, and it hasn't been done already. This should only
00619     // be done once, unless of course the user does something strange like
00620     // turning on neutrino prediction in the middle of an extrapolation.
00621     if(!fDoneWsNeutrinos) {
00622         if (!fPredictNeutrinos)
00623         {
00624             change = true;
00625             if (!fQuietMode) cout << "Neutrino prediction off: Precalculating wrong sign oscillation." << endl;
00626             OscillateNuMu(*PreCalcwrongSignNuMus,pars);
00627             PreCalcwrongSignNuMus->TrueToReco(fHelper->FDWrongSignNuRecoVsTrue());
00628             fDoneWsNeutrinos = true;
00629         }
00630     }
00631     if(!fPredictAntiNeutrinos) {
00632         if (!fDoneWsAntineutrinos)
00633         {
00634             change = true;
00635             if (!fQuietMode) cout << "Antineutrino prediction off: Precalculating wrong sign oscillation." << endl;
00636             OscillateNuBar(*PreCalcwrongSignNuBars,pars);
00637             PreCalcwrongSignNuBars->TrueToReco(fHelper->FDWrongSignBarRecoVsTrue());
00638             fDoneWsAntineutrinos = true;
00639         }
00640     }
00641     
00642     // Return the flag saying if we have changed anything
00643     return change;
00644 }

virtual Bool_t NuMMRunFC::PredictNuBars (  )  [inline, virtual]

Reimplemented from NuMMRunNuBar.

Definition at line 73 of file NuMMRunFC.h.

References NuMMRunNuBar::fPredictAntiNeutrinos.

00073 { return fPredictAntiNeutrinos;}

virtual void NuMMRunFC::PredictNuBars ( Bool_t  predict  )  [inline, virtual]

Will the antineutrino prediction be calculated?

Reimplemented from NuMMRunNuBar.

Definition at line 68 of file NuMMRunFC.h.

References CacheExtrapolation(), fDoneWsAntineutrinos, and NuMMRunNuBar::fPredictAntiNeutrinos.

00068                                              {
00069       fPredictAntiNeutrinos = predict;
00070       if(fDoneWsAntineutrinos) CacheExtrapolation();
00071   }

virtual Bool_t NuMMRunFC::PredictNus (  )  [inline, virtual]

Reimplemented from NuMMRunNuBar.

Definition at line 72 of file NuMMRunFC.h.

References NuMMRunNuBar::fPredictNeutrinos.

00072 { return fPredictNeutrinos;}

virtual void NuMMRunFC::PredictNus ( Bool_t  predict  )  [inline, virtual]

Will the neutrino prediction be calculated?

Reimplemented from NuMMRunNuBar.

Definition at line 63 of file NuMMRunFC.h.

References CacheExtrapolation(), fDoneWsNeutrinos, and NuMMRunNuBar::fPredictNeutrinos.

Referenced by NuFCFitter::NuFCFitter().

00063                                           {
00064       fPredictNeutrinos = predict;
00065       if(fDoneWsNeutrinos) CacheExtrapolation();
00066   }

void NuMMRunFC::ResetCache (  ) 

Resets the internal cache. This means that the next time you ask for a prediction, it will take longer as everything will need to be calculated from scratch.

Definition at line 236 of file NuMMRunFC.cxx.

References NuMMRunNuBar::fCached, PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, and PreCalcwrongSignNuMus.

Referenced by CacheExtrapolation(), ResetFDData(), ResetNDData(), TrueComponents(), and ~NuMMRunFC().

00237 {
00238   // delete the precalculated MM spectra we previously created
00239   if (PreCalcnuPrediction)    delete PreCalcnuPrediction;
00240   if (PreCalcbarPrediction)   delete PreCalcbarPrediction;
00241   
00242   if (PreCalcpotentialNuTaus) delete PreCalcpotentialNuTaus; 
00243   if (PreCalcpotentialTauBars)delete PreCalcpotentialTauBars; 
00244   
00245   if (PreCalcnuNCBackground)  delete PreCalcnuNCBackground; 
00246   if (PreCalcbarNCBackground) delete PreCalcbarNCBackground; 
00247   
00248   if (PreCalcwrongSignNuMus)  delete PreCalcwrongSignNuMus; 
00249   if (PreCalcwrongSignNuBars) delete PreCalcwrongSignNuBars; 
00250   
00251   PreCalcnuPrediction    = PreCalcbarPrediction    = 0;
00252   PreCalcpotentialNuTaus = PreCalcpotentialTauBars = 0;
00253   PreCalcnuNCBackground  = PreCalcbarNCBackground  = 0;
00254   PreCalcwrongSignNuMus  = PreCalcwrongSignNuBars  = 0;
00255   
00256   fCached = false;
00257 }

void NuMMRunFC::ResetFDData ( const NuMatrix fddata  )  [virtual]

Replace the FD data used in extrapolation.

Reimplemented from NuMMRun.

Definition at line 1171 of file NuMMRunFC.cxx.

References CacheExtrapolation(), NuMatrixSpectrum::Copy(), NuMMRunNuBar::ffdBarData, NuMMRunNuBar::ffdNuData, NuMatrix1D::GetNuMatrixSpectrum(), NuMatrix::GetPOT(), Msg::kFatal, MSG, NuMatrixCPT::NQ(), NuMatrixCPT::PQ(), and ResetCache().

01172 {
01173   // Attempt downcast to a CPT object
01174   const NuMatrixCPT *cpt = dynamic_cast<const NuMatrixCPT*>(&fddata);
01175   if (!cpt) {
01176     MSG("NuMMRunFC",Msg::kFatal) << "Error: Have not been passed a CPT matrix object to reset ND Data" << endl;
01177   }
01178 
01179   // Pointers to temporary storage if we need to convert NuMatrix1D->NuMatrixspectrum
01180   // This is because we use borrowed pointers normally, but by creating a new NuMatrixSpectrum
01181   // we become responsible for destroying the objects, and leaking them is not an option.
01182   auto_ptr<NuMatrixSpectrum> tmpPQ, tmpNQ;
01183   
01184   // Extract the NQ and PQ spectra
01185   const NuMatrixSpectrum *pq = dynamic_cast<const NuMatrixSpectrum*>(cpt->PQ());
01186   if (!pq) {
01187     // Try a NuMatrix1D, then convert it to a NuMatrixSpecturm if it is
01188     const NuMatrix1D *nm1d = dynamic_cast<const NuMatrix1D*>(cpt->PQ());
01189     if (!nm1d) {
01190       // Fail if we cannot handle this histogram
01191       MSG("NuMMRunFC",Msg::kFatal) << "Error: PQ spectrum appears not to be a NuMatrixSpectrum or NuMatrix1D" << endl;
01192     }
01193     tmpPQ.reset(nm1d->GetNuMatrixSpectrum().Copy());
01194     pq = tmpPQ.get();
01195   }
01196   
01197   const NuMatrixSpectrum *nq = dynamic_cast<NuMatrixSpectrum*>(cpt->NQ());
01198   if (!nq) {
01199     // Try a NuMatrix1D, then convert it to a NuMatrixSpecturm if it is
01200     const NuMatrix1D *nm1d = dynamic_cast<const NuMatrix1D*>(cpt->NQ());
01201     if (!nm1d) {
01202       // Fail if we cannot handle this histogram
01203       MSG("NuMMRunFC",Msg::kFatal) << "Error: NQ spectrum appears not to be a NuMatrixSpectrum" << endl;
01204     }
01205     tmpNQ.reset(nm1d->GetNuMatrixSpectrum().Copy());
01206     nq = tmpNQ.get();
01207   }
01208   
01209   // Store the old FD data POT
01210   Double_t oldPOT = ffdNuData->GetPOT();
01211   
01212   // Delete the old spectra, if they exist
01213   if (ffdNuData) delete ffdNuData; ffdNuData = 0;
01214   if (ffdBarData) delete ffdBarData; ffdBarData = 0;
01215   
01216   // Copy the spectra to this object
01217   ffdNuData = nq->Copy();
01218   ffdBarData = pq->Copy();
01219   
01220   // If the POT has changed, we need to recache the extrapolation
01221   if (ffdNuData->GetPOT() != oldPOT)
01222   {
01223     // cout << "POT CHANGE: " << oldPOT << " -> " << ffdNuData->GetPOT()
01224     //   << " = change of " << ffdNuData->GetPOT() - oldPOT << " POT" << endl;
01225     ResetCache();
01226     CacheExtrapolation();
01227   }
01228 }

void NuMMRunFC::ResetNDData ( const NuMatrix nddata  )  [virtual]

Replace the ND data used in extrapolation.

Reimplemented from NuMMRun.

Definition at line 1136 of file NuMMRunFC.cxx.

References CacheExtrapolation(), NuMatrixSpectrum::Copy(), NuMMRunNuBar::fndBarData, NuMMRunNuBar::fndNuData, Msg::kFatal, MSG, NuMatrixCPT::NQ(), NuMatrixCPT::PQ(), and ResetCache().

01137 {
01138   // Attempt downcast to a CPT object
01139   const NuMatrixCPT *cpt = dynamic_cast<const NuMatrixCPT*>(&nddata);
01140   if (!cpt) {
01141     MSG("NuMMRunFC",Msg::kFatal) << "Error: Have not been passed a CPT matrix object to reset ND Data" << endl;
01142   }
01143   
01144   // Extract the NQ and PQ spectra
01145   const NuMatrixSpectrum *pq = dynamic_cast<NuMatrixSpectrum*>(cpt->PQ());
01146   if (!pq) {
01147     MSG("NuMMRunFC",Msg::kFatal) << "Error: PQ spectrum appears not to be a NuMatrixSpectrum" << endl;
01148   }
01149   
01150   const NuMatrixSpectrum *nq = dynamic_cast<NuMatrixSpectrum*>(cpt->NQ());
01151   if (!nq) {
01152     MSG("NuMMRunFC",Msg::kFatal) << "Error: NQ spectrum appears not to be a NuMatrixSpectrum" << endl;
01153   }
01154   
01155   // Delete the old spectra, if they exist
01156   if (fndNuData) delete fndNuData; fndNuData = 0;
01157   if (fndBarData) delete fndBarData; fndBarData = 0;
01158   
01159   // Now we have the spectra!
01160   fndNuData = nq->Copy();
01161   fndBarData = pq->Copy();
01162   
01163   // Recalculate the extrapolation caches
01164   ResetCache();
01165   CacheExtrapolation();
01166 }

NuMatrixSpectrum NuMMRunFC::TrueComponents ( const NuMMParameters pars,
Sample_t  s 
) [virtual]

Definition at line 925 of file NuMMRunFC.cxx.

References CacheExtrapolation(), fDoneWsAntineutrinos, fDoneWsNeutrinos, Msg::kWarning, MAXMSG, ResetCache(), and TrueComponents().

00926 {
00927   if (fDoneWsNeutrinos || fDoneWsAntineutrinos) {
00928     MAXMSG("NuMMRunFC",Msg::kWarning,10) << "Already True-To-Recoed the wrong signs.  Re-caching -- this may be slow event-by-event." << endl;
00929     ResetCache();
00930   }
00931 
00932   CacheExtrapolation(); 
00933   
00934   return static_cast<const NuMMRunFC *>(this)->TrueComponents(pars, s);
00935 }

NuMatrixSpectrum NuMMRunFC::TrueComponents ( const NuMMParameters pars,
Sample_t  s 
) const [virtual]

Return the individual true energy prediction of the far detector sub sample s with oscillation parameters described in pars. Default implementation just drops an error.

Reimplemented from NuMMRun.

Definition at line 937 of file NuMMRunFC.cxx.

References NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMParameters::Epsilon(), NuMMRunNuBar::fCached, fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMRunNuBar::fPredictAntiNeutrinos, NuMMRunNuBar::fPredictNeutrinos, NuMMRun::fQuietMode, InverseOscillateNuTau(), InverseOscillateTauBar(), Sample::kAppearedNQ, Sample::kAppearedPQ, Msg::kError, Msg::kFatal, Sample::kNCNQ, Sample::kNCPQ, Sample::kSignalNQ, Sample::kSignalPQ, Sample::kTauNQ, Sample::kTauPQ, Msg::kWarning, Sample::kWrongSignNQ, Sample::kWrongSignPQ, MAXMSG, MSG, OscillateNuBar(), OscillateNuMu(), PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, PreCalcwrongSignNuMus, NuMatrixSpectrum::SetName(), NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), and NuMatrixSpectrum::Spectrum().

Referenced by TrueComponents().

00938 {
00939   if (fDoneWsNeutrinos || fDoneWsAntineutrinos) {
00940     MAXMSG("NuMMRunFC",Msg::kWarning,10) << "Already True-To-Recoed the wrong signs.  Re-caching -- this may be slow event-by-event." << endl;
00941     MSG("NuMMRunFC",Msg::kFatal) << "Cannot recache as TrueComponents is now constant" << endl;    
00942     // ResetCache();
00943   } 
00944   
00945   // Check that we are cached and throw an error otherwise
00946   if (!fCached) {
00947     MSG("NuMMRunFC",Msg::kError) << "Have not cached extrapolation prior to asking for true components!" << endl;
00948     assert(fCached);
00949   }
00950   
00951   // Output the oscillation settings!
00952   if (!fQuietMode) {
00953     cout << "sn2: " << pars.Sn2() << "; dm2: " << pars.Dm2() 
00954          << "; sn2bar: " << pars.Sn2Bar() << "; dm2bar: " << pars.Dm2Bar()
00955          << "; epsilon: " << pars.Epsilon() << endl;
00956   }
00957   
00958   // No appeared spectrum for oscillations
00959   if (s == kAppearedPQ || s == kAppearedNQ) {
00960     NuMatrixSpectrum blank(*PreCalcnuPrediction);
00961     blank.SetName("Blank");
00962     blank.Spectrum()->Scale(0);
00963     return blank;    
00964   }
00965   
00966   // Request NQ spectrum, but no NuBar Predictions OR
00967   // Request PQ spectrum, but no NuMu Predictions
00968   if ( (s < 0 && !fPredictNeutrinos) || 
00969       (s > 0 && !fPredictAntiNeutrinos) ) {
00970     NuMatrixSpectrum blank(*PreCalcnuPrediction);
00971     blank.SetName("Blank");
00972     blank.Spectrum()->Scale(0);
00973     return blank;
00974   }
00975   
00976   if (s == kSignalPQ) {
00977     NuMatrixSpectrum barPrediction(*PreCalcbarPrediction);
00978     OscillateNuBar(barPrediction,pars);
00979     return barPrediction;
00980   }
00981   else if (s == kSignalNQ) {
00982     NuMatrixSpectrum nuPrediction(*PreCalcnuPrediction);  
00983     OscillateNuMu(nuPrediction,pars);
00984     return nuPrediction;
00985   }
00986   else if (s == kWrongSignPQ) {
00987     NuMatrixSpectrum wrongSignNuMus(*PreCalcwrongSignNuMus);
00988     OscillateNuMu(wrongSignNuMus,pars);
00989     return wrongSignNuMus;
00990   }
00991   else if (s == kWrongSignNQ) {
00992     NuMatrixSpectrum wrongSignNuBars(*PreCalcwrongSignNuBars);
00993     OscillateNuBar(wrongSignNuBars,pars);
00994     return wrongSignNuBars;
00995   }  
00996   else if (s == kNCPQ) {
00997     NuMatrixSpectrum barNCBackground(*PreCalcbarNCBackground);
00998     return barNCBackground;
00999   }
01000   else if (s == kNCNQ) {
01001     NuMatrixSpectrum nuNCBackground(*PreCalcnuNCBackground);
01002     return nuNCBackground;
01003   }
01004   else if (s == kTauPQ) {
01005     NuMatrixSpectrum potentialTauBars(*PreCalcpotentialTauBars);
01006     InverseOscillateTauBar(potentialTauBars,pars);
01007     return potentialTauBars;
01008   }
01009   else if (s == kTauNQ) {
01010     NuMatrixSpectrum potentialNuTaus(*PreCalcpotentialNuTaus);
01011     InverseOscillateNuTau(potentialNuTaus,pars);
01012     return potentialNuTaus;
01013   }
01014   else {
01015     MSG("NuMMRunTransitions",Msg::kWarning) << "Requested unknown prediction #" << s << ", returning blank." << endl;
01016     NuMatrixSpectrum blank(*PreCalcnuPrediction);
01017     blank.SetName("Blank");
01018     blank.Spectrum()->Scale(0);
01019     return blank;
01020   }
01021 }

std::vector< TH1D > NuMMRunFC::WriteFDPredHistos ( const NuMMParameters pars  )  const [virtual]

Implements NuMMRun.

Definition at line 262 of file NuMMRunFC.cxx.

References NuMatrix1D::Add(), NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMHelperCPT::DoTaus(), NuMMParameters::Epsilon(), NuMMHelperCPT::FDBarRecoVsTrue(), NuMMHelperCPT::FDNuRecoVsTrue(), NuMMHelperCPT::FDNuTauRecoVsTrue(), fDoneWsAntineutrinos, fDoneWsNeutrinos, NuMMHelperCPT::FDTauBarRecoVsTrue(), NuMMHelperCPT::FDWrongSignBarRecoVsTrue(), NuMMHelperCPT::FDWrongSignNuRecoVsTrue(), NuMMRunNuBar::ffdBarData, NuMMRunNuBar::ffdNuData, NuMMRunNuBar::fHelper, NuMMRunNuBar::fndBarData, NuMMRunNuBar::fndNuData, NuMMRunNuBar::fPredictAntiNeutrinos, NuMMRunNuBar::fPredictNeutrinos, NuMMRun::fQuietMode, InverseOscillateNuTau(), InverseOscillateTauBar(), OscillateNuBar(), OscillateNuMu(), PreCalcbarNCBackground, PreCalcbarPrediction, PreCalcnuNCBackground, PreCalcnuPrediction, PreCalcpotentialNuTaus, PreCalcpotentialTauBars, PreCalcwrongSignNuBars, PreCalcwrongSignNuMus, NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), NuMatrixSpectrum::Spectrum(), and NuMatrixSpectrum::TrueToReco().

00263 {    
00264   //Set up a vector to push the histograms into.
00265   vector<TH1D> vHistos;
00266 
00267   //Put the ND data in the vector:
00268   TH1D hNDNuData(*(fndNuData->Spectrum()));
00269   hNDNuData.SetName("ndDataNQ");
00270   hNDNuData.SetTitle("ndDataNQ");
00271   vHistos.push_back(*(new TH1D(hNDNuData)));
00272   TH1D hNDBarData(*(fndBarData->Spectrum()));
00273   hNDBarData.SetName("ndDataPQ");
00274   hNDBarData.SetTitle("ndDataPQ");
00275   vHistos.push_back(*(new TH1D(hNDBarData)));
00276 
00277   if (!fQuietMode) {
00278   cout << "sn2: " << pars.Sn2() << "; dm2: " << pars.Dm2() 
00279      << "; sn2bar: " << pars.Sn2Bar() << "; dm2bar: " << pars.Dm2Bar()
00280        << "; epsilon: " << pars.Epsilon() << endl;
00281   }
00282 
00283   // Make copies of the prepared extrapolation variables
00284   NuMatrixSpectrum nuPrediction(*PreCalcnuPrediction);
00285   NuMatrixSpectrum barPrediction(*PreCalcbarPrediction);
00286   
00287   NuMatrixSpectrum potentialNuTaus(*PreCalcpotentialNuTaus);
00288   NuMatrixSpectrum potentialTauBars(*PreCalcpotentialTauBars);
00289 
00290   NuMatrixSpectrum nuNCBackground(*PreCalcnuNCBackground);
00291   NuMatrixSpectrum barNCBackground(*PreCalcbarNCBackground);
00292   
00293   NuMatrixSpectrum wrongSignNuMus(*PreCalcwrongSignNuMus);
00294   NuMatrixSpectrum wrongSignNuBars(*PreCalcwrongSignNuBars);
00295   
00296   cout << "NC Integral: " << barNCBackground.Spectrum()->Integral() << endl;
00297 
00298 
00299 
00300 // 
00301 //   //Add in backgrounds
00302 //   nuPrediction.Add(wrongSignNuBars);
00303 //   barPrediction.Add(wrongSignNuMus);
00304 //   nuPrediction.Add(nuNCBackground);
00305 //   nuPrediction.Add(potentialNuTaus);
00306 //   barPrediction.Add(barNCBackground);
00307 //   barPrediction.Add(potentialTauBars);
00308   
00310   // Processes for neutrinos
00311   
00312   if (fPredictNeutrinos)
00313   {  
00314     // Oscillate the taus
00315     if (fHelper->DoTaus()) {
00316       InverseOscillateNuTau(potentialNuTaus,pars);
00317     
00318       // Write out the true tau spectra
00319       TH1D hFDTausNuMu(*(potentialNuTaus.Spectrum()));
00320       hFDTausNuMu.SetName("fdTausNuMu");
00321       vHistos.push_back(hFDTausNuMu);
00322       
00323       potentialNuTaus.TrueToReco(fHelper->FDNuTauRecoVsTrue());
00324     }
00325 
00326     // Antineutrinos in the neutrino spectrum
00327     if (!fDoneWsAntineutrinos) OscillateNuBar(wrongSignNuBars,pars);
00328 
00329     // Now convert wrong sign to reco
00330     if (!fDoneWsAntineutrinos) wrongSignNuBars.TrueToReco(fHelper->FDWrongSignBarRecoVsTrue());
00331     
00332     // Write out the true wrong sign components
00333     TH1D hFDWrongSignNQ(*(wrongSignNuBars.Spectrum()));
00334     hFDWrongSignNQ.SetName("fdWrongSignNQ");
00335     vHistos.push_back(hFDWrongSignNQ);
00336     
00337     // Oscillation and efficiency for the Neutrino spectrum
00338     OscillateNuMu(nuPrediction,pars);
00339 //    nuPrediction.Multiply(fHelper->FDNuEfficiency());
00340 
00341     // Write out the true spectra for the prediction components
00342     // before we add in backgrounds
00343     TH1D hFDNoBackTrueNQ(*(nuPrediction.Spectrum()));
00344     hFDNoBackTrueNQ.SetName("fdBasePredictionNuMus");
00345     vHistos.push_back(hFDNoBackTrueNQ);
00346 
00347     // True to Reco
00348     nuPrediction.TrueToReco(fHelper->FDNuRecoVsTrue());
00349 
00350     // Dump out the reco spectrum before adding in the backgrounds
00351     TH1D hFDNoBackNQ(*(nuPrediction.Spectrum()));
00352     hFDNoBackNQ.SetName("fdBasePredictionNQ");
00353     vHistos.push_back(hFDNoBackNQ);
00354 
00355     //Add in backgrounds
00356     nuPrediction.Add(wrongSignNuBars);
00357     nuPrediction.Add(nuNCBackground);
00358     if (fHelper->DoTaus()) nuPrediction.Add(potentialNuTaus);
00359     
00360     //Put the other componants of the predictions in the vector
00361     TH1D hFDPredictionNQ(*(nuPrediction.Spectrum()));
00362     hFDPredictionNQ.SetName("fdPredictionNQ");
00363     vHistos.push_back(hFDPredictionNQ);
00364 
00365     TH1D hFDNCNQ(*(nuNCBackground.Spectrum()));
00366     hFDNCNQ.SetName("fdNCNQ");
00367     vHistos.push_back(hFDNCNQ);
00368 
00369     if (fHelper->DoTaus()) {
00370       TH1D hFDTausNQ(*(potentialNuTaus.Spectrum()));
00371       hFDTausNQ.SetName("fdTausNQ");
00372       vHistos.push_back(hFDTausNQ);
00373     }
00374     
00375     TH1D hFDDataNQ(*(ffdNuData->Spectrum()));
00376     hFDDataNQ.SetName("fdDataNQ");
00377     vHistos.push_back(hFDDataNQ);
00378     
00379   } else {
00380       // Scale the histogram to zero, so as not to confuse people
00381       nuPrediction.Spectrum()->Scale(0);
00382   }
00383   
00385   // Processes for Antineutrinos
00386   
00387   if (fPredictAntiNeutrinos)
00388   {
00389     if (fHelper->DoTaus()) {
00390       // Oscillate the taubars
00391       InverseOscillateTauBar(potentialTauBars,pars);
00392       // Write out the True Tau Spectrum
00393       TH1D hFDTausNuBar(*(potentialTauBars.Spectrum()));
00394       hFDTausNuBar.SetName("fdTausNuBar");
00395       vHistos.push_back(hFDTausNuBar);
00396       // Convert taus to reco energy
00397       potentialTauBars.TrueToReco(fHelper->FDTauBarRecoVsTrue());
00398     }
00399     // Oscillate the wrong sign component
00400     // Neutrinos for the antineutrino spectrum
00401     if (!fDoneWsNeutrinos) OscillateNuMu(wrongSignNuMus,pars);
00402 
00403     // Now, convert wrong sign to reco energy
00404     if (!fDoneWsNeutrinos) wrongSignNuMus.TrueToReco(fHelper->FDWrongSignNuRecoVsTrue());
00405     
00406     // write out the true wrong sign spectra
00407     TH1D hFDWrongSignPQ(*(wrongSignNuMus.Spectrum()));
00408     hFDWrongSignPQ.SetName("fdWrongSignPQ");
00409     vHistos.push_back(hFDWrongSignPQ);
00410     
00411     //Oscillation and efficiency for the antineutrino spectrum
00412     OscillateNuBar(barPrediction,pars);
00413 
00414     // Write out the true antineutrino spectrum, without backgrounds
00415     TH1D hFDNoBackTruePQ(*(barPrediction.Spectrum()));
00416     hFDNoBackTruePQ.SetName("fdBasePredictionNuBars");
00417     vHistos.push_back(hFDNoBackTruePQ);
00418 
00419     //True to reco
00420     barPrediction.TrueToReco(fHelper->FDBarRecoVsTrue());
00421 
00422     // Antineutrino reco spectrum, before backgrounds
00423     TH1D hFDNoBackPQ(*(barPrediction.Spectrum()));
00424     hFDNoBackPQ.SetName("fdBasePredictionPQ");
00425     vHistos.push_back(hFDNoBackPQ);
00426 
00427     //Add in backgrounds
00428     barPrediction.Add(wrongSignNuMus);
00429     barPrediction.Add(barNCBackground);
00430     if (fHelper->DoTaus()) barPrediction.Add(potentialTauBars);
00431     
00432     TH1D hFDPredictionPQ(*(barPrediction.Spectrum()));
00433     hFDPredictionPQ.SetName("fdPredictionPQ");
00434     vHistos.push_back(hFDPredictionPQ);
00435 
00436     TH1D hFDNCPQ(*(barNCBackground.Spectrum()));
00437     hFDNCPQ.SetName("fdNCPQ");
00438     vHistos.push_back(hFDNCPQ);
00439 
00440     if (fHelper->DoTaus()) {
00441       TH1D hFDTausPQ(*(potentialTauBars.Spectrum()));
00442       hFDTausPQ.SetName("fdTausPQ");
00443       vHistos.push_back(hFDTausPQ);
00444     }
00445 
00446     TH1D hFDDataPQ(*(ffdBarData->Spectrum()));
00447     hFDDataPQ.SetName("fdDataPQ");
00448     vHistos.push_back(hFDDataPQ);
00449     
00450   } else {
00451       // Scale the histogram to zero, so as not to confuse people
00452       barPrediction.Spectrum()->Scale(0);
00453   }
00454 
00455   return vHistos;
00456 }


Member Data Documentation

Bool_t NuMMRunFC::fDoneWsNeutrinos [private]

Flags to remember if the wrong sign has been precalculated.

Definition at line 141 of file NuMMRunFC.h.

Referenced by CacheExtrapolation(), Init(), MakeFDPred(), MakeFDPredBackgrounds(), NuMMRunFC(), PreCalcWrongSign(), PredictNus(), TrueComponents(), and WriteFDPredHistos().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1