OscFit::Fitter Class Reference

#include <Fitter.h>

List of all members.

Public Member Functions

void SetFileName (const char *filename)
void BuildExpt ()
void BuildExptFromData ()
void BuildExptFromMC ()
void WriteExpt ()
void PrintExpt ()
void ResetExpt ()
Bool_t TouchExpt ()
TemplateGetExpt (Run_t run)
Int_t GenSeed ()
void SetSeed (Int_t seed=-1)
void ForceCPT (Bool_t yesno=1)
void ConserveCPT ()
void ViolateCPT ()
Int_t GetDmsqBins ()
Double_t GetDmsqMin ()
Double_t GetDmsqMax ()
Double_t GetDmsq (Int_t n)
Int_t GetSinsqBins ()
Double_t GetSinsqMin ()
Double_t GetSinsqMax ()
Double_t GetSinsq (Int_t n)
void BuildGrid (Int_t n, Double_t min, Double_t max)
void CombineResBins (Bool_t yesno=1)
void CombineResBinsInFit (Bool_t yesno=1)
void ExcludeRAFBins (Bool_t yesno=1)
void SetMockData ()
void SetMockDataWithFluctuations ()
void SwitchOffFluctuationsOnSystematics ()
void SeedOscillationsFromBestFit (Bool_t yesno=1)
void SeedSystematicsFromBestFit (Bool_t yesno=1)
void SeedSystematicsFromLastFit (Bool_t yesno=1)
void AddPenaltyTerms (Bool_t yesno=1)
void PenaltyTermsOff ()
void EnforcePhysicalBoundary ()
void RelaxPhysicalBoundary ()
void RelaxDmsqBoundary ()
void SetInputOscillations (Double_t dmsq, Double_t sinsq)
void SetInputOscillations (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar)
void SetInputNuOscillations (Double_t dmsq, Double_t sinsq)
void SetInputNuBarOscillations (Double_t dmsqbar, Double_t sinsqbar)
void SetInputSystematics (Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken)
void SetInputNorm (Double_t norm)
void SetInputNCBkg (Double_t ncbkg)
void SetInputShwEn (Double_t shwen)
void SetInputTrkEn (Double_t trken)
void SetSeedOscillations (Double_t dmsq, Double_t sinsq)
void SetSeedOscillations (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar)
void SetSeedNuOscillations (Double_t dmsq, Double_t sinsq)
void SetSeedNuBarOscillations (Double_t dmsqbar, Double_t sinsqbar)
void SetSeedSystematics (Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken)
void SetSeedNorm (Double_t norm)
void SetSeedNCBkg (Double_t ncbkg)
void SetSeedShwEn (Double_t shwen)
void SetSeedTrkEn (Double_t trken)
void ResetFit ()
void ResetAnalysis ()
void DoCombinedAnalysis ()
void DoCombinedNuBarAnalysis ()
void DoRHCAnalysis ()
void DoFHCAnalysis ()
void DoFHCNuAnalysis ()
void DoFHCNuBarAnalysis ()
void DoFHCBarAnalysis ()
void DoCCAnalysis ()
void DoNuBarAnalysis ()
void UseCCData ()
void UseNuBarData ()
void UseRHCData ()
void FitNormalisation ()
void FitNCBackground ()
void FitSystematics ()
void FitReducedSystematics ()
void FitDmsq (Bool_t fitme=true)
void FitSinsq (Bool_t fitme=true)
void FitDmsqBar (Bool_t fitme=true)
void FitSinsqBar (Bool_t fitme=true)
void FitNuOscillations ()
void FitNuBarOscillations ()
void FitOscillations ()
void FixNuOscillations ()
void FixNuBarOscillations ()
void FixOscillations ()
void SetDebug (Bool_t yesno=1)
void WriteTemplates (Bool_t yesno=1)
void WriteContours (Int_t npts=150)
void PrintSettings ()
void GetLnL (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &LnL)
void GetLnL (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken, Double_t &LnL)
void GetLnLNoRes (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken, Double_t &LnL)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t &norm, Double_t &ncbkg, Double_t &shwen, Double_t &trken, Double_t &dm, Double_t &ds, Double_t &LnL)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &norm, Double_t &ncbkg, Double_t &shwen, Double_t &trken, Double_t &dm, Double_t &ds, Double_t &dmbar, Double_t &dsbar, Double_t &LnL)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t in_norm, Double_t in_ncbkg, Double_t in_shwen, Double_t in_trken, Double_t in_dm, Double_t in_ds, Double_t in_dmbar, Double_t in_dsbar, Double_t &out_norm, Double_t &out_ncbkg, Double_t &out_shwen, Double_t &out_trken, Double_t &out_dm, Double_t &out_ds, Double_t &out_dmbar, Double_t &out_dsbar, Double_t &LnL)
void RunContours ()
void SetSeedParameters ()
void SetSeedFromBestFit ()
void RunFit ()
void RunCptFit (Int_t ifirst=-1, Int_t ilast=-1)
void RunOscFit (Int_t ifirst=-1, Int_t ilast=-1)
void Run (Int_t ifirst=-1, Int_t ilast=-1)
void Reset ()
void itr ()
void reset_counter ()
Int_t get_counter ()

Static Public Member Functions

static FitterInstance ()

Public Attributes

Bool_t fForceCPT
Double_t fDmsq
Double_t fSinsq
Double_t fDmsqBar
Double_t fSinsqBar
Double_t fDeltaDmsq
Double_t fDeltaSinsq
Double_t fDeltaDmsqBar
Double_t fDeltaSinsqBar
Double_t fNorm
Double_t fNCBkg
Double_t fShwEn
Double_t fTrkEn
Bool_t fFittingDmsq
Bool_t fFittingSinsq
Bool_t fFittingDmsqBar
Bool_t fFittingSinsqBar
Bool_t fFittingNorm
Bool_t fFittingNCBkg
Bool_t fFittingShwEn
Bool_t fFittingTrkEn
Int_t fCtr

Private Member Functions

 Fitter ()
virtual ~Fitter ()

Private Attributes

std::map< Run_t, Template * > fTemplateArray
TMinuit * fMinuit
Int_t fMinuitStatus
Double_t fLnL68
Double_t fLnL90
Double_t fLnL99
Double_t fLnL90_1D
TemplatefTemplateExpt
TemplatefTemplateMC
TemplateArrayfTemplateArrayExpt
TemplateArrayfTemplateArrayMC
Bool_t fFitFHCNQ
Bool_t fFitFHCPQ
Bool_t fFitRHCNQ
Bool_t fFitRHCPQ
Double_t fInputForSeedDmsq
Double_t fInputForSeedSinsq
Double_t fInputForSeedDmsqBar
Double_t fInputForSeedSinsqBar
Double_t fInputForSeedNorm
Double_t fInputForSeedNCBkg
Double_t fInputForSeedShwEn
Double_t fInputForSeedTrkEn
Double_t fInputForExptDmsq
Double_t fInputForExptSinsq
Double_t fInputForExptDmsqBar
Double_t fInputForExptSinsqBar
Double_t fInputForExptNorm
Double_t fInputForExptNCBkg
Double_t fInputForExptShwEn
Double_t fInputForExptTrkEn
Double_t fSeedDmsq
Double_t fSeedSinsq
Double_t fSeedDmsqBar
Double_t fSeedSinsqBar
Double_t fSeedNorm
Double_t fSeedNCBkg
Double_t fSeedShwEn
Double_t fSeedTrkEn
Double_t fLastNorm
Double_t fLastNCBkg
Double_t fLastShwEn
Double_t fLastTrkEn
Bool_t fFixDmsq
Bool_t fFixSinsq
Bool_t fFixDmsqBar
Bool_t fFixSinsqBar
Bool_t fFitDmsq
Bool_t fFitSinsq
Bool_t fFitDmsqBar
Bool_t fFitSinsqBar
Bool_t fFitNorm
Bool_t fFitNCBkg
Bool_t fFitShwEn
Bool_t fFitTrkEn
Bool_t fMaskDmsq
Bool_t fMaskSinsq
Bool_t fMaskDmsqBar
Bool_t fMaskSinsqBar
Bool_t fMaskNorm
Bool_t fMaskNCBkg
Bool_t fMaskShwEn
Bool_t fMaskTrkEn
Bool_t fSeedOscillationsFromBestFit
Bool_t fSeedSystematicsFromBestFit
Bool_t fSeedSystematicsFromLastFit
Bool_t fSeedFromBestFit
Bool_t fPenaltyTerms
Bool_t fPhysicalBoundary
Bool_t fDmsqBoundary
Bool_t fCombineResBinsInFit
Bool_t fExcludeRAFBins
Bool_t fUseSimplex
Bool_t fMockData
Bool_t fMockDataWithFluctuations
Bool_t fSwitchOffFluctuationsOnSystematics
Bool_t fDebug
Int_t fSinsqBins
Double_t fSinsqMin
Double_t fSinsqMax
Bool_t fWriteTemplates
Bool_t fWriteContours
Int_t fNumPoints
TString fOutFile

Detailed Description

Definition at line 13 of file Fitter.h.


Constructor & Destructor Documentation

Fitter::Fitter (  )  [private]

Definition at line 90 of file Fitter.cxx.

References OscFit::Template::BuildHistograms(), fCombineResBinsInFit, fCtr, fDebug, fDeltaDmsq, fDeltaDmsqBar, fDeltaSinsq, fDeltaSinsqBar, fDmsq, fDmsqBar, fDmsqBoundary, fExcludeRAFBins, fFitDmsq, fFitDmsqBar, fFitFHCNQ, fFitFHCPQ, fFitNCBkg, fFitNorm, fFitRHCNQ, fFitRHCPQ, fFitShwEn, fFitSinsq, fFitSinsqBar, fFittingDmsq, fFittingDmsqBar, fFittingNCBkg, fFittingNorm, fFittingShwEn, fFittingSinsq, fFittingSinsqBar, fFittingTrkEn, fFitTrkEn, fFixDmsq, fFixDmsqBar, fFixSinsq, fFixSinsqBar, fInputForExptDmsq, fInputForExptDmsqBar, fInputForExptNCBkg, fInputForExptNorm, fInputForExptShwEn, fInputForExptSinsq, fInputForExptSinsqBar, fInputForExptTrkEn, fInputForSeedDmsq, fInputForSeedDmsqBar, fInputForSeedNCBkg, fInputForSeedNorm, fInputForSeedShwEn, fInputForSeedSinsq, fInputForSeedSinsqBar, fInputForSeedTrkEn, fLastNCBkg, fLastNorm, fLastShwEn, fLastTrkEn, fLnL68, fLnL90, fLnL90_1D, fLnL99, fMaskDmsq, fMaskDmsqBar, fMaskNCBkg, fMaskNorm, fMaskShwEn, fMaskSinsq, fMaskSinsqBar, fMaskTrkEn, fMinuit, fMinuitStatus, fMockData, fMockDataWithFluctuations, fNCBkg, fNorm, fNumPoints, ForceCPT(), fOutFile, fPenaltyTerms, fPhysicalBoundary, fSeedDmsq, fSeedDmsqBar, fSeedFromBestFit, fSeedNCBkg, fSeedNorm, fSeedOscillationsFromBestFit, fSeedShwEn, fSeedSinsq, fSeedSinsqBar, fSeedSystematicsFromBestFit, fSeedSystematicsFromLastFit, fSeedTrkEn, fShwEn, fSinsq, fSinsqBar, fSinsqBins, fSinsqMax, fSinsqMin, fSwitchOffFluctuationsOnSystematics, fTemplateArrayExpt, fTemplateArrayMC, fTemplateExpt, fTemplateMC, fTrkEn, fUseSimplex, fWriteContours, and fWriteTemplates.

Referenced by Instance().

00091 {
00092   std::cout << " *** Starting Fitter *** " << std::endl;
00093 
00094   ForceCPT(0);
00095 
00096   fFitFHCNQ = 1;
00097   fFitFHCPQ = 1;
00098   fFitRHCNQ = 0;
00099   fFitRHCPQ = 1;
00100 
00101   fLnL68 = 1.15;
00102   fLnL90 = 2.31;
00103   fLnL99 = 4.61;
00104 
00105   fLnL90_1D = 1.35;
00106 
00107   fSinsqBins = 2;
00108   fSinsqMin  = 0.0;
00109   fSinsqMax  = 1.0;
00110 
00111   fDmsq     = 0.0;
00112   fSinsq    = 0.0;
00113   fDmsqBar  = 0.0;
00114   fSinsqBar = 0.0; 
00115     
00116   fDeltaDmsq     = 0.0;
00117   fDeltaSinsq    = 0.0;
00118   fDeltaDmsqBar  = 0.0;
00119   fDeltaSinsqBar = 0.0;
00120   fNorm          = 0.0;
00121   fNCBkg         = 0.0;
00122   fShwEn         = 0.0;
00123   fTrkEn         = 0.0;
00124   
00125   fInputForSeedDmsq     = 2.32e-3;
00126   fInputForSeedSinsq    = 1.0;
00127   fInputForSeedDmsqBar  = 2.32e-3;
00128   fInputForSeedSinsqBar = 1.0;
00129   fInputForSeedNorm     = 0.0;
00130   fInputForSeedNCBkg    = 0.0;
00131   fInputForSeedShwEn    = 0.0;
00132   fInputForSeedTrkEn    = 0.0;
00133 
00134   fInputForExptDmsq     = 0.0;
00135   fInputForExptSinsq    = 0.0;
00136   fInputForExptDmsqBar  = 0.0;
00137   fInputForExptSinsqBar = 0.0;
00138   fInputForExptNorm     = 0.0;
00139   fInputForExptNCBkg    = 0.0;
00140   fInputForExptShwEn    = 0.0;
00141   fInputForExptTrkEn    = 0.0;
00142 
00143   fSeedDmsq        = fInputForSeedDmsq;
00144   fSeedSinsq       = fInputForSeedSinsq;
00145   fSeedDmsqBar     = fInputForSeedDmsqBar;
00146   fSeedSinsqBar    = fInputForSeedSinsqBar;
00147   fSeedNorm        = fInputForSeedNorm;
00148   fSeedNCBkg       = fInputForSeedNCBkg;
00149   fSeedShwEn       = fInputForSeedShwEn;
00150   fSeedTrkEn       = fInputForSeedTrkEn;
00151 
00152   fLastNorm        = 0.0;
00153   fLastNCBkg       = 0.0;
00154   fLastShwEn       = 0.0;
00155   fLastTrkEn       = 0.0;
00156 
00157   fFixDmsq         = 0;
00158   fFixSinsq        = 0;
00159   fFixDmsqBar      = 0;
00160   fFixSinsqBar     = 0;
00161   fFitDmsq         = 0;
00162   fFitSinsq        = 0;
00163   fFitDmsqBar      = 0;
00164   fFitSinsqBar     = 0;
00165   fFitNorm         = 0;
00166   fFitNCBkg        = 0;
00167   fFitShwEn        = 0;
00168   fFitTrkEn        = 0;  
00169 
00170   fMaskDmsq        = 1;
00171   fMaskSinsq       = 1;
00172   fMaskDmsqBar     = 1;
00173   fMaskSinsqBar    = 1;
00174   fMaskNorm        = 1;
00175   fMaskNCBkg       = 1;
00176   fMaskShwEn       = 1;
00177   fMaskTrkEn       = 1;  
00178  
00179   fFittingDmsq     = 0;
00180   fFittingSinsq    = 0;
00181   fFittingDmsqBar  = 0;
00182   fFittingSinsqBar = 0;
00183   fFittingNorm     = 0;
00184   fFittingNCBkg    = 0;
00185   fFittingShwEn    = 0;
00186   fFittingTrkEn    = 0;  
00187 
00188   fMockData = 0; 
00189   fMockDataWithFluctuations = 0; 
00190 
00191   fSwitchOffFluctuationsOnSystematics = 0;
00192 
00193   fUseSimplex = 0;
00194 
00195   fSeedSystematicsFromBestFit  = 0;
00196   fSeedOscillationsFromBestFit = 0;
00197   fSeedSystematicsFromLastFit  = 0;
00198   fSeedFromBestFit = 0;
00199 
00200   fPenaltyTerms = 1;
00201   fPhysicalBoundary = 1;
00202   fDmsqBoundary = 1;
00203 
00204   fTemplateExpt = 0;
00205 
00206   fTemplateMC = new Template();
00207   fTemplateMC->BuildHistograms();  
00208 
00209   fTemplateArrayMC = new TemplateArray();
00210   fTemplateArrayExpt = new TemplateArray();
00211 
00212   fWriteTemplates = 0;
00213   fWriteContours = 0;
00214 
00215   fCombineResBinsInFit = 0;
00216   fExcludeRAFBins = 0;
00217 
00218   fNumPoints = 150;
00219 
00220   fOutFile = "osc.root";
00221 
00222   gRandom->SetSeed(0);
00223 
00224   fMinuit = new TMinuit();
00225   fMinuit->SetPrintLevel(-1);
00226   fMinuit->SetMaxIterations(5000);
00227 
00228   fMinuitStatus = 999;
00229 
00230   fDebug = 0;
00231   fCtr = 0;
00232 }

Fitter::~Fitter (  )  [private, virtual]

Definition at line 234 of file Fitter.cxx.

References fMinuit, fTemplateArrayExpt, fTemplateArrayMC, and fTemplateMC.

00235 {
00236   delete fMinuit;
00237 
00238   delete fTemplateMC;
00239 
00240   delete fTemplateArrayMC;
00241   delete fTemplateArrayExpt;
00242 }


Member Function Documentation

void OscFit::Fitter::AddPenaltyTerms ( Bool_t  yesno = 1  )  [inline]

Definition at line 92 of file Fitter.h.

References fPenaltyTerms.

00092                                              {
00093       fPenaltyTerms = yesno;
00094     }

void Fitter::BuildExpt (  ) 

Definition at line 388 of file Fitter.cxx.

References BuildExptFromData(), BuildExptFromMC(), and fMockData.

Referenced by RunCptFit(), RunFit(), RunOscFit(), and SetSeedFromBestFit().

00389 {
00390   if( fMockData ) BuildExptFromMC();
00391   else BuildExptFromData();
00392 }

void Fitter::BuildExptFromData (  ) 

Definition at line 394 of file Fitter.cxx.

References fMockData, fTemplateArrayExpt, Instance(), PrintExpt(), and ResetExpt().

Referenced by BuildExpt().

00395 {
00396   if( fMockData==1 ) return;
00397 
00398   std::cout << " *** Fitter::BuildExptFromData() *** " << std::endl;
00399 
00400   // reset experiments
00401   this->ResetExpt();
00402  
00403   // build experiment
00404   TemplateCalculator::Instance()->GetData(fTemplateArrayExpt);
00405 
00406   // print experiments
00407   this->PrintExpt();
00408 
00409   return;
00410 }

void Fitter::BuildExptFromMC (  ) 

Definition at line 412 of file Fitter.cxx.

References fForceCPT, fInputForExptDmsq, fInputForExptDmsqBar, fInputForExptNCBkg, fInputForExptNorm, fInputForExptShwEn, fInputForExptSinsq, fInputForExptSinsqBar, fInputForExptTrkEn, fMockData, fMockDataWithFluctuations, fSwitchOffFluctuationsOnSystematics, fTemplateArrayExpt, Instance(), PrintExpt(), and ResetExpt().

Referenced by BuildExpt().

00413 {
00414   if( fMockData==0 ) return;
00415 
00416   std::cout << " *** Fitter::BuildExptFromMC() *** " << std::endl;
00417 
00418   // reset experiments
00419   this->ResetExpt();
00420 
00421   // Input Parameters
00422   Double_t inputDmsq     = fInputForExptDmsq;
00423   Double_t inputSinsq    = fInputForExptSinsq;
00424   Double_t inputDmsqBar  = fInputForExptDmsqBar;
00425   Double_t inputSinsqBar = fInputForExptSinsqBar;
00426   Double_t inputNorm     = fInputForExptNorm;
00427   Double_t inputNCBkg    = fInputForExptNCBkg;
00428   Double_t inputShwEn    = fInputForExptShwEn;
00429   Double_t inputTrkEn    = fInputForExptTrkEn;
00430 
00431   if( fForceCPT ){
00432     inputDmsqBar = inputDmsq;
00433     inputSinsqBar = inputSinsq;
00434   }
00435 
00436   // Pick Systematic Parameters
00437   if( fMockDataWithFluctuations
00438    && fSwitchOffFluctuationsOnSystematics==0 ){
00439 
00440     Int_t flag = 0;
00441     Double_t fDeltaInputNorm  = 0.0;
00442     Double_t fDeltaInputNCBkg = 0.0;
00443     Double_t fDeltaInputShwEn = 0.0;
00444     Double_t fDeltaInputTrkEn = 0.0;
00445 
00446     // Normalisation        
00447     flag = 0;
00448     while( !(fDeltaInputNorm>-2.0 && fDeltaInputNorm<+2.0 && flag) ){
00449       fDeltaInputNorm = gRandom->Gaus(0.0,1.0); flag = 1;
00450     }
00451 
00452     // NC Background
00453     flag = 0;
00454     while( !(fDeltaInputNCBkg>-2.0 && fDeltaInputNCBkg<+2.0 && flag) ){
00455       fDeltaInputNCBkg = gRandom->Gaus(0.0,1.0); flag = 1;
00456     }
00457 
00458     // Shower Energy
00459     flag = 0;
00460     while( !(fDeltaInputShwEn>-2.0 && fDeltaInputShwEn<+2.0 && flag) ){
00461       fDeltaInputShwEn = gRandom->Gaus(0.0,1.0); flag = 1;
00462     }
00463 
00464     // Track Energy
00465     flag = 0;
00466     while( !(fDeltaInputTrkEn>-2.0 && fDeltaInputTrkEn<+2.0 && flag) ){
00467       fDeltaInputTrkEn = gRandom->Gaus(0.0,1.0); flag = 1;
00468     }  
00469 
00470     // increment systematic parameters
00471     inputNorm  += fDeltaInputNorm;
00472     inputNCBkg += fDeltaInputNCBkg;
00473     inputShwEn += fDeltaInputShwEn;
00474     inputTrkEn += fDeltaInputTrkEn;
00475   }
00476 
00477   // print input parameters
00478   std::cout << "  Input Parameters for Expt: " << std::endl;
00479   std::cout << "   Dmsq=" << inputDmsq << ", Sinsq=" << inputSinsq << std::endl;
00480   std::cout << "   DmsqBar=" << inputDmsqBar << ", SinsqBar=" << inputSinsqBar << std::endl;
00481   std::cout << "   Norm=" << inputNorm << ", NCBkg=" << inputNCBkg << std::endl;
00482   std::cout << "   ShwEn=" << inputShwEn << ", TrkEn=" << inputTrkEn << std::endl;
00483 
00484   // build mock data with fluctuations
00485   if( fMockDataWithFluctuations ){
00486     TemplateCalculator::Instance()->GetExperiment(inputDmsq,    inputSinsq,
00487                                                   inputDmsqBar, inputSinsqBar,
00488                                                   inputNorm,    inputNCBkg,
00489                                                   inputShwEn,   inputTrkEn,
00490                                                   fTemplateArrayExpt);
00491   }
00492 
00493   // build mock data without fluctuations
00494   else{
00495     TemplateCalculator::Instance()->GetExpectation(inputDmsq,    inputSinsq,
00496                                                    inputDmsqBar, inputSinsqBar,
00497                                                    inputNorm,    inputNCBkg,
00498                                                    inputShwEn,   inputTrkEn,
00499                                                    fTemplateArrayExpt);
00500   }
00501   
00502   // print experiment
00503   this->PrintExpt();
00504 
00505   return;
00506 }

