OscFit::ExternalDataInterface Class Reference

#include <ExternalDataInterface.h>

List of all members.

Public Member Functions

void LoadData (External_t datatype, const char *filename)
Double_t GetLikelihood (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP)
Double_t GetPenaltyTerms (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP)
void ApplyPenaltyTerms (Bool_t yesno=true)
void Reset ()
void CalcProfileDeltaCP ()
void CalcProfileSinsq23 ()
void CalcProfileDmsq ()
void FitDmsq (Bool_t fitme=true)
void FitSinsq23 (Bool_t fitme=true)
void FitSinsq13 (Bool_t fitme=true)
void FitDeltaCP (Bool_t fitme=true)
void itr ()
void reset_counter ()
Int_t get_counter ()

Static Public Member Functions

static ExternalDataInterfaceInstance ()

Public Attributes

Double_t fDmsq
Double_t fSinsq23
Double_t fSinsq13
Double_t fDeltaCP
Double_t fOutputLnL
Bool_t fFittingDmsq
Bool_t fFittingSinsq23
Bool_t fFittingSinsq13
Bool_t fFittingDeltaCP

Private Member Functions

 ExternalDataInterface ()
 ~ExternalDataInterface ()
void CleanUp ()
void RunFitWithMinuit (Bool_t fitNormalHierarchy, Bool_t fitLowerOctant)
void RunFitWithMinuitStep1 ()
void RunFitWithMinuitStep2 ()
void RunFitWithMinuitStep3 ()

Private Attributes

Bool_t fPenaltyTerms
std::map< Int_t, ExternalData * > fDataMap
Bool_t fDebug
Bool_t fUseSimplex
Bool_t fMaskDmsq
Bool_t fMaskSinsq23
Bool_t fMaskSinsq13
Bool_t fMaskDeltaCP
Bool_t fFitDmsq
Bool_t fFitSinsq23
Bool_t fFitSinsq13
Bool_t fFitDeltaCP
Bool_t fExternalDmsq
Bool_t fExternalSinsq23
Bool_t fExternalSinsq13
Bool_t fFitLowerOctant
Bool_t fFitNormalHierarchy
Double_t fSeedDmsq
Double_t fSeedSinsq23
Double_t fSeedSinsq13
Double_t fSeedDeltaCP
Double_t fBestFitDmsq
Double_t fBestFitSinsq23
Double_t fBestFitSinsq13
Double_t fBestFitDeltaCP
Double_t fBestFitLnL
Int_t fCtr
Int_t fMinuitStatus
TMinuit * fMinuit

Detailed Description

Definition at line 14 of file ExternalDataInterface.h.


Constructor & Destructor Documentation

ExternalDataInterface::ExternalDataInterface (  )  [private]

Definition at line 48 of file ExternalDataInterface.cxx.

References fBestFitDeltaCP, fBestFitDmsq, fBestFitLnL, fBestFitSinsq13, fBestFitSinsq23, fDebug, fDeltaCP, fDmsq, fExternalDmsq, fExternalSinsq13, fExternalSinsq23, fFitDeltaCP, fFitDmsq, fFitLowerOctant, fFitNormalHierarchy, fFitSinsq13, fFitSinsq23, fFittingDeltaCP, fFittingDmsq, fFittingSinsq13, fFittingSinsq23, fMaskDeltaCP, fMaskDmsq, fMaskSinsq13, fMaskSinsq23, fMinuit, fMinuitStatus, fOutputLnL, fPenaltyTerms, fSeedDeltaCP, fSeedDmsq, fSeedSinsq13, fSeedSinsq23, fSinsq13, fSinsq23, and fUseSimplex.

Referenced by Instance().

00049 { 
00050   fMaskDmsq    = 1;
00051   fMaskSinsq23 = 1;
00052   fMaskSinsq13 = 1;
00053   fMaskDeltaCP = 1;
00054 
00055   fFitDmsq    = 0;
00056   fFitSinsq23 = 0;
00057   fFitSinsq13 = 0;
00058   fFitDeltaCP = 0;
00059 
00060   fExternalDmsq = 0;
00061   fExternalSinsq23 = 0;
00062   fExternalSinsq13 = 0;
00063 
00064   fFittingDmsq    = 0;
00065   fFittingSinsq23 = 0;
00066   fFittingSinsq13 = 0;
00067   fFittingDeltaCP = 0;
00068 
00069   fFitLowerOctant = 0;
00070   fFitNormalHierarchy = 0;
00071 
00072   fDmsq    = 0.0;
00073   fSinsq23 = 0.0;
00074   fSinsq13 = 0.0;
00075   fDeltaCP = 0.0;
00076   fOutputLnL = 0.0;
00077 
00078   fBestFitDmsq = 0.0;
00079   fBestFitSinsq23 = 0.0;
00080   fBestFitSinsq13 = 0.0;
00081   fBestFitDeltaCP = 0.0;
00082   fBestFitLnL = 0.0;
00083 
00084   fSeedDmsq    = 2.40e-3;
00085   fSeedSinsq23 = 0.41; 
00086   fSeedSinsq13 = 0.0242;
00087   fSeedDeltaCP = TMath::Pi();
00088 
00089   fMinuit = new TMinuit();
00090   fMinuit->SetPrintLevel(-1);
00091   fMinuit->SetMaxIterations(5000);
00092 
00093   fMinuitStatus = 999;
00094 
00095   fPenaltyTerms = false; 
00096 
00097   fUseSimplex = false;
00098 
00099   fDebug = false;
00100 }

ExternalDataInterface::~ExternalDataInterface (  )  [private]

Definition at line 102 of file ExternalDataInterface.cxx.

References CleanUp(), and fMinuit.

00103 {
00104   delete fMinuit;
00105 
00106   this->CleanUp();
00107 }


Member Function Documentation

void OscFit::ExternalDataInterface::ApplyPenaltyTerms ( Bool_t  yesno = true  )  [inline]

Definition at line 26 of file ExternalDataInterface.h.

References fPenaltyTerms.

00026 { fPenaltyTerms = yesno; }

