NuFCFitterNuMuBar Class Reference

#include <NuFCFitterNuMuBar.h>

Inheritance diagram for NuFCFitterNuMuBar:

NuFCFittingInterface List of all members.

Public Member Functions

 NuFCFitterNuMuBar (const NuMMParameters &pars)
virtual Bool_t Fit (void)
 Run the fitting routine. Returns true for success.

Private Attributes

NuMMParameters fBaseParameters

Detailed Description

Definition at line 8 of file NuFCFitterNuMuBar.h.


Constructor & Destructor Documentation

NuFCFitterNuMuBar::NuFCFitterNuMuBar ( const NuMMParameters pars  ) 

Definition at line 17 of file NuFCFitterNuMuBar.cxx.

References NuMMParameters::AreAllParametersFixed(), NuMMParameters::ConstrainPhysical(), fBaseParameters, NuMMParameters::FixAlpha(), NuMMParameters::FixDm2(), NuMMParameters::FixDm2Bar(), NuMMParameters::FixEpsilon(), NuMMParameters::FixMu2(), NuMMParameters::FixNCBackground(), NuMMParameters::FixNorm(), NuMMParameters::FixShwScale(), NuMMParameters::FixSn2(), NuMMParameters::FixSn2Bar(), NuMMParameters::FixTransitionProb(), NuMMParameters::FixTrkScale(), NuMMParameters::ReleaseDm2Bar(), and NuMMParameters::ReleaseSn2Bar().

00018   : fBaseParameters(pars)
00019 {
00020   // Fix everything
00021   fBaseParameters.FixDm2();
00022   fBaseParameters.FixSn2();
00023   fBaseParameters.FixNorm();
00024   fBaseParameters.FixShwScale();
00025   fBaseParameters.FixTrkScale();
00026   fBaseParameters.FixNCBackground();
00027   fBaseParameters.FixDm2Bar();
00028   fBaseParameters.FixSn2Bar();
00029   fBaseParameters.FixEpsilon();
00030   fBaseParameters.FixTransitionProb();
00031   fBaseParameters.FixMu2();
00032   fBaseParameters.FixAlpha();
00033   
00034   // Make sure everything is fixed now
00035   assert(fBaseParameters.AreAllParametersFixed());
00036   
00037   // Release the stuff we want
00038   fBaseParameters.ReleaseDm2Bar();
00039   fBaseParameters.ReleaseSn2Bar();
00040   fBaseParameters.ConstrainPhysical();
00041 }


Member Function Documentation

Bool_t NuFCFitterNuMuBar::Fit ( void   )  [virtual]

Run the fitting routine. Returns true for success.

Reimplemented from NuFCFittingInterface.

Definition at line 45 of file NuFCFitterNuMuBar.cxx.

References fBaseParameters, NuFCFittingInterface::fBestFit, NuSystFitter::FCMinimise(), NuFCFittingInterface::GetSystFitter(), gSystem(), Msg::kInfo, NuSystFitter::Likelihood(), NuSystFitter::Minimise(), and MSG.

00046 {
00047   // Turn off FPEs because Minuit is incredicly stupid and sometimes
00048   // tries to take sqrt(-1);
00049   Int_t FPEmask = gSystem->SetFPEMask(0);
00050   
00051   NuSystFitter *fitter = GetSystFitter();
00052   NuMMParameters fit = fitter->FCMinimise(fBaseParameters);
00053   
00054   // If this fit point was lower than our base parameters
00055   if (fitter->Likelihood(fit) > fitter->Likelihood(fBaseParameters))
00056   {
00057     MSG("NuFCFitterNuMuBar", Msg::kInfo) << "GOT NEGATIVE DELTA-CHI2: Refitting from base parameters" << endl;
00058     
00059     // Start a fit from our base parameters
00060     NuMMParameters mmFit = fitter->Minimise(fBaseParameters);
00061     fit = mmFit;
00062     
00063     // Work out the new deltachi2 to this reference and make sure it was lower
00064     Double_t newdelta = fitter->Likelihood(fBaseParameters) - fitter->Likelihood(mmFit);
00065     if (!mmFit.MinuitPass())
00066     {
00067         // Minuit failed to fit.
00068         MSG("NuFCFitterNuMuBar", Msg::kInfo) << "** FAILED MINUIT TRUTH REFIT **" << endl;
00069         MSG("NuFCFitterNuMuBar", Msg::kInfo) << "This is an error, but returning base parameters" << endl;
00070         fit = fBaseParameters;
00071     } else {
00072       // Print out what out refit was
00073       MSG("NuFCFitterNuMuBar", Msg::kInfo)
00074         << "Refit  found: dm2: " << mmFit.Dm2()
00075         << " sn2: " << mmFit.Sn2()
00076         << " dm2bar: " << mmFit.Dm2Bar()
00077         << " sn2bar: " << mmFit.Sn2Bar()
00078         << '\n';
00079     }
00080     if (newdelta < 0) {
00081       MSG("NuFCFitterNuMuBar", Msg::kInfo) << "New Minuit fit is still lower, returning base pars" << endl;
00082       fit = fBaseParameters;
00083     }
00084   }
00085   
00086   // Restore whatever FPE settings we had before
00087   gSystem->SetFPEMask(FPEmask);
00088 
00089   fBestFit = fit;
00090   // This function always returns a fit
00091   return true;
00092 }


Member Data Documentation

NuMMParameters NuFCFitterNuMuBar::fBaseParameters [private]

Definition at line 10 of file NuFCFitterNuMuBar.h.

Referenced by Fit(), and NuFCFitterNuMuBar().


The documentation for this class was generated from the following files:
Generated on Thu Jul 10 22:53:14 2014 for loon by  doxygen 1.4.7