void Fitter::BuildGrid ( Int_t  n,
Double_t  min,
Double_t  max 
)

Definition at line 355 of file Fitter.cxx.

References fSinsqBins, fSinsqMax, fSinsqMin, GetSinsq(), and GetSinsqBins().

00356 {
00357   std::cout << " *** Fitter::BuildGrid(...) *** " << std::endl;
00358   std::cout << "  bins=" << n << " (min=" << min << ", max=" << max << ") " << std::endl;
00359 
00360   fSinsqBins = n;
00361   fSinsqMin  = min;
00362   fSinsqMax  = max;
00363 
00364   for( Int_t i=0; i<GetSinsqBins(); i++ ){
00365     std::cout << " [" << i << "] " << GetSinsq(i) << std::endl;
00366   }
00367 }

void Fitter::CombineResBins ( Bool_t  yesno = 1  ) 

Definition at line 350 of file Fitter.cxx.

References CombineResBins(), and Instance().

Referenced by CombineResBins().

00351 {
00352   TemplateCalculator::Instance()->CombineResBins( yesno );
00353 }

void OscFit::Fitter::CombineResBinsInFit ( Bool_t  yesno = 1  )  [inline]

Definition at line 54 of file Fitter.h.

References fCombineResBinsInFit.

00054                                                  {
00055       fCombineResBinsInFit = yesno;
00056     }

void OscFit::Fitter::ConserveCPT (  )  [inline]

Definition at line 37 of file Fitter.h.

References ForceCPT().

00037 { ForceCPT(1); }

void OscFit::Fitter::DoCCAnalysis (  )  [inline]

Definition at line 266 of file Fitter.h.

References DoFHCAnalysis().

00266                         {
00267       DoFHCAnalysis();
00268     }

void OscFit::Fitter::DoCombinedAnalysis (  )  [inline]

Definition at line 220 of file Fitter.h.

References fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, and fFitRHCPQ.

00220                               {
00221       fFitFHCNQ = 1;
00222       fFitFHCPQ = 1;
00223       fFitRHCNQ = 0;
00224       fFitRHCPQ = 1;
00225     }

void OscFit::Fitter::DoCombinedNuBarAnalysis (  )  [inline]

Definition at line 227 of file Fitter.h.

References fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, and fFitRHCPQ.

00227                                    {
00228       fFitFHCNQ = 0;
00229       fFitFHCPQ = 1;
00230       fFitRHCNQ = 0;
00231       fFitRHCPQ = 1;
00232     }

void OscFit::Fitter::DoFHCAnalysis (  )  [inline]

Definition at line 241 of file Fitter.h.

References fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, and fFitRHCPQ.

Referenced by DoCCAnalysis().

00241                          {
00242       fFitFHCNQ = 1;
00243       fFitFHCPQ = 1;
00244       fFitRHCNQ = 0;
00245       fFitRHCPQ = 0;
00246     }

void OscFit::Fitter::DoFHCBarAnalysis (  )  [inline]

Definition at line 262 of file Fitter.h.

References DoFHCNuBarAnalysis().

00262                             {
00263       DoFHCNuBarAnalysis();
00264     }

void OscFit::Fitter::DoFHCNuAnalysis (  )  [inline]

Definition at line 248 of file Fitter.h.

References fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, and fFitRHCPQ.

00248                            {
00249       fFitFHCNQ = 1;
00250       fFitFHCPQ = 0;
00251       fFitRHCNQ = 0;
00252       fFitRHCPQ = 0;
00253     }

void OscFit::Fitter::DoFHCNuBarAnalysis (  )  [inline]

Definition at line 255 of file Fitter.h.

References fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, and fFitRHCPQ.

Referenced by DoFHCBarAnalysis(), and DoNuBarAnalysis().

00255                               {
00256       fFitFHCNQ = 0;
00257       fFitFHCPQ = 1;
00258       fFitRHCNQ = 0;
00259       fFitRHCPQ = 0;
00260     }

void OscFit::Fitter::DoNuBarAnalysis (  )  [inline]

Definition at line 270 of file Fitter.h.

References DoFHCNuBarAnalysis().

00270                            {
00271       DoFHCNuBarAnalysis();
00272     }

void OscFit::Fitter::DoRHCAnalysis (  )  [inline]

Definition at line 234 of file Fitter.h.

References fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, and fFitRHCPQ.

00234                          {
00235       fFitFHCNQ = 0;
00236       fFitFHCPQ = 0;
00237       fFitRHCNQ = 0;
00238       fFitRHCPQ = 1;
00239     }

void OscFit::Fitter::EnforcePhysicalBoundary (  )  [inline]

Definition at line 100 of file Fitter.h.

References fPhysicalBoundary.

00100                                    {
00101       fPhysicalBoundary = 1;
00102     }

void OscFit::Fitter::ExcludeRAFBins ( Bool_t  yesno = 1  )  [inline]

Definition at line 58 of file Fitter.h.

References fExcludeRAFBins.

00058                                             {
00059       fExcludeRAFBins = yesno;
00060     }

void OscFit::Fitter::FitDmsq ( Bool_t  fitme = true  )  [inline]

Definition at line 311 of file Fitter.h.

References fFitDmsq, and fFixDmsq.

00312     {
00313       fFitDmsq = fitme;
00314       if( fFitDmsq ) fFixDmsq = 0;
00315     }

void OscFit::Fitter::FitDmsqBar ( Bool_t  fitme = true  )  [inline]

Definition at line 323 of file Fitter.h.

References fFitDmsqBar, and fFixDmsqBar.

00324     {
00325       fFitDmsqBar = fitme;
00326       if( fFitDmsqBar ) fFixDmsqBar = 0;
00327     }

void OscFit::Fitter::FitNCBackground (  )  [inline]

Definition at line 293 of file Fitter.h.

References fFitNCBkg.

00293                            {
00294       fFitNCBkg    = 1;
00295     }

void OscFit::Fitter::FitNormalisation (  )  [inline]

Definition at line 289 of file Fitter.h.

References fFitNorm.

00289                             {
00290       fFitNorm     = 1;
00291     }

void OscFit::Fitter::FitNuBarOscillations (  )  [inline]

Definition at line 342 of file Fitter.h.

References fFitDmsqBar, fFitSinsqBar, fFixDmsqBar, and fFixSinsqBar.

Referenced by FitOscillations().

00342                                 {
00343       fFitDmsqBar  = 1;
00344       fFitSinsqBar = 1;
00345       fFixDmsqBar  = 0;
00346       fFixSinsqBar = 0;
00347     }

void OscFit::Fitter::FitNuOscillations (  )  [inline]

Definition at line 335 of file Fitter.h.

References fFitDmsq, fFitSinsq, fFixDmsq, and fFixSinsq.

Referenced by FitOscillations().

00335                              {
00336       fFitDmsq     = 1;
00337       fFitSinsq    = 1;
00338       fFixDmsq     = 0;
00339       fFixSinsq    = 0;
00340     }

void OscFit::Fitter::FitOscillations (  )  [inline]

Definition at line 349 of file Fitter.h.

References FitNuBarOscillations(), and FitNuOscillations().

00349                            {
00350       FitNuOscillations();
00351       FitNuBarOscillations();
00352     }

void OscFit::Fitter::FitReducedSystematics (  )  [inline]

Definition at line 304 of file Fitter.h.

References fFitNCBkg, fFitNorm, fFitShwEn, and fFitTrkEn.

00304                                  {
00305       fFitNorm     = 1;
00306       fFitNCBkg    = 1;
00307       fFitShwEn    = 1;
00308       fFitTrkEn    = 0;  
00309     }

void OscFit::Fitter::FitSinsq ( Bool_t  fitme = true  )  [inline]

Definition at line 317 of file Fitter.h.

References fFitSinsq, and fFixSinsq.

00318     {
00319       fFitSinsq = fitme;
00320       if( fFitSinsq ) fFixSinsq = 0;
00321     }

void OscFit::Fitter::FitSinsqBar ( Bool_t  fitme = true  )  [inline]

Definition at line 329 of file Fitter.h.

References fFitSinsqBar, and fFixSinsqBar.

00330     {
00331       fFitSinsqBar = fitme;
00332       if( fFitSinsqBar ) fFixSinsqBar = 0;
00333     }

void OscFit::Fitter::FitSystematics (  )  [inline]

Definition at line 297 of file Fitter.h.

References fFitNCBkg, fFitNorm, fFitShwEn, and fFitTrkEn.

00297                           {
00298       fFitNorm     = 1;
00299       fFitNCBkg    = 1;
00300       fFitShwEn    = 1;
00301       fFitTrkEn    = 1;  
00302     }

void OscFit::Fitter::FixNuBarOscillations (  )  [inline]

Definition at line 361 of file Fitter.h.

References fFitDmsqBar, fFitSinsqBar, fFixDmsqBar, and fFixSinsqBar.

Referenced by FixOscillations().

00361                                 {
00362       fFitDmsqBar  = 0;
00363       fFitSinsqBar = 0;
00364       fFixDmsqBar  = 1;
00365       fFixSinsqBar = 1;
00366     }

void OscFit::Fitter::FixNuOscillations (  )  [inline]

Definition at line 354 of file Fitter.h.

References fFitDmsq, fFitSinsq, fFixDmsq, and fFixSinsq.

Referenced by FixOscillations().

00354                              {
00355       fFitDmsq     = 0;
00356       fFitSinsq    = 0;
00357       fFixDmsq     = 1;
00358       fFixSinsq    = 1;
00359     }

void OscFit::Fitter::FixOscillations (  )  [inline]

Definition at line 368 of file Fitter.h.

References FixNuBarOscillations(), and FixNuOscillations().

00368                            {
00369       FixNuOscillations();
00370       FixNuBarOscillations();
00371     }

void Fitter::ForceCPT ( Bool_t  yesno = 1  ) 

Definition at line 249 of file Fitter.cxx.

References fForceCPT.

Referenced by ConserveCPT(), Fitter(), and ViolateCPT().

00250 {
00251   fForceCPT = yesno; 
00252 
00253   if( fForceCPT ){
00254     std::cout << " --- Conserving CPT --- " << std::endl;
00255   }
00256   else {
00257     std::cout << " --- Violating CPT --- " << std::endl;
00258   }
00259 
00260   return;
00261 }

Int_t Fitter::GenSeed (  ) 

Definition at line 369 of file Fitter.cxx.

00370 {
00371   const time_t theTime = time(0);
00372   tm* theTimeStruc = gmtime(&theTime);
00373   int seconds = 60*theTimeStruc->tm_min 
00374                  + theTimeStruc->tm_sec;
00375   int seed = seconds;
00376   return seed;
00377 }

Int_t OscFit::Fitter::get_counter (  )  [inline]

Definition at line 590 of file Fitter.h.

References fCtr.

Referenced by RunFit().

00590 { return fCtr; }

Double_t Fitter::GetDmsq ( Int_t  n  ) 

Definition at line 320 of file Fitter.cxx.

References Instance().

Referenced by RunCptFit(), and RunOscFit().

00321 {
00322   return TemplateMap::Instance()->GetGridPoint( n+1 );
00323 }

Int_t Fitter::GetDmsqBins (  ) 

Definition at line 305 of file Fitter.cxx.

References Instance().

Referenced by GetDmsqMax(), RunCptFit(), and RunOscFit().

00306 {
00307   return TemplateMap::Instance()->GetNumPoints();
00308 }

Double_t Fitter::GetDmsqMax (  ) 

Definition at line 315 of file Fitter.cxx.

References GetDmsqBins(), and Instance().

Referenced by GetLnL(), GetLnLNoRes(), RunCptFit(), and RunOscFit().

00316 {
00317   return TemplateMap::Instance()->GetGridPoint( GetDmsqBins() );
00318 }

Double_t Fitter::GetDmsqMin (  ) 

Definition at line 310 of file Fitter.cxx.

References Instance().

Referenced by GetLnL(), GetLnLNoRes(), RunCptFit(), and RunOscFit().

00311 {
00312   return TemplateMap::Instance()->GetGridPoint(1);
00313 }

Template * Fitter::GetExpt ( Run_t  run  ) 

Definition at line 543 of file Fitter.cxx.

References fTemplateArrayExpt, and OscFit::TemplateArray::GetTemplate().

Referenced by GetLnL(), and GetLnLNoRes().

00544 {
00545   return fTemplateArrayExpt->GetTemplate( run );
00546 }

void Fitter::GetLnL ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
Double_t &  LnL 
)

Definition at line 2378 of file Fitter.cxx.

References fCombineResBinsInFit, fDmsqBoundary, fExcludeRAFBins, fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, fFitRHCPQ, fPenaltyTerms, fPhysicalBoundary, fTemplateExpt, fTemplateMC, OscFit::GetBin(), OscFit::Histogram::GetBinContent(), OscFit::GetChargeSign(), GetDmsqMax(), GetDmsqMin(), GetExpt(), OscFit::Template::GetHistogramByType(), GetLnLNoRes(), OscFit::GetNumBins(), OscFit::Histogram::GetNumBins(), OscFit::GetNumRuns(), OscFit::GetRun(), OscFit::GetRunType(), Instance(), OscFit::kFHC, OscFit::kNegative, OscFit::kPositive, OscFit::kRAF, OscFit::kRHC, and run().

02379 {
02380   // Combine resolution bins
02381   if( fCombineResBinsInFit ){
02382     return GetLnLNoRes( dmsq, sinsq,
02383                         dmsqbar, sinsqbar,
02384                         norm, ncbkg,
02385                         shwen, trken,
02386                         LnL );
02387   }
02388 
02389   // Reset Log-Likelihood
02390   LnL = 0.0;
02391 
02392   // Calculate Log-Likelihood
02393   for( Int_t irun=0; irun<OscFit::GetNumRuns(); irun++ ){
02394     Run_t run = OscFit::GetRun(irun);
02395 
02396     if( OscFit::GetRunType(run)==OscFit::kFHC 
02397      && !(fFitFHCNQ||fFitFHCPQ) ) continue;
02398 
02399     if( OscFit::GetRunType(run)==OscFit::kRHC 
02400      && !(fFitRHCNQ||fFitRHCPQ) ) continue;
02401 
02402     fTemplateExpt = GetExpt( run );
02403     if( fTemplateExpt==0 ) continue;
02404 
02405     TemplateCalculator::Instance()->GetExpectation( run, 
02406                                                     dmsq, sinsq,
02407                                                     dmsqbar, sinsqbar,
02408                                                     norm, ncbkg,
02409                                                     shwen, trken,
02410                                                     fTemplateMC );
02411 
02412     for( Int_t ihist=0; ihist<OscFit::GetNumBins(); ihist++ ){
02413       Bin_t hist = OscFit::GetBin(ihist);
02414      
02415       if( OscFit::GetRunType(run)==OscFit::kFHC
02416        && OscFit::GetChargeSign(run,hist)==OscFit::kNegative 
02417        && !fFitFHCNQ ) continue;
02418 
02419       if( OscFit::GetRunType(run)==OscFit::kFHC
02420        && OscFit::GetChargeSign(run,hist)==OscFit::kPositive 
02421        && !fFitFHCPQ ) continue;
02422 
02423       if( OscFit::GetRunType(run)==OscFit::kRHC
02424        && OscFit::GetChargeSign(run,hist)==OscFit::kNegative 
02425        && !fFitRHCNQ ) continue;
02426 
02427       if( OscFit::GetRunType(run)==OscFit::kRHC
02428        && OscFit::GetChargeSign(run,hist)==OscFit::kPositive 
02429        && !fFitRHCPQ ) continue;
02430 
02431       if( fExcludeRAFBins && hist==OscFit::kRAF ) continue;
02432 
02433       Histogram* histogramExpt = fTemplateExpt->GetHistogramByType(hist);
02434       Histogram* histogramMC   = fTemplateMC->GetHistogramByType(hist);
02435 
02436       for( Int_t ibin=0; ibin<histogramExpt->GetNumBins(); ibin++ ){
02437         Double_t Obs = histogramExpt->GetBinContent(ibin);
02438         Double_t Exp = histogramMC->GetBinContent(ibin);
02439 
02440         if( Exp>0.0 ){
02441           LnL += Exp - Obs*log(Exp);
02442           if( Obs>0.0 ){
02443             LnL -= Obs - Obs*log(Obs);
02444           }
02445         }
02446 
02447       }
02448     }
02449   }
02450 
02451   // Add Penalty Terms
02452   // =================
02453   if( fPenaltyTerms ){
02454     LnL += 0.5*( norm*norm + ncbkg*ncbkg 
02455                + shwen*shwen + trken*trken );
02456   }
02457 
02458   // Enforce Physical Boundary
02459   // =========================
02460   if( fPhysicalBoundary ){
02461     Double_t dsinsq = 0.0;
02462     if( sinsq>1.0 ) dsinsq = sinsq-1.0;
02463     if( sinsq<0.0 ) dsinsq = 0.0-sinsq;
02464 
02465     Double_t dsinsqbar = 0.0;
02466     if( sinsqbar>1.0 ) dsinsqbar = sinsqbar-1.0;
02467     if( sinsqbar<0.0 ) dsinsqbar = 0.0-sinsqbar;
02468   
02469     LnL += 1.0e4*(dsinsq*dsinsq + dsinsqbar*dsinsqbar);
02470   }
02471 
02472   // Enforce Boundaries
02473   // ==================
02474   if( fDmsqBoundary ){
02475     Double_t delta_dmsq = 0.0;
02476     Double_t min_dmsq = GetDmsqMin();
02477     Double_t max_dmsq = GetDmsqMax();
02478     if( dmsq>max_dmsq ) delta_dmsq = max_dmsq - dmsq;
02479     if( dmsq<min_dmsq ) delta_dmsq = dmsq - min_dmsq;
02480 
02481     Double_t delta_dmsqbar = 0.0;
02482     Double_t min_dmsqbar = GetDmsqMin();
02483     Double_t max_dmsqbar = GetDmsqMax();
02484     if( dmsqbar>max_dmsqbar ) delta_dmsqbar = max_dmsqbar - dmsqbar;
02485     if( dmsqbar<min_dmsqbar ) delta_dmsqbar = dmsqbar - min_dmsqbar;
02486 
02487     LnL += 1.0e7*(delta_dmsq*delta_dmsq + delta_dmsqbar*delta_dmsqbar);
02488   }
02489 
02490   return;
02491 }

void Fitter::GetLnL ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t &  LnL 
)

Definition at line 2368 of file Fitter.cxx.

Referenced by RunFit().

02369 {
02370   return this->GetLnL( dmsq, sinsq, dmsqbar, sinsqbar,
02371                        0.0, 0.0,         // norm,  ncbkg
02372                        0.0, 0.0,         // shwen, trken
02373                        LnL );
02374 }

void Fitter::GetLnLNoRes ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
Double_t &  LnL 
)

Definition at line 2493 of file Fitter.cxx.

References fDmsqBoundary, fExcludeRAFBins, fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, fFitRHCPQ, fPenaltyTerms, fPhysicalBoundary, fTemplateExpt, fTemplateMC, OscFit::Histogram::GetBinContent(), GetDmsqMax(), GetDmsqMin(), GetExpt(), OscFit::Template::GetHistogramByType(), OscFit::Histogram::GetNumBins(), OscFit::GetNumRuns(), OscFit::GetRun(), OscFit::GetRunType(), Instance(), OscFit::kFHC, OscFit::kOppositeSign, OscFit::kRAF, OscFit::kResBin0, OscFit::kResBin1, OscFit::kResBin2, OscFit::kResBin3, OscFit::kResBin4, OscFit::kRHC, and run().

Referenced by GetLnL().