void ExternalDataInterface::CalcProfileDeltaCP (  ) 

Definition at line 436 of file ExternalDataInterface.cxx.

References fBestFitDmsq, fBestFitLnL, fBestFitSinsq13, fBestFitSinsq23, fExternalDmsq, fExternalSinsq13, fExternalSinsq23, fFitDeltaCP, fFitDmsq, fFitSinsq13, fFitSinsq23, fSeedDeltaCP, and RunFitWithMinuit().

00437 {
00438   std::cout << " *** ExternalDataInterface::CalcProfileDeltaCP() *** " << std::endl;
00439 
00440   Bool_t saveFitDmsq    = fFitDmsq;
00441   Bool_t saveFitSinsq23 = fFitSinsq23;
00442   Bool_t saveFitSinsq13 = fFitSinsq13;
00443   Bool_t saveFitDeltaCP = fFitDeltaCP;
00444 
00445   Bool_t saveExternalDmsq = fExternalDmsq;
00446   Bool_t saveExternalSinsq23 = fExternalSinsq23;
00447   Bool_t saveExternalSinsq13 = fExternalSinsq13;
00448 
00449   Double_t saveSeedDeltaCP = fSeedDeltaCP;
00450 
00451   fFitDmsq    = true;
00452   fFitSinsq23 = true;
00453   fFitSinsq13 = true;
00454   fFitDeltaCP = false;
00455 
00456   fExternalDmsq = true;
00457   fExternalSinsq23 = true;
00458   fExternalSinsq13 = true;
00459 
00460 
00461   Int_t nDeltaCP = 65;
00462   Double_t minDeltaCP = 0.0;
00463   Double_t maxDeltaCP = 2.0*TMath::Pi();
00464 
00465   TH1D* hLnL_Normal_Lower = new TH1D("hLnL_vs_DeltaCP_Normal_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00466   TH1D* hLnL_Normal_Higher = new TH1D("hLnL_vs_DeltaCP_Normal_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP);
00467   TH1D* hLnL_Inverted_Lower = new TH1D("hLnL_vs_DeltaCP_Inverted_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00468   TH1D* hLnL_Inverted_Higher = new TH1D("hLnL_vs_DeltaCP_Inverted_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP);
00469 
00470   TH1D* hDmsq_Normal_Lower = new TH1D("hDmsq_vs_DeltaCP_Normal_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00471   TH1D* hDmsq_Normal_Higher = new TH1D("hDmsq_vs_DeltaCP_Normal_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP);
00472   TH1D* hDmsq_Inverted_Lower = new TH1D("hDmsq_vs_DeltaCP_Inverted_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00473   TH1D* hDmsq_Inverted_Higher = new TH1D("hDmsq_vs_DeltaCP_Inverted_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP);
00474 
00475   TH1D* hSinsq23_Normal_Lower = new TH1D("hSinsq23_vs_DeltaCP_Normal_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00476   TH1D* hSinsq23_Normal_Higher = new TH1D("hSinsq23_vs_DeltaCP_Normal_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP);
00477   TH1D* hSinsq23_Inverted_Lower = new TH1D("hSinsq23_vs_DeltaCP_Inverted_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00478   TH1D* hSinsq23_Inverted_Higher = new TH1D("hSinsq23_vs_DeltaCP_Inverted_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP); 
00479 
00480   TH1D* hSinsq13_Normal_Lower = new TH1D("hSinsq13_vs_DeltaCP_Normal_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00481   TH1D* hSinsq13_Normal_Higher = new TH1D("hSinsq13_vs_DeltaCP_Normal_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP);
00482   TH1D* hSinsq13_Inverted_Lower = new TH1D("hSinsq13_vs_DeltaCP_Inverted_Lower","",nDeltaCP,minDeltaCP,maxDeltaCP);
00483   TH1D* hSinsq13_Inverted_Higher = new TH1D("hSinsq13_vs_DeltaCP_Inverted_Higher","",nDeltaCP,minDeltaCP,maxDeltaCP);
00484 
00485  
00486   for ( Int_t iDeltaCP=0; iDeltaCP<nDeltaCP; iDeltaCP++ ){
00487     fSeedDeltaCP = minDeltaCP + ((double)iDeltaCP/(double)(nDeltaCP-1))*(maxDeltaCP-minDeltaCP);
00488 
00489     this->RunFitWithMinuit(true,true);
00490     hLnL_Normal_Lower->SetBinContent(iDeltaCP+1, fBestFitLnL);
00491     hDmsq_Normal_Lower->SetBinContent(iDeltaCP+1, fBestFitDmsq);
00492     hSinsq23_Normal_Lower->SetBinContent(iDeltaCP+1, fBestFitSinsq23);
00493     hSinsq13_Normal_Lower->SetBinContent(iDeltaCP+1, fBestFitSinsq13);
00494 
00495     this->RunFitWithMinuit(true,false);
00496     hLnL_Normal_Higher->SetBinContent(iDeltaCP+1, fBestFitLnL);
00497     hDmsq_Normal_Higher->SetBinContent(iDeltaCP+1, fBestFitDmsq);
00498     hSinsq23_Normal_Higher->SetBinContent(iDeltaCP+1, fBestFitSinsq23);
00499     hSinsq13_Normal_Higher->SetBinContent(iDeltaCP+1, fBestFitSinsq13);
00500 
00501     this->RunFitWithMinuit(false,true);
00502     hLnL_Inverted_Lower->SetBinContent(iDeltaCP+1, fBestFitLnL);
00503     hDmsq_Inverted_Lower->SetBinContent(iDeltaCP+1, fBestFitDmsq);
00504     hSinsq23_Inverted_Lower->SetBinContent(iDeltaCP+1, fBestFitSinsq23);
00505     hSinsq13_Inverted_Lower->SetBinContent(iDeltaCP+1, fBestFitSinsq13);
00506 
00507     this->RunFitWithMinuit(false,false);
00508     hLnL_Inverted_Higher->SetBinContent(iDeltaCP+1, fBestFitLnL);
00509     hDmsq_Inverted_Higher->SetBinContent(iDeltaCP+1, fBestFitDmsq);
00510     hSinsq23_Inverted_Higher->SetBinContent(iDeltaCP+1, fBestFitSinsq23);
00511     hSinsq13_Inverted_Higher->SetBinContent(iDeltaCP+1, fBestFitSinsq13);
00512   }
00513 
00514 
00515   TDirectory* tmpd = gDirectory;
00516   TFile* file = new TFile("LikelihoodProfileDeltaCP.root","recreate");
00517 
00518   hLnL_Normal_Lower->Write();
00519   hDmsq_Normal_Lower->Write();
00520   hSinsq23_Normal_Lower->Write();
00521   hSinsq13_Normal_Lower->Write();
00522   
00523   hLnL_Normal_Higher->Write();
00524   hDmsq_Normal_Higher->Write();
00525   hSinsq23_Normal_Higher->Write();
00526   hSinsq13_Normal_Higher->Write();
00527 
00528   hLnL_Inverted_Lower->Write();
00529   hDmsq_Inverted_Lower->Write();
00530   hSinsq23_Inverted_Lower->Write();
00531   hSinsq13_Inverted_Lower->Write();
00532   
00533   hLnL_Inverted_Higher->Write();
00534   hDmsq_Inverted_Higher->Write();
00535   hSinsq23_Inverted_Higher->Write();
00536   hSinsq13_Inverted_Higher->Write();
00537 
00538   file->Close();
00539   gDirectory = tmpd;
00540 
00541 
00542   fFitDmsq    = saveFitDmsq;
00543   fFitSinsq23 = saveFitSinsq23;
00544   fFitSinsq13 = saveFitSinsq13;
00545   fFitDeltaCP = saveFitDeltaCP;
00546 
00547   fExternalDmsq = saveExternalDmsq;
00548   fExternalSinsq23 = saveExternalSinsq23;
00549   fExternalSinsq13 = saveExternalSinsq13;
00550 
00551   fSeedDeltaCP = saveSeedDeltaCP;
00552 }