02494 {
02495   // Reset Log-Likelihood
02496   LnL = 0.0;
02497 
02498   // Calculate Log-Likelihood
02499   for( Int_t irun=0; irun<OscFit::GetNumRuns(); irun++ ){
02500     Run_t run = OscFit::GetRun(irun);
02501 
02502     if( OscFit::GetRunType(run)==OscFit::kFHC 
02503      && !(fFitFHCNQ||fFitFHCPQ) ) continue;
02504 
02505     if( OscFit::GetRunType(run)==OscFit::kRHC 
02506      && !(fFitRHCNQ||fFitRHCPQ) ) continue;
02507 
02508     fTemplateExpt = GetExpt( run );
02509     if( fTemplateExpt==0 ) continue;
02510 
02511     TemplateCalculator::Instance()->GetExpectation( run, 
02512                                                     dmsq, sinsq,
02513                                                     dmsqbar, sinsqbar,
02514                                                     norm, ncbkg,
02515                                                     shwen, trken,
02516                                                     fTemplateMC );
02517  
02518     Histogram* histogramExptNQ0 = fTemplateExpt->GetHistogramByType(OscFit::kResBin0);
02519     Histogram* histogramExptNQ1 = fTemplateExpt->GetHistogramByType(OscFit::kResBin1);
02520     Histogram* histogramExptNQ2 = fTemplateExpt->GetHistogramByType(OscFit::kResBin2);
02521     Histogram* histogramExptNQ3 = fTemplateExpt->GetHistogramByType(OscFit::kResBin3);
02522     Histogram* histogramExptNQ4 = fTemplateExpt->GetHistogramByType(OscFit::kResBin4);
02523     Histogram* histogramExptPQ  = fTemplateExpt->GetHistogramByType(OscFit::kOppositeSign);
02524     Histogram* histogramExptRAF = fTemplateExpt->GetHistogramByType(OscFit::kRAF);
02525 
02526     Histogram* histogramFitNQ0  = fTemplateMC->GetHistogramByType(OscFit::kResBin0);
02527     Histogram* histogramFitNQ1  = fTemplateMC->GetHistogramByType(OscFit::kResBin1);
02528     Histogram* histogramFitNQ2  = fTemplateMC->GetHistogramByType(OscFit::kResBin2);
02529     Histogram* histogramFitNQ3  = fTemplateMC->GetHistogramByType(OscFit::kResBin3);
02530     Histogram* histogramFitNQ4  = fTemplateMC->GetHistogramByType(OscFit::kResBin4);
02531     Histogram* histogramFitPQ   = fTemplateMC->GetHistogramByType(OscFit::kOppositeSign);
02532     Histogram* histogramFitRAF  = fTemplateMC->GetHistogramByType(OscFit::kRAF);
02533 
02534     for( Int_t ibin=0; ibin<histogramExptNQ0->GetNumBins(); ibin++ ){
02535       
02536       Double_t ObsNQ = histogramExptNQ0->GetBinContent(ibin)
02537                      + histogramExptNQ1->GetBinContent(ibin)
02538                      + histogramExptNQ2->GetBinContent(ibin)
02539                      + histogramExptNQ3->GetBinContent(ibin)
02540                      + histogramExptNQ4->GetBinContent(ibin);
02541 
02542       Double_t ObsPQ = histogramExptPQ->GetBinContent(ibin);
02543 
02544       Double_t ExpNQ = histogramFitNQ0->GetBinContent(ibin)
02545                      + histogramFitNQ1->GetBinContent(ibin)
02546                      + histogramFitNQ2->GetBinContent(ibin)
02547                      + histogramFitNQ3->GetBinContent(ibin)
02548                      + histogramFitNQ4->GetBinContent(ibin);
02549 
02550       Double_t ExpPQ = histogramFitPQ->GetBinContent(ibin);
02551 
02552       if( (OscFit::GetRunType(run)==OscFit::kFHC && fFitFHCNQ)
02553        || (OscFit::GetRunType(run)==OscFit::kRHC && fFitRHCNQ) ){
02554         if( ExpNQ>0.0 ){
02555           LnL += ExpNQ - ObsNQ*log(ExpNQ);
02556           if( ObsNQ>0.0 ){
02557             LnL -= ObsNQ - ObsNQ*log(ObsNQ);
02558           }
02559         }
02560       }
02561 
02562       if( (OscFit::GetRunType(run)==OscFit::kFHC && fFitFHCPQ)
02563        || (OscFit::GetRunType(run)==OscFit::kRHC && fFitRHCPQ) ){
02564         if( ExpPQ>0.0 ){
02565           LnL += ExpPQ - ObsPQ*log(ExpPQ);
02566           if( ObsPQ>0.0 ){
02567             LnL -= ObsPQ - ObsPQ*log(ObsPQ);
02568           }
02569         }
02570       }
02571     }
02572 
02573     if( fExcludeRAFBins==false ){
02574 
02575       for( Int_t iraf=0; iraf<histogramExptRAF->GetNumBins(); iraf++ ){
02576 
02577         Double_t ObsRAF = histogramExptRAF->GetBinContent(iraf);
02578         Double_t ExpRAF = histogramFitRAF->GetBinContent(iraf);
02579 
02580         if( ExpRAF>0.0 ){
02581           LnL += ExpRAF - ObsRAF*log(ExpRAF);
02582           if( ObsRAF>0.0 ){
02583             LnL -= ObsRAF - ObsRAF*log(ObsRAF);
02584           }
02585         }
02586       }
02587     }
02588 
02589   }
02590 
02591   // Add Penalty Terms
02592   // =================
02593   if( fPenaltyTerms ){
02594     LnL += 0.5*( norm*norm + ncbkg*ncbkg 
02595                + shwen*shwen + trken*trken );
02596   }
02597 
02598   // Enforce Physical Boundary
02599   // =========================
02600   if( fPhysicalBoundary ){
02601     Double_t dsinsq = 0.0;
02602     if( sinsq>1.0 ) dsinsq = sinsq-1.0;
02603     if( sinsq<0.0 ) dsinsq = 0.0-sinsq;
02604 
02605     Double_t dsinsqbar = 0.0;
02606     if( sinsqbar>1.0 ) dsinsqbar = sinsqbar-1.0;
02607     if( sinsqbar<0.0 ) dsinsqbar = 0.0-sinsqbar;
02608   
02609     LnL += 1.0e4*(dsinsq*dsinsq + dsinsqbar*dsinsqbar);
02610   }
02611 
02612   // Enforce Boundaries
02613   // ==================
02614   if( fDmsqBoundary ){
02615     Double_t delta_dmsq = 0.0;
02616     Double_t min_dmsq = GetDmsqMin();
02617     Double_t max_dmsq = GetDmsqMax();
02618     if( dmsq>max_dmsq ) delta_dmsq = max_dmsq - dmsq;
02619     if( dmsq<min_dmsq ) delta_dmsq = dmsq - min_dmsq;
02620     
02621     Double_t delta_dmsqbar = 0.0;
02622     Double_t min_dmsqbar = GetDmsqMin();
02623     Double_t max_dmsqbar = GetDmsqMax();
02624     if( dmsqbar>max_dmsqbar ) delta_dmsqbar = max_dmsqbar - dmsqbar;
02625     if( dmsqbar<min_dmsqbar ) delta_dmsqbar = dmsqbar - min_dmsqbar;
02626 
02627     LnL += 1.0e7*(delta_dmsq*delta_dmsq + delta_dmsqbar*delta_dmsqbar);
02628   }
02629 
02630   return;
02631 }

Double_t Fitter::GetSinsq ( Int_t  n  ) 

Definition at line 340 of file Fitter.cxx.

References fSinsqBins, fSinsqMax, and fSinsqMin.

Referenced by BuildGrid(), and RunOscFit().

00341 {
00342   if( n>=0 && n<fSinsqBins ){
00343     return fSinsqMin + (fSinsqMax-fSinsqMin)*((double)n)/(fSinsqBins-1.0);
00344   }
00345   else{
00346     return 0.0;
00347   }
00348 }

Int_t Fitter::GetSinsqBins (  ) 

Definition at line 325 of file Fitter.cxx.

References fSinsqBins.

Referenced by BuildGrid(), and RunOscFit().

00326 {
00327   return fSinsqBins;
00328 }

Double_t Fitter::GetSinsqMax (  ) 

Definition at line 335 of file Fitter.cxx.

References fSinsqMax.

Referenced by RunOscFit().

00336 {
00337   return fSinsqMax;
00338 }

Double_t Fitter::GetSinsqMin (  ) 

Definition at line 330 of file Fitter.cxx.

References fSinsqMin.

Referenced by RunOscFit().

00331 {
00332   return fSinsqMin;
00333 }

Fitter * Fitter::Instance (  )  [static]

Definition at line 81 of file Fitter.cxx.

References fgFitter, and Fitter().

Referenced by BuildExptFromData(), BuildExptFromMC(), CombineResBins(), GetDmsq(), GetDmsqBins(), GetDmsqMax(), GetDmsqMin(), OscFitInterface::GetLikelihood(), GetLnL(), GetLnLNoRes(), RunCptFit(), RunFit(), RunOscFit(), and WriteExpt().

00082 {
00083   if( !fgFitter ){
00084     fgFitter = new Fitter();
00085   }
00086 
00087   return fgFitter;
00088 }

void OscFit::Fitter::itr (  )  [inline]

Definition at line 588 of file Fitter.h.

References fCtr.

00588 { fCtr++; }

void OscFit::Fitter::PenaltyTermsOff (  )  [inline]

Definition at line 96 of file Fitter.h.

References fPenaltyTerms.

00096                            {
00097       fPenaltyTerms = 0;
00098     }

void Fitter::PrintExpt (  ) 

Definition at line 526 of file Fitter.cxx.

References fTemplateArrayExpt, and OscFit::TemplateArray::PrintTemplates().

Referenced by BuildExptFromData(), and BuildExptFromMC().

00527 {
00528   std::cout << " *** Fitter::PrintExpt() *** " << std::endl;
00529 
00530   return fTemplateArrayExpt->PrintTemplates();
00531 }

void Fitter::PrintSettings (  ) 

Definition at line 263 of file Fitter.cxx.

References fDmsqBoundary, fExcludeRAFBins, fFitDmsq, fFitDmsqBar, fFitFHCNQ, fFitFHCPQ, fFitNCBkg, fFitNorm, fFitRHCNQ, fFitRHCPQ, fFitShwEn, fFitSinsq, fFitSinsqBar, fFitTrkEn, fFixDmsq, fFixDmsqBar, fFixSinsq, fFixSinsqBar, fForceCPT, fInputForExptDmsq, fInputForExptDmsqBar, fInputForExptNCBkg, fInputForExptNorm, fInputForExptShwEn, fInputForExptSinsq, fInputForExptSinsqBar, fInputForExptTrkEn, fInputForSeedDmsq, fInputForSeedDmsqBar, fInputForSeedNCBkg, fInputForSeedNorm, fInputForSeedShwEn, fInputForSeedSinsq, fInputForSeedSinsqBar, fInputForSeedTrkEn, fMockData, fMockDataWithFluctuations, fPenaltyTerms, fPhysicalBoundary, fSeedFromBestFit, fSeedOscillationsFromBestFit, fSeedSystematicsFromBestFit, fSeedSystematicsFromLastFit, fSinsqBins, fSinsqMax, fSinsqMin, and fSwitchOffFluctuationsOnSystematics.

Referenced by RunCptFit(), RunFit(), and RunOscFit().

00264 {
00265   std::cout << " *** Fitter::PrintSettings() *** " << std::endl;
00266 
00267   std::cout << "  Configuration: " << std::endl;
00268   std::cout << "   Fit FHC (NQ/PQ) = (" << fFitFHCNQ << "," << fFitFHCPQ << ") " << std::endl;
00269   std::cout << "   Fit RHC (NQ/PQ) = (" << fFitRHCNQ << "," << fFitRHCPQ << ") " << std::endl;
00270   std::cout << "   Fit RAF = " << !fExcludeRAFBins << std::endl;
00271   std::cout << "   ForceCPT = " << fForceCPT << std::endl;
00272   std::cout << "   Sinsq Bins = (" <<  fSinsqBins << "," << fSinsqMin << "," << fSinsqMax  << ") " << std::endl;
00273   std::cout << "   MockData = " << fMockData << std::endl;
00274   std::cout << "    (Fluctuations = " << fMockDataWithFluctuations << ") " << std::endl;
00275   std::cout << "    (SwitchOffFluctuationsOnSystematics = " << fSwitchOffFluctuationsOnSystematics << ") " << std::endl;
00276   std::cout << "   SeedFromBestFit = " << fSeedFromBestFit << std::endl;
00277   std::cout << "    (Oscilations = " << fSeedOscillationsFromBestFit << "," << std::endl;
00278   std::cout << "     Systematics = " << fSeedSystematicsFromBestFit << ") " << std::endl;
00279   std::cout << "   SeedFromLastFit = " << fSeedSystematicsFromLastFit << std::endl;
00280   std::cout << "   PenaltyTerms = " << fPenaltyTerms << std::endl;
00281   std::cout << "   PhysicalBoundary = " << fPhysicalBoundary << std::endl;
00282   std::cout << "   DmsqBoundary = " << fDmsqBoundary << std::endl;
00283   std::cout << "  Inputs for Building Expt: " << std::endl;
00284   std::cout << "   (Dmsq,Sinsq)=(" << fInputForExptDmsq << "," << fInputForExptSinsq << ") " << std::endl;
00285   std::cout << "   (DmsqBar,SinsqBar)=(" << fInputForExptDmsqBar << "," << fInputForExptSinsqBar << ") " << std::endl;
00286   std::cout << "   (Norm,NCBkg)=(" << fInputForExptNorm << "," << fInputForExptNCBkg << ") " << std::endl;
00287   std::cout << "   (ShwEn,TrkEn)=(" << fInputForExptShwEn << "," << fInputForExptTrkEn << ") " << std::endl;
00288   std::cout << "  Inputs for Seeding Fit: " << std::endl;
00289   std::cout << "   (Dmsq,Sinsq)=(" << fInputForSeedDmsq << "," << fInputForSeedSinsq << ") " << std::endl;
00290   std::cout << "   (DmsqBar,SinsqBar)=(" << fInputForSeedDmsqBar << "," << fInputForSeedSinsqBar << ") " << std::endl;  
00291   std::cout << "   (Norm,NCBkg)=(" << fInputForSeedNorm << "," << fInputForSeedNCBkg << ") " << std::endl;
00292   std::cout << "   (ShwEn,TrkEn)=(" << fInputForSeedShwEn << "," << fInputForSeedTrkEn << ")" << std::endl; 
00293   std::cout << "  Fixing Parameters: " << std::endl;
00294   std::cout << "   (Dmsq,Sinsq)=(" << fFixDmsq << "," << fFixSinsq << ") " << std::endl;
00295   std::cout << "   (DmsqBar,SinsqBar)=(" << fFixDmsqBar << "," << fFixSinsqBar << ") " << std::endl;  
00296   std::cout << "  Fitting Parameters: " << std::endl;
00297   std::cout << "   (Dmsq,Sinsq)=(" << fFitDmsq << "," << fFitSinsq << ") " << std::endl;
00298   std::cout << "   (DmsqBar,SinsqBar)=(" << fFitDmsqBar << "," << fFitSinsqBar << ")" << std::endl;
00299   std::cout << "   (Norm,NCBkg)=(" << fFitNorm << "," << fFitNCBkg << ") " << std::endl;
00300   std::cout << "   (ShwEn,TrkEn)=(" << fFitShwEn << "," << fFitTrkEn << ")" << std::endl;
00301  
00302   return; 
00303 }

void OscFit::Fitter::RelaxDmsqBoundary (  )  [inline]

Definition at line 108 of file Fitter.h.

References fDmsqBoundary.

00108                              {
00109       fDmsqBoundary = 0;
00110     }

void OscFit::Fitter::RelaxPhysicalBoundary (  )  [inline]

Definition at line 104 of file Fitter.h.

References fPhysicalBoundary.

00104                                  {
00105       fPhysicalBoundary = 0;
00106     }

void Fitter::Reset (  ) 

Definition at line 244 of file Fitter.cxx.

00245 {
00246   std::cout << " *** Fitter::Reset() *** " << std::endl;
00247 }

void OscFit::Fitter::reset_counter (  )  [inline]

Definition at line 589 of file Fitter.h.

References fCtr.

Referenced by RunFit().

00589 { fCtr = 0; }

void OscFit::Fitter::ResetAnalysis (  )  [inline]

Definition at line 213 of file Fitter.h.

References fFitFHCNQ, fFitFHCPQ, fFitRHCNQ, and fFitRHCPQ.

00213                          {
00214       fFitFHCNQ = 0;
00215       fFitFHCPQ = 0;
00216       fFitRHCNQ = 0;
00217       fFitRHCPQ = 0;
00218     }

void Fitter::ResetExpt (  ) 

Definition at line 533 of file Fitter.cxx.

References fTemplateArrayExpt, and OscFit::TemplateArray::ResetTemplates().

Referenced by BuildExptFromData(), and BuildExptFromMC().

00534 {
00535   return fTemplateArrayExpt->ResetTemplates();
00536 }

void OscFit::Fitter::ResetFit (  )  [inline]

Definition at line 202 of file Fitter.h.

References fFitDmsq, fFitDmsqBar, fFitNCBkg, fFitNorm, fFitShwEn, fFitSinsq, fFitSinsqBar, and fFitTrkEn.

00202                     {
00203       fFitDmsq     = 0;
00204       fFitSinsq    = 0;
00205       fFitDmsqBar  = 0;
00206       fFitSinsqBar = 0;
00207       fFitNorm     = 0;
00208       fFitNCBkg    = 0;  
00209       fFitShwEn    = 0;
00210       fFitTrkEn    = 0;
00211     }

void Fitter::Run ( Int_t  ifirst = -1,
Int_t  ilast = -1 
)

Definition at line 548 of file Fitter.cxx.

References RunOscFit().

00549 {
00550   this->RunOscFit( ifirst, ilast );
00551 }

void Fitter::RunContours (  ) 

Definition at line 2124 of file Fitter.cxx.

References fDmsq, fDmsqBar, fFittingDmsq, fFittingDmsqBar, fFittingSinsq, fFittingSinsqBar, fForceCPT, fLnL68, fLnL90, fLnL90_1D, fMinuit, fMinuitStatus, fNumPoints, fOutFile, fPhysicalBoundary, fSinsq, fSinsqBar, and n.

Referenced by RunFit().