void ExternalDataInterface::CalcProfileDmsq (  ) 

Definition at line 647 of file ExternalDataInterface.cxx.

References fBestFitDeltaCP, fBestFitLnL, fBestFitSinsq13, fBestFitSinsq23, fExternalDmsq, fExternalSinsq13, fExternalSinsq23, fFitDeltaCP, fFitDmsq, fFitSinsq13, fFitSinsq23, fSeedDmsq, and RunFitWithMinuit().

00648 {
00649   std::cout << " *** ExternalDataInterface::CalcProfileDmsq() *** " << std::endl;
00650 
00651   Bool_t saveFitDmsq    = fFitDmsq;
00652   Bool_t saveFitSinsq23 = fFitSinsq23;
00653   Bool_t saveFitSinsq13 = fFitSinsq13;
00654   Bool_t saveFitDeltaCP = fFitDeltaCP;
00655 
00656   Bool_t saveExternalDmsq = fExternalDmsq;
00657   Bool_t saveExternalSinsq23 = fExternalSinsq23;
00658   Bool_t saveExternalSinsq13 = fExternalSinsq13;
00659 
00660   Double_t saveSeedDmsq = fSeedDmsq;
00661 
00662   fFitDmsq    = false;
00663   fFitSinsq23 = true;
00664   fFitSinsq13 = true;
00665   fFitDeltaCP = true;
00666 
00667   fExternalDmsq = false;
00668   fExternalSinsq23 = true;
00669   fExternalSinsq13 = true;
00670 
00671 
00672   Int_t nDmsq = 51;
00673   Double_t minDmsq = 2.15e-3;
00674   Double_t maxDmsq = 2.65e-3;
00675 
00676   TH1D* hLnL_Normal_Lower = new TH1D("hLnL_vs_Dmsq_Normal_Lower","",nDmsq,minDmsq,maxDmsq);
00677   TH1D* hLnL_Normal_Higher = new TH1D("hLnL_vs_Dmsq_Normal_Higher","",nDmsq,minDmsq,maxDmsq);
00678   TH1D* hLnL_Inverted_Lower = new TH1D("hLnL_vs_Dmsq_Inverted_Lower","",nDmsq,minDmsq,maxDmsq);
00679   TH1D* hLnL_Inverted_Higher = new TH1D("hLnL_vs_Dmsq_Inverted_Higher","",nDmsq,minDmsq,maxDmsq);
00680 
00681   TH1D* hSinsq23_Normal_Lower = new TH1D("hSinsq23_vs_Dmsq_Normal_Lower","",nDmsq,minDmsq,maxDmsq);
00682   TH1D* hSinsq23_Normal_Higher = new TH1D("hSinsq23_vs_Dmsq_Normal_Higher","",nDmsq,minDmsq,maxDmsq);
00683   TH1D* hSinsq23_Inverted_Lower = new TH1D("hSinsq23_vs_Dmsq_Inverted_Lower","",nDmsq,minDmsq,maxDmsq);
00684   TH1D* hSinsq23_Inverted_Higher = new TH1D("hSinsq23_vs_Dmsq_Inverted_Higher","",nDmsq,minDmsq,maxDmsq); 
00685 
00686   TH1D* hSinsq13_Normal_Lower = new TH1D("hSinsq13_vs_Dmsq_Normal_Lower","",nDmsq,minDmsq,maxDmsq);
00687   TH1D* hSinsq13_Normal_Higher = new TH1D("hSinsq13_vs_Dmsq_Normal_Higher","",nDmsq,minDmsq,maxDmsq);
00688   TH1D* hSinsq13_Inverted_Lower = new TH1D("hSinsq13_vs_Dmsq_Inverted_Lower","",nDmsq,minDmsq,maxDmsq);
00689   TH1D* hSinsq13_Inverted_Higher = new TH1D("hSinsq13_vs_Dmsq_Inverted_Higher","",nDmsq,minDmsq,maxDmsq);
00690 
00691   TH1D* hDeltaCP_Normal_Lower = new TH1D("hDeltaCP_vs_Dmsq_Normal_Lower","",nDmsq,minDmsq,maxDmsq);
00692   TH1D* hDeltaCP_Normal_Higher = new TH1D("hDeltaCP_vs_Dmsq_Normal_Higher","",nDmsq,minDmsq,maxDmsq);
00693   TH1D* hDeltaCP_Inverted_Lower = new TH1D("hDeltaCP_vs_Dmsq_Inverted_Lower","",nDmsq,minDmsq,maxDmsq);
00694   TH1D* hDeltaCP_Inverted_Higher = new TH1D("hDeltaCP_vs_Dmsq_Inverted_Higher","",nDmsq,minDmsq,maxDmsq);
00695 
00696 
00697   for ( Int_t iDmsq=0; iDmsq<nDmsq; iDmsq++ ){
00698     fSeedDmsq = +(minDmsq + ((double)iDmsq/(double)(nDmsq-1))*(maxDmsq-minDmsq));
00699 
00700     this->RunFitWithMinuit(true,true);
00701     hLnL_Normal_Lower->SetBinContent(iDmsq+1, fBestFitLnL);
00702     hSinsq23_Normal_Lower->SetBinContent(iDmsq+1, fBestFitSinsq23);
00703     hSinsq13_Normal_Lower->SetBinContent(iDmsq+1, fBestFitSinsq13);
00704     hDeltaCP_Normal_Lower->SetBinContent(iDmsq+1, fBestFitDeltaCP);
00705 
00706     this->RunFitWithMinuit(true,false);
00707     hLnL_Normal_Higher->SetBinContent(iDmsq+1, fBestFitLnL);
00708     hSinsq23_Normal_Higher->SetBinContent(iDmsq+1, fBestFitSinsq23);
00709     hSinsq13_Normal_Higher->SetBinContent(iDmsq+1, fBestFitSinsq13);
00710     hDeltaCP_Normal_Higher->SetBinContent(iDmsq+1, fBestFitDeltaCP);
00711 
00712 
00713     fSeedDmsq = -(minDmsq + ((double)iDmsq/(double)(nDmsq-1))*(maxDmsq-minDmsq));
00714 
00715     this->RunFitWithMinuit(false,true);
00716     hLnL_Inverted_Lower->SetBinContent(iDmsq+1, fBestFitLnL);
00717     hSinsq23_Inverted_Lower->SetBinContent(iDmsq+1, fBestFitSinsq23);
00718     hSinsq13_Inverted_Lower->SetBinContent(iDmsq+1, fBestFitSinsq13);
00719     hDeltaCP_Inverted_Lower->SetBinContent(iDmsq+1, fBestFitDeltaCP);
00720 
00721     this->RunFitWithMinuit(false,false);
00722     hLnL_Inverted_Higher->SetBinContent(iDmsq+1, fBestFitLnL);
00723     hSinsq23_Inverted_Higher->SetBinContent(iDmsq+1, fBestFitSinsq23);
00724     hSinsq13_Inverted_Higher->SetBinContent(iDmsq+1, fBestFitSinsq13);
00725     hDeltaCP_Inverted_Higher->SetBinContent(iDmsq+1, fBestFitDeltaCP);
00726   }
00727 
00728 
00729   TDirectory* tmpd = gDirectory;
00730   TFile* file = new TFile("LikelihoodProfileDmsq.root","recreate");
00731 
00732   hLnL_Normal_Lower->Write();
00733   hSinsq23_Normal_Lower->Write();
00734   hSinsq13_Normal_Lower->Write();
00735   hDeltaCP_Normal_Lower->Write();
00736   
00737   hLnL_Normal_Higher->Write();
00738   hSinsq23_Normal_Higher->Write();
00739   hSinsq13_Normal_Higher->Write();
00740   hDeltaCP_Normal_Higher->Write();
00741 
00742   hLnL_Inverted_Lower->Write();
00743   hSinsq23_Inverted_Lower->Write();
00744   hSinsq13_Inverted_Lower->Write();
00745   hDeltaCP_Inverted_Lower->Write();
00746   
00747   hLnL_Inverted_Higher->Write();
00748   hSinsq23_Inverted_Higher->Write();
00749   hSinsq13_Inverted_Higher->Write();
00750   hDeltaCP_Inverted_Higher->Write();
00751 
00752   file->Close();
00753   gDirectory = tmpd;
00754 
00755 
00756   fFitDmsq    = saveFitDmsq;
00757   fFitSinsq23 = saveFitSinsq23;
00758   fFitSinsq13 = saveFitSinsq13;
00759   fFitDeltaCP = saveFitDeltaCP;
00760 
00761   fExternalDmsq = saveExternalDmsq;
00762   fExternalSinsq23 = saveExternalSinsq23;
00763   fExternalSinsq13 = saveExternalSinsq13;
00764 
00765   fSeedDmsq = saveSeedDmsq;
00766 }

void ExternalDataInterface::CalcProfileSinsq23 (  ) 

Definition at line 555 of file ExternalDataInterface.cxx.

References fBestFitDeltaCP, fBestFitDmsq, fBestFitLnL, fBestFitSinsq13, fExternalDmsq, fExternalSinsq13, fExternalSinsq23, fFitDeltaCP, fFitDmsq, fFitSinsq13, fFitSinsq23, fSeedSinsq23, and RunFitWithMinuit().

00556 {
00557   std::cout << " *** ExternalDataInterface::CalcProfileSinsq23() *** " << std::endl;
00558 
00559   Bool_t saveFitDmsq    = fFitDmsq;
00560   Bool_t saveFitSinsq23 = fFitSinsq23;
00561   Bool_t saveFitSinsq13 = fFitSinsq13;
00562   Bool_t saveFitDeltaCP = fFitDeltaCP;
00563 
00564   Bool_t saveExternalDmsq = fExternalDmsq;
00565   Bool_t saveExternalSinsq23 = fExternalSinsq23;
00566   Bool_t saveExternalSinsq13 = fExternalSinsq13;
00567 
00568   Double_t saveSeedSinsq23 = fSeedSinsq23;
00569 
00570   fFitDmsq    = true;
00571   fFitSinsq23 = false;
00572   fFitSinsq13 = true;
00573   fFitDeltaCP = true;
00574 
00575   fExternalDmsq = true;
00576   fExternalSinsq23 = false;
00577   fExternalSinsq13 = true;
00578 
00579 
00580   Int_t nSinsq23 = 41;
00581   Double_t minSinsq23 = 0.3;
00582   Double_t maxSinsq23 = 0.7;
00583 
00584   TH1D* hLnL_Normal = new TH1D("hLnL_vs_Sinsq23_Normal","",nSinsq23,minSinsq23,maxSinsq23);
00585   TH1D* hLnL_Inverted = new TH1D("hLnL_vs_Sinsq23_Inverted","",nSinsq23,minSinsq23,maxSinsq23);
00586 
00587   TH1D* hDmsq_Normal = new TH1D("hDmsq_vs_Sinsq23_Normal","",nSinsq23,minSinsq23,maxSinsq23);
00588   TH1D* hDmsq_Inverted = new TH1D("hDmsq_vs_Sinsq23_Inverted","",nSinsq23,minSinsq23,maxSinsq23);
00589 
00590   TH1D* hSinsq13_Normal = new TH1D("hSinsq13_vs_Sinsq23_Normal","",nSinsq23,minSinsq23,maxSinsq23);
00591   TH1D* hSinsq13_Inverted = new TH1D("hSinsq13_vs_Sinsq23_Inverted","",nSinsq23,minSinsq23,maxSinsq23);
00592 
00593   TH1D* hDeltaCP_Normal = new TH1D("hDeltaCP_vs_Sinsq23_Normal","",nSinsq23,minSinsq23,maxSinsq23);
00594   TH1D* hDeltaCP_Inverted = new TH1D("hDeltaCP_vs_Sinsq23_Inverted","",nSinsq23,minSinsq23,maxSinsq23);
00595 
00596 
00597   for ( Int_t iSinsq23=0; iSinsq23<nSinsq23; iSinsq23++ ){
00598     fSeedSinsq23 = minSinsq23 + ((double)iSinsq23/(double)(nSinsq23-1))*(maxSinsq23-minSinsq23);
00599 
00600     if( fSeedSinsq23<0.5 ) this->RunFitWithMinuit(true,true);
00601     else                   this->RunFitWithMinuit(true,false);
00602 
00603     hLnL_Normal->SetBinContent(iSinsq23+1, fBestFitLnL);
00604     hDmsq_Normal->SetBinContent(iSinsq23+1, fBestFitDmsq);
00605     hSinsq13_Normal->SetBinContent(iSinsq23+1, fBestFitSinsq13);
00606     hDeltaCP_Normal->SetBinContent(iSinsq23+1, fBestFitDeltaCP);
00607 
00608 
00609     if( fSeedSinsq23<0.5 ) this->RunFitWithMinuit(false,true);
00610     else                   this->RunFitWithMinuit(false,false);
00611     hLnL_Inverted->SetBinContent(iSinsq23+1, fBestFitLnL);
00612     hDmsq_Inverted->SetBinContent(iSinsq23+1, fBestFitDmsq);
00613     hSinsq13_Inverted->SetBinContent(iSinsq23+1, fBestFitSinsq13);
00614     hDeltaCP_Inverted->SetBinContent(iSinsq23+1, fBestFitDeltaCP);
00615   }
00616 
00617 
00618   TDirectory* tmpd = gDirectory;
00619   TFile* file = new TFile("LikelihoodProfileSinsq23.root","recreate");
00620 
00621   hLnL_Normal->Write();
00622   hDmsq_Normal->Write();
00623   hSinsq13_Normal->Write();
00624   hDeltaCP_Normal->Write();
00625 
00626   hLnL_Inverted->Write();
00627   hDmsq_Inverted->Write();
00628   hSinsq13_Inverted->Write();
00629   hDeltaCP_Inverted->Write();
00630 
00631   file->Close();
00632   gDirectory = tmpd;
00633 
00634 
00635   fFitDmsq    = saveFitDmsq;
00636   fFitSinsq23 = saveFitSinsq23;
00637   fFitSinsq13 = saveFitSinsq13;
00638   fFitDeltaCP = saveFitDeltaCP;
00639 
00640   fExternalDmsq = saveExternalDmsq;
00641   fExternalSinsq23 = saveExternalSinsq23;
00642   fExternalSinsq13 = saveExternalSinsq13;
00643 
00644   fSeedSinsq23 = saveSeedSinsq23;
00645 }