02125 {
02126   std::cout << " *** Fitter::RunContours() *** " << std::endl;
02127 
02128   // Sanity Check
02129   // ============
02130   if( fMinuitStatus==999 ){
02131     std::cout << "  <warning> Cannot generate contours: fit failed to converge [return] " << std::endl;
02132     return;
02133   }
02134 
02135   // Parameter Labels
02136   // ================
02137   //  0: Dmsq,    1: Sinsq
02138   //  2: DmsqBar, 3: SinsqBar
02139 
02140   // Calculate Contours
02141   // ==================
02142   Int_t Npts = fNumPoints;  
02143  
02144   std::cout << "  Generating Contours using " << Npts << " points " << std::endl;
02145 
02146   TGraph* myContourNuLnL68       = 0;
02147   TGraph* myContourNuLnL90       = 0;
02148   TGraph* myContourNuLnL90_1D    = 0;
02149 
02150   TGraph* myContourNuBarLnL68    = 0;
02151   TGraph* myContourNuBarLnL90    = 0;
02152   TGraph* myContourNuBarLnL90_1D = 0;
02153 
02154   TGraph* myContourCPTLnL68      = 0;
02155   TGraph* myContourCPTLnL90      = 0;
02156   TGraph* myContourCPTLnL90_1D   = 0;
02157 
02158   // Dmsq vs Sinsq
02159   // -------------
02160   if( fFittingDmsq && fFittingSinsq ){
02161 
02162     // LnL68
02163     std::cout << "  Generating Contour... [Dmsq, Sinsq, 68%]" << std::endl;
02164     fMinuit->SetErrorDef( fLnL68 );
02165     TGraph* graphNuLnL68 = (TGraph*)(fMinuit->Contour(Npts-1,1,0));
02166     if( graphNuLnL68 ){
02167       Int_t npts  = graphNuLnL68->GetN();
02168       Double_t* x = graphNuLnL68->GetX();     // 1: Sinsq
02169       Double_t* y = graphNuLnL68->GetY();     // 0: Dmsq
02170       for( Int_t n=0; n<npts; n++ ){
02171         x[n] += fSinsq;  
02172         y[n] += fDmsq;
02173         if( fPhysicalBoundary ){
02174           if( x[n]<0.0 ) x[n] = -0.001; 
02175           if( x[n]>1.0 ) x[n] = +1.001; 
02176         }
02177       }
02178       myContourNuLnL68 = new TGraph(npts,x,y);
02179     }
02180 
02181     // LnL90
02182     std::cout << "  Generating Contour... [Dmsq, Sinsq, 90%]" << std::endl;
02183     fMinuit->SetErrorDef( fLnL90 );
02184     TGraph* graphNuLnL90 = (TGraph*)(fMinuit->Contour(Npts-1,1,0));
02185     if( graphNuLnL90 ){
02186       Int_t npts  = graphNuLnL90->GetN();
02187       Double_t* x = graphNuLnL90->GetX();     // 1: Sinsq
02188       Double_t* y = graphNuLnL90->GetY();     // 0: Dmsq
02189       for( Int_t n=0; n<npts; n++ ){
02190         x[n] += fSinsq;  
02191         y[n] += fDmsq;
02192         if( fPhysicalBoundary ){
02193           if( x[n]<0.0 ) x[n] = -0.001; 
02194           if( x[n]>1.0 ) x[n] = +1.001; 
02195         }
02196       }
02197       myContourNuLnL90 = new TGraph(npts,x,y);
02198     }
02199 
02200     // LnL90 (1D)
02201     std::cout << "  Generating Contour... [Dmsq, Sinsq, 90% 1D]" << std::endl;
02202     fMinuit->SetErrorDef( fLnL90_1D );
02203     TGraph* graphNuLnL90_1D = (TGraph*)(fMinuit->Contour(Npts-1,1,0));
02204     if( graphNuLnL90_1D ){
02205       Int_t npts  = graphNuLnL90_1D->GetN();
02206       Double_t* x = graphNuLnL90_1D->GetX();     // 1: Sinsq
02207       Double_t* y = graphNuLnL90_1D->GetY();     // 0: Dmsq
02208       for( Int_t n=0; n<npts; n++ ){
02209         x[n] += fSinsq;  
02210         y[n] += fDmsq;
02211         if( fPhysicalBoundary ){
02212           if( x[n]<0.0 ) x[n] = -0.001; 
02213           if( x[n]>1.0 ) x[n] = +1.001; 
02214         }
02215       }
02216       myContourNuLnL90_1D = new TGraph(npts,x,y);
02217     }
02218 
02219   }
02220 
02221   // DmsqBar vs SinsqBar
02222   // -------------------
02223   if( fForceCPT==0
02224    && fFittingDmsqBar && fFittingSinsqBar ){
02225 
02226     // LnL68
02227     std::cout << "  Generating Contour... [DmsqBar, SinsqBar, 68%]" << std::endl;
02228     fMinuit->SetErrorDef( fLnL68 );
02229     TGraph* graphNuBarLnL68 = (TGraph*)(fMinuit->Contour(Npts-1,3,2));
02230     if( graphNuBarLnL68 ){
02231       Int_t npts  = graphNuBarLnL68->GetN();
02232       Double_t* x = graphNuBarLnL68->GetX();  // 3: SinsqBar
02233       Double_t* y = graphNuBarLnL68->GetY();  // 2: DmsqBar
02234       for( Int_t n=0; n<npts; n++ ){
02235         x[n] += fSinsqBar;  
02236         y[n] += fDmsqBar;
02237         if( fPhysicalBoundary ){
02238           if( x[n]<0.0 ) x[n] = -0.001; 
02239           if( x[n]>1.0 ) x[n] = +1.001; 
02240         }
02241       }
02242       myContourNuBarLnL68 = new TGraph(npts,x,y);
02243     }
02244 
02245     // LnL90
02246     std::cout << "  Generating Contour... [DmsqBar, SinsqBar, 90%]" << std::endl;
02247     fMinuit->SetErrorDef( fLnL90 );
02248     TGraph* graphNuBarLnL90 = (TGraph*)(fMinuit->Contour(Npts-1,3,2));
02249     if( graphNuBarLnL90 ){
02250       Int_t npts  = graphNuBarLnL90->GetN();
02251       Double_t* x = graphNuBarLnL90->GetX();  // 3: SinsqBar
02252       Double_t* y = graphNuBarLnL90->GetY();  // 2: DmsqBar
02253       for( Int_t n=0; n<npts; n++ ){
02254         x[n] += fSinsqBar;  
02255         y[n] += fDmsqBar;
02256         if( fPhysicalBoundary ){
02257           if( x[n]<0.0 ) x[n] = -0.001; 
02258           if( x[n]>1.0 ) x[n] = +1.001; 
02259         }
02260       }
02261       myContourNuBarLnL90 = new TGraph(npts,x,y);
02262     }  
02263 
02264     // LnL90 (1D)
02265     std::cout << "  Generating Contour... [DmsqBar, SinsqBar, 90% 1D]" << std::endl;
02266     fMinuit->SetErrorDef( fLnL90_1D );
02267     TGraph* graphNuBarLnL90_1D = (TGraph*)(fMinuit->Contour(Npts-1,3,2));
02268     if( graphNuBarLnL90_1D ){
02269       Int_t npts  = graphNuBarLnL90_1D->GetN();
02270       Double_t* x = graphNuBarLnL90_1D->GetX();  // 3: SinsqBar
02271       Double_t* y = graphNuBarLnL90_1D->GetY();  // 2: DmsqBar
02272       for( Int_t n=0; n<npts; n++ ){
02273         x[n] += fSinsqBar;  
02274         y[n] += fDmsqBar;
02275         if( fPhysicalBoundary ){
02276           if( x[n]<0.0 ) x[n] = -0.001; 
02277           if( x[n]>1.0 ) x[n] = +1.001; 
02278         }
02279       }
02280       myContourNuBarLnL90_1D = new TGraph(npts,x,y);
02281     }
02282   }
02283 
02284   // Dmsq vs DmsqBar
02285   // ---------------
02286   if( fForceCPT==0
02287    && fFittingDmsq && fFittingDmsqBar ){
02288 
02289     // LnL68
02290     std::cout << "  Generating Contour... [Dmsq, DmsqBar, 68%]" << std::endl;
02291     fMinuit->SetErrorDef( fLnL68 );
02292     TGraph* graphCPTLnL68 = (TGraph*)(fMinuit->Contour(Npts-1,2,0));
02293     if( graphCPTLnL68 ){
02294       Int_t npts  = graphCPTLnL68->GetN();
02295       Double_t* x = graphCPTLnL68->GetX();  // 2: DmsqBar
02296       Double_t* y = graphCPTLnL68->GetY();  // 0: Dmsq
02297       for( Int_t n=0; n<npts; n++ ){
02298         x[n] += fDmsqBar;
02299         y[n] += fDmsq;
02300       }
02301       myContourCPTLnL68 = new TGraph(npts,x,y);
02302     }
02303 
02304     // LnL90
02305     std::cout << "  Generating Contour... [Dmsq, DmsqBar, 90%]" << std::endl;
02306     fMinuit->SetErrorDef( fLnL90 );
02307     TGraph* graphCPTLnL90 = (TGraph*)(fMinuit->Contour(Npts-1,2,0));
02308     if( graphCPTLnL90 ){
02309       Int_t npts  = graphCPTLnL90->GetN();
02310       Double_t* x = graphCPTLnL90->GetX();  // 2: DmsqBar
02311       Double_t* y = graphCPTLnL90->GetY();  // 0: Dmsq
02312       for( Int_t n=0; n<npts; n++ ){
02313         x[n] += fDmsqBar;
02314         y[n] += fDmsq;
02315       }
02316       myContourCPTLnL90 = new TGraph(npts,x,y);
02317     }    
02318 
02319     // LnL90
02320     std::cout << "  Generating Contour... [Dmsq, DmsqBar, 90% 1D]" << std::endl;
02321     fMinuit->SetErrorDef( fLnL90_1D );
02322     TGraph* graphCPTLnL90_1D = (TGraph*)(fMinuit->Contour(Npts-1,2,0));
02323     if( graphCPTLnL90_1D ){
02324       Int_t npts  = graphCPTLnL90_1D->GetN();
02325       Double_t* x = graphCPTLnL90_1D->GetX();  // 2: DmsqBar
02326       Double_t* y = graphCPTLnL90_1D->GetY();  // 0: Dmsq
02327       for( Int_t n=0; n<npts; n++ ){
02328         x[n] += fDmsqBar;
02329         y[n] += fDmsq;
02330       }
02331       myContourCPTLnL90_1D = new TGraph(npts,x,y);
02332     } 
02333   }
02334  
02335   // Write Out Contours
02336   // ==================
02337   TString filename = fOutFile;
02338   TString tag = ".contours";
02339     
02340   if( filename.EndsWith(".root") )
02341     filename.Insert(filename.Length()-5,tag);
02342   else filename.Append(tag);
02343 
02344   std::cout << " *** Fitter::WriteContours() *** " << std::endl;
02345   std::cout << "   Writing Contours to File: " << filename.Data() << std::endl;
02346 
02347   TDirectory* tmpd = gDirectory;
02348   TFile* fileNew = new TFile(filename.Data(),"recreate");
02349 
02350   if( myContourNuLnL68 ) myContourNuLnL68->Write("gContourNuLnL68");
02351   if( myContourNuLnL90 ) myContourNuLnL90->Write("gContourNuLnL90");
02352   if( myContourNuLnL90_1D ) myContourNuLnL90_1D->Write("gContourNuLnL90_1D");
02353   
02354   if( myContourNuBarLnL68 ) myContourNuBarLnL68->Write("gContourNuBarLnL68");
02355   if( myContourNuBarLnL90 ) myContourNuBarLnL90->Write("gContourNuBarLnL90");
02356   if( myContourNuBarLnL90_1D ) myContourNuBarLnL90_1D->Write("gContourNuBarLnL90_1D");
02357 
02358   if( myContourCPTLnL68 ) myContourCPTLnL68->Write("gContourCPTLnL68");
02359   if( myContourCPTLnL90 ) myContourCPTLnL90->Write("gContourCPTLnL90");
02360   if( myContourCPTLnL90_1D ) myContourCPTLnL90_1D->Write("gContourCPTLnL90_1D");
02361 
02362   fileNew->Close();
02363   tmpd->cd();
02364 
02365   return;
02366 }

void Fitter::RunCptFit ( Int_t  ifirst = -1,
Int_t  ilast = -1 
)

Definition at line 929 of file Fitter.cxx.

References BuildExpt(), fFitDmsq, fFitDmsqBar, fFixDmsq, fFixDmsqBar, fLnL68, fLnL90, fLnL99, fOutFile, fSeedDmsq, fSeedDmsqBar, fSeedNCBkg, fSeedNorm, fSeedShwEn, fSeedSinsq, fSeedSinsqBar, fSeedTrkEn, fTemplateArrayExpt, fWriteContours, fWriteTemplates, GetDmsq(), GetDmsqBins(), GetDmsqMax(), GetDmsqMin(), Instance(), PrintSettings(), RunFit(), SetSeedParameters(), and TouchExpt().

00930 {
00931   std::cout << " *** Fitter::RunCptFit() *** " << std::endl;
00932 
00933   // Print Settings
00934   // ==============
00935   this->PrintSettings();
00936 
00937   // Build Experiments
00938   // =================
00939   if( this->TouchExpt()==0 ){
00940     this->BuildExpt();
00941 
00942     // Write Experiments
00943     if( fWriteTemplates ){
00944       TString filename = fOutFile;
00945       TString tag = "";
00946 
00947       // data
00948       filename = fOutFile;
00949       tag = ".expt";
00950 
00951       if( filename.EndsWith(".root") )
00952         filename.Insert(filename.Length()-5,tag);
00953       else filename.Append(tag);
00954     
00955       TemplateWriter::Instance()->WriteToFile(fTemplateArrayExpt,
00956                                               filename.Data());
00957 
00958       // no oscillations
00959       filename = fOutFile;
00960       tag = ".noosc";
00961   
00962       if( filename.EndsWith(".root") )
00963         filename.Insert(filename.Length()-5,tag);
00964       else filename.Append(tag);
00965 
00966       TemplateWriter::Instance()->WriteToFile( filename.Data() );
00967     }
00968   }
00969 
00970 
00971   // Build Histograms
00972   // ================
00973   // x-axis: DmsqBar
00974   // y-axis: Dmsq
00975 
00976   Int_t nx = GetDmsqBins();
00977   Double_t xlow = GetDmsqMin();
00978   Double_t xhigh = GetDmsqMax();
00979   Double_t dx = (xhigh-xlow)/((double)nx-1.0);
00980   Double_t xmin = xlow  - 0.50*dx;
00981   Double_t xmax = xhigh + 0.50*dx;
00982   
00983   Int_t ny = GetDmsqBins();
00984   Double_t ylow = GetDmsqMin();
00985   Double_t yhigh = GetDmsqMax();
00986   Double_t dy = (yhigh-ylow)/((double)ny-1.0);
00987   Double_t ymin = ylow  - 0.50*dy;
00988   Double_t ymax = yhigh + 0.50*dy;
00989 
00990   TH2D* hInputDmsq     = new TH2D("hInputDmsq",    "", nx,xmin,xmax, ny,ymin,ymax);
00991   TH2D* hInputSinsq    = new TH2D("hInputDmsqBar", "", nx,xmin,xmax, ny,ymin,ymax);
00992   TH2D* hInputDmsqBar  = new TH2D("hInputSinsq",   "", nx,xmin,xmax, ny,ymin,ymax);
00993   TH2D* hInputSinsqBar = new TH2D("hInputSinsqBar","", nx,xmin,xmax, ny,ymin,ymax);
00994  
00995   TH2D* hDmsq     = new TH2D("hDmsq",    "", nx,xmin,xmax, ny,ymin,ymax);
00996   TH2D* hSinsq    = new TH2D("hDmsqBar", "", nx,xmin,xmax, ny,ymin,ymax);
00997   TH2D* hDmsqBar  = new TH2D("hSinsq",   "", nx,xmin,xmax, ny,ymin,ymax);
00998   TH2D* hSinsqBar = new TH2D("hSinsqBar","", nx,xmin,xmax, ny,ymin,ymax);
00999 
01000   TH2D* hNorm  = new TH2D("hNorm", "", nx,xmin,xmax, ny,ymin,ymax); 
01001   hNorm->GetZaxis()->SetTitle("Shift / #sigma");
01002   hNorm->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
01003   hNorm->GetXaxis()->SetTitle("#Delta #bar{m}^{2} / eV^{2}");
01004   hNorm->GetZaxis()->CenterTitle();
01005   hNorm->GetYaxis()->CenterTitle();
01006   hNorm->GetXaxis()->CenterTitle();
01007 
01008   TH2D* hNCBkg = new TH2D("hNCBkg","", nx,xmin,xmax, ny,ymin,ymax);
01009   hNCBkg->GetZaxis()->SetTitle("Shift / #sigma");
01010   hNCBkg->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
01011   hNCBkg->GetXaxis()->SetTitle("#Delta #bar{m}^{2} / eV^{2}");
01012   hNCBkg->GetZaxis()->CenterTitle();
01013   hNCBkg->GetYaxis()->CenterTitle();
01014   hNCBkg->GetXaxis()->CenterTitle();
01015 
01016   TH2D* hShwEn = new TH2D("hShwEn","", nx,xmin,xmax, ny,ymin,ymax);  
01017   hShwEn->GetZaxis()->SetTitle("Shift / #sigma");
01018   hShwEn->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
01019   hShwEn->GetXaxis()->SetTitle("#Delta #bar{m}^{2} / eV^{2}");
01020   hShwEn->GetZaxis()->CenterTitle();
01021   hShwEn->GetYaxis()->CenterTitle();
01022   hShwEn->GetXaxis()->CenterTitle();
01023 
01024   TH2D* hTrkEn = new TH2D("hTrkEn","", nx,xmin,xmax, ny,ymin,ymax);
01025   hTrkEn->GetZaxis()->SetTitle("Shift / #sigma");
01026   hTrkEn->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
01027   hTrkEn->GetXaxis()->SetTitle("#Delta #bar{m}^{2} / eV^{2}");
01028   hTrkEn->GetZaxis()->CenterTitle();
01029   hTrkEn->GetYaxis()->CenterTitle();
01030   hTrkEn->GetXaxis()->CenterTitle();
01031 
01032   TH2D* hLnLTotal = new TH2D("hLnLTotal", "", nx,xmin,xmax, ny,ymin,ymax);
01033   hLnLTotal->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
01034   hLnLTotal->GetXaxis()->SetTitle("#Delta #bar{m}^{2} / eV^{2}");
01035   hLnLTotal->GetYaxis()->CenterTitle();
01036   hLnLTotal->GetXaxis()->CenterTitle();
01037 
01038   TH2D* hLnL = new TH2D("hLnL", "", nx,xmin,xmax, ny,ymin,ymax);
01039   hLnL->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
01040   hLnL->GetXaxis()->SetTitle("#Delta #bar{m}^{2} / eV^{2}");
01041   hLnL->GetYaxis()->CenterTitle();
01042   hLnL->GetXaxis()->CenterTitle();
01043 
01044   //
01045   // Print Binning
01046   // -------------
01047   // std::cout << " --- dmsq --- " << std::endl;
01048   // for( Int_t n=0; n<hLnL->GetYaxis()->GetNbins(); n++ ){
01049   //   std::cout << " [" << n << "] " << hLnL->GetYaxis()->GetBinCenter(n+1) << std::endl;
01050   // }
01051   //
01052 
01053   // Seed Parameters
01054   // ================
01055   this->SetSeedParameters();
01056 
01057   // Seed Oscillations
01058   // =================
01059   Double_t seedDmsq = fSeedDmsq;
01060   Double_t seedSinsq = fSeedSinsq;
01061   Double_t seedDmsqBar = fSeedDmsqBar;
01062   Double_t seedSinsqBar = fSeedSinsqBar;
01063 
01064   // Run Oscillation Fit
01065   // ===================
01066   Double_t dmsq0 = 0.0;
01067   Double_t sinsq0 = 0.0;
01068   Double_t dmsqbar0 = 0.0;
01069   Double_t sinsqbar0 = 0.0;
01070 
01071   Double_t dmsq = 0.0;
01072   Double_t sinsq = 0.0;
01073   Double_t dmsqbar = 0.0;
01074   Double_t sinsqbar = 0.0;
01075 
01076   Double_t dmsqBestFit = 0.0;
01077   Double_t dmsqbarBestFit = 0.0;
01078 
01079   Double_t dm = 0.0;
01080   Double_t ds = 0.0;
01081   Double_t dmbar = 0.0;
01082   Double_t dsbar = 0.0;
01083 
01084   Double_t norm = 0.0;
01085   Double_t ncbkg = 0.0;
01086   Double_t shwen = 0.0;
01087   Double_t trken = 0.0;
01088 
01089   Double_t LnL = 0.0; 
01090   Double_t minLnL = 1.0e10;
01091 
01092   Int_t ibest = -1;
01093   Int_t jbest = -1;
01094 
01095   Int_t first = ifirst;
01096   Int_t last  = ilast;
01097 
01098   if( first<0 ) first = 0;
01099   if( last<0 )  last  = GetDmsqBins();
01100 
01101   // Loop over Dmsq Bins (y-axis)
01102   for( Int_t i=first; i<last; i++ ){          
01103     std::cout << " ---- RunFit: [" << i << "] [" << first << "|" << last << "] --- " << std::endl;
01104 
01105     // Loop over DmsqBar Bins (x-axis)
01106     for( Int_t j=0; j<GetDmsqBins(); j++ ){  
01107       std::cout << "              [" << i << "] [" << j << "]" << std::endl;
01108 
01109       // Input Parameters
01110       dmsq = GetDmsq( i );
01111       sinsq = seedSinsq;
01112       dmsqbar = GetDmsq( j );
01113       sinsqbar = seedSinsqBar;
01114 
01115       // Run Fit
01116       this->RunFit( dmsq, sinsq,
01117                     dmsqbar, sinsqbar,
01118                     norm, ncbkg,
01119                     shwen, trken,
01120                     dm, ds,
01121                     dmbar, dsbar,
01122                     LnL );
01123 
01124       hInputDmsq->SetBinContent( j+1, i+1, dmsq );
01125       hInputSinsq->SetBinContent( j+1, i+1, sinsq );
01126       hInputDmsqBar->SetBinContent( j+1, i+1, dmsqbar );
01127       hInputSinsqBar->SetBinContent( j+1, i+1, sinsqbar );
01128 
01129       hDmsq->SetBinContent( j+1, i+1, dmsq+dm );
01130       hSinsq->SetBinContent( j+1, i+1, sinsq+ds );
01131       hDmsqBar->SetBinContent( j+1, i+1, dmsqbar+dmbar );
01132       hSinsqBar->SetBinContent( j+1, i+1, sinsqbar+dsbar );
01133      
01134       hNorm->SetBinContent( j+1, i+1, norm);
01135       hNCBkg->SetBinContent( j+1, i+1, ncbkg);
01136       hShwEn->SetBinContent( j+1, i+1, shwen);
01137       hTrkEn->SetBinContent( j+1, i+1, trken);
01138 
01139       hLnL->SetBinContent( j+1, i+1, LnL );
01140       hLnLTotal->SetBinContent( j+1, i+1, LnL );
01141 
01142       // Best Fit
01143       if( LnL<minLnL ){
01144         ibest = i; 
01145         jbest = j;
01146         minLnL = LnL;
01147       }
01148 
01149     }
01150   }
01151 
01152 
01153   // Best Fit Oscillations
01154   // =====================
01155   if( ibest>=0 && jbest>=0 ){
01156  
01157     dmsqBestFit = hLnL->GetYaxis()->GetBinCenter( ibest+1 );
01158     dmsqbarBestFit = hLnL->GetXaxis()->GetBinCenter( jbest+1 );
01159 
01160     for( Int_t i=0; i<hLnL->GetYaxis()->GetNbins(); i++ ){
01161       for( Int_t j=0; j<hLnL->GetXaxis()->GetNbins(); j++ ){    
01162         Double_t myLnL = hLnL->GetBinContent( j+1, i+1 );
01163         hLnL->SetBinContent( j+1, i+1, myLnL - minLnL );
01164       }
01165     }
01166 
01167     dmsq0 = hInputDmsq->GetBinContent( jbest+1, ibest+1 );
01168     sinsq0 = hInputSinsq->GetBinContent( jbest+1, ibest+1 );
01169     dmsqbar0 = hInputDmsqBar->GetBinContent( jbest+1, ibest+1 );
01170     sinsqbar0 = hInputSinsqBar->GetBinContent( jbest+1, ibest+1 );
01171 
01172     dmsq = hDmsq->GetBinContent( jbest+1, ibest+1 );
01173     sinsq = hSinsq->GetBinContent( jbest+1, ibest+1 );
01174     dmsqbar = hDmsqBar->GetBinContent( jbest+1, ibest+1 );
01175     sinsqbar = hSinsqBar->GetBinContent( jbest+1, ibest+1 );
01176 
01177     norm  = hNorm->GetBinContent( jbest+1, ibest+1 );
01178     ncbkg = hNCBkg->GetBinContent( jbest+1, ibest+1 );
01179     shwen = hShwEn->GetBinContent( jbest+1, ibest+1 );
01180     trken = hTrkEn->GetBinContent( jbest+1, ibest+1 );
01181 
01182     std::cout << " *** Fitter::RunCptFit() *** " << std::endl;
01183     std::cout << "   CPT FIT RESULTS: " << std::endl;
01184     std::cout << "    seed parameters: " << std::endl;
01185     std::cout << "     dmsq="; if( fFitDmsq || fFixDmsq )  std::cout << seedDmsq; else std::cout << "n/a"; 
01186         std::cout << " sinsq=" << seedSinsq << std::endl;
01187     std::cout << "     dmsqbar="; if( fFitDmsqBar || fFixDmsqBar )  std::cout << seedDmsqBar; else std::cout << "n/a"; 
01188         std::cout << " sinsqbar=" << seedSinsqBar << std::endl;
01189     std::cout << "     norm=" << fSeedNorm << " ncbkg=" << fSeedNCBkg << std::endl;
01190     std::cout << "     shwen=" << fSeedShwEn << " trken=" << fSeedTrkEn << std::endl;
01191     std::cout << "    best fit oscilation grid point: " << std::endl;  
01192     std::cout << "     dmsq=" << dmsq0 << " sinsq=" << sinsq0 << std::endl;
01193     std::cout << "     dmsqbar=" << dmsqbar0 << " sinsqbar=" << sinsqbar0 << std::endl;   
01194     std::cout << "    best fit parameters: " << std::endl; 
01195     std::cout << "     dmsq=" << dmsq << " sinsq=" << sinsq << std::endl;
01196     std::cout << "     dmsqbar=" << dmsqbar << " sinsqbar=" << sinsqbar << std::endl;
01197     std::cout << "     norm=" << norm << " ncbkg=" << ncbkg << std::endl;
01198     std::cout << "     shwen=" << shwen << " trken=" << trken << std::endl; 
01199     std::cout << "    goodness of fit: " << std::endl;
01200     std::cout << "     LnLbest=" << minLnL << std::endl;   
01201 
01202     // Write Best Fit Point
01203     if( fWriteTemplates ){
01204 
01205       TString filename = fOutFile;
01206       TString tag = ".cpt.bestfit";
01207   
01208       if( filename.EndsWith(".root") )  
01209         filename.Insert(filename.Length()-5,tag);
01210       else filename.Append(tag);
01211     
01212       TemplateWriter::Instance()->WriteToFile( dmsq,sinsq,
01213                                                dmsqbar,sinsqbar,
01214                                                norm,ncbkg,
01215                                                shwen,trken,
01216                                                filename.Data() );
01217     }
01218   }
01219 
01220 
01221   // Gaussian 2-parameter C.L.
01222   // -------------------------
01223   TH2D* hLnL68 = (TH2D*)(hLnL->Clone("hLnL68")); 
01224   hLnL68->SetContour(1);
01225   hLnL68->SetContourLevel(0,fLnL68);
01226 
01227   TH2D* hLnL90 = (TH2D*)(hLnL->Clone("hLnL90"));
01228   hLnL90->SetContour(1);
01229   hLnL90->SetContourLevel(0,fLnL90);
01230 
01231   TH2D* hLnL99 = (TH2D*)(hLnL->Clone("hLnL99"));
01232   hLnL99->SetContour(1);
01233   hLnL99->SetContourLevel(0,fLnL99);
01234 
01235 
01236   // Best Fit Marker
01237   // ---------------
01238   TMarker* marker = new TMarker(dmsqbarBestFit,dmsqBestFit,20);
01239   marker->SetMarkerColor(1);
01240   marker->SetMarkerSize(1.2);
01241 
01242 
01243   // Write Output Histograms
01244   // =======================
01245   if( 1 // always write this file...
01246    || fWriteContours ){
01247     TString filename = fOutFile;
01248     TString tag = ".cpt.output";
01249   
01250     if( filename.EndsWith(".root") )
01251       filename.Insert(filename.Length()-5,tag);
01252     else filename.Append(tag);
01253 
01254     std::cout << " *** Fitter::WriteContours() *** " << std::endl;
01255     std::cout << "   Writing Contours to File: " << filename.Data() << std::endl;
01256 
01257     TDirectory* tmpd = gDirectory;
01258     TFile* file = new TFile(filename.Data(),"recreate");
01259 
01260     hInputDmsq->Write();
01261     hInputSinsq->Write();
01262     hInputDmsqBar->Write();
01263     hInputSinsqBar->Write();  
01264 
01265     hDmsq->Write(); 
01266     hSinsq->Write();
01267     hDmsqBar->Write();
01268     hSinsqBar->Write();
01269     hNorm->Write();
01270     hNCBkg->Write();
01271     hShwEn->Write();
01272     hTrkEn->Write();
01273 
01274     hLnL->Write();
01275     hLnLTotal->Write();
01276     hLnL68->Write();
01277     hLnL90->Write();
01278     hLnL99->Write();
01279 
01280     marker->Write("bestfit");
01281 
01282     file->Close();
01283     tmpd->cd();
01284   }
01285 
01286   return;
01287 }