void ExternalDataInterface::CleanUp (  )  [private]

Definition at line 114 of file ExternalDataInterface.cxx.

References fDataMap.

Referenced by Reset(), and ~ExternalDataInterface().

00115 {
00116   std::map<Int_t,ExternalData*>::iterator Iter = fDataMap.begin();
00117 
00118   for( ; Iter!=fDataMap.end(); Iter++ ){
00119     ExternalData* myData = Iter->second;
00120     if( myData ) delete myData;
00121   }
00122 
00123   fDataMap.clear();
00124 }

void OscFit::ExternalDataInterface::FitDeltaCP ( Bool_t  fitme = true  )  [inline]

Definition at line 69 of file ExternalDataInterface.h.

References fFitDeltaCP.

00070     {
00071       fFitDeltaCP = fitme;
00072     }

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

Definition at line 54 of file ExternalDataInterface.h.

References fFitDmsq.

00055     {
00056       fFitDmsq = fitme;
00057     }

void OscFit::ExternalDataInterface::FitSinsq13 ( Bool_t  fitme = true  )  [inline]

Definition at line 64 of file ExternalDataInterface.h.

References fFitSinsq13.

00065     {
00066       fFitSinsq13 = fitme;
00067     }

void OscFit::ExternalDataInterface::FitSinsq23 ( Bool_t  fitme = true  )  [inline]

Definition at line 59 of file ExternalDataInterface.h.

References fFitSinsq23.

00060     {
00061       fFitSinsq23 = fitme;
00062     }

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

Definition at line 87 of file ExternalDataInterface.h.