void Fitter::RunFit (  ) 

Definition at line 1289 of file Fitter.cxx.

References BuildExpt(), fForceCPT, fOutFile, fSeedDmsq, fSeedDmsqBar, fSeedNCBkg, fSeedNorm, fSeedShwEn, fSeedSinsq, fSeedSinsqBar, fSeedTrkEn, fTemplateArrayExpt, fWriteContours, fWriteTemplates, Instance(), PrintSettings(), RunContours(), SetSeedParameters(), and TouchExpt().

Referenced by RunCptFit(), RunFit(), RunOscFit(), and SetSeedFromBestFit().

01290 {  
01291   std::cout << " *** Fitter::RunFit() *** " << std::endl;
01292   
01293   // Print Settings
01294   // ==============
01295   this->PrintSettings();
01296   
01297   // Build Experiments
01298   // =================
01299   if( this->TouchExpt()==0 ){
01300     this->BuildExpt();
01301   
01302     // Write Experiments
01303     if( fWriteTemplates ){
01304       TString filename = fOutFile;
01305       TString tag = "";
01306   
01307       // data
01308       filename = fOutFile;
01309       tag = ".expt";
01310   
01311       if( filename.EndsWith(".root") )
01312         filename.Insert(filename.Length()-5,tag);
01313       else filename.Append(tag);
01314   
01315       TemplateWriter::Instance()->WriteToFile(fTemplateArrayExpt,
01316                                               filename.Data());
01317       // no oscillations
01318       filename = fOutFile;
01319       tag = ".noosc";
01320   
01321       if( filename.EndsWith(".root") )
01322         filename.Insert(filename.Length()-5,tag);
01323       else filename.Append(tag);
01324   
01325       TemplateWriter::Instance()->WriteToFile( filename.Data() );
01326     }
01327   }
01328 
01329   // Seed Parameters
01330   // ================
01331   this->SetSeedParameters();
01332 
01333   // Input Oscillations
01334   // ==================
01335   Double_t seedDmsq = fSeedDmsq;
01336   Double_t seedSinsq = fSeedSinsq;
01337   Double_t seedDmsqBar = fSeedDmsqBar;
01338   Double_t seedSinsqBar = fSeedSinsqBar;
01339 
01340   if( fForceCPT ){
01341     seedDmsqBar = seedDmsq;
01342     seedSinsqBar = seedSinsq;
01343   }
01344 
01345   // Find Best Fit Point
01346   // ===================
01347   Double_t bestNorm  = 0.0;   
01348   Double_t bestNCbkg = 0.0; 
01349   Double_t bestShwEn = 0.0;
01350   Double_t bestTrkEn = 0.0; 
01351                 
01352   Double_t dm    = 0.0;   
01353   Double_t ds    = 0.0;
01354   Double_t dmbar = 0.0;  
01355   Double_t dsbar = 0.0;
01356                  
01357   Double_t LnL   = 0.0;
01358 
01359   this->RunFit( seedDmsq,seedSinsq,
01360                 seedDmsqBar,seedSinsqBar,
01361                 bestNorm,bestNCbkg,
01362                 bestShwEn,bestTrkEn,
01363                 dm,ds,dmbar,dsbar,
01364                 LnL );
01365 
01366   Double_t bestDmsq     = seedDmsq     + dm;
01367   Double_t bestSinsq    = seedSinsq    + ds;
01368   Double_t bestDmsqBar  = seedDmsqBar  + dmbar;
01369   Double_t bestSinsqBar = seedSinsqBar + dsbar;
01370 
01371   std::cout << " *** Fitter::RunFit() *** " << std::endl;
01372   std::cout << "  Input Parameters: " << std::endl
01373             << "   dmsq=" << seedDmsq << " sinsq=" << seedSinsq << std::endl
01374             << "   dmsqbar=" << seedDmsqBar << " sinsqbar=" << seedSinsqBar << std::endl
01375             << "   norm=" << fSeedNorm << " ncbkg=" << fSeedNCBkg << std::endl
01376             << "   shwen=" << fSeedShwEn << " trken=" << fSeedTrkEn << std::endl;
01377   std::cout << "  Best Fit Parameters: " << std::endl
01378             << "   dmsq=" << bestDmsq << " sinsq=" << bestSinsq << std::endl
01379             << "   dmsqbar=" << bestDmsqBar << " sinsqbar=" << bestSinsqBar << std::endl
01380             << "   norm=" << bestNorm << " ncbkg=" << bestNCbkg << std::endl
01381             << "   shwen=" << bestShwEn << " trken=" << bestTrkEn << std::endl
01382             << "    LnL=" << LnL << std::endl; 
01383 
01384   // Write Best Fit Point
01385   // ====================
01386   if( fWriteTemplates ){  
01387     TString filename = fOutFile;
01388     TString tag = ".bestfit";
01389     
01390     if( filename.EndsWith(".root") )
01391       filename.Insert(filename.Length()-5,tag);
01392     else filename.Append(tag);
01393 
01394     TemplateWriter::Instance()->WriteToFile( bestDmsq,bestSinsq,
01395                                              bestDmsqBar,bestSinsqBar,
01396                                              bestNorm,bestNCbkg,
01397                                              bestShwEn,bestTrkEn,
01398                                              filename.Data() );
01399   }
01400 
01401   // Write Contours To File
01402   // ======================
01403   if( fWriteContours ) this->RunContours();
01404 
01405   return;
01406 }

void Fitter::RunFit ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  in_norm,
Double_t  in_ncbkg,
Double_t  in_shwen,
Double_t  in_trken,
Double_t  in_dm,
Double_t  in_ds,
Double_t  in_dmbar,
Double_t  in_dsbar,
Double_t &  out_norm,
Double_t &  out_ncbkg,
Double_t &  out_shwen,
Double_t &  out_trken,
Double_t &  out_dm,
Double_t &  out_ds,
Double_t &  out_dmbar,
Double_t &  out_dsbar,
Double_t &  LnL 
)

Definition at line 1929 of file Fitter.cxx.

References err(), fDebug, fDeltaDmsq, fDeltaDmsqBar, fDeltaSinsq, fDeltaSinsqBar, fDmsq, fDmsqBar, fFitDmsq, fFitDmsqBar, fFitNCBkg, fFitNorm, fFitShwEn, fFitSinsq, fFitSinsqBar, fFittingDmsq, fFittingDmsqBar, fFittingNCBkg, fFittingNorm, fFittingShwEn, fFittingSinsq, fFittingSinsqBar, fFittingTrkEn, fFitTrkEn, fForceCPT, fMaskDmsq, fMaskDmsqBar, fMaskNCBkg, fMaskNorm, fMaskShwEn, fMaskSinsq, fMaskSinsqBar, fMaskTrkEn, fMinuit, fMinuitStatus, fNCBkg, fNorm, fShwEn, fSinsq, fSinsqBar, fTrkEn, fUseSimplex, get_counter(), OscFitLikelihoodFunction(), and reset_counter().

01930 {
01931   // input oscillations
01932   fDmsq     = dmsq;
01933   fSinsq    = sinsq;
01934   fDmsqBar  = dmsqbar;
01935   fSinsqBar = sinsqbar;
01936 
01937   if( fForceCPT ){
01938     fDmsqBar  = fDmsq;
01939     fSinsqBar = fSinsq;
01940   }
01941 
01942   // input parameters
01943   fDeltaDmsq     = in_dm;
01944   fDeltaSinsq    = in_ds;
01945   fDeltaDmsqBar  = in_dmbar;
01946   fDeltaSinsqBar = in_dsbar;
01947   fNorm          = in_norm;
01948   fNCBkg         = in_ncbkg;
01949   fShwEn         = in_shwen;
01950   fTrkEn         = in_trken;
01951 
01952   if( fForceCPT ){
01953     fDeltaDmsqBar = fDeltaDmsq;
01954     fDeltaSinsqBar = fDeltaSinsq;
01955   }
01956 
01957   // best fit parameters
01958   Double_t dm_fit    = fDeltaDmsq; 
01959   Double_t ds_fit    = fDeltaSinsq;
01960   Double_t dmbar_fit = fDeltaDmsqBar; 
01961   Double_t dsbar_fit = fDeltaSinsqBar; 
01962   Double_t norm_fit  = fNorm;
01963   Double_t ncbkg_fit = fNCBkg;
01964   Double_t shwen_fit = fShwEn;
01965   Double_t trken_fit = fTrkEn;
01966   
01967   Double_t dm_err    = 2.0; 
01968   Double_t ds_err    = 2.0;
01969   Double_t dmbar_err = 2.0; 
01970   Double_t dsbar_err = 2.0;
01971   Double_t norm_err  = 2.0;
01972   Double_t ncbkg_err = 2.0;
01973   Double_t shwen_err = 2.0;
01974   Double_t trken_err = 2.0;
01975 
01976   // which parameters to fit
01977   fFittingDmsq     = 0;
01978   fFittingSinsq    = 0;
01979   fFittingDmsqBar  = 0;
01980   fFittingSinsqBar = 0;
01981   fFittingNorm     = 0;
01982   fFittingNCBkg    = 0;
01983   fFittingShwEn    = 0;
01984   fFittingTrkEn    = 0;  
01985 
01986   if( fFitDmsq     && fMaskDmsq )     fFittingDmsq     = 1;
01987   if( fFitSinsq    && fMaskSinsq )    fFittingSinsq    = 1;
01988   if( fFitDmsqBar  && fMaskDmsqBar )  fFittingDmsqBar  = 1;
01989   if( fFitSinsqBar && fMaskSinsqBar ) fFittingSinsqBar = 1;
01990   if( fFitNorm     && fMaskNorm )     fFittingNorm     = 1;
01991   if( fFitNCBkg    && fMaskNCBkg )    fFittingNCBkg    = 1;  
01992   if( fFitShwEn    && fMaskShwEn )    fFittingShwEn    = 1;
01993   if( fFitTrkEn    && fMaskTrkEn )    fFittingTrkEn    = 1;
01994 
01995   Bool_t saveFittingDmsqBar  = fFittingDmsqBar;
01996   Bool_t saveFittingSinsqBar = fFittingSinsqBar;
01997 
01998   if( fForceCPT ){
01999     fFittingDmsqBar  = 0;  
02000     fFittingSinsqBar = 0;
02001   }
02002 
02003   // set up fit
02004   Int_t err   = 0;
02005   Int_t flag  = 0;
02006   Int_t npari = 0;
02007   Int_t nparx = 0;
02008   Int_t istat = 0;
02009   Double_t lnl = 0.0;
02010   Double_t fedm = 0.0;
02011   Double_t errdef = 0.0;
02012 
02013   Double_t* arglist = new Double_t[10];
02014   
02015   // Reset Counter
02016   this->reset_counter();
02017 
02018   // Reset Status 
02019   fMinuitStatus = 999;
02020 
02021   // Reset Fit
02022   fMinuit->mncler();
02023 
02024   // Set Likelihood Function
02025   fMinuit->SetFCN(OscFitLikelihoodFunction);
02026 
02027   // Log-Likelihood
02028   arglist[0] = 0.5; // 0.5: log-likelihood function
02029                     // 1.0: chi-squared function
02030   fMinuit->mnexcm("SET STR",arglist,1,err);
02031 
02032   // Set Strategy
02033   arglist[0] = 1;  // 1: standard minimization
02034                    // 2: try to improve minimum (also: better errors)
02035   fMinuit->mnexcm("SET STR",arglist,1,err);
02036 
02037   // Set Parameters
02038   if( fFittingDmsq )     fMinuit->mnparm(0,"dm",   fDeltaDmsq,    0.005,-1.0,+1.0,err);
02039   if( fFittingSinsq )    fMinuit->mnparm(1,"ds",   fDeltaSinsq,   0.05, -2.0,+2.0,err);
02040   if( fFittingDmsqBar )  fMinuit->mnparm(2,"dmbar",fDeltaDmsqBar, 0.005,-1.0,+1.0,err);
02041   if( fFittingSinsqBar ) fMinuit->mnparm(3,"dsbar",fDeltaSinsqBar,0.05, -2.0,+2.0,err);
02042   if( fFittingNorm )     fMinuit->mnparm(4,"norm", fNorm,         1.0,  -3.0,+3.0,err);
02043   if( fFittingNCBkg )    fMinuit->mnparm(5,"ncbkg",fNCBkg,        1.0,  -2.5,+2.5,err);
02044   if( fFittingShwEn )    fMinuit->mnparm(6,"shwen",fShwEn,        1.0,  -2.5,+2.5,err);
02045   if( fFittingTrkEn )    fMinuit->mnparm(7,"trken",fTrkEn,        1.0,  -2.5,+2.5,err);  
02046 
02047   // run the fit
02048   if( fUseSimplex ){
02049     if( fDebug ) std::cout << "  Fitting With Minuit (Simplex) " << std::endl;
02050     fMinuit->mnsimp(); flag = 0;
02051   }
02052   else{
02053     if( fDebug ) std::cout << "  Fitting With Minuit (Migrad) " << std::endl;
02054     flag = fMinuit->Migrad();
02055   }
02056 
02057   // set status
02058   if( fMinuit->GetNumPars()>0 ){
02059     fMinuitStatus = flag;
02060   }
02061 
02062   // get best fit parameters
02063   if( fFittingDmsq )     fMinuit->GetParameter(0,dm_fit,   dm_err); 
02064   if( fFittingSinsq )    fMinuit->GetParameter(1,ds_fit,   ds_err);
02065   if( fFittingDmsqBar )  fMinuit->GetParameter(2,dmbar_fit,dmbar_err); 
02066   if( fFittingSinsqBar ) fMinuit->GetParameter(3,dsbar_fit,dsbar_err);
02067   if( fFittingNorm )     fMinuit->GetParameter(4,norm_fit, norm_err);
02068   if( fFittingNCBkg )    fMinuit->GetParameter(5,ncbkg_fit,ncbkg_err);
02069   if( fFittingShwEn )    fMinuit->GetParameter(6,shwen_fit,shwen_err);
02070   if( fFittingTrkEn )    fMinuit->GetParameter(7,trken_fit,trken_err);
02071 
02072   // get best fit log-likelihood
02073   fMinuit->mnstat(lnl,fedm,errdef,npari,nparx,istat);
02074 
02075   if( fForceCPT ){
02076     dmbar_fit = dm_fit;
02077     dsbar_fit = ds_fit;
02078     dmbar_err = dm_err;
02079     dsbar_err = ds_err;
02080   }
02081 
02082   if( fForceCPT ){
02083     fFittingDmsqBar  = saveFittingDmsqBar;  
02084     fFittingSinsqBar = saveFittingSinsqBar;
02085   }
02086 
02087   // print results
02088   if( fDebug ){
02089     std::cout << "  Input Oscillations: " << std::endl
02090               << "   dmsq:     " << fDmsq << std::endl
02091               << "   sinsq:    " << fSinsq << std::endl
02092               << "   dmsqbar:  " << fDmsqBar << std::endl
02093               << "   sinsqbar: " << fSinsqBar << std::endl
02094               << "  Fit Results: " << std::endl
02095               << "  (iterations=" << get_counter() << ", status=" << flag << ")" << std::endl
02096               << "   dm:     " << dm_fit    << "\t+/-\t" << dm_err    << std::endl 
02097               << "   ds:     " << ds_fit    << "\t+/-\t" << ds_err    << std::endl
02098               << "   dmbar:  " << dmbar_fit << "\t+/-\t" << dmbar_err << std::endl 
02099               << "   dsbar:  " << dsbar_fit << "\t+/-\t" << dsbar_err << std::endl
02100               << "   norm:   " << norm_fit  << "\t+/-\t" << norm_err  << std::endl
02101               << "   ncbkg:  " << ncbkg_fit << "\t+/-\t" << ncbkg_err << std::endl
02102               << "   shwen:  " << shwen_fit << "\t+/-\t" << shwen_err << std::endl
02103               << "   trken:  " << trken_fit << "\t+/-\t" << trken_err << std::endl;
02104     std::cout << "    lnl=" << lnl << std::endl;
02105   }
02106 
02107   // get best fit parameters
02108   out_dm    = dm_fit;
02109   out_ds    = ds_fit; 
02110   out_dmbar = dmbar_fit; 
02111   out_dsbar = dsbar_fit; 
02112   out_norm  = norm_fit;
02113   out_ncbkg = ncbkg_fit;
02114   out_shwen = shwen_fit;
02115   out_trken = trken_fit;
02116 
02117   LnL = lnl;
02118 
02119   delete [] arglist;
02120 
02121   return;
02122 }

void Fitter::RunFit ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t &  norm,
Double_t &  ncbkg,
Double_t &  shwen,
Double_t &  trken,
Double_t &  dm,
Double_t &  ds,
Double_t &  dmbar,
Double_t &  dsbar,
Double_t &  LnL 
)

Definition at line 1555 of file Fitter.cxx.

References fDebug, fFitDmsq, fFitDmsqBar, fFitNCBkg, fFitNorm, fFitShwEn, fFitSinsq, fFitSinsqBar, fFitTrkEn, fForceCPT, fLastNCBkg, fLastNorm, fLastShwEn, fLastTrkEn, fMaskDmsq, fMaskDmsqBar, fMaskNCBkg, fMaskNorm, fMaskShwEn, fMaskSinsq, fMaskSinsqBar, fMaskTrkEn, fSeedNCBkg, fSeedNorm, fSeedShwEn, fSeedSystematicsFromLastFit, fSeedTrkEn, fUseSimplex, GetLnL(), OscFit::TemplateMap::Instance(), RunFit(), TouchExpt(), and OscFit::TemplateMap::TouchSystematics().

01556 {   
01557   if( fDebug ){
01558     std::cout << " *** Fitter::RunFit(...) *** " << std::endl;
01559     std::cout << "  Running Oscillation Fit... " << std::endl;
01560   }
01561 
01562   if( fSeedSystematicsFromLastFit ){
01563     fSeedNorm  = fLastNorm;
01564     fSeedNCBkg = fLastNCBkg;
01565     fSeedShwEn = fLastShwEn;
01566     fSeedTrkEn = fLastTrkEn;
01567   }
01568 
01569   // defaults
01570   dm    = 0.0;
01571   ds    = 0.0;
01572   dmbar = 0.0;
01573   dsbar = 0.0;
01574   norm  = fSeedNorm;
01575   ncbkg = fSeedNCBkg;
01576   shwen = fSeedShwEn;
01577   trken = fSeedTrkEn;
01578 
01579   // input oscillations
01580   Double_t seedDmsq     = dmsq;
01581   Double_t seedSinsq    = sinsq;
01582   Double_t seedDmsqBar  = dmsqbar;
01583   Double_t seedSinsqBar = sinsqbar;
01584 
01585   if( fForceCPT ){
01586     seedDmsqBar  = seedDmsq;
01587     seedSinsqBar = seedSinsq;
01588   }
01589 
01590   // seed parameters
01591   Double_t seedDeltaDmsq     = 0.0;
01592   Double_t seedDeltaSinsq    = 0.0;
01593   Double_t seedDeltaDmsqBar  = 0.0;
01594   Double_t seedDeltaSinsqBar = 0.0;
01595   Double_t seedNorm          = fSeedNorm;
01596   Double_t seedNCBkg         = fSeedNCBkg;
01597   Double_t seedShwEn         = fSeedShwEn;
01598   Double_t seedTrkEn         = fSeedTrkEn;
01599 
01600   // fitted parameters
01601   Double_t fitDeltaDmsq      = 0.0;
01602   Double_t fitDeltaSinsq     = 0.0;
01603   Double_t fitDeltaDmsqBar   = 0.0;
01604   Double_t fitDeltaSinsqBar  = 0.0;
01605   Double_t fitNorm           = fSeedNorm;
01606   Double_t fitNCBkg          = fSeedNCBkg;
01607   Double_t fitShwEn          = fSeedShwEn;
01608   Double_t fitTrkEn          = fSeedTrkEn;
01609 
01610   // log-likelihood
01611   Double_t fitLnL = 0.0;
01612 
01613   // run fit or not
01614   Bool_t runfit = 0;
01615 
01616   // sanity check
01617   if( this->TouchExpt()==0 ){
01618     std::cout << "   <Warning>: No Experiment Loaded [RETURN] " << std::endl;
01619     return;
01620   }
01621 
01622   // configuration
01623   Bool_t fittingOscillations = ( fFitDmsq || fFitSinsq || fFitDmsqBar || fFitSinsqBar ) ;
01624   Bool_t fittingSystematics =  ( fFitNorm || fFitNCBkg || fFitShwEn || fFitTrkEn );
01625 
01626   if( fittingSystematics
01627    && TemplateMap::Instance()->TouchSystematics()==0 ){
01628     std::cout << "   <Warning>: No systematic templates have been loaded" << std::endl
01629               << "              Switching off systematics in fit" << std::endl;
01630     fittingSystematics = 0;
01631   }
01632 
01633   // run oscillation fit
01634   // ===================
01635   
01636   // (0) Get Likelihood
01637   // ------------------
01638   this->GetLnL( seedDmsq, seedSinsq, seedDmsqBar, seedSinsqBar, 
01639                 seedNorm, seedNCBkg, seedShwEn, seedTrkEn, fitLnL );
01640 
01641   // print results
01642   if( fDebug ){
01643     std::cout << " --- Fit Inputs --- " << std::endl;
01644     std::cout << "  Input Oscillations: " << std::endl
01645               << "   dmsq:     " << seedDmsq << std::endl
01646               << "   sinsq:    " << seedSinsq << std::endl
01647               << "   dmsqbar:  " << seedDmsqBar << std::endl
01648               << "   sinsqbar: " << seedSinsqBar << std::endl;
01649     std::cout << "  Input Systematics: " << std::endl
01650               << "   norm:     " << seedNorm << std::endl
01651               << "   ncbkg:    " << seedNCBkg << std::endl
01652               << "   shwen:    " << seedShwEn << std::endl
01653               << "   trken:    " << seedTrkEn << std::endl; 
01654     std::cout << "    LnL=" << fitLnL << std::endl;
01655   }
01656 
01657   // (1) Oscillations [Simplex]
01658   // --------------------------
01659   if( fittingOscillations ){
01660     fUseSimplex = 1;  
01661   
01662     fMaskDmsq     = 1;
01663     fMaskSinsq    = 1;
01664     fMaskDmsqBar  = 1;
01665     fMaskSinsqBar = 1;
01666     fMaskNorm     = 0;
01667     fMaskNCBkg    = 0;
01668     fMaskShwEn    = 0;
01669     fMaskTrkEn    = 0;
01670   
01671     runfit = 0;
01672     if( !runfit && fFitDmsq     && fMaskDmsq )     runfit = 1;
01673     if( !runfit && fFitSinsq    && fMaskSinsq )    runfit = 1;
01674     if( !runfit && fFitDmsqBar  && fMaskDmsqBar )  runfit = 1;
01675     if( !runfit && fFitSinsqBar && fMaskSinsqBar ) runfit = 1;
01676     if( !runfit && fFitNorm     && fMaskNorm )     runfit = 1;
01677     if( !runfit && fFitNCBkg    && fMaskNCBkg )    runfit = 1;  
01678     if( !runfit && fFitShwEn    && fMaskShwEn )    runfit = 1;
01679     if( !runfit && fFitTrkEn    && fMaskTrkEn )    runfit = 1;
01680 
01681     if( runfit ){
01682       if( fDebug ) std::cout << " --- Fit 1A (oscillations|simplex) --- " << std::endl;
01683 
01684       seedDeltaDmsq     = fitDeltaDmsq;
01685       seedDeltaSinsq    = fitDeltaSinsq;
01686       seedDeltaDmsqBar  = fitDeltaDmsqBar;
01687       seedDeltaSinsqBar = fitDeltaSinsqBar;
01688       seedNorm          = fitNorm;
01689       seedNCBkg         = fitNCBkg;
01690       seedShwEn         = fitShwEn;
01691       seedTrkEn         = fitTrkEn;
01692 
01693       this->RunFit( seedDmsq, seedSinsq, seedDmsqBar, seedSinsqBar,
01694                     seedNorm, seedNCBkg, seedShwEn, seedTrkEn,
01695                     seedDeltaDmsq, seedDeltaSinsq, seedDeltaDmsqBar, seedDeltaSinsqBar,
01696                     fitNorm, fitNCBkg, fitShwEn, fitTrkEn,
01697                     fitDeltaDmsq, fitDeltaSinsq, fitDeltaDmsqBar, fitDeltaSinsqBar,
01698                     fitLnL );
01699     }
01700   }
01701 
01702   // (1B) Oscillations [Migrad]
01703   // --------------------------
01704   if( fittingOscillations ){
01705     fUseSimplex = 0;  
01706   
01707     fMaskDmsq     = 1;
01708     fMaskSinsq    = 1;
01709     fMaskDmsqBar  = 1;
01710     fMaskSinsqBar = 1;
01711     fMaskNorm     = 0;
01712     fMaskNCBkg    = 0;
01713     fMaskShwEn    = 0;
01714     fMaskTrkEn    = 0;
01715   
01716     runfit = 0;
01717     if( !runfit && fFitDmsq     && fMaskDmsq )     runfit = 1;
01718     if( !runfit && fFitSinsq    && fMaskSinsq )    runfit = 1;
01719     if( !runfit && fFitDmsqBar  && fMaskDmsqBar )  runfit = 1;
01720     if( !runfit && fFitSinsqBar && fMaskSinsqBar ) runfit = 1;
01721     if( !runfit && fFitNorm     && fMaskNorm )     runfit = 1;
01722     if( !runfit && fFitNCBkg    && fMaskNCBkg )    runfit = 1;  
01723     if( !runfit && fFitShwEn    && fMaskShwEn )    runfit = 1;
01724     if( !runfit && fFitTrkEn    && fMaskTrkEn )    runfit = 1;
01725 
01726     if( runfit ){
01727       if( fDebug ) std::cout << " --- Fit 1B (oscillations|migrad) --- " << std::endl;
01728 
01729       seedDeltaDmsq     = fitDeltaDmsq;
01730       seedDeltaSinsq    = fitDeltaSinsq;
01731       seedDeltaDmsqBar  = fitDeltaDmsqBar;
01732       seedDeltaSinsqBar = fitDeltaSinsqBar;
01733       seedNorm          = fitNorm;
01734       seedNCBkg         = fitNCBkg;
01735       seedShwEn         = fitShwEn;
01736       seedTrkEn         = fitTrkEn;
01737 
01738       this->RunFit( seedDmsq, seedSinsq, seedDmsqBar, seedSinsqBar,
01739                     seedNorm, seedNCBkg, seedShwEn, seedTrkEn,
01740                     seedDeltaDmsq, seedDeltaSinsq, seedDeltaDmsqBar, seedDeltaSinsqBar,
01741                     fitNorm, fitNCBkg, fitShwEn, fitTrkEn,
01742                     fitDeltaDmsq, fitDeltaSinsq, fitDeltaDmsqBar, fitDeltaSinsqBar,
01743                     fitLnL );
01744     }
01745   }
01746 
01747   // (2A) Systematics [Simplex]
01748   // --------------------------
01749   if( fittingSystematics ){
01750     fUseSimplex = 1;     
01751   
01752     fMaskDmsq     = 0;
01753     fMaskSinsq    = 0;
01754     fMaskDmsqBar  = 0;
01755     fMaskSinsqBar = 0;
01756     fMaskNorm     = 1;
01757     fMaskNCBkg    = 1;
01758     fMaskShwEn    = 1;
01759     fMaskTrkEn    = 1;  
01760 
01761     runfit = 0;
01762     if( !runfit && fFitDmsq     && fMaskDmsq )     runfit = 1;
01763     if( !runfit && fFitSinsq    && fMaskSinsq )    runfit = 1;
01764     if( !runfit && fFitDmsqBar  && fMaskDmsqBar )  runfit = 1;
01765     if( !runfit && fFitSinsqBar && fMaskSinsqBar ) runfit = 1;
01766     if( !runfit && fFitNorm     && fMaskNorm )     runfit = 1;
01767     if( !runfit && fFitNCBkg    && fMaskNCBkg )    runfit = 1;  
01768     if( !runfit && fFitShwEn    && fMaskShwEn )    runfit = 1;
01769     if( !runfit && fFitTrkEn    && fMaskTrkEn )    runfit = 1;
01770 
01771     if( runfit ){
01772       if( fDebug ) std::cout << " --- Fit 2A (systematics|simplex) --- " << std::endl;
01773 
01774       seedDeltaDmsq     = fitDeltaDmsq;
01775       seedDeltaSinsq    = fitDeltaSinsq;
01776       seedDeltaDmsqBar  = fitDeltaDmsqBar;
01777       seedDeltaSinsqBar = fitDeltaSinsqBar;
01778       seedNorm          = fitNorm;
01779       seedNCBkg         = fitNCBkg;
01780       seedShwEn         = fitShwEn;
01781       seedTrkEn         = fitTrkEn;
01782 
01783       this->RunFit( seedDmsq, seedSinsq, seedDmsqBar, seedSinsqBar,
01784                     seedNorm, seedNCBkg, seedShwEn, seedTrkEn,
01785                     seedDeltaDmsq, seedDeltaSinsq, seedDeltaDmsqBar, seedDeltaSinsqBar,
01786                     fitNorm, fitNCBkg, fitShwEn, fitTrkEn,
01787                     fitDeltaDmsq, fitDeltaSinsq, fitDeltaDmsqBar, fitDeltaSinsqBar,
01788                     fitLnL );
01789     }
01790   }
01791 
01792   // (2B) Systematics [Migrad]
01793   // -------------------------
01794   if( fittingSystematics ){
01795     fUseSimplex = 0;        
01796   
01797     fMaskDmsq     = 0;
01798     fMaskSinsq    = 0;
01799     fMaskDmsqBar  = 0;
01800     fMaskSinsqBar = 0;
01801     fMaskNorm     = 1;
01802     fMaskNCBkg    = 1;
01803     fMaskShwEn    = 1;
01804     fMaskTrkEn    = 1;  
01805 
01806     runfit = 0;
01807     if( !runfit && fFitDmsq     && fMaskDmsq )     runfit = 1;
01808     if( !runfit && fFitSinsq    && fMaskSinsq )    runfit = 1;
01809     if( !runfit && fFitDmsqBar  && fMaskDmsqBar )  runfit = 1;
01810     if( !runfit && fFitSinsqBar && fMaskSinsqBar ) runfit = 1;
01811     if( !runfit && fFitNorm     && fMaskNorm )     runfit = 1;
01812     if( !runfit && fFitNCBkg    && fMaskNCBkg )    runfit = 1;  
01813     if( !runfit && fFitShwEn    && fMaskShwEn )    runfit = 1;
01814     if( !runfit && fFitTrkEn    && fMaskTrkEn )    runfit = 1;
01815 
01816     if( runfit ){
01817       if( fDebug ) std::cout << " --- Fit 2B (systematics|migrad) --- " << std::endl;
01818 
01819       seedDeltaDmsq     = fitDeltaDmsq;
01820       seedDeltaSinsq    = fitDeltaSinsq;
01821       seedDeltaDmsqBar  = fitDeltaDmsqBar;
01822       seedDeltaSinsqBar = fitDeltaSinsqBar;
01823       seedNorm          = fitNorm;
01824       seedNCBkg         = fitNCBkg;
01825       seedShwEn         = fitShwEn;
01826       seedTrkEn         = fitTrkEn;
01827 
01828       this->RunFit( seedDmsq, seedSinsq, seedDmsqBar, seedSinsqBar,
01829                     seedNorm, seedNCBkg, seedShwEn, seedTrkEn,
01830                     seedDeltaDmsq, seedDeltaSinsq, seedDeltaDmsqBar, seedDeltaSinsqBar,
01831                     fitNorm, fitNCBkg, fitShwEn, fitTrkEn,
01832                     fitDeltaDmsq, fitDeltaSinsq, fitDeltaDmsqBar, fitDeltaSinsqBar,
01833                     fitLnL );
01834     }
01835   }
01836 
01837   // (3) Both Oscillations and Systematics [Migrad]
01838   // ----------------------------------------------
01839   if( fittingSystematics && fittingOscillations ){
01840     fUseSimplex = 0;   
01841   
01842     fMaskDmsq     = 1;
01843     fMaskSinsq    = 1;
01844     fMaskDmsqBar  = 1;
01845     fMaskSinsqBar = 1;
01846     fMaskNorm     = 1;
01847     fMaskNCBkg    = 1;
01848     fMaskShwEn    = 1;
01849     fMaskTrkEn    = 1;  
01850 
01851     runfit = 0;
01852     if( !runfit && fFitDmsq     && fMaskDmsq )     runfit = 1;
01853     if( !runfit && fFitSinsq    && fMaskSinsq )    runfit = 1;
01854     if( !runfit && fFitDmsqBar  && fMaskDmsqBar )  runfit = 1;
01855     if( !runfit && fFitSinsqBar && fMaskSinsqBar ) runfit = 1;
01856     if( !runfit && fFitNorm     && fMaskNorm )     runfit = 1;
01857     if( !runfit && fFitNCBkg    && fMaskNCBkg )    runfit = 1;  
01858     if( !runfit && fFitShwEn    && fMaskShwEn )    runfit = 1;
01859     if( !runfit && fFitTrkEn    && fMaskTrkEn )    runfit = 1;
01860 
01861     if( runfit ){
01862       if( fDebug ) std::cout << " --- Fit 3 (all|migrad) --- " << std::endl;
01863 
01864       seedDeltaDmsq     = fitDeltaDmsq;
01865       seedDeltaSinsq    = fitDeltaSinsq;
01866       seedDeltaDmsqBar  = fitDeltaDmsqBar;
01867       seedDeltaSinsqBar = fitDeltaSinsqBar;
01868       seedNorm          = fitNorm;
01869       seedNCBkg         = fitNCBkg;
01870       seedShwEn         = fitShwEn;
01871       seedTrkEn         = fitTrkEn;
01872 
01873       this->RunFit( seedDmsq, seedSinsq, seedDmsqBar, seedSinsqBar,
01874                     seedNorm, seedNCBkg, seedShwEn, seedTrkEn,
01875                     seedDeltaDmsq, seedDeltaSinsq, seedDeltaDmsqBar, seedDeltaSinsqBar,
01876                     fitNorm, fitNCBkg, fitShwEn, fitTrkEn,
01877                     fitDeltaDmsq, fitDeltaSinsq, fitDeltaDmsqBar, fitDeltaSinsqBar,
01878                     fitLnL );
01879     }
01880   }
01881 
01882   // results of fit
01883   dm    = fitDeltaDmsq;
01884   ds    = fitDeltaSinsq;
01885   dmbar = fitDeltaDmsqBar;
01886   dsbar = fitDeltaSinsqBar;
01887   norm  = fitNorm;
01888   ncbkg = fitNCBkg;
01889   shwen = fitShwEn;
01890   trken = fitTrkEn;
01891 
01892   // save these results
01893   fLastNorm  = fitNorm;
01894   fLastNCBkg = fitNCBkg;
01895   fLastShwEn = fitShwEn;
01896   fLastTrkEn = fitTrkEn;
01897 
01898   // log-likelihood
01899   LnL = fitLnL;  
01900 
01901   // print results
01902   if( fDebug ){
01903     std::cout << " --- Fit Done --- " << std::endl;
01904     std::cout << "  Input Parameters: " << std::endl
01905               << "   dmsq:     " << seedDmsq << std::endl
01906               << "   sinsq:    " << seedSinsq << std::endl
01907               << "   dmsqbar:  " << seedDmsqBar << std::endl
01908               << "   sinsqbar: " << seedSinsqBar << std::endl
01909               << "   norm:     " << fSeedNorm  << std::endl
01910               << "   ncbkg:    " << fSeedNCBkg << std::endl
01911               << "   shwen:    " << fSeedShwEn << std::endl
01912               << "   trken:    " << fSeedTrkEn << std::endl;
01913     std::cout << "  Fitted Parameters: " << std::endl
01914               << "   dmsq:     " << seedDmsq+dm << std::endl 
01915               << "   sinsq:    " << seedSinsq+ds << std::endl
01916               << "   dmsqbar:  " << seedDmsqBar+dmbar << std::endl 
01917               << "   sinsqbar: " << seedSinsqBar+dsbar << std::endl
01918               << "   norm:     " << norm  << std::endl
01919               << "   ncbkg:    " << ncbkg << std::endl
01920               << "   shwen:    " << shwen << std::endl
01921               << "   trken:    " << trken << std::endl;
01922     std::cout << "    LnL=" << LnL << std::endl;
01923   }
01924 
01925   return;
01926 }

void Fitter::RunFit ( Double_t  dmsq,
Double_t  sinsq,
Double_t &  norm,
Double_t &  ncbkg,
Double_t &  shwen,
Double_t &  trken,
Double_t &  dm,
Double_t &  ds,
Double_t &  LnL 
)

Definition at line 1534 of file Fitter.cxx.

References fForceCPT, and RunFit().

01535 {
01536   Bool_t saveCPT = fForceCPT;
01537 
01538   fForceCPT = 1;
01539 
01540   Double_t dmbar = 0.0;; 
01541   Double_t dsbar = 0.0; 
01542 
01543   this->RunFit( dmsq,sinsq,
01544                 dmsq,sinsq,
01545                 norm,ncbkg,
01546                 shwen,trken,
01547                 dm,ds,dmbar,dsbar,
01548                 LnL );
01549 
01550   fForceCPT = saveCPT;
01551 
01552   return;
01553 }

void Fitter::RunOscFit ( Int_t  ifirst = -1,
Int_t  ilast = -1 
)

Definition at line 553 of file Fitter.cxx.

References BuildExpt(), fFitDmsq, fFitDmsqBar, fFitSinsq, fFitSinsqBar, fFixDmsq, fFixDmsqBar, fFixSinsq, fFixSinsqBar, fForceCPT, fLnL68, fLnL90, fLnL99, fOutFile, fSeedDmsq, fSeedDmsqBar, fSeedNCBkg, fSeedNorm, fSeedShwEn, fSeedSinsq, fSeedSinsqBar, fSeedTrkEn, fTemplateArrayExpt, fWriteContours, fWriteTemplates, GetDmsq(), GetDmsqBins(), GetDmsqMax(), GetDmsqMin(), GetSinsq(), GetSinsqBins(), GetSinsqMax(), GetSinsqMin(), Instance(), PrintSettings(), RunFit(), SetSeedParameters(), and TouchExpt().

Referenced by Run().