References fCtr.

Referenced by RunFitWithMinuitStep3().

00087 { return fCtr; }

Double_t ExternalDataInterface::GetLikelihood ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP 
)

Definition at line 156 of file ExternalDataInterface.cxx.

References fDataMap, fPenaltyTerms, OscFit::ExternalData::GetLikelihood(), and GetPenaltyTerms().

Referenced by ExternalLikelihoodFunction(), and RunFitWithMinuitStep3().

00157 {
00158   Double_t LnL = 0.0;
00159 
00160   std::map<Int_t,ExternalData*>::iterator Iter = fDataMap.begin();
00161 
00162   for( ; Iter!=fDataMap.end(); Iter++ ){
00163     ExternalData* myData = Iter->second;
00164     if( myData ) LnL += myData->GetLikelihood( dmsq, sinsq23, sinsq13, deltaCP );
00165   }
00166 
00167   if( fPenaltyTerms ){
00168     LnL += this->GetPenaltyTerms( dmsq, sinsq23, sinsq13, deltaCP );
00169   }
00170 
00171   return LnL;
00172 } 

Double_t ExternalDataInterface::GetPenaltyTerms ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP 
)

Definition at line 174 of file ExternalDataInterface.cxx.

References fExternalDmsq, fExternalSinsq13, fExternalSinsq23, fSeedDmsq, fSeedSinsq13, and fSeedSinsq23.

Referenced by GetLikelihood().

00175 {
00176   Double_t LnL = 0.0;
00177 
00178   if( fExternalDmsq ){
00179     Double_t Dmsq = fabs(dmsq);
00180     Double_t Dmsq0 = fabs(fSeedDmsq);
00181     Double_t SigmaDmsq = 0.10e-3;
00182 
00183     /*
00184     if( dmsq >0.0 ) Dmsq0 = 2.42e-3;
00185     else            Dmsq0 = 2.36e-3;
00186     */
00187 
00188     LnL += 0.5 * ( Dmsq - Dmsq0 ) * ( Dmsq - Dmsq0 ) / ( SigmaDmsq*SigmaDmsq );
00189   }
00190 
00191   if( fExternalSinsq23 ){
00192     Double_t SinsqTheta = sinsq23*(1.0-sinsq13);
00193     Double_t Sinsq2Theta = 4.0*SinsqTheta*(1.0-SinsqTheta);
00194     Double_t SinsqTheta0 = fSeedSinsq23*(1.0-fSeedSinsq13);
00195     Double_t Sinsq2Theta0 = 4.0*SinsqTheta0*(1.0-SinsqTheta0);
00196     Double_t SigmaSinsq2Theta = 0.035;
00197 
00198     /*
00199     SinsqTheta = sinsq23;
00200     Sinsq2Theta = 4.0*SinsqTheta*(1.0-SinsqTheta);
00201     Sinsq2Theta0 = 0.957;    
00202     */
00203 
00204     LnL += 0.5 * ( Sinsq2Theta - Sinsq2Theta0 ) * ( Sinsq2Theta - Sinsq2Theta0 ) / ( SigmaSinsq2Theta*SigmaSinsq2Theta );
00205   }
00206 
00207   if( fExternalSinsq13 ){
00208     Double_t Sinsq = sinsq13;
00209     Double_t Sinsq0 = fSeedSinsq13;
00210     Double_t SigmaSinsq = 0.0025;
00211 
00212     /*
00213     Sinsq0 = 0.0252;
00214     SigmaSinsq = 0.0033;
00215     */
00216 
00217     LnL += 0.5 * ( Sinsq - Sinsq0 ) * ( Sinsq - Sinsq0 ) / ( SigmaSinsq*SigmaSinsq );
00218   }
00219 
00220   return LnL;
00221 }

ExternalDataInterface * ExternalDataInterface::Instance (  )  [static]

Definition at line 39 of file ExternalDataInterface.cxx.

References ExternalDataInterface().

00040 {
00041   if( !fgExternalDataInterface ){
00042     fgExternalDataInterface = new ExternalDataInterface();
00043   }
00044 
00045   return fgExternalDataInterface;
00046 }

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

Definition at line 85 of file ExternalDataInterface.h.

References fCtr.

Referenced by ExternalLikelihoodFunction().

00085 { fCtr++; }

void ExternalDataInterface::LoadData ( External_t  datatype,
const char *  filename 
)

Definition at line 126 of file ExternalDataInterface.cxx.

References fDataMap, gSystem(), OscFit::kMinosNue, and OscFit::ExternalData::LoadData().

00127 { 
00128   std::cout << " *** ExternalDataInterface::LoadData(...) *** " << std::endl;
00129 
00130   if( gSystem->AccessPathName( filename ) ) { // returns kTrue if non-existent
00131     std::cout << "   Warning: failed to find " << filename << std::endl;
00132     return;
00133   }
00134 
00135   ExternalData* myData = 0;
00136   Int_t index = static_cast<Int_t>(datatype);
00137 
00138   std::map<Int_t,ExternalData*>::iterator myEntry = fDataMap.find(datatype);
00139 
00140   if( myEntry != fDataMap.end() ){
00141     myData = myEntry->second;
00142     myData->LoadData(filename);
00143   }
00144   else{
00145     if( datatype == kMinosNue ) myData = new NueData();
00146     
00147     assert( myData ); // bail out if data type is invalid
00148      
00149     myData->LoadData(filename);
00150     fDataMap.insert( std::pair<Int_t,ExternalData*>(index,myData) );
00151   } 
00152 
00153   return;
00154 }

void ExternalDataInterface::Reset (  ) 

Definition at line 109 of file ExternalDataInterface.cxx.

References CleanUp().

00110 {
00111   this->CleanUp();
00112 }

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

Definition at line 86 of file ExternalDataInterface.h.

References fCtr.

Referenced by RunFitWithMinuitStep3().

00086 { fCtr = 0; }

void ExternalDataInterface::RunFitWithMinuit ( Bool_t  fitNormalHierarchy,
Bool_t  fitLowerOctant 
) [private]

Definition at line 223 of file ExternalDataInterface.cxx.

References fBestFitDeltaCP, fBestFitDmsq, fBestFitLnL, fBestFitSinsq13, fBestFitSinsq23, fDebug, fFitLowerOctant, fFitNormalHierarchy, and RunFitWithMinuitStep1().

Referenced by CalcProfileDeltaCP(), CalcProfileDmsq(), and CalcProfileSinsq23().

00224 {
00225   if( fDebug ){ std::cout << " *** ExternalDataInterface::RunFitWithMinuitStep0() *** " << std::endl; }
00226   
00227   if( fDebug ){ std::cout << "   normalHierarchy=" << fitNormalHierarchy << " lowerOctant=" << fitLowerOctant << std::endl; }
00228   
00229   fBestFitDmsq    = 0.0;
00230   fBestFitSinsq23 = 0.0;
00231   fBestFitSinsq13 = 0.0;
00232   fBestFitDeltaCP = 0.0;
00233   fBestFitLnL     = 99999.9;
00234 
00235   fFitNormalHierarchy = fitNormalHierarchy;
00236   fFitLowerOctant     = fitLowerOctant; 
00237 
00238   this->RunFitWithMinuitStep1();
00239 }

void ExternalDataInterface::RunFitWithMinuitStep1 (  )  [private]

Definition at line 241 of file ExternalDataInterface.cxx.

References fBestFitDeltaCP, fBestFitDmsq, fBestFitLnL, fBestFitSinsq13, fBestFitSinsq23, fDebug, fDeltaCP, fDmsq, fFitLowerOctant, fFitNormalHierarchy, fOutputLnL, fSeedDeltaCP, fSeedDmsq, fSeedSinsq13, fSeedSinsq23, fSinsq13, fSinsq23, and RunFitWithMinuitStep2().

Referenced by RunFitWithMinuit().

00242 { 
00243   if( fDebug ){ std::cout << " *** ExternalDataInterface::RunFitWithMinuitStep1() *** " << std::endl; }
00244     
00245   if( fFitNormalHierarchy ) fDmsq = +std::fabs(fSeedDmsq);
00246   else                      fDmsq = -std::fabs(fSeedDmsq);
00247 
00248   if( fFitLowerOctant ) fSinsq23 = 0.5 - std::fabs(0.5-fSeedSinsq23);
00249   else                  fSinsq23 = 0.5 + std::fabs(0.5-fSeedSinsq23);
00250 
00251   fSinsq13 = fSeedSinsq13;
00252   fDeltaCP = fSeedDeltaCP;
00253 
00254   fOutputLnL = 99999.9;
00255 
00256   this->RunFitWithMinuitStep2();
00257 
00258   if( fOutputLnL<fBestFitLnL ){
00259     fBestFitDmsq    = fDmsq;
00260     fBestFitSinsq23 = fSinsq23;
00261     fBestFitSinsq13 = fSinsq13;
00262     fBestFitDeltaCP = fDeltaCP;
00263     fBestFitLnL     = fOutputLnL;
00264   }
00265 
00266   return;
00267 }

void ExternalDataInterface::RunFitWithMinuitStep2 (  )  [private]

Definition at line 270 of file ExternalDataInterface.cxx.

References fDebug, fMaskDeltaCP, fMaskDmsq, fMaskSinsq13, fMaskSinsq23, fMinuitStatus, fUseSimplex, and RunFitWithMinuitStep3().

Referenced by RunFitWithMinuitStep1().

00271 {
00272   if( fDebug ){ std::cout << " *** ExternalDataInterface::RunFitWithMinuitStep2() *** " << std::endl; }
00273 
00274   fMinuitStatus = 999;  
00275 
00276   fMaskDmsq     = 1;
00277   fMaskSinsq23  = 1;
00278   fMaskSinsq13  = 1;
00279   fMaskDeltaCP  = 1;
00280 
00281   if( fDebug ){ std::cout << " -*- oscillations (simplex) -*- " << std::endl; }
00282   fUseSimplex = 1;  this->RunFitWithMinuitStep3();
00283 
00284   if( fDebug ){ std::cout << " -*- oscillations (migrad) -*- " << std::endl; }
00285   fUseSimplex = 0;  this->RunFitWithMinuitStep3();
00286 
00287   return;
00288 }

void ExternalDataInterface::RunFitWithMinuitStep3 (  )  [private]

Definition at line 290 of file ExternalDataInterface.cxx.

References err(), ExternalLikelihoodFunction(), fDebug, fDeltaCP, fDmsq, fFitDeltaCP, fFitDmsq, fFitSinsq13, fFitSinsq23, fFittingDeltaCP, fFittingDmsq, fFittingSinsq13, fFittingSinsq23, fMaskDeltaCP, fMaskDmsq, fMaskSinsq13, fMaskSinsq23, fMinuit, fMinuitStatus, fOutputLnL, fSinsq13, fSinsq23, fUseSimplex, get_counter(), GetLikelihood(), and reset_counter().

Referenced by RunFitWithMinuitStep2().