00554 {
00555   std::cout << " *** Fitter::RunOscFit() *** " << std::endl;
00556 
00557   // Print Settings
00558   // ==============
00559   this->PrintSettings();
00560 
00561   // Build Experiments
00562   // =================
00563   if( this->TouchExpt()==0 ){
00564     this->BuildExpt();
00565 
00566     // Write Experiments
00567     if( fWriteTemplates ){
00568       TString filename = fOutFile;
00569       TString tag = "";
00570 
00571       // data
00572       filename = fOutFile;
00573       tag = ".expt";
00574 
00575       if( filename.EndsWith(".root") )
00576         filename.Insert(filename.Length()-5,tag);
00577       else filename.Append(tag);
00578     
00579       TemplateWriter::Instance()->WriteToFile(fTemplateArrayExpt,
00580                                               filename.Data());
00581 
00582       // no oscillations
00583       filename = fOutFile;
00584       tag = ".noosc";
00585   
00586       if( filename.EndsWith(".root") )
00587         filename.Insert(filename.Length()-5,tag);
00588       else filename.Append(tag);
00589 
00590       TemplateWriter::Instance()->WriteToFile( filename.Data() );
00591     }
00592   }
00593 
00594   // Build Histograms
00595   // ================  
00596   // x-axis: Sinsq
00597   // y-axis: Dmsq
00598 
00599   Int_t nx = GetSinsqBins();
00600   Double_t xlow = GetSinsqMin();
00601   Double_t xhigh = GetSinsqMax();
00602   Double_t dx = (xhigh-xlow)/((double)nx-1.0);
00603   Double_t xmin = xlow  - 0.50*dx;
00604   Double_t xmax = xhigh + 0.50*dx;
00605   
00606   Int_t ny = GetDmsqBins();
00607   Double_t ylow = GetDmsqMin();
00608   Double_t yhigh = GetDmsqMax();
00609   Double_t dy = (yhigh-ylow)/((double)ny-1.0);
00610   Double_t ymin = ylow  - 0.50*dy;
00611   Double_t ymax = yhigh + 0.50*dy;
00612 
00613   TH2D* hInputDmsq     = new TH2D("hInputDmsq",    "", nx,xmin,xmax, ny,ymin,ymax);
00614   TH2D* hInputSinsq    = new TH2D("hInputDmsqBar", "", nx,xmin,xmax, ny,ymin,ymax);
00615   TH2D* hInputDmsqBar  = new TH2D("hInputSinsq",   "", nx,xmin,xmax, ny,ymin,ymax);
00616   TH2D* hInputSinsqBar = new TH2D("hInputSinsqBar","", nx,xmin,xmax, ny,ymin,ymax);
00617  
00618   TH2D* hDmsq     = new TH2D("hDmsq",    "", nx,xmin,xmax, ny,ymin,ymax);
00619   TH2D* hSinsq    = new TH2D("hDmsqBar", "", nx,xmin,xmax, ny,ymin,ymax);
00620   TH2D* hDmsqBar  = new TH2D("hSinsq",   "", nx,xmin,xmax, ny,ymin,ymax);
00621   TH2D* hSinsqBar = new TH2D("hSinsqBar","", nx,xmin,xmax, ny,ymin,ymax);
00622 
00623   TH2D* hNorm  = new TH2D("hNorm", "", nx,xmin,xmax, ny,ymin,ymax); 
00624   hNorm->GetZaxis()->SetTitle("Shift / #sigma");
00625   hNorm->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
00626   hNorm->GetXaxis()->SetTitle("sin^{2}2#theta");
00627   hNorm->GetZaxis()->CenterTitle();
00628   hNorm->GetYaxis()->CenterTitle();
00629   hNorm->GetXaxis()->CenterTitle();
00630 
00631   TH2D* hNCBkg = new TH2D("hNCBkg","", nx,xmin,xmax, ny,ymin,ymax);
00632   hNCBkg->GetZaxis()->SetTitle("Shift / #sigma");
00633   hNCBkg->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
00634   hNCBkg->GetXaxis()->SetTitle("sin^{2}2#theta");
00635   hNCBkg->GetZaxis()->CenterTitle();
00636   hNCBkg->GetYaxis()->CenterTitle();
00637   hNCBkg->GetXaxis()->CenterTitle();
00638 
00639   TH2D* hShwEn = new TH2D("hShwEn","", nx,xmin,xmax, ny,ymin,ymax);  
00640   hShwEn->GetZaxis()->SetTitle("Shift / #sigma");
00641   hShwEn->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
00642   hShwEn->GetXaxis()->SetTitle("sin^{2}2#theta");
00643   hShwEn->GetZaxis()->CenterTitle();
00644   hShwEn->GetYaxis()->CenterTitle();
00645   hShwEn->GetXaxis()->CenterTitle();
00646 
00647   TH2D* hTrkEn = new TH2D("hTrkEn","", nx,xmin,xmax, ny,ymin,ymax);
00648   hTrkEn->GetZaxis()->SetTitle("Shift / #sigma");
00649   hTrkEn->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
00650   hTrkEn->GetXaxis()->SetTitle("sin^{2}2#theta");
00651   hTrkEn->GetZaxis()->CenterTitle();
00652   hTrkEn->GetYaxis()->CenterTitle();
00653   hTrkEn->GetXaxis()->CenterTitle();
00654 
00655   TH2D* hLnLTotal = new TH2D("hLnLTotal", "", nx,xmin,xmax, ny,ymin,ymax);
00656   hLnLTotal->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
00657   hLnLTotal->GetXaxis()->SetTitle("sin^{2}2#theta");
00658   hLnLTotal->GetYaxis()->CenterTitle();
00659   hLnLTotal->GetXaxis()->CenterTitle();
00660 
00661   TH2D* hLnL = new TH2D("hLnL", "", nx,xmin,xmax, ny,ymin,ymax);
00662   hLnL->GetYaxis()->SetTitle("#Delta m^{2} / eV^{2}");
00663   hLnL->GetXaxis()->SetTitle("sin^{2}2#theta");
00664   hLnL->GetYaxis()->CenterTitle();
00665   hLnL->GetXaxis()->CenterTitle();
00666 
00667   //
00668   // Print Binning
00669   // -------------
00670   // std::cout << " --- dmsq --- " << std::endl;
00671   // for( Int_t n=0; n<hLnL->GetYaxis()->GetNbins(); n++ ){
00672   //   std::cout << " [" << n << "] " << hLnL->GetYaxis()->GetBinCenter(n+1) << std::endl;
00673   // }
00674   //
00675   // std::cout << " --- sinsq --- " << std::endl;
00676   // for( Int_t n=0; n<hLnL->GetXaxis()->GetNbins(); n++ ){
00677   //   std::cout << " [" << n << "] " << hLnL->GetXaxis()->GetBinCenter(n+1) << std::endl;
00678   // }
00679   //
00680 
00681   // Seed Parameters
00682   // ================
00683   this->SetSeedParameters();
00684 
00685   // Seed Oscillations
00686   // =================
00687   Double_t seedDmsq = fSeedDmsq;
00688   Double_t seedSinsq = fSeedSinsq;
00689   Double_t seedDmsqBar = fSeedDmsqBar;
00690   Double_t seedSinsqBar = fSeedSinsqBar;
00691 
00692   if( fForceCPT ){
00693     seedDmsqBar = seedDmsq;
00694     seedSinsqBar = seedSinsq;
00695   }
00696 
00697   // Run Oscillation Fit
00698   // ===================
00699   Double_t dmsq0 = 0.0;
00700   Double_t sinsq0 = 0.0;
00701   Double_t dmsqbar0 = 0.0;
00702   Double_t sinsqbar0 = 0.0;
00703 
00704   Double_t dmsq = 0.0;
00705   Double_t sinsq = 0.0;
00706   Double_t dmsqbar = 0.0;
00707   Double_t sinsqbar = 0.0;
00708 
00709   Double_t dmsqBestFit = 0.0;
00710   Double_t sinsqBestFit = 0.0;
00711 
00712   Double_t dm = 0.0;
00713   Double_t ds = 0.0;
00714   Double_t dmbar = 0.0;
00715   Double_t dsbar = 0.0;
00716 
00717   Double_t norm = 0.0;
00718   Double_t ncbkg = 0.0;
00719   Double_t shwen = 0.0;
00720   Double_t trken = 0.0;
00721 
00722   Double_t LnL = 0.0; 
00723   Double_t minLnL = 1.0e10;
00724 
00725   Int_t ibest = -1;
00726   Int_t jbest = -1;
00727 
00728   Int_t first = ifirst;
00729   Int_t last  = ilast;
00730 
00731   if( first<0 ) first = 0;
00732   if( last<0 )  last  = GetDmsqBins();
00733 
00734   // Loop over Dmsq Bins (y-axis)
00735   for( Int_t i=first; i<last; i++ ){          
00736     std::cout << " ---- RunFit: [" << i << "] [" << first << "|" << last << "] --- " << std::endl;
00737 
00738     // Loop over Sinsq Bins (x-axis)
00739     for( Int_t j=0; j<GetSinsqBins(); j++ ){  
00740       std::cout << "              [" << i << "] [" << j << "]" << std::endl;
00741 
00742       // Input Parameters
00743       dmsq = GetDmsq( i );
00744       sinsq = GetSinsq( j );
00745       dmsqbar = dmsq;
00746       sinsqbar = sinsq;
00747 
00748       if( fFitDmsq     || fFixDmsq     ) dmsq     = seedDmsq;
00749       if( fFitDmsqBar  || fFixDmsqBar  ) dmsqbar  = seedDmsqBar;
00750       if( fFitSinsq    || fFixSinsq    ) sinsq    = seedSinsq;
00751       if( fFitSinsqBar || fFixSinsqBar ) sinsqbar = seedSinsqBar;
00752 
00753       // Run Fit
00754       this->RunFit( dmsq, sinsq,
00755                     dmsqbar, sinsqbar,
00756                     norm, ncbkg,
00757                     shwen, trken,
00758                     dm, ds,
00759                     dmbar, dsbar,
00760                     LnL );
00761 
00762       hInputDmsq->SetBinContent( j+1, i+1, dmsq );
00763       hInputSinsq->SetBinContent( j+1, i+1, sinsq );
00764       hInputDmsqBar->SetBinContent( j+1, i+1, dmsqbar );
00765       hInputSinsqBar->SetBinContent( j+1, i+1, sinsqbar );
00766 
00767       hDmsq->SetBinContent( j+1, i+1, dmsq+dm );
00768       hSinsq->SetBinContent( j+1, i+1, sinsq+ds );
00769       hDmsqBar->SetBinContent( j+1, i+1, dmsqbar+dmbar );
00770       hSinsqBar->SetBinContent( j+1, i+1, sinsqbar+dsbar );
00771      
00772       hNorm->SetBinContent( j+1, i+1, norm);
00773       hNCBkg->SetBinContent( j+1, i+1, ncbkg);
00774       hShwEn->SetBinContent( j+1, i+1, shwen);
00775       hTrkEn->SetBinContent( j+1, i+1, trken);
00776 
00777       hLnL->SetBinContent( j+1, i+1, LnL );
00778       hLnLTotal->SetBinContent( j+1, i+1, LnL );
00779 
00780       // Best Fit
00781       if( LnL<minLnL ){
00782         ibest = i; 
00783         jbest = j;
00784         minLnL = LnL;
00785       }
00786 
00787     }
00788   }
00789 
00790   
00791   // Best Fit Oscillations
00792   // =====================
00793   if( ibest>=0 && jbest>=0 ){
00794  
00795     dmsqBestFit = hLnL->GetYaxis()->GetBinCenter( ibest+1 );
00796     sinsqBestFit = hLnL->GetXaxis()->GetBinCenter( jbest+1 );
00797 
00798     for( Int_t i=0; i<hLnL->GetYaxis()->GetNbins(); i++ ){
00799       for( Int_t j=0; j<hLnL->GetXaxis()->GetNbins(); j++ ){    
00800         Double_t myLnL = hLnL->GetBinContent( j+1, i+1 );
00801         hLnL->SetBinContent( j+1, i+1, myLnL - minLnL );
00802       }
00803     }
00804 
00805     dmsq0 = hInputDmsq->GetBinContent( jbest+1, ibest+1 );
00806     sinsq0 = hInputSinsq->GetBinContent( jbest+1, ibest+1 );
00807     dmsqbar0 = hInputDmsqBar->GetBinContent( jbest+1, ibest+1 );
00808     sinsqbar0 = hInputSinsqBar->GetBinContent( jbest+1, ibest+1 );
00809 
00810     dmsq = hDmsq->GetBinContent( jbest+1, ibest+1 );
00811     sinsq = hSinsq->GetBinContent( jbest+1, ibest+1 );
00812     dmsqbar = hDmsqBar->GetBinContent( jbest+1, ibest+1 );
00813     sinsqbar = hSinsqBar->GetBinContent( jbest+1, ibest+1 );
00814 
00815     norm  = hNorm->GetBinContent( jbest+1, ibest+1 );
00816     ncbkg = hNCBkg->GetBinContent( jbest+1, ibest+1 );
00817     shwen = hShwEn->GetBinContent( jbest+1, ibest+1 );
00818     trken = hTrkEn->GetBinContent( jbest+1, ibest+1 );
00819 
00820     std::cout << " *** Fitter::RunOscFit() *** " << std::endl;
00821     std::cout << "   OSC FIT RESULTS: " << std::endl;
00822     std::cout << "    seed parameters: " << std::endl;
00823     std::cout << "     dmsq="; if( fFitDmsq || fFixDmsq )  std::cout << seedDmsq; else std::cout << "n/a"; 
00824         std::cout << " sinsq="; if( fFitSinsq || fFixSinsq ) std::cout << seedSinsq; else std::cout << "n/a";
00825         std::cout << std::endl;
00826     std::cout << "     dmsqbar="; if( fFitDmsqBar || fFixDmsqBar )  std::cout << seedDmsqBar; else std::cout << "n/a"; 
00827         std::cout << " sinsqbar="; if( fFitSinsqBar || fFixSinsqBar ) std::cout << seedSinsqBar; else std::cout << "n/a";
00828         std::cout << std::endl;
00829     std::cout << "     norm=" << fSeedNorm << " ncbkg=" << fSeedNCBkg << std::endl;
00830     std::cout << "     shwen=" << fSeedShwEn << " trken=" << fSeedTrkEn << std::endl;
00831     std::cout << "    best fit oscilation grid point: " << std::endl;  
00832     std::cout << "     dmsq=" << dmsq0 << " sinsq=" << sinsq0 << std::endl;
00833     std::cout << "     dmsqbar=" << dmsqbar0 << " sinsqbar=" << sinsqbar0 << std::endl;   
00834     std::cout << "    best fit parameters: " << std::endl; 
00835     std::cout << "     dmsq=" << dmsq << " sinsq=" << sinsq << std::endl;
00836     std::cout << "     dmsqbar=" << dmsqbar << " sinsqbar=" << sinsqbar << std::endl;
00837     std::cout << "     norm=" << norm << " ncbkg=" << ncbkg << std::endl;
00838     std::cout << "     shwen=" << shwen << " trken=" << trken << std::endl; 
00839     std::cout << "    goodness of fit: " << std::endl;
00840     std::cout << "     LnLbest=" << minLnL << std::endl;   
00841 
00842     // Write Best Fit Point
00843     if( fWriteTemplates ){
00844 
00845       TString filename = fOutFile;
00846       TString tag = ".osc.bestfit";
00847   
00848       if( filename.EndsWith(".root") )  
00849         filename.Insert(filename.Length()-5,tag);
00850       else filename.Append(tag);
00851     
00852       TemplateWriter::Instance()->WriteToFile( dmsq,sinsq,
00853                                                dmsqbar,sinsqbar,
00854                                                norm,ncbkg,
00855                                                shwen,trken,
00856                                                filename.Data() );
00857     }
00858   }
00859 
00860 
00861   // Gaussian 2-parameter C.L.
00862   // -------------------------
00863   TH2D* hLnL68 = (TH2D*)(hLnL->Clone("hLnL68")); 
00864   hLnL68->SetContour(1);
00865   hLnL68->SetContourLevel(0,fLnL68);
00866 
00867   TH2D* hLnL90 = (TH2D*)(hLnL->Clone("hLnL90"));
00868   hLnL90->SetContour(1);
00869   hLnL90->SetContourLevel(0,fLnL90);
00870 
00871   TH2D* hLnL99 = (TH2D*)(hLnL->Clone("hLnL99"));
00872   hLnL99->SetContour(1);
00873   hLnL99->SetContourLevel(0,fLnL99);
00874 
00875 
00876   // Best Fit Marker
00877   // ---------------
00878   TMarker* marker = new TMarker(sinsqBestFit,dmsqBestFit,20);
00879   marker->SetMarkerColor(1);
00880   marker->SetMarkerSize(1.2);
00881 
00882 
00883   // Write Output Histograms
00884   // =======================
00885   if( 1 // always write this file...
00886    || fWriteContours ){
00887     TString filename = fOutFile;
00888     TString tag = ".osc.output";
00889   
00890     if( filename.EndsWith(".root") )
00891       filename.Insert(filename.Length()-5,tag);
00892     else filename.Append(tag);
00893 
00894     std::cout << " *** Fitter::WriteContours() *** " << std::endl;
00895     std::cout << "   Writing Contours to File: " << filename.Data() << std::endl;
00896 
00897     TDirectory* tmpd = gDirectory;
00898     TFile* file = new TFile(filename.Data(),"recreate");
00899 
00900     hInputDmsq->Write();
00901     hInputSinsq->Write();
00902     hInputDmsqBar->Write();
00903     hInputSinsqBar->Write();  
00904 
00905     hDmsq->Write(); 
00906     hSinsq->Write();
00907     hDmsqBar->Write();
00908     hSinsqBar->Write();
00909     hNorm->Write();
00910     hNCBkg->Write();
00911     hShwEn->Write();
00912     hTrkEn->Write();
00913 
00914     hLnL->Write();
00915     hLnLTotal->Write();
00916     hLnL68->Write();
00917     hLnL90->Write();
00918     hLnL99->Write();
00919 
00920     marker->Write("bestfit");
00921 
00922     file->Close();
00923     tmpd->cd();
00924   }
00925 
00926   return;
00927 }

void OscFit::Fitter::SeedOscillationsFromBestFit ( Bool_t  yesno = 1  )  [inline]

Definition at line 76 of file Fitter.h.

References fSeedFromBestFit, fSeedOscillationsFromBestFit, and fSeedSystematicsFromBestFit.

00076                                                          {
00077       fSeedOscillationsFromBestFit = yesno;
00078       if( fSeedOscillationsFromBestFit==1 ) fSeedFromBestFit = 1;
00079       else if( fSeedSystematicsFromBestFit==0 ) fSeedFromBestFit = 0;
00080     }

void OscFit::Fitter::SeedSystematicsFromBestFit ( Bool_t  yesno = 1  )  [inline]

Definition at line 82 of file Fitter.h.

References fSeedFromBestFit, fSeedOscillationsFromBestFit, and fSeedSystematicsFromBestFit.

00082                                                         {
00083       fSeedSystematicsFromBestFit = yesno;
00084       if( fSeedSystematicsFromBestFit==1 ) fSeedFromBestFit = 1;
00085       else if( fSeedOscillationsFromBestFit==0 ) fSeedFromBestFit = 0;
00086     }

void OscFit::Fitter::SeedSystematicsFromLastFit ( Bool_t  yesno = 1  )  [inline]

Definition at line 88 of file Fitter.h.

References fSeedSystematicsFromLastFit.

00088                                                         {
00089       fSeedSystematicsFromLastFit = yesno;
00090     }

void OscFit::Fitter::SetDebug ( Bool_t  yesno = 1  )  [inline]

Definition at line 373 of file Fitter.h.

References fDebug.

00373                                       {
00374       fDebug = yesno;
00375     }

void OscFit::Fitter::SetFileName ( const char *  filename  )  [inline]

Definition at line 18 of file Fitter.h.

References fOutFile.

00018                                              {
00019       fOutFile = filename;
00020     }

void OscFit::Fitter::SetInputNCBkg ( Double_t  ncbkg  )  [inline]

Definition at line 140 of file Fitter.h.

References fInputForExptNCBkg.

Referenced by SetInputSystematics().

00140                                          {
00141       fInputForExptNCBkg = ncbkg;
00142     }

void OscFit::Fitter::SetInputNorm ( Double_t  norm  )  [inline]

Definition at line 136 of file Fitter.h.

References fInputForExptNorm.

Referenced by SetInputSystematics().

00136                                        {
00137       fInputForExptNorm = norm;
00138     }

void OscFit::Fitter::SetInputNuBarOscillations ( Double_t  dmsqbar,
Double_t  sinsqbar 
) [inline]

Definition at line 126 of file Fitter.h.

References fInputForExptDmsqBar, and fInputForExptSinsqBar.

Referenced by SetInputOscillations().

00126                                                                           {
00127       fInputForExptDmsqBar = dmsqbar; fInputForExptSinsqBar = sinsqbar; 
00128     }

void OscFit::Fitter::SetInputNuOscillations ( Double_t  dmsq,
Double_t  sinsq 
) [inline]

Definition at line 122 of file Fitter.h.

References fInputForExptDmsq, and fInputForExptSinsq.

Referenced by SetInputOscillations().

00122                                                                  {
00123       fInputForExptDmsq = dmsq; fInputForExptSinsq = sinsq; 
00124     }

void OscFit::Fitter::SetInputOscillations ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar 
) [inline]

Definition at line 116 of file Fitter.h.

References SetInputNuBarOscillations(), and SetInputNuOscillations().

00117                                                                      {
00118       SetInputNuOscillations( dmsq, sinsq );
00119       SetInputNuBarOscillations( dmsqbar, sinsqbar );
00120     }

void OscFit::Fitter::SetInputOscillations ( Double_t  dmsq,
Double_t  sinsq 
) [inline]

Definition at line 112 of file Fitter.h.

00112                                                                {
00113       SetInputOscillations( dmsq, sinsq, dmsq, sinsq );
00114     }

void OscFit::Fitter::SetInputShwEn ( Double_t  shwen  )  [inline]

Definition at line 144 of file Fitter.h.

References fInputForExptShwEn.

Referenced by SetInputSystematics().

00144                                         {
00145       fInputForExptShwEn = shwen;
00146     }

void OscFit::Fitter::SetInputSystematics ( Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken 
) [inline]

Definition at line 130 of file Fitter.h.

References SetInputNCBkg(), SetInputNorm(), SetInputShwEn(), and SetInputTrkEn().

00131                                                               {
00132       SetInputNorm( norm );   SetInputNCBkg( ncbkg );
00133       SetInputShwEn( shwen ); SetInputTrkEn( trken );
00134     }

void OscFit::Fitter::SetInputTrkEn ( Double_t  trken  )  [inline]

Definition at line 148 of file Fitter.h.

References fInputForExptTrkEn.

Referenced by SetInputSystematics().

00148                                         {
00149       fInputForExptTrkEn = trken;
00150     }  

void OscFit::Fitter::SetMockData (  )  [inline]

Definition at line 62 of file Fitter.h.

References fMockData, and fMockDataWithFluctuations.

00062                        { 
00063       fMockData = 1; 
00064       fMockDataWithFluctuations = 0;
00065     }

void OscFit::Fitter::SetMockDataWithFluctuations (  )  [inline]

Definition at line 67 of file Fitter.h.

References fMockData, and fMockDataWithFluctuations.

00067                                        {
00068       fMockData = 1;
00069       fMockDataWithFluctuations = 1;
00070     }

void OscFit::Fitter::SetSeed ( Int_t  seed = -1  ) 
void Fitter::SetSeedFromBestFit (  ) 

Definition at line 1443 of file Fitter.cxx.

References BuildExpt(), fDebug, fFitDmsq, fFitDmsqBar, fFitSinsq, fFitSinsqBar, fFixDmsq, fFixDmsqBar, fFixSinsq, fFixSinsqBar, fForceCPT, fLastNCBkg, fLastNorm, fLastShwEn, fLastTrkEn, fSeedDmsq, fSeedDmsqBar, fSeedNCBkg, fSeedNorm, fSeedOscillationsFromBestFit, fSeedShwEn, fSeedSinsq, fSeedSinsqBar, fSeedSystematicsFromBestFit, fSeedTrkEn, RunFit(), and TouchExpt().

Referenced by SetSeedParameters().

01444 {
01445   std::cout << " *** Fitter::SetSeedFromBestFit() *** " << std::endl;
01446 
01447   // Build Experiments
01448   // =================
01449   if( this->TouchExpt()==0 ){
01450     this->BuildExpt();
01451   }
01452 
01453   // Input Oscillations
01454   // ==================
01455   Double_t seedDmsq = fSeedDmsq;
01456   Double_t seedSinsq = fSeedSinsq;
01457   Double_t seedDmsqBar = fSeedDmsqBar;
01458   Double_t seedSinsqBar = fSeedSinsqBar;
01459 
01460   if( fForceCPT ){
01461     seedDmsqBar = seedDmsq;
01462     seedSinsqBar = seedSinsq;
01463   }
01464 
01465   // Run Oscillation Fit
01466   // ===================  
01467   Double_t dm = 0.0;
01468   Double_t ds = 0.0;
01469   Double_t dmbar = 0.0;
01470   Double_t dsbar = 0.0;
01471 
01472   Double_t norm = 0.0;
01473   Double_t ncbkg = 0.0;
01474   Double_t shwen = 0.0;
01475   Double_t trken = 0.0;
01476 
01477   Double_t LnL = 0.0; 
01478 
01479   Bool_t saveDmsq     = fFitDmsq;
01480   Bool_t saveSinsq    = fFitSinsq;
01481   Bool_t saveDmsqBar  = fFitDmsqBar;
01482   Bool_t saveSinsqBar = fFitSinsqBar;
01483 
01484   if( fFixDmsq==0 )     fFitDmsq     = 1;
01485   if( fFixDmsqBar==0 )  fFitDmsqBar  = 1;
01486   if( fFixSinsq==0 )    fFitSinsq    = 1;
01487   if( fFixSinsqBar==0 ) fFitSinsqBar = 1;
01488 
01489   this->RunFit( seedDmsq, seedSinsq,
01490                 seedDmsqBar, seedSinsqBar,
01491                 norm, ncbkg, shwen, trken,
01492                 dm, ds, dmbar, dsbar,
01493                 LnL );
01494 
01495   fFitDmsq     = saveDmsq;
01496   fFitSinsq    = saveSinsq;
01497   fFitDmsqBar  = saveDmsqBar;
01498   fFitSinsqBar = saveSinsqBar;
01499 
01500   // Set Seed Systematics
01501   // ====================  
01502   if( fDebug ){
01503     std::cout << " --- Seeding Fit --- " << std::endl;
01504     std::cout << "  Seed Parameters (From Input): " << std::endl; 
01505     std::cout << "   (Dmsq,Sinsq)=(" << fSeedDmsq << "," << fSeedSinsq << ") " << std::endl;
01506     std::cout << "   (DmsqBar,SinsqBar)=(" << fSeedDmsqBar << "," << fSeedSinsqBar << ") " << std::endl;  
01507     std::cout << "   (Norm,NCBkg)=(" << fSeedNorm << "," << fSeedNCBkg << ") " << std::endl;
01508     std::cout << "   (ShwEn,TrkEn)=(" << fSeedShwEn << "," << fSeedTrkEn << ")" << std::endl;
01509   }
01510 
01511   if( fSeedOscillationsFromBestFit ){
01512     fSeedDmsq     = seedDmsq     + dm;
01513     fSeedSinsq    = seedSinsq    + ds;
01514     fSeedDmsqBar  = seedDmsqBar  + dmbar;
01515     fSeedSinsqBar = seedSinsqBar + dsbar;
01516   }
01517 
01518   if( fSeedSystematicsFromBestFit ){
01519     fSeedNorm  = norm;
01520     fSeedNCBkg = ncbkg;
01521     fSeedShwEn = shwen;
01522     fSeedTrkEn = trken;
01523   }
01524 
01525   // save these results
01526   fLastNorm  = fSeedNorm;
01527   fLastNCBkg = fSeedNCBkg;
01528   fLastShwEn = fSeedShwEn;
01529   fLastTrkEn = fSeedTrkEn;
01530 
01531   return;
01532 }

void OscFit::Fitter::SetSeedNCBkg ( Double_t  ncbkg  )  [inline]

Definition at line 187 of file Fitter.h.

References fInputForSeedNCBkg, and fSeedNCBkg.

Referenced by SetSeedSystematics().

00187                                         {
00188       fInputForSeedNCBkg = ncbkg; 
00189       fSeedNCBkg = fInputForSeedNCBkg;
00190     }

void OscFit::Fitter::SetSeedNorm ( Double_t  norm  )  [inline]

Definition at line 182 of file Fitter.h.

References fInputForSeedNorm, and fSeedNorm.

Referenced by SetSeedSystematics().

00182                                       {
00183       fInputForSeedNorm = norm; 
00184       fSeedNorm = fInputForSeedNorm;
00185     }

void OscFit::Fitter::SetSeedNuBarOscillations ( Double_t  dmsqbar,
Double_t  sinsqbar 
) [inline]

Definition at line 169 of file Fitter.h.

References fInputForSeedDmsqBar, fInputForSeedSinsqBar, fSeedDmsqBar, and fSeedSinsqBar.

Referenced by SetSeedOscillations().

00169                                                                          {
00170       fInputForSeedDmsqBar = dmsqbar; 
00171       fInputForSeedSinsqBar = sinsqbar; 
00172       fSeedDmsqBar = fInputForSeedDmsqBar; 
00173       fSeedSinsqBar = fInputForSeedSinsqBar;
00174     }

void OscFit::Fitter::SetSeedNuOscillations ( Double_t  dmsq,
Double_t  sinsq 
) [inline]

Definition at line 162 of file Fitter.h.

References fInputForSeedDmsq, fInputForSeedSinsq, fSeedDmsq, and fSeedSinsq.

Referenced by SetSeedOscillations().

00162                                                                 {
00163       fInputForSeedDmsq = dmsq; 
00164       fInputForSeedSinsq = sinsq; 
00165       fSeedDmsq = fInputForSeedDmsq; 
00166       fSeedSinsq = fInputForSeedSinsq;
00167     }

void OscFit::Fitter::SetSeedOscillations ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar 
) [inline]

Definition at line 156 of file Fitter.h.

References SetSeedNuBarOscillations(), and SetSeedNuOscillations().

00157                                                                     {
00158       SetSeedNuOscillations( dmsq, sinsq );
00159       SetSeedNuBarOscillations( dmsqbar, sinsqbar );
00160     }

void OscFit::Fitter::SetSeedOscillations ( Double_t  dmsq,
Double_t  sinsq 
) [inline]

Definition at line 152 of file Fitter.h.

00152                                                               {
00153       SetSeedOscillations( dmsq, sinsq, dmsq, sinsq );
00154     }

void Fitter::SetSeedParameters (  ) 

Definition at line 1408 of file Fitter.cxx.

References fDebug, fInputForSeedDmsq, fInputForSeedDmsqBar, fInputForSeedNCBkg, fInputForSeedNorm, fInputForSeedShwEn, fInputForSeedSinsq, fInputForSeedSinsqBar, fInputForSeedTrkEn, fLastNCBkg, fLastNorm, fLastShwEn, fLastTrkEn, fSeedDmsq, fSeedDmsqBar, fSeedFromBestFit, fSeedNCBkg, fSeedNorm, fSeedShwEn, fSeedSinsq, fSeedSinsqBar, fSeedTrkEn, and SetSeedFromBestFit().

Referenced by RunCptFit(), RunFit(), and RunOscFit().

01409 {
01410   std::cout << " *** Fitter::SetSeedParameters() *** " << std::endl;
01411 
01412   fSeedDmsq     = fInputForSeedDmsq;
01413   fSeedSinsq    = fInputForSeedSinsq;
01414   fSeedDmsqBar  = fInputForSeedDmsqBar;
01415   fSeedSinsqBar = fInputForSeedSinsqBar;
01416   fSeedNorm     = fInputForSeedNorm;
01417   fSeedNCBkg    = fInputForSeedNCBkg;
01418   fSeedShwEn    = fInputForSeedShwEn;
01419   fSeedTrkEn    = fInputForSeedTrkEn;
01420 
01421   if( fSeedFromBestFit ){
01422     this->SetSeedFromBestFit();
01423   }
01424 
01425   if( fDebug ){
01426     std::cout << " --- Seeding Fit --- " << std::endl;
01427     std::cout << "  Seed Parameters: " << std::endl; 
01428     std::cout << "   (Dmsq,Sinsq)=(" << fSeedDmsq << "," << fSeedSinsq << ") " << std::endl;
01429     std::cout << "   (DmsqBar,SinsqBar)=(" << fSeedDmsqBar << "," << fSeedSinsqBar << ") " << std::endl;  
01430     std::cout << "   (Norm,NCBkg)=(" << fSeedNorm << "," << fSeedNCBkg << ") " << std::endl;
01431     std::cout << "   (ShwEn,TrkEn)=(" << fSeedShwEn << "," << fSeedTrkEn << ")" << std::endl;
01432   }
01433 
01434   // save these results
01435   fLastNorm  = fSeedNorm;
01436   fLastNCBkg = fSeedNCBkg;
01437   fLastShwEn = fSeedShwEn;
01438   fLastTrkEn = fSeedTrkEn;
01439 
01440   return;
01441 }

void OscFit::Fitter::SetSeedShwEn ( Double_t  shwen  )  [inline]

Definition at line 192 of file Fitter.h.

References fInputForSeedShwEn, and fSeedShwEn.

Referenced by SetSeedSystematics().

00192                                        {
00193       fInputForSeedShwEn = shwen; 
00194       fSeedShwEn = fInputForSeedShwEn;
00195     }

void OscFit::Fitter::SetSeedSystematics ( Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken 
) [inline]

Definition at line 176 of file Fitter.h.

References SetSeedNCBkg(), SetSeedNorm(), SetSeedShwEn(), and SetSeedTrkEn().

00177                                                              {
00178       SetSeedNorm( norm );   SetSeedNCBkg( ncbkg );
00179       SetSeedShwEn( shwen ); SetSeedTrkEn( trken );
00180     }

void OscFit::Fitter::SetSeedTrkEn ( Double_t  trken  )  [inline]

Definition at line 197 of file Fitter.h.

References fInputForSeedTrkEn, and fSeedTrkEn.

Referenced by SetSeedSystematics().

00197                                        {
00198       fInputForSeedTrkEn = trken; 
00199       fSeedTrkEn = fInputForSeedTrkEn;
00200     }  

void OscFit::Fitter::SwitchOffFluctuationsOnSystematics (  )  [inline]

Definition at line 72 of file Fitter.h.

References fSwitchOffFluctuationsOnSystematics.

00072                                               {
00073       fSwitchOffFluctuationsOnSystematics = 1;
00074     }

Bool_t Fitter::TouchExpt (  ) 

Definition at line 538 of file Fitter.cxx.

References fTemplateArrayExpt, and OscFit::TemplateArray::TouchTemplates().

Referenced by RunCptFit(), RunFit(), RunOscFit(), and SetSeedFromBestFit().

00539 {
00540   return fTemplateArrayExpt->TouchTemplates();
00541 }

void OscFit::Fitter::UseCCData (  )  [inline]

Definition at line 274 of file Fitter.h.

References fFitFHCNQ.

00275     {
00276       fFitFHCNQ = 1;
00277     }

void OscFit::Fitter::UseNuBarData (  )  [inline]

Definition at line 279 of file Fitter.h.

References fFitFHCPQ.

00280     {
00281       fFitFHCPQ = 1;
00282     }

void OscFit::Fitter::UseRHCData (  )  [inline]

Definition at line 284 of file Fitter.h.

References fFitRHCPQ.

00285     {
00286       fFitRHCPQ = 1;
00287     }

void OscFit::Fitter::ViolateCPT (  )  [inline]

Definition at line 38 of file Fitter.h.

References ForceCPT().

00038 { ForceCPT(0); }

void OscFit::Fitter::WriteContours ( Int_t  npts = 150  )  [inline]

Definition at line 381 of file Fitter.h.

References fNumPoints, and fWriteContours.

00381                                           {
00382       if( npts>0 ){
00383         fWriteContours = 1;
00384         fNumPoints     = npts;
00385       }
00386       else{
00387         fWriteContours = 0;
00388       }
00389     }

void Fitter::WriteExpt (  ) 

Definition at line 508 of file Fitter.cxx.

References fOutFile, fTemplateArrayExpt, and Instance().

00509 {
00510   std::cout << " *** Fitter::WriteExpt() *** " << std::endl;
00511   
00512   TString filename = fOutFile;
00513   TString tag = ".expt";
00514 
00515   if( filename.EndsWith(".root") ){
00516     filename.Insert(filename.Length()-5,tag);
00517   }
00518   else{
00519     filename.Append(tag);
00520   }
00521 
00522   return TemplateWriter::Instance()->WriteToFile(fTemplateArrayExpt,
00523                                                  filename.Data());
00524 }

void OscFit::Fitter::WriteTemplates ( Bool_t  yesno = 1  )  [inline]

Definition at line 377 of file Fitter.h.

References fWriteTemplates.

00377                                             {
00378       fWriteTemplates = yesno;
00379     }


Member Data Documentation

Definition at line 538 of file Fitter.h.

Referenced by CombineResBinsInFit(), Fitter(), and GetLnL().

Definition at line 592 of file Fitter.h.

Referenced by Fitter(), get_counter(), itr(), and reset_counter().

Bool_t OscFit::Fitter::fDebug [private]

Definition at line 548 of file Fitter.h.

Referenced by Fitter(), RunFit(), SetDebug(), SetSeedFromBestFit(), and SetSeedParameters().

Definition at line 570 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 572 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 571 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 573 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 565 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Definition at line 567 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Definition at line 536 of file Fitter.h.

Referenced by Fitter(), GetLnL(), GetLnLNoRes(), PrintSettings(), and RelaxDmsqBoundary().

Definition at line 539 of file Fitter.h.

Referenced by ExcludeRAFBins(), Fitter(), GetLnL(), GetLnLNoRes(), and PrintSettings().

Bool_t OscFit::Fitter::fFitDmsq [private]
Bool_t OscFit::Fitter::fFitDmsqBar [private]
Bool_t OscFit::Fitter::fFitFHCNQ [private]
Bool_t OscFit::Fitter::fFitFHCPQ [private]
Bool_t OscFit::Fitter::fFitNCBkg [private]
Bool_t OscFit::Fitter::fFitNorm [private]
Bool_t OscFit::Fitter::fFitRHCNQ [private]
Bool_t OscFit::Fitter::fFitRHCPQ [private]
Bool_t OscFit::Fitter::fFitShwEn [private]

Definition at line 517 of file Fitter.h.

Referenced by FitReducedSystematics(), FitSystematics(), Fitter(), PrintSettings(), ResetFit(), and RunFit().

Bool_t OscFit::Fitter::fFitSinsq [private]
Bool_t OscFit::Fitter::fFitSinsqBar [private]

Definition at line 579 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Definition at line 581 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Definition at line 584 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 583 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 585 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 580 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Definition at line 582 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Definition at line 586 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fFitTrkEn [private]

Definition at line 518 of file Fitter.h.

Referenced by FitReducedSystematics(), FitSystematics(), Fitter(), PrintSettings(), ResetFit(), and RunFit().

Bool_t OscFit::Fitter::fFixDmsq [private]
Bool_t OscFit::Fitter::fFixDmsqBar [private]
Bool_t OscFit::Fitter::fFixSinsq [private]
Bool_t OscFit::Fitter::fFixSinsqBar [private]

Definition at line 484 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputNuOscillations().

Definition at line 486 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputNuBarOscillations().

Definition at line 489 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputNCBkg().

Definition at line 488 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputNorm().

Definition at line 490 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputShwEn().

Definition at line 485 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputNuOscillations().

Definition at line 487 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputNuBarOscillations().

Definition at line 491 of file Fitter.h.

Referenced by BuildExptFromMC(), Fitter(), PrintSettings(), and SetInputTrkEn().

Definition at line 475 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedNuOscillations(), and SetSeedParameters().

Definition at line 477 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedNuBarOscillations(), and SetSeedParameters().

Definition at line 480 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedNCBkg(), and SetSeedParameters().

Definition at line 479 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedNorm(), and SetSeedParameters().

Definition at line 481 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedParameters(), and SetSeedShwEn().

Definition at line 476 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedNuOscillations(), and SetSeedParameters().

Definition at line 478 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedNuBarOscillations(), and SetSeedParameters().

Definition at line 482 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), SetSeedParameters(), and SetSeedTrkEn().

Double_t OscFit::Fitter::fLastNCBkg [private]

Definition at line 503 of file Fitter.h.

Referenced by Fitter(), RunFit(), SetSeedFromBestFit(), and SetSeedParameters().

Double_t OscFit::Fitter::fLastNorm [private]

Definition at line 502 of file Fitter.h.

Referenced by Fitter(), RunFit(), SetSeedFromBestFit(), and SetSeedParameters().

Double_t OscFit::Fitter::fLastShwEn [private]

Definition at line 504 of file Fitter.h.

Referenced by Fitter(), RunFit(), SetSeedFromBestFit(), and SetSeedParameters().

Double_t OscFit::Fitter::fLastTrkEn [private]

Definition at line 505 of file Fitter.h.

Referenced by Fitter(), RunFit(), SetSeedFromBestFit(), and SetSeedParameters().

Double_t OscFit::Fitter::fLnL68 [private]

Definition at line 459 of file Fitter.h.

Referenced by Fitter(), RunContours(), RunCptFit(), and RunOscFit().

Double_t OscFit::Fitter::fLnL90 [private]

Definition at line 460 of file Fitter.h.

Referenced by Fitter(), RunContours(), RunCptFit(), and RunOscFit().

Double_t OscFit::Fitter::fLnL90_1D [private]

Definition at line 462 of file Fitter.h.

Referenced by Fitter(), and RunContours().

Double_t OscFit::Fitter::fLnL99 [private]

Definition at line 461 of file Fitter.h.

Referenced by Fitter(), RunCptFit(), and RunOscFit().

Bool_t OscFit::Fitter::fMaskDmsq [private]

Definition at line 520 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fMaskDmsqBar [private]

Definition at line 522 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fMaskNCBkg [private]

Definition at line 525 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fMaskNorm [private]

Definition at line 524 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fMaskShwEn [private]

Definition at line 526 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fMaskSinsq [private]

Definition at line 521 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 523 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fMaskTrkEn [private]

Definition at line 527 of file Fitter.h.

Referenced by Fitter(), and RunFit().

TMinuit* OscFit::Fitter::fMinuit [private]

Definition at line 455 of file Fitter.h.

Referenced by Fitter(), RunContours(), RunFit(), and ~Fitter().

Definition at line 457 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Bool_t OscFit::Fitter::fMockData [private]

Definition at line 575 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 574 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Int_t OscFit::Fitter::fNumPoints [private]

Definition at line 557 of file Fitter.h.

Referenced by Fitter(), RunContours(), and WriteContours().

TString OscFit::Fitter::fOutFile [private]

Definition at line 559 of file Fitter.h.

Referenced by Fitter(), RunContours(), RunCptFit(), RunFit(), RunOscFit(), SetFileName(), and WriteExpt().

Definition at line 534 of file Fitter.h.

Referenced by AddPenaltyTerms(), Fitter(), GetLnL(), GetLnLNoRes(), PenaltyTermsOff(), and PrintSettings().

Double_t OscFit::Fitter::fSeedDmsq [private]
Double_t OscFit::Fitter::fSeedDmsqBar [private]
Double_t OscFit::Fitter::fSeedNCBkg [private]
Double_t OscFit::Fitter::fSeedNorm [private]
Double_t OscFit::Fitter::fSeedShwEn [private]
Double_t OscFit::Fitter::fSeedSinsq [private]
Double_t OscFit::Fitter::fSeedSinsqBar [private]

Definition at line 531 of file Fitter.h.

Referenced by Fitter(), PrintSettings(), RunFit(), and SeedSystematicsFromLastFit().

Double_t OscFit::Fitter::fSeedTrkEn [private]

Definition at line 576 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 566 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Definition at line 568 of file Fitter.h.

Referenced by Fitter(), RunContours(), and RunFit().

Int_t OscFit::Fitter::fSinsqBins [private]

Definition at line 550 of file Fitter.h.

Referenced by BuildGrid(), Fitter(), GetSinsq(), GetSinsqBins(), and PrintSettings().

Double_t OscFit::Fitter::fSinsqMax [private]

Definition at line 552 of file Fitter.h.

Referenced by BuildGrid(), Fitter(), GetSinsq(), GetSinsqMax(), and PrintSettings().

Double_t OscFit::Fitter::fSinsqMin [private]

Definition at line 551 of file Fitter.h.

Referenced by BuildGrid(), Fitter(), GetSinsq(), GetSinsqMin(), and PrintSettings().

Definition at line 453 of file Fitter.h.

Definition at line 468 of file Fitter.h.

Referenced by Fitter(), and ~Fitter().

Definition at line 464 of file Fitter.h.

Referenced by Fitter(), GetLnL(), and GetLnLNoRes().

Definition at line 465 of file Fitter.h.

Referenced by Fitter(), GetLnL(), GetLnLNoRes(), and ~Fitter().

Definition at line 577 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Bool_t OscFit::Fitter::fUseSimplex [private]

Definition at line 541 of file Fitter.h.

Referenced by Fitter(), and RunFit().

Definition at line 555 of file Fitter.h.

Referenced by Fitter(), RunCptFit(), RunFit(), RunOscFit(), and WriteContours().

Definition at line 554 of file Fitter.h.

Referenced by Fitter(), RunCptFit(), RunFit(), RunOscFit(), and WriteTemplates().


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

Generated on 3 Dec 2018 for loon by  doxygen 1.6.1