00291 {
00292   if( fDebug ){ std::cout << " *** ExternalDataInterface::RunFitWithMinuitStep3() *** " << std::endl; }
00293 
00294   // default parameters
00295   Double_t dmsq    = fDmsq;
00296   Double_t sinsq23 = fSinsq23;
00297   Double_t sinsq13 = fSinsq13;
00298   Double_t deltaCP = fDeltaCP;
00299 
00300   Double_t dmsq_err    = 0.0;
00301   Double_t sinsq23_err = 0.0;
00302   Double_t sinsq13_err = 0.0;
00303   Double_t deltaCP_err = 0.0;
00304 
00305   Double_t outputLnL = this->GetLikelihood(dmsq,sinsq23,sinsq13,deltaCP);
00306 
00307 
00308   // fit parameters
00309   fFittingDmsq    = ( fMaskDmsq && fFitDmsq );
00310   fFittingSinsq23 = ( fMaskSinsq23 && fFitSinsq23 );
00311   fFittingSinsq13 = ( fMaskSinsq13 && fFitSinsq13 );
00312   fFittingDeltaCP = ( fMaskDeltaCP && fFitDeltaCP );
00313 
00314   if( fFittingDmsq    == false
00315    && fFittingSinsq23 == false
00316    && fFittingSinsq13 == false
00317    && fFittingDeltaCP == false ) {
00318     return;
00319   }
00320 
00321 
00322   // which hierarchy/octant
00323   Bool_t isNormalHierarchy = 0;
00324   Bool_t isLowerSinsq23    = 0;
00325 
00326   if( dmsq>=0.0 )    isNormalHierarchy = 1;
00327   else               isNormalHierarchy = 0;
00328 
00329   if( sinsq23<=0.5 ) isLowerSinsq23 = 1;
00330   else               isLowerSinsq23 = 0;
00331 
00332 
00333   // set up fit
00334   Int_t err   = 0;
00335   Int_t flag  = 0;
00336   Int_t npari = 0;
00337   Int_t nparx = 0;
00338   Int_t istat = 0;
00339   Double_t lnl = 0.0;
00340   Double_t fedm = 0.0;
00341   Double_t errdef = 0.0;
00342 
00343   Double_t* arglist = new Double_t[10];
00344 
00345   // Reset Counter
00346   this->reset_counter();
00347 
00348   // Reset Fit
00349   fMinuit->mncler();
00350 
00351   // Set Likelihood Function
00352   fMinuit->SetFCN( ExternalLikelihoodFunction );
00353 
00354   // Log-Likelihood
00355   arglist[0] = 0.5; // 0.5: log-likelihood function
00356                     // 1.0: chi-squared function
00357   fMinuit->mnexcm("SET STR",arglist,1,err);
00358 
00359   // Set Strategy
00360   arglist[0] = 1;  // 1: standard minimization
00361                    // 2: try to improve minimum (also: better errors)
00362   fMinuit->mnexcm("SET STR",arglist,1,err);
00363 
00364 
00365   // Set Fit Parameters
00366   if( fFittingDmsq ){
00367     if( isNormalHierarchy )  fMinuit->mnparm(0,  "dmsq",     dmsq,      0.0002,  0.0, +0.1, err); 
00368     else                     fMinuit->mnparm(0,  "dmsq",     dmsq,      0.0002, -0.1, -0.0, err); 
00369   }
00370 
00371   if( fFittingSinsq23 ){
00372     if( isLowerSinsq23 )     fMinuit->mnparm(1,  "sinsq23",  sinsq23,   0.125,   0.0, +0.5, err);
00373     else                     fMinuit->mnparm(1,  "sinsq23",  sinsq23,   0.125,  +0.5, +1.0, err);
00374   }
00375 
00376   if( fFittingSinsq13 )      fMinuit->mnparm(2,  "sinsq13",  sinsq13,   0.005,  0.0, +1.0, err);
00377 
00378   if( fFittingDeltaCP )      fMinuit->mnparm(3,  "deltaCP",  deltaCP,   0.5*TMath::Pi(), 0.0, +2.0*TMath::Pi(), err);
00379    
00380 
00381    
00382   // Run The Fit
00383   if( fUseSimplex ){
00384     if( fDebug ) std::cout << "  Fitting With Minuit (Simplex) " << std::endl;
00385     fMinuit->mnsimp(); flag = 0;
00386   }
00387   else{
00388     if( fDebug ) std::cout << "  Fitting With Minuit (Migrad) " << std::endl;
00389     flag = fMinuit->Migrad();
00390   }
00391 
00392   if( fMinuit->GetNumPars()>0 ){
00393     fMinuitStatus = flag;
00394   }
00395 
00396 
00397   // Get Fitted Parameters
00398   if( fFittingDmsq )     fMinuit->GetParameter(0,  dmsq,     dmsq_err);
00399   if( fFittingSinsq23 )  fMinuit->GetParameter(1,  sinsq23,  sinsq23_err);
00400   if( fFittingSinsq13 )  fMinuit->GetParameter(2,  sinsq13,  sinsq13_err);
00401   if( fFittingDeltaCP )  fMinuit->GetParameter(3,  deltaCP,  deltaCP_err);
00402 
00403   
00404   // get best fit log-likelihood
00405   fMinuit->mnstat(lnl,fedm,errdef,npari,nparx,istat);
00406 
00407   outputLnL = lnl;
00408 
00409   delete [] arglist;
00410 
00411 
00412   // Print Fitted Parameters
00413   if( fDebug ){
00414     std::cout << "  Iterations: " << std::endl;
00415     std::cout << "   Ctr=" << this->get_counter() << std::endl;
00416     std::cout << "  Oscillations: " << std::endl;
00417     std::cout << "   dmsq:         " << dmsq    << "\t+/-\t" << dmsq_err   << std::endl;
00418     std::cout << "   sinsq23:      " << sinsq23 << "\t+/-\t" << sinsq23_err  << std::endl;
00419     std::cout << "   sinsq13:      " << sinsq13 << "\t+/-\t" << sinsq13_err  << std::endl;
00420     std::cout << "   deltaCP:      " << deltaCP << "\t+/-\t" << deltaCP_err << std::endl;
00421     std::cout << "  Log-likelihood: " << std::endl;
00422     std::cout << "   LnL=" << outputLnL << std::endl;
00423   }
00424 
00425   // Set Fitted Parameters
00426   fDmsq      = dmsq;
00427   fSinsq23   = sinsq23;
00428   fSinsq13   = sinsq13;
00429   fDeltaCP   = deltaCP;
00430  
00431   fOutputLnL = outputLnL;
00432 
00433   return;
00434 }


Member Data Documentation

Definition at line 129 of file ExternalDataInterface.h.

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

Definition at line 42 of file ExternalDataInterface.h.

Referenced by CleanUp(), GetLikelihood(), and LoadData().

Definition at line 40 of file ExternalDataInterface.h.

Referenced by ApplyPenaltyTerms(), ExternalDataInterface(), and GetLikelihood().


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

Generated on 24 Apr 2018 for loon by  doxygen 1.6.1