AtNuOscFit Class Reference

#include <AtNuOscFit.h>

List of all members.

Public Member Functions

Int_t GetDmsqBins ()
Int_t GetDmsqBin (Double_t dmsq)
Double_t GetDmsq (Int_t ibin)
Double_t GetDmsqMin (Int_t ibin)
Double_t GetDmsqMax (Int_t ibin)
Int_t GetSinsqBins ()
Int_t GetSinsqBin (Double_t sinsq)
Double_t GetSinsq (Int_t ibin)
Double_t GetSinsqMin (Int_t ibin)
Double_t GetSinsqMax (Int_t ibin)
void AddData (const char *filename)
void AddCosmics (const char *filename)
void AddAtmosNueCC (const char *filename)
void AddAtmosNumuCC (const char *filename)
void AddAtmosNutauCC (const char *filename)
void AddAtmosNueNC (const char *filename)
void AddAtmosNumuNC (const char *filename)
void AddUpmuNueCC (const char *filename)
void AddUpmuNumuCC (const char *filename)
void AddUpmuNutauCC (const char *filename)
void AddUpmuNueNC (const char *filename)
void AddUpmuNumuNC (const char *filename)
void SetNuOscillations (Double_t dmsq, Double_t sinsq)
void SetNuBarOscillations (Double_t dmsqbar, Double_t sinsqbar)
void SetOscillations (Double_t dmsq, Double_t sinsq)
void SetOscillations (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar)
void SetBestOscillations (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar)
void SetSeedOscillations (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar)
void SetInputOscillations (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar)
void DoOscFit (Bool_t fitnu=1, Bool_t fitnubar=1)
void DoFullOscFit (Bool_t fitnu=1, Bool_t fitnubar=1)
void DoCptFit ()
void DoFullCptFit ()
void DoFullFit (Bool_t fitDmsq=1, Bool_t fitSinsq=1, Bool_t fitDmsqBar=1, Bool_t fitSinsqBar=1)
void ResetFit ()
void ForceCPT (Bool_t forceCPT=1)
void SetMockData (Bool_t mockdata=1)
void DoRandomizing (Bool_t random=1)
void SetScale (Double_t scale)
void DoNuSeparation (Bool_t nu=1)
void DoNuBarSeparation (Bool_t nubar=1)
void DoChargeSeparation (Bool_t chg=1)
void DoChargeSeparation (Bool_t nu, Bool_t nubar)
void DoParallelRunning (Bool_t parallel=1)
void ResetSystematics ()
void PrintSystematics ()
void DoInputSystematics (Bool_t dosys=1)
void DoAllSystematics (Bool_t dosys=1)
void DoSimpleSystematics (Bool_t dosys=1)
void FitAllSystematics (Bool_t dosys=1)
void FitSimpleSystematics (Bool_t dosys=1)
void FitNormalization (Bool_t dosys=1)
void FitAtmosSystematics (Bool_t nu=1, Bool_t nubar=1)
void AddPenaltyTerms (Bool_t penalty=1)
void EnforcePhysicalBoundary ()
void RelaxPhysicalBoundary ()
void DoNestedFit (Bool_t dofit=1)
void SetSysNorm (Double_t input, Double_t sigma)
void SetSysNormUpmu (Double_t input, Double_t sigma)
void SetSysUpDn (Double_t input, Double_t sigma)
void SetSysElMu (Double_t input, Double_t sigma)
void SetSysCCNC (Double_t input, Double_t sigma)
void SetSysChg (Double_t input, Double_t sigma)
void SetSysChgUpmu (Double_t input, Double_t sigma)
void SetSysSpecNu (Double_t input, Double_t sigma)
void SetSysSpecNuBar (Double_t input, Double_t sigma)
void SetSysEmuRange (Double_t input, Double_t sigma)
void SetSysEmuCurve (Double_t input, Double_t sigma)
void SetSysEshw (Double_t input, Double_t sigma)
void SetChargeWeight (Double_t weight)
void SetFileName (const char *filename)
void UseNUE (Bool_t usenue=1)
void UseCV (Bool_t lores=1, Bool_t hires=1)
void UseUPMU (Bool_t lores=1, Bool_t hires=1)
void UseAtmosLikelihood (Bool_t yesno=1)
void UseBayesLikelihood (Bool_t yesno=1)
void UseModifiedLikelihood (Bool_t yesno=1)
void UseModifiedBayesLikelihood (Bool_t yesno=1)
void UseDmsqInterpolation (Bool_t yesno=1)
void UseModifiedDmsqInterpolation (Bool_t yesno=1)
void UseLinearInterpolation (Bool_t yesno=1)
void WriteTemplates (Bool_t write=1)
void WriteSystTemplates (Bool_t write=1)
void RunWriteOscTemplates ()
void RunWriteExptTemplates ()
void RunWriteSystTemplates ()
void RunWriteFitTemplates (Bool_t oscfit=1, Bool_t cptfit=1)
void MakeHistograms ()
void WriteHistograms (Bool_t oscfit=1, Bool_t cptfit=1)
void MergeHistograms (const char *filename)
void Reset ()
void ResetExpt ()
void ResetFitter ()
void RunExpt ()
void RunExpts (Int_t nexpts=1)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &outputLnL)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &dmsqfit, Double_t &sinsqfit, Double_t &dmsqbarfit, Double_t &sinsqbarfit, Double_t &norm, Double_t &normupmu, Double_t &elmu, Double_t &ccnc, Double_t &updn, Double_t &chg, Double_t &chgupmu, Double_t &specnu, Double_t &specnubar, Double_t &emurange, Double_t &emucurve, Double_t &eshw, Double_t &outputLnL)
void RunFit (Double_t dmsq, Double_t sinsq)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t &outputLnL)
void RunFit (Double_t dmsq, Double_t sinsq, Double_t &dmsqfit, Double_t &sinsqfit, Double_t &norm, Double_t &normupmu, Double_t &elmu, Double_t &ccnc, Double_t &updn, Double_t &chg, Double_t &chgupmu, Double_t &specnu, Double_t &specnubar, Double_t &emurange, Double_t &emucurve, Double_t &eshw, Double_t &outputLnL)
void Run (Int_t imin=-1, Int_t imax=-1)
void PrintSettings ()
void Debug ()
void DebugMinuit ()
 AtNuOscFit ()
 AtNuOscFit (Int_t nX, Double_t X1, Double_t X2, Int_t nY, Double_t Y1, Double_t Y2)
 ~AtNuOscFit ()
void GetLikelihoodBase (Double_t &dLnL)
void GetLikelihood (Double_t dmsq, Double_t sinsq, Double_t &LnL)
void GetLikelihood (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &LnL)
void GetLikelihood (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &norm, Double_t &normupmu, Double_t &elmu, Double_t &ccnc, Double_t &updn, Double_t &chg, Double_t &chgupmu, Double_t &specnu, Double_t &specnubar, Double_t &emurange, Double_t &emucurve, Double_t &eshw, Double_t &fsnu, Double_t &fsnubar, Double_t &dmnu, Double_t &dmnubar, Double_t &LnL)
void GetLikelihood (Bool_t separate_charge, Bool_t use_negatives, Bool_t use_positives, AtNuOscFitTemplate *myTemplateExpt, AtNuOscFitTemplate *myTemplateFit, Double_t &LnL)
void GetLikelihood (Double_t norm, Double_t normupmu, Double_t elmu, Double_t ccnc, Double_t updn, Double_t chg, Double_t chgupmu, Double_t specnu, Double_t specnubar, Double_t emurange, Double_t emucurve, Double_t eshw, Double_t fsnu, Double_t fsnubar, Double_t dmnu, Double_t dmnubar, Double_t &f)
void GetLikelihoodMinusBase (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &norm, Double_t &normupmu, Double_t &elmu, Double_t &ccnc, Double_t &updn, Double_t &chg, Double_t &chgupmu, Double_t &specnu, Double_t &specnubar, Double_t &emurange, Double_t &emucurve, Double_t &eshw, Double_t &fsnu, Double_t &fsnubar, Double_t &dmnu, Double_t &dmnubar, Double_t &LnL)
void GetLikelihoodMinusBase (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t normupmu, Double_t elmu, Double_t ccnc, Double_t updn, Double_t chg, Double_t chgupmu, Double_t specnu, Double_t specnubar, Double_t emurange, Double_t emucurve, Double_t eshw, Double_t &LnL)
void GetExpectation (Double_t dmsq, Double_t sinsq, AtNuOscFitTemplate *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, AtNuOscFitTemplate *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t norm, Double_t normupmu, Double_t elmu, Double_t ccnc, Double_t updn, Double_t chg, Double_t chgupmu, Double_t specnu, Double_t specnubar, Double_t emurange, Double_t emucurve, Double_t eshw, Double_t fsnu, Double_t dmnu, AtNuOscFitTemplate *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t normupmu, Double_t elmu, Double_t ccnc, Double_t updn, Double_t chg, Double_t chgupmu, Double_t specnu, Double_t specnubar, Double_t emurange, Double_t emucurve, Double_t eshw, Double_t fsnu, Double_t fsnubar, Double_t dmnu, Double_t dmnubar, AtNuOscFitTemplate *&myTemplate)

Static Public Member Functions

static AtNuOscFitInstance ()
static AtNuOscFitInstance (Int_t nX, Double_t X1, Double_t X2, Int_t nY, Double_t Y1, Double_t Y2)

Public Attributes

Bool_t fDebug
Bool_t fDebugMinuit
Bool_t fForceCPT
Bool_t fUsingNorm
Bool_t fUsingNormUpmu
Bool_t fUsingUpDn
Bool_t fUsingElMu
Bool_t fUsingCCNC
Bool_t fUsingChg
Bool_t fUsingChgUpmu
Bool_t fUsingSpecNu
Bool_t fUsingSpecNuBar
Bool_t fUsingEmuRange
Bool_t fUsingEmuCurve
Bool_t fUsingEshw
Bool_t fUsingSinNu
Bool_t fUsingSinNuBar
Bool_t fUsingDmsqNu
Bool_t fUsingDmsqNuBar
Double_t fFitNorm
Double_t fFitNormUpmu
Double_t fFitElMu
Double_t fFitCCNC
Double_t fFitUpDn
Double_t fFitChg
Double_t fFitChgUpmu
Double_t fFitSpecNu
Double_t fFitSpecNuBar
Double_t fFitEmuRange
Double_t fFitEmuCurve
Double_t fFitEshw
Double_t fFitSinNu
Double_t fFitSinNuBar
Double_t fFitDmsqNu
Double_t fFitDmsqNuBar

Private Member Functions

void Initialize (Int_t nX=-1, Double_t X1=0.0, Double_t X2=0.0, Int_t nY=-1, Double_t Y1=0.0, Double_t Y2=0.0)
void ReInitialize ()
Bool_t CheckLoadTemplatesMC ()
Bool_t CheckLoadTemplatesData ()
void LoadTemplates (const char *myFileName, TObjArray *&myArray, Int_t dmsqBins=0)
void ScaleTemplates (Double_t scale)
void SnapToGrid (Double_t Dmsq, Double_t Sinsq, Int_t &DmsqBin, Int_t &SinsqBin)
void SnapToGrid (Double_t Dmsq, Double_t Sinsq, Double_t &DmsqGrid, Double_t &SinsqGrid)
void SnapToGridDmsq (Double_t Dmsq, Int_t &DmsqBin)
void SnapToGridSinsq (Double_t Sinsq, Int_t &SinsqBin)
void SnapToGridDmsq (Double_t Dmsq, Double_t &DmsqGrid)
void SnapToGridSinsq (Double_t Sinsq, Double_t &SinsqGrid)
void GetExpectation (Bool_t atmoscv, Bool_t atmosupmu, Bool_t atmosnumu, Bool_t atmosnue, Bool_t atmosnutau, Bool_t atmoscc, Bool_t atmosnc, Bool_t cosmicbkg, Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t normupmu, Double_t elmu, Double_t ccnc, Double_t updn, Double_t chg, Double_t chgupmu, Double_t specnu, Double_t specnubar, Double_t emurange, Double_t emucurve, Double_t eshw, Double_t fsnu, Double_t fsnubar, Double_t dmnu, Double_t dmnubar, AtNuOscFitTemplate *&myTemplate)
void GetExpectation (Bool_t atmoscv, Bool_t atmosupmu, Bool_t atmosnumu, Bool_t atmosnue, Bool_t atmosnutau, Bool_t atmoscc, Bool_t atmosnc, Bool_t cosmicbkg, Int_t nx, Double_t sinsq, Int_t nxbar, Double_t sinsqbar, Double_t norm, Double_t normupmu, Double_t elmu, Double_t ccnc, Double_t updn, Double_t chg, Double_t chgupmu, Double_t specnu, Double_t specnubar, Double_t emurange, Double_t emucurve, Double_t eshw, Double_t fsnu, Double_t fsnubar, AtNuOscFitTemplate *&myTemplate)
void AddToExpectation (AtNuOscFitTemplate *myTemplateInput, AtNuOscFitTemplate *&myTemplate)
void AddToExpectation (Double_t normweight, AtNuOscFitTemplate *myTemplateInput, AtNuOscFitTemplate *&myTemplate)
void AddToExpectation (Double_t normweight, Double_t upweight, Double_t downweight, Double_t negweight, Double_t posweight, Double_t specnu, Double_t specnubar, Double_t emurange, Double_t emucurve, Double_t eshw, AtNuOscFitTemplate *myTemplateInput, AtNuOscFitTemplate *&myTemplate)
void GetLikelihoodNested (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &norm, Double_t &normupmu, Double_t &elmu, Double_t &ccnc, Double_t &updn, Double_t &chg, Double_t &chgupmu, Double_t &specnu, Double_t &specnubar, Double_t &emurange, Double_t &emucurve, Double_t &eshw, Double_t &fsnu, Double_t &fsnubar, Double_t &dmnu, Double_t &dmnubar, Double_t &LnL)
void GetLikelihoodAll (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t &norm, Double_t &normupmu, Double_t &elmu, Double_t &ccnc, Double_t &updn, Double_t &chg, Double_t &chgupmu, Double_t &specnu, Double_t &specnubar, Double_t &emurange, Double_t &emucurve, Double_t &eshw, Double_t &fsnu, Double_t &fsnubar, Double_t &dmnu, Double_t &dmnubar, Double_t &LnL)
void GetLikelihoodSyst (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t inputnorm, Double_t inputnormupmu, Double_t inputelmu, Double_t inputccnc, Double_t inputupdn, Double_t inputchg, Double_t inputchgupmu, Double_t inputspecnu, Double_t inputspecnubar, Double_t inputemurange, Double_t inputemucurve, Double_t inputeshw, Double_t inputfsnu, Double_t inputfsnubar, Double_t inputdmnu, Double_t inputdmnubar, Double_t &outputnorm, Double_t &outputnormupmu, Double_t &outputelmu, Double_t &outputccnc, Double_t &outputupdn, Double_t &outputchg, Double_t &outputchgupmu, Double_t &outputspecnu, Double_t &outputspecnubar, Double_t &outputemurange, Double_t &outputemucurve, Double_t &outputeshw, Double_t &outputfsnu, Double_t &outputfsnubar, Double_t &outputdmnu, Double_t &outputdmnubar, Double_t &LnL, Bool_t &status)
void GetDeltaLikelihood (Bool_t separate_charge, Bool_t use_negatives, Bool_t use_positives, AtNuOscFitTemplate *myTemplateExpt, AtNuOscFitTemplate *myTemplateFit, Double_t &dLnL)
void GetDeltaLikelihood (Bool_t separate_charge, Bool_t use_negatives, Bool_t use_positives, AtNuOscFitHistogram *hExpt, AtNuOscFitHistogram *hFit, Double_t &dLnL)
void GetDeltaLikelihoodBayes (Bool_t separate_charge, Bool_t use_negatives, Bool_t use_positives, AtNuOscFitTemplate *myTemplateExpt, AtNuOscFitTemplate *myTemplateFit, Double_t &dLnL)
void GetDeltaLikelihoodBayes (Bool_t separate_charge, Bool_t use_negatives, Bool_t use_positives, AtNuOscFitHistogram *hExpt, AtNuOscFitHistogram *hFit, Double_t &dLnL)

Private Attributes

TObjArray * fHistData
TObjArray * fHistCosmics
TObjArray * fHistAtmosNueCC
TObjArray * fHistAtmosNumuCC
TObjArray * fHistAtmosNutauCC
TObjArray * fHistAtmosNueNC
TObjArray * fHistAtmosNumuNC
TObjArray * fHistUpmuNueCC
TObjArray * fHistUpmuNumuCC
TObjArray * fHistUpmuNutauCC
TObjArray * fHistUpmuNueNC
TObjArray * fHistUpmuNumuNC
Bool_t fDoOscFit
Bool_t fDoCptFit
Bool_t fMockData
Bool_t fDoRandomizing
Bool_t fDoParallelRunning
Bool_t fWriteTemplates
Bool_t fWriteSystTemplates
Bool_t fWriteHistograms
Bool_t fDoScaling
Double_t fScale
Int_t fNX
Double_t fX1
Double_t fX2
Int_t fNY
Double_t fY1
Double_t fY2
Double_t * fX
Double_t * fY
Double_t * fXedge
Double_t * fYedge
Bool_t fUseALL
Bool_t fUseNUE
Bool_t fUseCVLORES
Bool_t fUseCVHIRES
Bool_t fUseUPMULORES
Bool_t fUseUPMUHIRES
Bool_t fDoChargeSeparation
Bool_t fUseNegatives
Bool_t fUsePositives
Bool_t fFixNuOscillations
Bool_t fFixNuBarOscillations
Double_t fDmsqTrue
Double_t fSinsqTrue
Double_t fDmsqBarTrue
Double_t fSinsqBarTrue
Double_t fDmsqBest
Double_t fSinsqBest
Double_t fDmsqBarBest
Double_t fSinsqBarBest
Double_t fDmsqFit
Double_t fSinsqFit
Double_t fDmsqBarFit
Double_t fSinsqBarFit
Bool_t fUseBayesLikelihood
Bool_t fUseModifiedLikelihood
Bool_t fUseModifiedBayesLikelihood
Bool_t fUseDmsqInterp
Bool_t fUseModifiedDmsqInterp
Bool_t fDoScalingSystematics
Bool_t fDoEnergySystematics
Bool_t fDoInputSystematics
Bool_t fFitSystematics
Bool_t fFitSimpleSystematics
Bool_t fFitAllSystematics
Bool_t fDoNestedFit
Bool_t fAddPenaltyTerms
Bool_t fPhysicalBoundary
Bool_t fLinearInterpolation
Double_t fSigmaNorm
Double_t fSigmaNormUpmu
Double_t fSigmaUpDn
Double_t fSigmaElMu
Double_t fSigmaCCNC
Double_t fSigmaChg
Double_t fSigmaChgUpmu
Double_t fChargeWeight
Double_t fSigmaSpecNu
Double_t fSigmaSpecNuBar
Double_t fSigmaEmuRange
Double_t fSigmaEmuCurve
Double_t fSigmaEshw
Bool_t fUseNorm
Bool_t fUseNormUpmu
Bool_t fUseUpDn
Bool_t fUseElMu
Bool_t fUseCCNC
Bool_t fUseChg
Bool_t fUseChgUpmu
Bool_t fUseSpecNu
Bool_t fUseSpecNuBar
Bool_t fUseEmuRange
Bool_t fUseEmuCurve
Bool_t fUseEshw
Bool_t fUseSinNu
Bool_t fUseSinNuBar
Bool_t fUseDmsqNu
Bool_t fUseDmsqNuBar
Bool_t fMaskNorm
Bool_t fMaskNormUpmu
Bool_t fMaskUpDn
Bool_t fMaskElMu
Bool_t fMaskCCNC
Bool_t fMaskChg
Bool_t fMaskChgUpmu
Bool_t fMaskSpecNu
Bool_t fMaskSpecNuBar
Bool_t fMaskEmuRange
Bool_t fMaskEmuCurve
Bool_t fMaskEshw
Bool_t fMaskSinNu
Bool_t fMaskSinNuBar
Bool_t fMaskDmsqNu
Bool_t fMaskDmsqNuBar
Double_t fInputNorm
Double_t fInputNormUpmu
Double_t fInputUpDn
Double_t fInputElMu
Double_t fInputCCNC
Double_t fInputChg
Double_t fInputChgUpmu
Double_t fInputSpecNu
Double_t fInputSpecNuBar
Double_t fInputEmuRange
Double_t fInputEmuCurve
Double_t fInputEshw
Double_t fM0
Double_t fM1
TRandom * fRandom
TMinuit * fMinuit
Double_t * fOscFit
Double_t * fOscLnL
Double_t * fOscNorm
Double_t * fOscNormUpmu
Double_t * fOscElMu
Double_t * fOscCCNC
Double_t * fOscUpDn
Double_t * fOscChg
Double_t * fOscChgUpmu
Double_t * fOscSpecNu
Double_t * fOscSpecNuBar
Double_t * fOscEmuRange
Double_t * fOscEmuCurve
Double_t * fOscEshw
Double_t * fOscSinNu
Double_t * fOscSinNuBar
Double_t * fOscDmsqNu
Double_t * fOscDmsqNuBar
Double_t * fOscLnL_NUE
Double_t * fOscLnL_CV_LORES
Double_t * fOscLnL_CV_HIRES
Double_t * fOscLnL_CV_HIRES_SHAPE
Double_t * fOscLnL_CV_HIRES_NORM
Double_t * fOscLnL_CV_HIRES_UPDN
Double_t * fOscLnL_UPMU_HIRES
Double_t * fOscLnL_UPMU_HIRES_SHAPE
Double_t * fOscLnL_UPMU_HIRES_NORM
Double_t * fOscLnL_UPMU_HIRES_UPDN
Double_t * fOscLnL_PENALTY
Double_t * fOscLnL_STATUS
Double_t * fCptFit
Double_t * fCptLnL
Double_t * fCptNorm
Double_t * fCptNormUpmu
Double_t * fCptElMu
Double_t * fCptCCNC
Double_t * fCptUpDn
Double_t * fCptChg
Double_t * fCptChgUpmu
Double_t * fCptSpecNu
Double_t * fCptSpecNuBar
Double_t * fCptEmuRange
Double_t * fCptEmuCurve
Double_t * fCptEshw
Double_t * fCptSinNu
Double_t * fCptSinNuBar
Double_t * fCptDmsqNu
Double_t * fCptDmsqNuBar
Double_t * fCptLnL_NUE
Double_t * fCptLnL_CV_LORES
Double_t * fCptLnL_CV_HIRES
Double_t * fCptLnL_CV_HIRES_SHAPE
Double_t * fCptLnL_CV_HIRES_NORM
Double_t * fCptLnL_CV_HIRES_UPDN
Double_t * fCptLnL_UPMU_HIRES
Double_t * fCptLnL_UPMU_HIRES_SHAPE
Double_t * fCptLnL_UPMU_HIRES_NORM
Double_t * fCptLnL_UPMU_HIRES_UPDN
Double_t * fCptLnL_PENALTY
Double_t * fCptLnL_STATUS
AtNuOscFitTemplatefTemplateMCnoosc
AtNuOscFitTemplatefTemplateMCtrueosc
AtNuOscFitTemplatefTemplateMCcosmics
AtNuOscFitTemplatefTemplateMCatmosbkg
AtNuOscFitTemplatefTemplateMCsys
AtNuOscFitTemplatefTemplateExpt
AtNuOscFitTemplatefTemplateFit
AtNuOscFitTemplatefTemplateOscFit
AtNuOscFitTemplatefTemplateCptFit
AtNuOscFitTemplatefTemplateMCdmsq00
AtNuOscFitTemplatefTemplateMCdmsq01
AtNuOscFitTemplatefTemplateMCdmsq10
AtNuOscFitTemplatefTemplateMCdmsq11
AtNuOscFitInterpolationfInterpolation
TString fOscFileName
TFile * fOscFile
TTree * fOscTree
TFile * fOscResultsFile
TFile * fCptResultsFile
Double_t fLNL_NUE
Double_t fLNL_CV_LORES
Double_t fLNL_CV_HIRES
Double_t fLNL_CV_HIRES_SHAPE
Double_t fLNL_CV_HIRES_NORM
Double_t fLNL_CV_HIRES_UPDN
Double_t fLNL_UPMU_HIRES
Double_t fLNL_UPMU_HIRES_SHAPE
Double_t fLNL_UPMU_HIRES_NORM
Double_t fLNL_UPMU_HIRES_UPDN
Double_t fLNL_PENALTY
Int_t fFIT_STATUS
TH1D * hexptNorm
TH1D * hexptNormUpmu
TH1D * hexptUpDn
TH1D * hexptElMu
TH1D * hexptCCNC
TH1D * hexptChg
TH1D * hexptChgUpmu
TH1D * hexptSpecNu
TH1D * hexptSpecNuBar
TH1D * hexptEmuRange
TH1D * hexptEmuCurve
TH1D * hexptEshw
TH2D * hoscFit
TH2D * hoscBest
TH2D * hoscTrue
TH2D * hoscLnL
TH2D * hoscNorm
TH2D * hoscNormUpmu
TH2D * hoscUpDn
TH2D * hoscElMu
TH2D * hoscCCNC
TH2D * hoscChg
TH2D * hoscChgUpmu
TH2D * hoscSpecNu
TH2D * hoscSpecNuBar
TH2D * hoscEmuRange
TH2D * hoscEmuCurve
TH2D * hoscEshw
TH2D * hoscSinNu
TH2D * hoscSinNuBar
TH2D * hoscDmsqNu
TH2D * hoscDmsqNuBar
TH2D * hoscLnL_nue
TH2D * hoscLnL_cv_lores
TH2D * hoscLnL_cv_hires
TH2D * hoscLnL_cv_hires_shape
TH2D * hoscLnL_cv_hires_norm
TH2D * hoscLnL_cv_hires_updn
TH2D * hoscLnL_upmu_hires
TH2D * hoscLnL_upmu_hires_shape
TH2D * hoscLnL_upmu_hires_norm
TH2D * hoscLnL_upmu_hires_updn
TH2D * hoscLnL_penalty
TH2D * hoscLnL_status
TH1D * hoscbestNorm
TH1D * hoscbestNormUpmu
TH1D * hoscbestUpDn
TH1D * hoscbestElMu
TH1D * hoscbestCCNC
TH1D * hoscbestChg
TH1D * hoscbestChgUpmu
TH1D * hoscbestSpecNu
TH1D * hoscbestSpecNuBar
TH1D * hoscbestEmuRange
TH1D * hoscbestEmuCurve
TH1D * hoscbestEshw
TH1D * hoscbestSinNu
TH1D * hoscbestSinNuBar
TH1D * hoscbestDmsqNu
TH1D * hoscbestDmsqNuBar
TH1D * hoscbestLnL
TH2D * hcptFit
TH2D * hcptBest
TH2D * hcptTrue
TH2D * hcptLnL
TH2D * hcptNorm
TH2D * hcptNormUpmu
TH2D * hcptUpDn
TH2D * hcptElMu
TH2D * hcptCCNC
TH2D * hcptChg
TH2D * hcptChgUpmu
TH2D * hcptSpecNu
TH2D * hcptSpecNuBar
TH2D * hcptEmuRange
TH2D * hcptEmuCurve
TH2D * hcptEshw
TH2D * hcptSinNu
TH2D * hcptSinNuBar
TH2D * hcptDmsqNu
TH2D * hcptDmsqNuBar
TH2D * hcptLnL_nue
TH2D * hcptLnL_cv_lores
TH2D * hcptLnL_cv_hires
TH2D * hcptLnL_cv_hires_shape
TH2D * hcptLnL_cv_hires_norm
TH2D * hcptLnL_cv_hires_updn
TH2D * hcptLnL_upmu_hires
TH2D * hcptLnL_upmu_hires_shape
TH2D * hcptLnL_upmu_hires_norm
TH2D * hcptLnL_upmu_hires_updn
TH2D * hcptLnL_penalty
TH2D * hcptLnL_status
TH1D * hcptbestNorm
TH1D * hcptbestNormUpmu
TH1D * hcptbestUpDn
TH1D * hcptbestElMu
TH1D * hcptbestCCNC
TH1D * hcptbestChg
TH1D * hcptbestChgUpmu
TH1D * hcptbestSpecNu
TH1D * hcptbestSpecNuBar
TH1D * hcptbestEmuRange
TH1D * hcptbestEmuCurve
TH1D * hcptbestEshw
TH1D * hcptbestSinNu
TH1D * hcptbestSinNuBar
TH1D * hcptbestDmsqNu
TH1D * hcptbestDmsqNuBar
TH1D * hcptbestLnL
TMarker * oscmarker
TMarker * trueoscmarker
TMarker * cptmarker
TMarker * truecptmarker

Detailed Description

Definition at line 18 of file AtNuOscFit.h.


Constructor & Destructor Documentation

AtNuOscFit::AtNuOscFit (  ) 

Definition at line 98 of file AtNuOscFit.cxx.

References Initialize().

Referenced by Instance().

00099 {
00100   std::cout << " *** AtNuOscFit::AtNuOscFit() *** " << std::endl;
00101 
00102   this->Initialize();
00103 }

AtNuOscFit::AtNuOscFit ( Int_t  nX,
Double_t  X1,
Double_t  X2,
Int_t  nY,
Double_t  Y1,
Double_t  Y2 
)

Definition at line 105 of file AtNuOscFit.cxx.

References Initialize().

00107 {
00108   std::cout << " *** AtNuOscFit::AtNuOscFit(...) *** " << std::endl;
00109 
00110   this->Initialize(nX,X1,X2,
00111                    nY,Y1,Y2);
00112 }

AtNuOscFit::~AtNuOscFit (  ) 

Definition at line 1083 of file AtNuOscFit.cxx.

References fCptCCNC, fCptChg, fCptChgUpmu, fCptDmsqNu, fCptDmsqNuBar, fCptElMu, fCptEmuCurve, fCptEmuRange, fCptEshw, fCptFit, fCptLnL, fCptLnL_CV_HIRES, fCptLnL_CV_HIRES_NORM, fCptLnL_CV_HIRES_SHAPE, fCptLnL_CV_HIRES_UPDN, fCptLnL_CV_LORES, fCptLnL_NUE, fCptLnL_PENALTY, fCptLnL_STATUS, fCptLnL_UPMU_HIRES, fCptLnL_UPMU_HIRES_NORM, fCptLnL_UPMU_HIRES_SHAPE, fCptLnL_UPMU_HIRES_UPDN, fCptNorm, fCptNormUpmu, fCptSinNu, fCptSinNuBar, fCptSpecNu, fCptSpecNuBar, fCptUpDn, fHistAtmosNueCC, fHistAtmosNueNC, fHistAtmosNumuCC, fHistAtmosNumuNC, fHistAtmosNutauCC, fHistCosmics, fHistData, fHistUpmuNueCC, fHistUpmuNueNC, fHistUpmuNumuCC, fHistUpmuNumuNC, fHistUpmuNutauCC, fInterpolation, fMinuit, fNX, fOscCCNC, fOscChg, fOscChgUpmu, fOscDmsqNu, fOscDmsqNuBar, fOscElMu, fOscEmuCurve, fOscEmuRange, fOscEshw, fOscFit, fOscLnL, fOscLnL_CV_HIRES, fOscLnL_CV_HIRES_NORM, fOscLnL_CV_HIRES_SHAPE, fOscLnL_CV_HIRES_UPDN, fOscLnL_CV_LORES, fOscLnL_NUE, fOscLnL_PENALTY, fOscLnL_STATUS, fOscLnL_UPMU_HIRES, fOscLnL_UPMU_HIRES_NORM, fOscLnL_UPMU_HIRES_SHAPE, fOscLnL_UPMU_HIRES_UPDN, fOscNorm, fOscNormUpmu, fOscSinNu, fOscSinNuBar, fOscSpecNu, fOscSpecNuBar, fOscUpDn, fRandom, fTemplateCptFit, fTemplateExpt, fTemplateFit, fTemplateMCatmosbkg, fTemplateMCcosmics, fTemplateMCdmsq00, fTemplateMCdmsq01, fTemplateMCdmsq10, fTemplateMCdmsq11, fTemplateMCnoosc, fTemplateMCsys, fTemplateMCtrueosc, fTemplateOscFit, fX, fXedge, fY, fYedge, and n.

01084 {
01085   std::cout << " *** AtNuOscFit::~AtNuOscFit() *** " << std::endl;
01086 
01087   // delete templates
01088   // ================
01089 
01090   if( fHistData ){
01091     std::cout << "   deleting histograms for: data" << std::endl;
01092     delete [] fHistData;
01093   }
01094 
01095   if( fHistCosmics ){
01096     std::cout << "   deleting templates for: cosmics" << std::endl;
01097     delete [] fHistCosmics;
01098   }
01099 
01100   if( fHistAtmosNueCC ){
01101     std::cout << "   deleting templates for: atmos nue cc" << std::endl;
01102     delete [] fHistAtmosNueCC;
01103   }
01104 
01105   if( fHistAtmosNumuCC ){
01106     std::cout << "   deleting templates for: atmos numu cc" << std::endl;
01107     for( Int_t n=0; n<=fNX; n++ ){
01108       fHistAtmosNumuCC[n].Delete();
01109     }
01110     delete [] fHistAtmosNumuCC;
01111   }
01112 
01113   if( fHistAtmosNutauCC ){
01114     std::cout << "   deleting templates for: atmos nutau cc" << std::endl;
01115     for( Int_t n=0; n<=fNX; n++ ){
01116       fHistAtmosNutauCC[n].Delete();
01117     }
01118     delete [] fHistAtmosNutauCC;
01119   }
01120 
01121   if( fHistAtmosNueNC ){ 
01122     std::cout << "   deleting templates for: atmos nue nc" << std::endl;
01123     delete [] fHistAtmosNueNC;
01124   }
01125 
01126   if( fHistAtmosNumuNC ){ 
01127     std::cout << "   deleting templates for: atmos numu nc" << std::endl;
01128     delete [] fHistAtmosNumuNC;
01129   }
01130 
01131   if( fHistUpmuNueCC ){
01132     std::cout << "   deleting templates for: upmu nue cc" << std::endl;
01133     delete [] fHistUpmuNueCC;
01134   }
01135 
01136   if( fHistUpmuNumuCC ){
01137     std::cout << "   deleting templates for: upmu numu cc" << std::endl;
01138     for( Int_t n=0; n<=fNX; n++ ){
01139       fHistUpmuNumuCC[n].Delete();
01140     }
01141     delete [] fHistUpmuNumuCC;
01142   }
01143 
01144   if( fHistUpmuNutauCC ){
01145     std::cout << "   deleting templates for: upmu nutau cc" << std::endl;
01146     for( Int_t n=0; n<=fNX; n++ ){
01147       fHistUpmuNutauCC[n].Delete();
01148     }
01149     delete [] fHistUpmuNutauCC;
01150   }
01151 
01152   if( fHistUpmuNueNC ){
01153     std::cout << "   deleting templates for: upmu nue nc" << std::endl;
01154     delete [] fHistUpmuNueNC;
01155   }
01156 
01157   if( fHistUpmuNumuNC ){
01158     std::cout << "   deleting templates for: upmu numu nc" << std::endl;
01159     delete [] fHistUpmuNumuNC;
01160   }
01161 
01162 
01163   // delete oscillation arrays
01164   // =========================
01165   delete [] fX;
01166   delete [] fY;
01167   delete [] fXedge;
01168   delete [] fYedge;
01169 
01170   // delete TRandom
01171   // ==============
01172   delete fRandom;
01173 
01174   // delete TMinuit
01175   // =============
01176   delete fMinuit;
01177 
01178   // delete arrays
01179   // =============
01180   delete [] fOscFit;
01181   delete [] fOscLnL;
01182   delete [] fOscNorm;
01183   delete [] fOscNormUpmu;
01184   delete [] fOscElMu;
01185   delete [] fOscCCNC;
01186   delete [] fOscUpDn;
01187   delete [] fOscChg;
01188   delete [] fOscChgUpmu;
01189   delete [] fOscSpecNu;
01190   delete [] fOscSpecNuBar;
01191   delete [] fOscEmuRange;
01192   delete [] fOscEmuCurve;
01193   delete [] fOscEshw;
01194   delete [] fOscSinNu;
01195   delete [] fOscSinNuBar;
01196   delete [] fOscDmsqNu;
01197   delete [] fOscDmsqNuBar;
01198 
01199   delete [] fOscLnL_NUE;
01200   delete [] fOscLnL_CV_LORES;
01201   delete [] fOscLnL_CV_HIRES;
01202   delete [] fOscLnL_CV_HIRES_SHAPE;
01203   delete [] fOscLnL_CV_HIRES_NORM;
01204   delete [] fOscLnL_CV_HIRES_UPDN;
01205   delete [] fOscLnL_UPMU_HIRES;
01206   delete [] fOscLnL_UPMU_HIRES_SHAPE;
01207   delete [] fOscLnL_UPMU_HIRES_NORM;
01208   delete [] fOscLnL_UPMU_HIRES_UPDN;
01209   delete [] fOscLnL_PENALTY;
01210   delete [] fOscLnL_STATUS;
01211 
01212   delete [] fCptFit;
01213   delete [] fCptLnL;
01214   delete [] fCptNorm;
01215   delete [] fCptNormUpmu;
01216   delete [] fCptElMu;
01217   delete [] fCptCCNC;
01218   delete [] fCptUpDn;
01219   delete [] fCptChg;
01220   delete [] fCptChgUpmu;
01221   delete [] fCptSpecNu;
01222   delete [] fCptSpecNuBar;
01223   delete [] fCptEmuRange;
01224   delete [] fCptEmuCurve;
01225   delete [] fCptEshw;
01226   delete [] fCptSinNu;
01227   delete [] fCptSinNuBar;
01228   delete [] fCptDmsqNu;
01229   delete [] fCptDmsqNuBar;
01230 
01231   delete [] fCptLnL_NUE;
01232   delete [] fCptLnL_CV_LORES;
01233   delete [] fCptLnL_CV_HIRES;
01234   delete [] fCptLnL_CV_HIRES_SHAPE;
01235   delete [] fCptLnL_CV_HIRES_NORM;
01236   delete [] fCptLnL_CV_HIRES_UPDN;
01237   delete [] fCptLnL_UPMU_HIRES;
01238   delete [] fCptLnL_UPMU_HIRES_SHAPE;
01239   delete [] fCptLnL_UPMU_HIRES_NORM;
01240   delete [] fCptLnL_UPMU_HIRES_UPDN;
01241   delete [] fCptLnL_PENALTY;
01242   delete [] fCptLnL_STATUS;
01243 
01244   // delete templates
01245   // ================
01246   if( fTemplateMCnoosc )     delete fTemplateMCnoosc;
01247   if( fTemplateMCtrueosc )   delete fTemplateMCtrueosc;
01248   if( fTemplateMCcosmics )   delete fTemplateMCcosmics;
01249   if( fTemplateMCatmosbkg )  delete fTemplateMCatmosbkg;
01250   if( fTemplateMCsys )       delete fTemplateMCsys;
01251 
01252   if( fTemplateExpt )        delete fTemplateExpt;  
01253   if( fTemplateFit )         delete fTemplateFit;
01254   
01255   if( fTemplateOscFit )      delete fTemplateOscFit;
01256   if( fTemplateCptFit )      delete fTemplateCptFit;
01257 
01258   if( fTemplateMCdmsq00 )    delete fTemplateMCdmsq00; 
01259   if( fTemplateMCdmsq01 )    delete fTemplateMCdmsq01;
01260   if( fTemplateMCdmsq10 )    delete fTemplateMCdmsq10;
01261   if( fTemplateMCdmsq11 )    delete fTemplateMCdmsq11;
01262 
01263   delete fInterpolation;
01264 }


Member Function Documentation

void AtNuOscFit::AddAtmosNueCC ( const char *  filename  ) 

Definition at line 1286 of file AtNuOscFit.cxx.

References fHistAtmosNueCC, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01287 {
01288   std::cout << " *** AtNuOscFit::AddAtmosNueCC(...) *** " << std::endl;
01289   std::cout << "   loading templates from file: " << filename << std::endl;
01290 
01291   this->LoadTemplates(filename,fHistAtmosNueCC);
01292 
01293   return;
01294 }

void AtNuOscFit::AddAtmosNueNC ( const char *  filename  ) 

Definition at line 1316 of file AtNuOscFit.cxx.

References fHistAtmosNueNC, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01317 {
01318   std::cout << " *** AtNuOscFit::AddAtmosNueNC(...) *** " << std::endl;
01319   std::cout << "   loading templates from file: " << filename << std::endl;
01320 
01321   this->LoadTemplates(filename,fHistAtmosNueNC);
01322 
01323   return;
01324 }

void AtNuOscFit::AddAtmosNumuCC ( const char *  filename  ) 

Definition at line 1296 of file AtNuOscFit.cxx.

References fHistAtmosNumuCC, fNX, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01297 {
01298   std::cout << " *** AtNuOscFit::AddAtmosNumuCC(...) *** " << std::endl;
01299   std::cout << "   loading templates from file: " << filename << std::endl;
01300 
01301   this->LoadTemplates(filename,fHistAtmosNumuCC,fNX);
01302 
01303   return;
01304 }

void AtNuOscFit::AddAtmosNumuNC ( const char *  filename  ) 

Definition at line 1326 of file AtNuOscFit.cxx.

References fHistAtmosNumuNC, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01327 {
01328   std::cout << " *** AtNuOscFit::AddAtmosNumuNC(...) *** " << std::endl;
01329   std::cout << "   loading templates from file: " << filename << std::endl;
01330 
01331   this->LoadTemplates(filename,fHistAtmosNumuNC);
01332 
01333   return;
01334 }

void AtNuOscFit::AddAtmosNutauCC ( const char *  filename  ) 

Definition at line 1306 of file AtNuOscFit.cxx.

References fHistAtmosNutauCC, fNX, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01307 {
01308   std::cout << " *** AtNuOscFit::AddAtmosNutauCC(...) *** " << std::endl;
01309   std::cout << "   loading templates from file: " << filename << std::endl;
01310 
01311   this->LoadTemplates(filename,fHistAtmosNutauCC,fNX);
01312 
01313   return;
01314 }

void AtNuOscFit::AddCosmics ( const char *  filename  ) 

Definition at line 1276 of file AtNuOscFit.cxx.

References fHistCosmics, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01277 {
01278   std::cout << " *** AtNuOscFit::AddCosmics(...) *** " << std::endl;
01279   std::cout << "   loading templates from file: " << filename << std::endl;
01280 
01281   this->LoadTemplates(filename,fHistCosmics);
01282 
01283   return;
01284 }

void AtNuOscFit::AddData ( const char *  filename  ) 

Definition at line 1266 of file AtNuOscFit.cxx.

References fHistData, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01267 {
01268   std::cout << " *** AtNuOscFit::AddData(...) *** " << std::endl;
01269   std::cout << "   loading templates from file: " << filename << std::endl;
01270 
01271   this->LoadTemplates(filename,fHistData);
01272 
01273   return;
01274 }

void AtNuOscFit::AddPenaltyTerms ( Bool_t  penalty = 1  )  [inline]

Definition at line 203 of file AtNuOscFit.h.

References fAddPenaltyTerms.

Referenced by AtNuOscFitInterface::Initialize().

00203                                           {
00204     fAddPenaltyTerms = penalty;
00205   }

void AtNuOscFit::AddToExpectation ( Double_t  normweight,
Double_t  upweight,
Double_t  downweight,
Double_t  negweight,
Double_t  posweight,
Double_t  specnu,
Double_t  specnubar,
Double_t  emurange,
Double_t  emucurve,
Double_t  eshw,
AtNuOscFitTemplate myTemplateInput,
AtNuOscFitTemplate *&  myTemplate 
) [private]

Definition at line 2432 of file AtNuOscFit.cxx.

References AtNuOscFitHistogram::Add(), fDoEnergySystematics, fInterpolation, fUseCVHIRES, fUseCVLORES, fUseNUE, fUseUPMUHIRES, AtNuOscFitTemplate::GetBins(), AtNuOscFitTemplate::GetHistogram(), AtNuOscFitTemplate::GetMax(), AtNuOscFitTemplate::GetMin(), AtNuOscFitInterpolation::Interpolate(), AtNuTemplateType::kAtmosMC, AtNuResolutionEventType::kCV, AtNuResolutionType::kHiRes1, AtNuResolutionType::kHiRes2, AtNuResolutionType::kHiRes3, AtNuResolutionType::kHiRes4, AtNuResolutionType::kLoRes, AtNuResolutionEventType::kNUE, and AtNuResolutionEventType::kUPMU.

02433 {
02434   // sanity check
02435   if( myTemplateInput==0 ){
02436     std::cout << " *** AtNuOscFit::AddToExpectation(...) *** " << std::endl;
02437     std::cout << "   error: no input templates... " << std::endl;
02438     return;
02439   }
02440 
02441   // create template if necessary
02442   if( myTemplate==0 ){
02443     Int_t ebins = myTemplateInput->GetBins();
02444     Double_t emin = myTemplateInput->GetMin();
02445     Double_t emax = myTemplateInput->GetMax();
02446     myTemplate = new AtNuOscFitTemplate(AtNuTemplateType::kAtmosMC,ebins,emin,emax);
02447   }
02448 
02449   // return if weight is zero (or negative)
02450   if( normweight<=0 ){
02451     return;
02452   }
02453 
02454   // internal histograms
02455   // ===================
02456   AtNuOscFitHistogram* myHistogramNUE  = 0;
02457   AtNuOscFitHistogram* myHistogramNUMU = 0;
02458   AtNuOscFitHistogram* myHistogramCV1  = 0;
02459   AtNuOscFitHistogram* myHistogramCV2  = 0;
02460   AtNuOscFitHistogram* myHistogramCV3  = 0;
02461   AtNuOscFitHistogram* myHistogramCV4  = 0;
02462   AtNuOscFitHistogram* myHistogramUP1  = 0;
02463   AtNuOscFitHistogram* myHistogramUP2  = 0;
02464   AtNuOscFitHistogram* myHistogramUP3  = 0;
02465   AtNuOscFitHistogram* myHistogramUP4  = 0;
02466 
02467   AtNuOscFitHistogram* myHistogramP2   = 0;
02468   AtNuOscFitHistogram* myHistogramP1   = 0;
02469   AtNuOscFitHistogram* myHistogram00   = 0;
02470   AtNuOscFitHistogram* myHistogramM1   = 0;
02471   AtNuOscFitHistogram* myHistogramM2   = 0;
02472 
02473   // number of systematics
02474   // =====================
02475   Int_t Nsys = 0;
02476 
02477   if( fDoEnergySystematics ){
02478     Nsys = 5;
02479   }
02480 
02481   Nsys += 1;
02482 
02483   // loop over systematics
02484   // =====================
02485   for( Int_t ndir=-1; ndir<=+1; ndir++ ){
02486     for( Int_t nchg=-1; nchg<=+1; nchg++ ){
02487       for( Int_t isys = 0; isys<Nsys; isys++ ){
02488 
02489         // flux weight
02490         // ===========
02491         Double_t fluxweight = normweight;
02492         if( ndir==-1 ) fluxweight *= downweight; 
02493         if( ndir==+1 ) fluxweight *= upweight;
02494         if( nchg==-1 ) fluxweight *= negweight;
02495         if( nchg==+1 ) fluxweight *= posweight;
02496 
02497         // systematic shift
02498         // ================
02499         Double_t isigma = 0.0;
02500         if( isys==0 ) isigma = 0.0;
02501         if( isys==1 ) isigma = specnu;
02502         if( isys==2 ) isigma = specnubar;
02503         if( isys==3 ) isigma = emurange;
02504         if( isys==4 ) isigma = emucurve;
02505         if( isys==5 ) isigma = eshw;
02506 
02507         Double_t weight_p2 = 0.0;
02508         Double_t weight_p1 = 0.0;
02509         Double_t weight_00 = 0.0;
02510         Double_t weight_m1 = 0.0;
02511         Double_t weight_m2 = 0.0;
02512 
02513         if( isys>0 ){
02514 
02515           // get interpolation weights
02516           fInterpolation->Interpolate(isigma,
02517                                       weight_m2,
02518                                       weight_m1,
02519                                       weight_00,
02520                                       weight_p1,
02521                                       weight_p2);
02522 
02523           weight_00 -= 1.0; // only add residual         
02524         }
02525 
02526         // Electron Neutrinos
02527         // ==================
02528         if( fUseNUE ){ 
02529 
02530           // (0) NUE::LORES
02531           myHistogramNUE = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kNUE,
02532                                                                             AtNuResolutionType::kLoRes));
02533 
02534           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kNUE,
02535                                                                                 AtNuResolutionType::kLoRes,
02536                                                                                  ndir,nchg,isys,+2));
02537           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kNUE,
02538                                                                                 AtNuResolutionType::kLoRes,
02539                                                                                  ndir,nchg,isys,+1));
02540           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kNUE,
02541                                                                                 AtNuResolutionType::kLoRes,
02542                                                                                  ndir,nchg,isys,0));
02543           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kNUE,
02544                                                                                 AtNuResolutionType::kLoRes,
02545                                                                                  ndir,nchg,isys,-1));
02546           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kNUE,
02547                                                                                 AtNuResolutionType::kLoRes,
02548                                                                                  ndir,nchg,isys,-2));
02549           if( isys==0 
02550            && myHistogram00 ){
02551             myHistogramNUE->Add(myHistogram00,fluxweight);
02552           }
02553           else if( isys>0 
02554            && myHistogram00
02555            && myHistogramP2 && myHistogramP1
02556            && myHistogramM1 && myHistogramM2 ){
02557             myHistogramNUE->Add(myHistogramP2,fluxweight*weight_p2);
02558             myHistogramNUE->Add(myHistogramP1,fluxweight*weight_p1);
02559             myHistogramNUE->Add(myHistogram00,fluxweight*weight_00);
02560             myHistogramNUE->Add(myHistogramM1,fluxweight*weight_m1);
02561             myHistogramNUE->Add(myHistogramM2,fluxweight*weight_m2);
02562           }
02563         }
02564 
02565         // Contained Muon Neutrinos
02566         // ========================
02567         if( fUseCVLORES ){ 
02568 
02569           // (1) CV::LORES
02570           myHistogramNUMU = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kCV,
02571                                                                              AtNuResolutionType::kLoRes));
02572 
02573           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02574                                                                                 AtNuResolutionType::kLoRes,
02575                                                                                  ndir,nchg,isys,+2));
02576           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02577                                                                                 AtNuResolutionType::kLoRes,
02578                                                                                  ndir,nchg,isys,+1));
02579           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02580                                                                                 AtNuResolutionType::kLoRes,
02581                                                                                  ndir,nchg,isys,0));
02582           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02583                                                                                 AtNuResolutionType::kLoRes,
02584                                                                                  ndir,nchg,isys,-1));
02585           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02586                                                                                 AtNuResolutionType::kLoRes,
02587                                                                                  ndir,nchg,isys,-2));
02588           if( isys==0 
02589            && myHistogram00 ){
02590             myHistogramNUMU->Add(myHistogram00,fluxweight);
02591           }
02592           else if( isys>0 
02593            && myHistogram00
02594            && myHistogramP2 && myHistogramP1
02595            && myHistogramM1 && myHistogramM2 ){
02596             myHistogramNUMU->Add(myHistogramP2,fluxweight*weight_p2);
02597             myHistogramNUMU->Add(myHistogramP1,fluxweight*weight_p1);
02598             myHistogramNUMU->Add(myHistogram00,fluxweight*weight_00);
02599             myHistogramNUMU->Add(myHistogramM1,fluxweight*weight_m1);
02600             myHistogramNUMU->Add(myHistogramM2,fluxweight*weight_m2);
02601           }
02602 
02603         }
02604 
02605         if( fUseCVHIRES ){ 
02606 
02607           // (2) CV::HIRES1
02608           myHistogramCV1 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kCV,
02609                                                                             AtNuResolutionType::kHiRes1)); 
02610 
02611           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02612                                                                                 AtNuResolutionType::kHiRes1,
02613                                                                                  ndir,nchg,isys,+2));
02614           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02615                                                                                 AtNuResolutionType::kHiRes1,
02616                                                                                  ndir,nchg,isys,+1));
02617           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02618                                                                                 AtNuResolutionType::kHiRes1,
02619                                                                                  ndir,nchg,isys,0));
02620           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02621                                                                                 AtNuResolutionType::kHiRes1,
02622                                                                                  ndir,nchg,isys,-1));
02623           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02624                                                                                 AtNuResolutionType::kHiRes1,
02625                                                                                  ndir,nchg,isys,-2));
02626           if( isys==0 
02627            && myHistogram00 ){
02628             myHistogramCV1->Add(myHistogram00,fluxweight);
02629           }
02630           else if( isys>0 
02631            && myHistogram00
02632            && myHistogramP2 && myHistogramP1
02633            && myHistogramM1 && myHistogramM2 ){
02634             myHistogramCV1->Add(myHistogramP2,fluxweight*weight_p2);
02635             myHistogramCV1->Add(myHistogramP1,fluxweight*weight_p1);
02636             myHistogramCV1->Add(myHistogram00,fluxweight*weight_00);
02637             myHistogramCV1->Add(myHistogramM1,fluxweight*weight_m1);
02638             myHistogramCV1->Add(myHistogramM2,fluxweight*weight_m2);
02639           }
02640 
02641           // (3) CV::HIRES2
02642           myHistogramCV2 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kCV,
02643                                                                             AtNuResolutionType::kHiRes2));
02644  
02645           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02646                                                                                 AtNuResolutionType::kHiRes2,
02647                                                                                  ndir,nchg,isys,+2));
02648           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02649                                                                                 AtNuResolutionType::kHiRes2,
02650                                                                                  ndir,nchg,isys,+1));
02651           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02652                                                                                 AtNuResolutionType::kHiRes2,
02653                                                                                  ndir,nchg,isys,0));
02654           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02655                                                                                 AtNuResolutionType::kHiRes2,
02656                                                                                  ndir,nchg,isys,-1));
02657           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02658                                                                                 AtNuResolutionType::kHiRes2,
02659                                                                                  ndir,nchg,isys,-2));
02660           if( isys==0 
02661            && myHistogram00 ){
02662             myHistogramCV2->Add(myHistogram00,fluxweight);
02663           }
02664           else if( isys>0 
02665            && myHistogram00
02666            && myHistogramP2 && myHistogramP1
02667            && myHistogramM1 && myHistogramM2 ){
02668             myHistogramCV2->Add(myHistogramP2,fluxweight*weight_p2);
02669             myHistogramCV2->Add(myHistogramP1,fluxweight*weight_p1);
02670             myHistogramCV2->Add(myHistogram00,fluxweight*weight_00);
02671             myHistogramCV2->Add(myHistogramM1,fluxweight*weight_m1);
02672             myHistogramCV2->Add(myHistogramM2,fluxweight*weight_m2);
02673           }
02674 
02675           // (4) CV::HIRES3
02676           myHistogramCV3 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kCV,
02677                                                                             AtNuResolutionType::kHiRes3));
02678 
02679           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02680                                                                                 AtNuResolutionType::kHiRes3,
02681                                                                                  ndir,nchg,isys,+2));
02682           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02683                                                                                 AtNuResolutionType::kHiRes3,
02684                                                                                  ndir,nchg,isys,+1));
02685           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02686                                                                                 AtNuResolutionType::kHiRes3,
02687                                                                                  ndir,nchg,isys,0));
02688           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02689                                                                                 AtNuResolutionType::kHiRes3,
02690                                                                                  ndir,nchg,isys,-1));
02691           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02692                                                                                 AtNuResolutionType::kHiRes3,
02693                                                                                  ndir,nchg,isys,-2));
02694           if( isys==0 
02695            && myHistogram00 ){
02696             myHistogramCV3->Add(myHistogram00,fluxweight);
02697           }
02698           else if( isys>0 
02699            && myHistogram00
02700            && myHistogramP2 && myHistogramP1
02701            && myHistogramM1 && myHistogramM2 ){
02702             myHistogramCV3->Add(myHistogramP2,fluxweight*weight_p2);
02703             myHistogramCV3->Add(myHistogramP1,fluxweight*weight_p1);
02704             myHistogramCV3->Add(myHistogram00,fluxweight*weight_00);
02705             myHistogramCV3->Add(myHistogramM1,fluxweight*weight_m1);
02706             myHistogramCV3->Add(myHistogramM2,fluxweight*weight_m2);
02707           }
02708 
02709           // (5) CV::HIRES4 
02710           myHistogramCV4 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kCV,
02711                                                                             AtNuResolutionType::kHiRes4));
02712 
02713           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02714                                                                                 AtNuResolutionType::kHiRes4,
02715                                                                                  ndir,nchg,isys,+2));
02716           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02717                                                                                 AtNuResolutionType::kHiRes4,
02718                                                                                  ndir,nchg,isys,+1));
02719           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02720                                                                                 AtNuResolutionType::kHiRes4,
02721                                                                                  ndir,nchg,isys,0));
02722           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02723                                                                                 AtNuResolutionType::kHiRes4,
02724                                                                                  ndir,nchg,isys,-1));
02725           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kCV,
02726                                                                                 AtNuResolutionType::kHiRes4,
02727                                                                                  ndir,nchg,isys,-2));
02728           if( isys==0 
02729            && myHistogram00 ){
02730             myHistogramCV4->Add(myHistogram00,fluxweight);
02731           }
02732           else if( isys>0 
02733            && myHistogram00
02734            && myHistogramP2 && myHistogramP1
02735            && myHistogramM1 && myHistogramM2 ){
02736             myHistogramCV4->Add(myHistogramP2,fluxweight*weight_p2);
02737             myHistogramCV4->Add(myHistogramP1,fluxweight*weight_p1);
02738             myHistogramCV4->Add(myHistogram00,fluxweight*weight_00);
02739             myHistogramCV4->Add(myHistogramM1,fluxweight*weight_m1);
02740             myHistogramCV4->Add(myHistogramM2,fluxweight*weight_m2);
02741           }
02742         }
02743 
02744         // Upward Muons
02745         // ============       
02746         if( fUseUPMUHIRES ){ 
02747 
02748           // (6) UPMU::HIRES1
02749           myHistogramUP1 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kUPMU,
02750                                                                             AtNuResolutionType::kHiRes1)); 
02751   
02752           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02753                                                                                 AtNuResolutionType::kHiRes1,
02754                                                                                  ndir,nchg,isys,+2));
02755           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02756                                                                                 AtNuResolutionType::kHiRes1,
02757                                                                                  ndir,nchg,isys,+1));
02758           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02759                                                                                 AtNuResolutionType::kHiRes1,
02760                                                                                  ndir,nchg,isys,0));
02761           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02762                                                                                 AtNuResolutionType::kHiRes1,
02763                                                                                  ndir,nchg,isys,-1));
02764           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02765                                                                                 AtNuResolutionType::kHiRes1,
02766                                                                                  ndir,nchg,isys,-2));
02767           if( isys==0 
02768            && myHistogram00 ){
02769             myHistogramUP1->Add(myHistogram00,fluxweight);
02770           }
02771           else if( isys>0 
02772            && myHistogram00
02773            && myHistogramP2 && myHistogramP1
02774            && myHistogramM1 && myHistogramM2 ){
02775             myHistogramUP1->Add(myHistogramP2,fluxweight*weight_p2);
02776             myHistogramUP1->Add(myHistogramP1,fluxweight*weight_p1);
02777             myHistogramUP1->Add(myHistogram00,fluxweight*weight_00);
02778             myHistogramUP1->Add(myHistogramM1,fluxweight*weight_m1);
02779             myHistogramUP1->Add(myHistogramM2,fluxweight*weight_m2);
02780           }
02781 
02782           // (7) UPMU::HIRES2
02783           myHistogramUP2 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kUPMU,
02784                                                                             AtNuResolutionType::kHiRes2)); 
02785 
02786           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02787                                                                                 AtNuResolutionType::kHiRes2,
02788                                                                                  ndir,nchg,isys,+2));
02789           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02790                                                                                 AtNuResolutionType::kHiRes2,
02791                                                                                  ndir,nchg,isys,+1));
02792           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02793                                                                                 AtNuResolutionType::kHiRes2,
02794                                                                                  ndir,nchg,isys,0));
02795           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02796                                                                                 AtNuResolutionType::kHiRes2,
02797                                                                                  ndir,nchg,isys,-1));
02798           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02799                                                                                 AtNuResolutionType::kHiRes2,
02800                                                                                  ndir,nchg,isys,-2));
02801           if( isys==0 
02802            && myHistogram00 ){
02803             myHistogramUP2->Add(myHistogram00,fluxweight);
02804           }
02805           else if( isys>0 
02806            && myHistogram00
02807            && myHistogramP2 && myHistogramP1
02808            && myHistogramM1 && myHistogramM2 ){
02809             myHistogramUP2->Add(myHistogramP2,fluxweight*weight_p2);
02810             myHistogramUP2->Add(myHistogramP1,fluxweight*weight_p1);
02811             myHistogramUP2->Add(myHistogram00,fluxweight*weight_00);
02812             myHistogramUP2->Add(myHistogramM1,fluxweight*weight_m1);
02813             myHistogramUP2->Add(myHistogramM2,fluxweight*weight_m2);
02814           }
02815 
02816           // (8) UPMU::HIRES3
02817           myHistogramUP3 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kUPMU,
02818                                                                             AtNuResolutionType::kHiRes3));
02819 
02820           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02821                                                                                 AtNuResolutionType::kHiRes3,
02822                                                                                  ndir,nchg,isys,+2));
02823           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02824                                                                                 AtNuResolutionType::kHiRes3,
02825                                                                                  ndir,nchg,isys,+1));
02826           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02827                                                                                 AtNuResolutionType::kHiRes3,
02828                                                                                  ndir,nchg,isys,0));
02829           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02830                                                                                 AtNuResolutionType::kHiRes3,
02831                                                                                  ndir,nchg,isys,-1));
02832           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02833                                                                                 AtNuResolutionType::kHiRes3,
02834                                                                                  ndir,nchg,isys,-2));
02835           if( isys==0 
02836            && myHistogram00 ){
02837             myHistogramUP3->Add(myHistogram00,fluxweight);
02838           }
02839           else if( isys>0 
02840            && myHistogram00
02841            && myHistogramP2 && myHistogramP1
02842            && myHistogramM1 && myHistogramM2 ){
02843             myHistogramUP3->Add(myHistogramP2,fluxweight*weight_p2);
02844             myHistogramUP3->Add(myHistogramP1,fluxweight*weight_p1);
02845             myHistogramUP3->Add(myHistogram00,fluxweight*weight_00);
02846             myHistogramUP3->Add(myHistogramM1,fluxweight*weight_m1);
02847             myHistogramUP3->Add(myHistogramM2,fluxweight*weight_m2);
02848           }
02849 
02850           // (9) UPMU::HIRES4
02851           myHistogramUP4 = (AtNuOscFitHistogram*)(myTemplate->GetHistogram(AtNuResolutionEventType::kUPMU,
02852                                                                             AtNuResolutionType::kHiRes4)); 
02853 
02854           myHistogramP2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02855                                                                                 AtNuResolutionType::kHiRes4,
02856                                                                                  ndir,nchg,isys,+2));
02857           myHistogramP1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02858                                                                                 AtNuResolutionType::kHiRes4,
02859                                                                                  ndir,nchg,isys,+1));
02860           myHistogram00 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02861                                                                                 AtNuResolutionType::kHiRes4,
02862                                                                                  ndir,nchg,isys,0));
02863           myHistogramM1 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02864                                                                                 AtNuResolutionType::kHiRes4,
02865                                                                                  ndir,nchg,isys,-1));
02866           myHistogramM2 = (AtNuOscFitHistogram*)(myTemplateInput->GetHistogram(AtNuResolutionEventType::kUPMU,
02867                                                                                 AtNuResolutionType::kHiRes4,
02868                                                                                  ndir,nchg,isys,-2));
02869           if( isys==0 
02870            && myHistogram00 ){
02871             myHistogramUP4->Add(myHistogram00,fluxweight);
02872           }
02873           else if( isys>0 
02874            && myHistogram00
02875            && myHistogramP2 && myHistogramP1
02876            && myHistogramM1 && myHistogramM2 ){
02877             myHistogramUP4->Add(myHistogramP2,fluxweight*weight_p2);
02878             myHistogramUP4->Add(myHistogramP1,fluxweight*weight_p1);
02879             myHistogramUP4->Add(myHistogram00,fluxweight*weight_00);
02880             myHistogramUP4->Add(myHistogramM1,fluxweight*weight_m1);
02881             myHistogramUP4->Add(myHistogramM2,fluxweight*weight_m2);
02882           }
02883         }
02884 
02885       } // for( Int_t isys = 0; isys<Nsys; isys++ ){ ...
02886     } // for( Int_t nchg=-1; nchg<=+1; nchg++ ){ ...
02887   } // for( Int_t ndir=-1; ndir<=+1; ndir++ ){ ...
02888 
02889   return;
02890 }

void AtNuOscFit::AddToExpectation ( Double_t  normweight,
AtNuOscFitTemplate myTemplateInput,
AtNuOscFitTemplate *&  myTemplate 
) [private]

Definition at line 2422 of file AtNuOscFit.cxx.

References AddToExpectation().

02423 {
02424   this->AddToExpectation(normweight,
02425                          1.0, 1.0,
02426                          1.0, 1.0,
02427                          0.0, 0.0,      
02428                          0.0, 0.0, 0.0, 
02429                          myTemplateInput, myTemplate);
02430 }

void AtNuOscFit::AddToExpectation ( AtNuOscFitTemplate myTemplateInput,
AtNuOscFitTemplate *&  myTemplate 
) [private]

Definition at line 2416 of file AtNuOscFit.cxx.

Referenced by AddToExpectation(), GetExpectation(), Run(), RunExpt(), and RunFit().

02417 {
02418   this->AddToExpectation(1.0,
02419                          myTemplateInput, myTemplate);
02420 }

void AtNuOscFit::AddUpmuNueCC ( const char *  filename  ) 

Definition at line 1336 of file AtNuOscFit.cxx.

References fHistUpmuNueCC, and LoadTemplates().

01337 {
01338   std::cout << " *** AtNuOscFit::AddUpmuNueCC(...) *** " << std::endl;
01339   std::cout << "   loading templates from file: " << filename << std::endl;
01340 
01341   this->LoadTemplates(filename,fHistUpmuNueCC);
01342 
01343   return;
01344 }

void AtNuOscFit::AddUpmuNueNC ( const char *  filename  ) 

Definition at line 1366 of file AtNuOscFit.cxx.

References fHistUpmuNueNC, and LoadTemplates().

01367 {
01368   std::cout << " *** AtNuOscFit::AddUpmuNueNC(...) *** " << std::endl;
01369   std::cout << "   loading templates from file: " << filename << std::endl;
01370 
01371   this->LoadTemplates(filename,fHistUpmuNueNC);
01372 
01373   return;
01374 }

void AtNuOscFit::AddUpmuNumuCC ( const char *  filename  ) 

Definition at line 1346 of file AtNuOscFit.cxx.

References fHistUpmuNumuCC, fNX, and LoadTemplates().

Referenced by AtNuOscFitInterface::LoadDataFromCambridge(), and AtNuOscFitInterface::LoadDataFromFermilab().

01347 {
01348   std::cout << " *** AtNuOscFit::AddUpmuNumuCC(...) *** " << std::endl;
01349   std::cout << "   loading templates from file: " << filename << std::endl;
01350 
01351   this->LoadTemplates(filename,fHistUpmuNumuCC,fNX);
01352 
01353   return;
01354 }

void AtNuOscFit::AddUpmuNumuNC ( const char *  filename  ) 

Definition at line 1376 of file AtNuOscFit.cxx.

References fHistUpmuNumuNC, and LoadTemplates().

01377 {
01378   std::cout << " *** AtNuOscFit::AddUpmuNumNC(...) *** " << std::endl;
01379   std::cout << "   loading templates from file: " << filename << std::endl;
01380 
01381   this->LoadTemplates(filename,fHistUpmuNumuNC);
01382 
01383   return;
01384 }

void AtNuOscFit::AddUpmuNutauCC ( const char *  filename  ) 

Definition at line 1356 of file AtNuOscFit.cxx.

References fHistUpmuNutauCC, fNX, and LoadTemplates().

01357 {
01358   std::cout << " *** AtNuOscFit::AddUpmuNutauCC(...) *** " << std::endl;
01359   std::cout << "   loading templates from file: " << filename << std::endl; 
01360 
01361   this->LoadTemplates(filename,fHistUpmuNutauCC,fNX);
01362 
01363   return;
01364 }

Bool_t AtNuOscFit::CheckLoadTemplatesData (  )  [private]

Definition at line 1736 of file AtNuOscFit.cxx.

References fHistData.

Referenced by Run(), and RunExpt().

01737 {
01738   if( fHistData == 0 ) return 0;
01739 
01740   return 1;
01741 }

Bool_t AtNuOscFit::CheckLoadTemplatesMC (  )  [private]

Definition at line 1719 of file AtNuOscFit.cxx.

References fHistAtmosNueCC, fHistAtmosNueNC, fHistAtmosNumuCC, fHistAtmosNumuNC, fHistAtmosNutauCC, fHistCosmics, fHistUpmuNueCC, fHistUpmuNueNC, fHistUpmuNumuCC, fHistUpmuNumuNC, and fHistUpmuNutauCC.

Referenced by Run(), and RunExpt().

01720 {
01721   if( fHistCosmics == 0
01722    && fHistAtmosNueCC == 0
01723    && fHistAtmosNumuCC == 0
01724    && fHistAtmosNutauCC == 0
01725    && fHistAtmosNueNC == 0
01726    && fHistAtmosNumuNC == 0
01727    && fHistUpmuNueCC == 0
01728    && fHistUpmuNumuCC == 0
01729    && fHistUpmuNutauCC == 0
01730    && fHistUpmuNueNC == 0
01731    && fHistUpmuNumuNC == 0 ) return 0;
01732 
01733   return 1;
01734 }

void AtNuOscFit::Debug (  )  [inline]

Definition at line 416 of file AtNuOscFit.h.

References fDebug.

00416               {
00417     fDebug = 1;
00418   }

void AtNuOscFit::DebugMinuit (  )  [inline]

Definition at line 420 of file AtNuOscFit.h.

References fDebugMinuit.

00420                     {
00421     fDebugMinuit = 1;
00422   }

void AtNuOscFit::DoAllSystematics ( Bool_t  dosys = 1  ) 

Definition at line 945 of file AtNuOscFit.cxx.

References fDoEnergySystematics, and fDoScalingSystematics.

Referenced by FitAllSystematics(), FitAtmosSystematics(), and AtNuOscFitInterface::Initialize().

00946 {
00947   if( dosys ){
00948     fDoScalingSystematics = 1;
00949     fDoEnergySystematics = 1;
00950   }
00951 
00952   return;
00953 }

void AtNuOscFit::DoChargeSeparation ( Bool_t  nu,
Bool_t  nubar 
) [inline]

Definition at line 173 of file AtNuOscFit.h.

References fDoChargeSeparation, fUseNegatives, and fUsePositives.

00173                                                   {
00174     fUseNegatives = nu;
00175     fUsePositives = nubar;
00176     fDoChargeSeparation = (nu||nubar); 
00177   }

void AtNuOscFit::DoChargeSeparation ( Bool_t  chg = 1  )  [inline]

Definition at line 169 of file AtNuOscFit.h.

Referenced by DoNuBarSeparation(), DoNuSeparation(), and AtNuOscFitInterface::Initialize().

00169                                          {
00170     this->DoChargeSeparation(chg,chg);
00171   }

void AtNuOscFit::DoCptFit (  )  [inline]

Definition at line 98 of file AtNuOscFit.h.

References fDoCptFit, fDoOscFit, fFixNuBarOscillations, fFixNuOscillations, fUseDmsqNu, fUseDmsqNuBar, fUseSinNu, and fUseSinNuBar.

00098                  { 
00099     fDoOscFit = 0;
00100     fDoCptFit = 1;    
00101     fUseSinNu = 0;
00102     fUseSinNuBar = 0;
00103     fUseDmsqNu = 0;
00104     fUseDmsqNuBar = 0;
00105     fFixNuOscillations = 0;
00106     fFixNuBarOscillations = 0;
00107   }

void AtNuOscFit::DoFullCptFit (  )  [inline]

Definition at line 109 of file AtNuOscFit.h.

References fDoCptFit, fDoOscFit, fFixNuBarOscillations, fFixNuOscillations, fUseDmsqNu, fUseDmsqNuBar, fUseSinNu, and fUseSinNuBar.

00109                      { 
00110     fDoOscFit = 0;
00111     fDoCptFit = 1; 
00112     fUseSinNu = 1;
00113     fUseSinNuBar = 1;
00114     fUseDmsqNu = 0;
00115     fUseDmsqNuBar = 0;
00116     fFixNuOscillations = 0;
00117     fFixNuBarOscillations = 0;
00118   }

void AtNuOscFit::DoFullFit ( Bool_t  fitDmsq = 1,
Bool_t  fitSinsq = 1,
Bool_t  fitDmsqBar = 1,
Bool_t  fitSinsqBar = 1 
) [inline]

Definition at line 120 of file AtNuOscFit.h.

References fDoCptFit, fDoOscFit, fFixNuBarOscillations, fFixNuOscillations, fUseDmsqNu, fUseDmsqNuBar, fUseSinNu, and fUseSinNuBar.

00121                                                                {
00122     fDoOscFit = 0; 
00123     fDoCptFit = 0;  
00124     fUseSinNu = fitSinsq;
00125     fUseSinNuBar = fitSinsqBar; 
00126     fUseDmsqNu = fitDmsq;
00127     fUseDmsqNuBar = fitDmsqBar;
00128     fFixNuOscillations = 1;
00129     fFixNuBarOscillations = 1;
00130   }

void AtNuOscFit::DoFullOscFit ( Bool_t  fitnu = 1,
Bool_t  fitnubar = 1 
) [inline]

Definition at line 81 of file AtNuOscFit.h.

References fDoCptFit, fDoOscFit, fFixNuBarOscillations, fFixNuOscillations, fUseDmsqNu, fUseDmsqNuBar, fUseSinNu, and fUseSinNuBar.

00081                                                           { 
00082     fDoOscFit = 1;
00083     fDoCptFit = 0; 
00084     fUseSinNu = 0;
00085     fUseSinNuBar = 0;
00086     fUseDmsqNu = 0;
00087     fUseDmsqNuBar = 0;
00088     fFixNuOscillations = 0;
00089     fFixNuBarOscillations = 0;
00090     if( fitnu==0 && fitnubar==1 ){
00091       fFixNuOscillations = 1; fUseSinNu = 1; fUseDmsqNu = 1;
00092     }
00093     if( fitnu==1 && fitnubar==0 ){
00094       fFixNuBarOscillations = 1; fUseSinNuBar = 1; fUseDmsqNuBar = 1;
00095     }
00096   }

void AtNuOscFit::DoInputSystematics ( Bool_t  dosys = 1  )  [inline]

Definition at line 187 of file AtNuOscFit.h.

References fDoInputSystematics.

00187                                            {
00188     fDoInputSystematics = dosys;
00189   }

void AtNuOscFit::DoNestedFit ( Bool_t  dofit = 1  )  [inline]

Definition at line 215 of file AtNuOscFit.h.

References fDoNestedFit.

Referenced by AtNuOscFitInterface::Initialize().

00215                                     {
00216     fDoNestedFit = dofit;
00217   }

void AtNuOscFit::DoNuBarSeparation ( Bool_t  nubar = 1  )  [inline]

Definition at line 165 of file AtNuOscFit.h.

References DoChargeSeparation().

00165                                           {
00166     if( nubar ) this->DoChargeSeparation(0,nubar);
00167   }

void AtNuOscFit::DoNuSeparation ( Bool_t  nu = 1  )  [inline]

Definition at line 161 of file AtNuOscFit.h.

References DoChargeSeparation().

00161                                     {
00162     if( nu ) this->DoChargeSeparation(nu,0);
00163   }

void AtNuOscFit::DoOscFit ( Bool_t  fitnu = 1,
Bool_t  fitnubar = 1 
) [inline]

Definition at line 64 of file AtNuOscFit.h.

References fDoCptFit, fDoOscFit, fFixNuBarOscillations, fFixNuOscillations, fUseDmsqNu, fUseDmsqNuBar, fUseSinNu, and fUseSinNuBar.

Referenced by AtNuOscFitInterface::Initialize().

00064                                                       { 
00065     fDoOscFit = 1;
00066     fDoCptFit = 0; 
00067     fUseSinNu = 0;
00068     fUseSinNuBar = 0;
00069     fUseDmsqNu = 0;
00070     fUseDmsqNuBar = 0;
00071     fFixNuOscillations = 0;
00072     fFixNuBarOscillations = 0;
00073     if( fitnu==0 && fitnubar==1 ){
00074       fFixNuOscillations = 1;
00075     }
00076     if( fitnu==1 && fitnubar==0 ){
00077       fFixNuBarOscillations = 1;
00078     }
00079   }

void AtNuOscFit::DoParallelRunning ( Bool_t  parallel = 1  )  [inline]

Definition at line 179 of file AtNuOscFit.h.

References fDoParallelRunning.

00179                                              {
00180     fDoParallelRunning = parallel;
00181   }

void AtNuOscFit::DoRandomizing ( Bool_t  random = 1  )  [inline]

Definition at line 151 of file AtNuOscFit.h.

References fDoRandomizing.

00151                                        {
00152     fDoRandomizing = random;
00153   }

void AtNuOscFit::DoSimpleSystematics ( Bool_t  dosys = 1  ) 

Definition at line 936 of file AtNuOscFit.cxx.

References fDoScalingSystematics.

Referenced by FitNormalization(), and FitSimpleSystematics().

00937 {
00938   if( dosys ){
00939     fDoScalingSystematics = 1;
00940   }
00941 
00942   return;
00943 }

void AtNuOscFit::EnforcePhysicalBoundary (  )  [inline]

Definition at line 207 of file AtNuOscFit.h.

References fPhysicalBoundary.

00207                                 {
00208     fPhysicalBoundary = 1;
00209   }

void AtNuOscFit::FitAllSystematics ( Bool_t  dosys = 1  ) 

Definition at line 991 of file AtNuOscFit.cxx.

References DoAllSystematics(), fFitAllSystematics, fFitSimpleSystematics, fFitSystematics, fUseCCNC, fUseChg, fUseChgUpmu, fUseElMu, fUseEmuCurve, fUseEmuRange, fUseEshw, fUseNorm, fUseNormUpmu, fUseSpecNu, fUseSpecNuBar, fUseUpDn, PrintSystematics(), and ResetSystematics().

Referenced by AtNuOscFitInterface::Initialize().

00992 {
00993   std::cout << " *** AtNuOscFit::FitAllSystematics(...) *** " << std::endl;
00994 
00995   // reset systematics
00996   this->ResetSystematics();
00997 
00998   // set systematics
00999   std::cout << "  setting new systematics... " << std::endl;
01000   if( dosys ){
01001     fUseNorm = 1;        
01002     fUseNormUpmu = 1;     
01003     fUseElMu = 1;        
01004     fUseCCNC = 1;        
01005     fUseUpDn = 1;        
01006     fUseChg = 1;     
01007     fUseChgUpmu = 1;       
01008     fUseSpecNu = 1;      
01009     fUseSpecNuBar = 1;   
01010     fUseEmuRange = 1;    
01011     fUseEmuCurve = 1;    
01012     fUseEshw = 1;       
01013 
01014     fFitSystematics = dosys; 
01015     fFitSimpleSystematics = dosys;
01016     fFitAllSystematics = dosys;
01017 
01018     this->DoAllSystematics();    
01019   }
01020 
01021   this->PrintSystematics();
01022 
01023   return;
01024 }

void AtNuOscFit::FitAtmosSystematics ( Bool_t  nu = 1,
Bool_t  nubar = 1 
)

Definition at line 955 of file AtNuOscFit.cxx.

References DoAllSystematics(), fFitAllSystematics, fFitSimpleSystematics, fFitSystematics, fUseChg, fUseChgUpmu, fUseNorm, fUseNormUpmu, fUseSpecNu, fUseSpecNuBar, PrintSystematics(), and ResetSystematics().

00956 {
00957   std::cout << " *** AtNuOscFit::FitAtmosSystematics(...) *** " << std::endl;
00958 
00959   // reset systematics
00960   this->ResetSystematics();
00961 
00962   // set systematics
00963   std::cout << "   setting new systematics... " << std::endl;
00964   fUseNorm = 1;   
00965   fUseNormUpmu = 1;
00966 
00967   if( nu && nubar ){
00968     fUseChg = 1;
00969     fUseChgUpmu = 1;
00970   }
00971 
00972   if( nu ){
00973     fUseSpecNu = 1;
00974   }
00975 
00976   if( nubar ){
00977     fUseSpecNuBar = 1;
00978   }
00979     
00980   fFitSystematics = 1; 
00981   fFitSimpleSystematics = 1;
00982   fFitAllSystematics = 1;
00983   
00984   this->DoAllSystematics();
00985   
00986   this->PrintSystematics();
00987 
00988   return;
00989 }

void AtNuOscFit::FitNormalization ( Bool_t  dosys = 1  ) 

Definition at line 1055 of file AtNuOscFit.cxx.

References DoSimpleSystematics(), fFitSystematics, fUseNorm, fUseNormUpmu, PrintSystematics(), and ResetSystematics().

01056 {  
01057   std::cout << " *** AtNuOscFit::FitNormalization() *** " << std::endl;
01058   
01059   // reset systematics
01060   this->ResetSystematics();
01061 
01062   // set systematics
01063   std::cout << "  setting new systematics... " << std::endl;
01064   if( dosys ){
01065     fUseNorm = 1;
01066     fUseNormUpmu = 1;
01067 
01068     fFitSystematics = dosys; 
01069 
01070     this->DoSimpleSystematics();  
01071   }
01072 
01073   this->PrintSystematics();
01074 
01075   return;
01076 }

void AtNuOscFit::FitSimpleSystematics ( Bool_t  dosys = 1  ) 

Definition at line 1026 of file AtNuOscFit.cxx.

References DoSimpleSystematics(), fFitSimpleSystematics, fFitSystematics, fUseCCNC, fUseChg, fUseChgUpmu, fUseElMu, fUseNorm, fUseNormUpmu, fUseUpDn, PrintSystematics(), and ResetSystematics().

01027 {    
01028   std::cout << " *** AtNuOscFit::FitSimpleSystematics(...) *** " << std::endl;
01029   
01030   // reset systematics
01031   this->ResetSystematics();
01032   
01033   // set systematics
01034   std::cout << "  setting new systematics... " << std::endl;
01035   if( dosys ){
01036     fUseNorm = 1;        
01037     fUseNormUpmu = 1;     
01038     fUseElMu = 1;        
01039     fUseCCNC = 1;        
01040     fUseUpDn = 1;        
01041     fUseChg = 1;    
01042     fUseChgUpmu = 1;  
01043      
01044     fFitSystematics = dosys; 
01045     fFitSimpleSystematics = dosys;
01046 
01047     this->DoSimpleSystematics();      
01048   }
01049 
01050   this->PrintSystematics();
01051 
01052   return;
01053 }

void AtNuOscFit::ForceCPT ( Bool_t  forceCPT = 1  )  [inline]

Definition at line 143 of file AtNuOscFit.h.

References fForceCPT.

00143                                     {
00144     fForceCPT = forceCPT;
00145   }

void AtNuOscFit::GetDeltaLikelihood ( Bool_t  separate_charge,
Bool_t  use_negatives,
Bool_t  use_positives,
AtNuOscFitHistogram hExpt,
AtNuOscFitHistogram hFit,
Double_t &  dLnL 
) [private]

Definition at line 7129 of file AtNuOscFit.cxx.

References MuELoss::e, fM0, fM1, fUseModifiedLikelihood, AtNuOscFitHistogram::GetBins(), AtNuOscFitHistogram::GetContent(), and n.

07130 { 
07131   // initialise log-likelihood
07132   // =========================
07133   Double_t myDeltaLnL = 0.0;
07134    
07135   for( Int_t n=-1; n<=+1; n++ ){
07136     for( Int_t i=0; i<hExpt->GetBins(); i++ ){
07137 
07138       Double_t obs0 = hExpt->GetContent(i,n,-1);
07139       Double_t exp0 = hFit->GetContent(i,n,-1);
07140 
07141       Double_t obs1 = hExpt->GetContent(i,n,0);
07142       Double_t exp1 = hFit->GetContent(i,n,0);
07143 
07144       Double_t obs2 = hExpt->GetContent(i,n,+1);
07145       Double_t exp2 = hFit->GetContent(i,n,+1);
07146 
07147       Double_t deltaLnL0 = 0.0;
07148       Double_t deltaLnL1 = 0.0;
07149       Double_t deltaLnL2 = 0.0;
07150  
07151       Double_t deltaLnL = 0.0;
07152 
07153       if( separate_charge ){ 
07154         
07155         // separate neutrinos and anti-neutrinos
07156         if( use_negatives ){
07157           Double_t e = 0.0; 
07158           if( fUseModifiedLikelihood ){           
07159             Double_t x = exp0/fM1; 
07160             e += fM0*exp(-x);
07161           }
07162           deltaLnL0 = 0.0;
07163           if( exp0>0.0 ) deltaLnL0 = exp0-obs0*log(exp0+e);
07164           else if( obs0>0.0 ) deltaLnL0 = 0.0; // 1.0e100; 
07165           myDeltaLnL += deltaLnL0;
07166         }
07167         if( use_negatives 
07168          && use_positives ){
07169           Double_t e = 0.0; 
07170           if( fUseModifiedLikelihood ){
07171             Double_t x = exp1/fM1;  
07172             e += fM0*exp(-x);
07173           }
07174           deltaLnL1 = 0.0;
07175           if( exp1>0.0 ) deltaLnL1 = exp1-obs1*log(exp1+e);
07176           else if( obs1>0.0 ) deltaLnL1 = 0.0; // 1.0e100;
07177           myDeltaLnL += deltaLnL1;
07178         }
07179         if( use_positives ){
07180           Double_t e = 0.0; 
07181           if( fUseModifiedLikelihood ){
07182             Double_t x = exp2/fM1;  
07183             e += fM0*exp(-x);
07184           }
07185           deltaLnL2 = 0.0;
07186           if( exp2>0.0 ) deltaLnL2 = exp2-obs2*log(exp2+e);
07187           else if( obs2>0.0 ) deltaLnL2 = 0.0; // 1.0e100;
07188           myDeltaLnL += deltaLnL2;
07189         }
07190       } 
07191       else{ 
07192         // combine neutrinos and anti-neutrinos
07193         Double_t exptot = exp0+exp1+exp2;
07194         Double_t obstot = obs0+obs1+obs2;
07195         Double_t e = 0.0; 
07196         if( fUseModifiedLikelihood ){
07197           Double_t x = exptot/fM1;  
07198           e += fM0*exp(-x);
07199         }
07200         deltaLnL = 0.0;
07201         if( exptot>0.0 ) deltaLnL = exptot-obstot*log(exptot+e);
07202         else if( obstot>0.0 ) deltaLnL = 0.0; // 1.0e100;
07203         myDeltaLnL += deltaLnL;
07204       }
07205     }
07206   }
07207   
07208   // return log-likelihood
07209   // =====================
07210   dLnL = myDeltaLnL;
07211 
07212   return;
07213 }

void AtNuOscFit::GetDeltaLikelihood ( Bool_t  separate_charge,
Bool_t  use_negatives,
Bool_t  use_positives,
AtNuOscFitTemplate myTemplateExpt,
AtNuOscFitTemplate myTemplateFit,
Double_t &  dLnL 
) [private]

Definition at line 6956 of file AtNuOscFit.cxx.

References fLNL_CV_HIRES, fLNL_CV_LORES, fLNL_NUE, fLNL_UPMU_HIRES, fUseCVHIRES, fUseCVLORES, fUseNUE, fUseUPMUHIRES, AtNuOscFitTemplate::GetHistogram(), AtNuResolutionEventType::kCV, AtNuResolutionType::kHiRes1, AtNuResolutionType::kHiRes2, AtNuResolutionType::kHiRes3, AtNuResolutionType::kHiRes4, AtNuResolutionType::kLoRes, AtNuResolutionEventType::kNUE, and AtNuResolutionEventType::kUPMU.

Referenced by GetLikelihood().

06957 {  
06958   // initialise log-likelihood
06959   // =========================
06960   dLnL = 0.0;
06961 
06962   // changes in log-likelihood
06963   // =========================
06964   Double_t deltaLnL = 0.0;
06965   Double_t myDeltaLnL = 0.0;
06966  
06967   // add statistical errors
06968   // =======================
06969   AtNuOscFitHistogram* hExpt = 0;
06970   AtNuOscFitHistogram* hFit = 0;
06971 
06972   // Electron Neutrinos
06973   // ==================
06974   if( fUseNUE ){
06975 
06976     // initialize log-likelihood
06977     myDeltaLnL = 0.0;
06978 
06979     // (0) NUE::LORES
06980     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kNUE,
06981                                                                AtNuResolutionType::kLoRes));
06982     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kNUE,
06983                                                                  AtNuResolutionType::kLoRes));
06984     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
06985 
06986     myDeltaLnL += deltaLnL;    
06987 
06988     // store delta log-likelihood
06989     fLNL_NUE = myDeltaLnL;
06990 
06991     // add on log-likelihood
06992     dLnL += myDeltaLnL;
06993   }
06994 
06995   // Contained Muon Neutrinos
06996   // ========================
06997   if( fUseCVLORES ){
06998 
06999     // initialize log-likelihood
07000     myDeltaLnL = 0.0;
07001 
07002     // (1) CV::LORES
07003     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07004                                                                AtNuResolutionType::kLoRes));
07005     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07006                                                                  AtNuResolutionType::kLoRes));
07007     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07008 
07009     myDeltaLnL += deltaLnL;    
07010 
07011     // store delta log-likelihood
07012     fLNL_CV_LORES = myDeltaLnL;
07013 
07014     // add on log-likelihood
07015     dLnL += myDeltaLnL;
07016   }
07017 
07018   if( fUseCVHIRES ){
07019 
07020     // initialize log-likelihood
07021     myDeltaLnL = 0.0;
07022 
07023     // (2) CV::HIRES1
07024     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07025                                                                AtNuResolutionType::kHiRes1));
07026     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07027                                                                  AtNuResolutionType::kHiRes1));
07028     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL); 
07029 
07030     myDeltaLnL += deltaLnL;
07031 
07032 
07033     // (3) CV::HIRES2
07034     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07035                                                                AtNuResolutionType::kHiRes2));
07036     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07037                                                                  AtNuResolutionType::kHiRes2));
07038     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07039 
07040     myDeltaLnL += deltaLnL;
07041 
07042 
07043     // (4) CV::HIRES3
07044     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07045                                                                AtNuResolutionType::kHiRes3));
07046     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07047                                                                  AtNuResolutionType::kHiRes3));
07048     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07049 
07050     myDeltaLnL += deltaLnL;
07051 
07052 
07053     // (5) CV::HIRES4 
07054     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07055                                                                AtNuResolutionType::kHiRes4));
07056     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07057                                                                  AtNuResolutionType::kHiRes4));
07058     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07059 
07060     myDeltaLnL += deltaLnL;    
07061 
07062     // store delta log-likelihood
07063     fLNL_CV_HIRES = myDeltaLnL;
07064 
07065     // add on log-likelihood
07066     dLnL += myDeltaLnL;
07067   }
07068 
07069   // Upward Muons
07070   // ============       
07071   if( fUseUPMUHIRES ){
07072 
07073     // initialize log-likelihood
07074     myDeltaLnL = 0.0;
07075 
07076     // (6) UPMU::HIRES1
07077     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07078                                                                AtNuResolutionType::kHiRes1));
07079     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07080                                                                  AtNuResolutionType::kHiRes1));
07081     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07082 
07083     myDeltaLnL += deltaLnL;
07084 
07085 
07086     // (7) UPMU::HIRES2
07087     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07088                                                                AtNuResolutionType::kHiRes2)); 
07089     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07090                                                                  AtNuResolutionType::kHiRes2));
07091     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07092 
07093     myDeltaLnL += deltaLnL;
07094 
07095 
07096     // (8) UPMU::HIRES3
07097     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07098                                                                AtNuResolutionType::kHiRes3));
07099     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07100                                                                  AtNuResolutionType::kHiRes3));
07101     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07102 
07103     myDeltaLnL += deltaLnL;
07104 
07105 
07106     // (9) UPMU::HIRES4
07107     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07108                                                                AtNuResolutionType::kHiRes4));
07109     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07110                                                                  AtNuResolutionType::kHiRes4));
07111     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07112 
07113     myDeltaLnL += deltaLnL;    
07114 
07115     // store delta log-likelihood
07116     fLNL_UPMU_HIRES = myDeltaLnL;
07117 
07118     // add on log-likelihood
07119     dLnL += myDeltaLnL;
07120   } 
07121 
07122 
07123   // return log-likelihood
07124   // =====================
07125 
07126   return;
07127 }

void AtNuOscFit::GetDeltaLikelihoodBayes ( Bool_t  separate_charge,
Bool_t  use_negatives,
Bool_t  use_positives,
AtNuOscFitHistogram hExpt,
AtNuOscFitHistogram hFit,
Double_t &  dLnL 
) [private]

Definition at line 8081 of file AtNuOscFit.cxx.

References MuELoss::e, fM0, fM1, fUseModifiedLikelihood, AtNuOscFitHistogram::GetBins(), AtNuOscFitHistogram::GetContent(), AtNuOscFitHistogram::GetTotalContent(), and n.

08082 {  
08083   // initialise log-likelihood
08084   // =========================
08085   Double_t myDeltaLnL = 0.0;
08086 
08087   for( Int_t n=-1; n<=+1; n++ ){
08088 
08089     Double_t exptotal0 = hFit->GetTotalContent(n,-1);    
08090     Double_t exptotal1 = hFit->GetTotalContent(n,0);
08091     Double_t exptotal2 = hFit->GetTotalContent(n,+1);
08092 
08093     Double_t exptotal = exptotal0 + exptotal1 + exptotal2;
08094 
08095     Double_t deltaLnL0 = 0.0;
08096     Double_t deltaLnL1 = 0.0;
08097     Double_t deltaLnL2 = 0.0;
08098 
08099     Double_t deltaLnL = 0.0;
08100 
08101     for( Int_t i=0; i<hExpt->GetBins(); i++ ){
08102    
08103       if( separate_charge ){
08104  
08105         // separate neutrinos and anti-neutrinos
08106         Double_t obs0 = hExpt->GetContent(i,n,-1);
08107         Double_t exp0 = hFit->GetContent(i,n,-1);
08108         if( exptotal0>0.0 ) exp0 /= exptotal0;
08109 
08110         Double_t obs1 = hExpt->GetContent(i,n,0);
08111         Double_t exp1 = hFit->GetContent(i,n,0);
08112         if( exptotal1>0.0 ) exp1 /= exptotal1;
08113 
08114         Double_t obs2 = hExpt->GetContent(i,n,+1);
08115         Double_t exp2 = hFit->GetContent(i,n,+1);
08116         if( exptotal2>0.0 ) exp2 /= exptotal2;
08117 
08118         if( use_negatives ){
08119           Double_t e = 0.0; 
08120           if( fUseModifiedLikelihood ){
08121             if( exptotal0>0.0 ){
08122               Double_t x = exp0/(fM1/exptotal0); 
08123               e += (fM0/exptotal0)*exp(-x);
08124             }
08125           }
08126           deltaLnL0 = 0.0;
08127           if( exp0>0.0 ) deltaLnL0 = -obs0*log(exp0+e);
08128           else if( obs0>0.0 ) deltaLnL0 = 0.0; // 1.0e100;  
08129           myDeltaLnL += deltaLnL0;
08130         }
08131         if( use_negatives 
08132          && use_positives ){
08133           Double_t e = 0.0; 
08134           if( fUseModifiedLikelihood ){
08135             if( exptotal1>0.0 ){
08136               Double_t x = exp1/(fM1/exptotal1);
08137               e += (fM0/exptotal1)*exp(-x);
08138             }
08139           }
08140           deltaLnL1 = 0.0;
08141           if( exp1>0.0 ) deltaLnL1 = -obs1*log(exp1+e);
08142           else if( obs1>0.0 ) deltaLnL1 = 0.0; // 1.0e100; 
08143           myDeltaLnL += deltaLnL1;
08144         }
08145         if( use_positives ){
08146           Double_t e = 0.0; 
08147           if( fUseModifiedLikelihood ){
08148             if( exptotal2>0.0 ){
08149               Double_t x = exp2/(fM1/exptotal2);
08150               e += (fM0/exptotal2)*exp(-x);
08151             }
08152           }
08153           deltaLnL2 = 0.0;
08154           if( exp2>0.0 ) deltaLnL2 = -obs2*log(exp2+e);
08155           else if( obs2>0.0 ) deltaLnL2 = 0.0; // 1.0e100;
08156           myDeltaLnL += deltaLnL2;
08157         }
08158       } 
08159 
08160       else{  
08161 
08162         // combine neutrinos and anti-neutrinos        
08163         Double_t obs0 = hExpt->GetContent(i,n,-1)
08164                       + hExpt->GetContent(i,n,0)
08165                       + hExpt->GetContent(i,n,+1);
08166         Double_t exp0 = hFit->GetContent(i,n,-1)
08167                       + hFit->GetContent(i,n,0)
08168                       + hFit->GetContent(i,n,+1);
08169         if( exptotal>0.0 ) exp0 /= exptotal;
08170 
08171         Double_t e = 0.0; 
08172         if( fUseModifiedLikelihood ){
08173           if( exptotal>0.0 ){
08174             Double_t x = exp0/(fM1/exptotal);
08175             e += (fM0/exptotal)*exp(-x);
08176           }
08177         }
08178         deltaLnL = 0.0;
08179         if( exp0>0.0 ) deltaLnL = -obs0*log(exp0+e);
08180         else if( obs0>0.0 ) deltaLnL = 0.0; // 1.0e100;
08181         myDeltaLnL += deltaLnL;
08182       }
08183 
08184     } // for( Int_t i=0; i<hExpt->GetBins(); i++ ){ ...
08185   } // for( Int_t n=-1; n<=+1; n++ ){ ...
08186   
08187   // return log-likelihood
08188   // =====================
08189   dLnL = myDeltaLnL;
08190 
08191   return;
08192 }

void AtNuOscFit::GetDeltaLikelihoodBayes ( Bool_t  separate_charge,
Bool_t  use_negatives,
Bool_t  use_positives,
AtNuOscFitTemplate myTemplateExpt,
AtNuOscFitTemplate myTemplateFit,
Double_t &  dLnL 
) [private]

Definition at line 7215 of file AtNuOscFit.cxx.

References fLNL_CV_HIRES, fLNL_CV_HIRES_NORM, fLNL_CV_HIRES_SHAPE, fLNL_CV_HIRES_UPDN, fLNL_CV_LORES, fLNL_NUE, fLNL_UPMU_HIRES, fLNL_UPMU_HIRES_NORM, fLNL_UPMU_HIRES_SHAPE, fLNL_UPMU_HIRES_UPDN, fUseCVHIRES, fUseCVLORES, fUseModifiedBayesLikelihood, fUseNUE, fUseUPMUHIRES, AtNuOscFitTemplate::GetHistogram(), AtNuOscFitHistogram::GetTotalContent(), AtNuResolutionEventType::kCV, AtNuResolutionType::kHiRes1, AtNuResolutionType::kHiRes2, AtNuResolutionType::kHiRes3, AtNuResolutionType::kHiRes4, AtNuResolutionType::kLoRes, AtNuResolutionEventType::kNUE, and AtNuResolutionEventType::kUPMU.

Referenced by GetLikelihood().

07216 {
07217   // initialise log-likelihood
07218   // =========================
07219   dLnL = 0.0;
07220 
07221   // changes in log-likelihood
07222   // =========================
07223   Double_t deltaLnL = 0.0;
07224   Double_t myDeltaLnL = 0.0;
07225   Double_t myDeltaLnLnorm = 0.0;
07226   Double_t myDeltaLnLupdn = 0.0;
07227   Double_t myDeltaLnLres = 0.0;
07228 
07229   // total event count (by event category)
07230   // ====================================
07231   Double_t N_obs_nue = 0.0;
07232   Double_t N_obs_numu = 0.0;
07233   Double_t N_obs_cvup = 0.0;
07234   Double_t N_obs_cvup_pos = 0.0;
07235   Double_t N_obs_cvup_0 = 0.0;
07236   Double_t N_obs_cvup_neg = 0.0;
07237   Double_t N_obs_cvdn = 0.0;
07238   Double_t N_obs_cvdn_pos = 0.0;
07239   Double_t N_obs_cvdn_0 = 0.0;
07240   Double_t N_obs_cvdn_neg = 0.0;
07241   Double_t N_obs_upmu = 0.0;
07242   Double_t N_obs_upmu_pos = 0.0;
07243   Double_t N_obs_upmu_0 = 0.0;
07244   Double_t N_obs_upmu_neg = 0.0;  
07245 
07246   Double_t N_fit_nue = 0.0;
07247   Double_t N_fit_numu = 0.0;
07248   Double_t N_fit_cvup = 0.0;
07249   Double_t N_fit_cvup_pos = 0.0;
07250   Double_t N_fit_cvup_0 = 0.0;
07251   Double_t N_fit_cvup_neg = 0.0;
07252   Double_t N_fit_cvdn = 0.0;
07253   Double_t N_fit_cvdn_pos = 0.0;
07254   Double_t N_fit_cvdn_0 = 0.0;
07255   Double_t N_fit_cvdn_neg = 0.0;
07256   Double_t N_fit_upmu = 0.0;
07257   Double_t N_fit_upmu_pos = 0.0;
07258   Double_t N_fit_upmu_0 = 0.0;
07259   Double_t N_fit_upmu_neg = 0.0;
07260 
07261 
07262   // total event count (by resolution bin)
07263   // ====================================
07264   Double_t N_obs_cvup_res1 = 0.0;
07265   Double_t N_obs_cvup_pos_res1 = 0.0;
07266   Double_t N_obs_cvup_0_res1 = 0.0;
07267   Double_t N_obs_cvup_neg_res1 = 0.0;
07268   Double_t N_obs_cvdn_res1 = 0.0;
07269   Double_t N_obs_cvdn_pos_res1 = 0.0;
07270   Double_t N_obs_cvdn_0_res1 = 0.0;
07271   Double_t N_obs_cvdn_neg_res1 = 0.0;
07272   Double_t N_obs_upmu_res1 = 0.0;
07273   Double_t N_obs_upmu_pos_res1 = 0.0;
07274   Double_t N_obs_upmu_0_res1 = 0.0;
07275   Double_t N_obs_upmu_neg_res1 = 0.0;
07276 
07277   Double_t N_obs_cvup_res2 = 0.0;
07278   Double_t N_obs_cvup_pos_res2 = 0.0;
07279   Double_t N_obs_cvup_0_res2 = 0.0;
07280   Double_t N_obs_cvup_neg_res2 = 0.0;
07281   Double_t N_obs_cvdn_res2 = 0.0;
07282   Double_t N_obs_cvdn_pos_res2 = 0.0;
07283   Double_t N_obs_cvdn_0_res2 = 0.0;
07284   Double_t N_obs_cvdn_neg_res2 = 0.0;
07285   Double_t N_obs_upmu_res2 = 0.0;
07286   Double_t N_obs_upmu_pos_res2 = 0.0;
07287   Double_t N_obs_upmu_0_res2 = 0.0;
07288   Double_t N_obs_upmu_neg_res2 = 0.0;
07289 
07290   Double_t N_obs_cvup_res3 = 0.0;
07291   Double_t N_obs_cvup_pos_res3 = 0.0;
07292   Double_t N_obs_cvup_0_res3 = 0.0;
07293   Double_t N_obs_cvup_neg_res3 = 0.0;
07294   Double_t N_obs_cvdn_res3 = 0.0;
07295   Double_t N_obs_cvdn_pos_res3 = 0.0;
07296   Double_t N_obs_cvdn_0_res3 = 0.0;
07297   Double_t N_obs_cvdn_neg_res3 = 0.0;
07298   Double_t N_obs_upmu_res3 = 0.0;
07299   Double_t N_obs_upmu_pos_res3 = 0.0;
07300   Double_t N_obs_upmu_0_res3 = 0.0;
07301   Double_t N_obs_upmu_neg_res3 = 0.0;
07302 
07303   Double_t N_obs_cvup_res4 = 0.0;
07304   Double_t N_obs_cvup_pos_res4 = 0.0;
07305   Double_t N_obs_cvup_0_res4 = 0.0;
07306   Double_t N_obs_cvup_neg_res4 = 0.0; 
07307   Double_t N_obs_cvdn_res4 = 0.0;
07308   Double_t N_obs_cvdn_pos_res4 = 0.0;
07309   Double_t N_obs_cvdn_0_res4 = 0.0;
07310   Double_t N_obs_cvdn_neg_res4 = 0.0;
07311   Double_t N_obs_upmu_res4 = 0.0;
07312   Double_t N_obs_upmu_pos_res4 = 0.0;
07313   Double_t N_obs_upmu_0_res4 = 0.0;
07314   Double_t N_obs_upmu_neg_res4 = 0.0;
07315 
07316   Double_t N_fit_cvup_res1 = 0.0;
07317   Double_t N_fit_cvup_pos_res1 = 0.0;
07318   Double_t N_fit_cvup_0_res1 = 0.0;
07319   Double_t N_fit_cvup_neg_res1 = 0.0;
07320   Double_t N_fit_cvdn_res1 = 0.0;
07321   Double_t N_fit_cvdn_pos_res1 = 0.0;
07322   Double_t N_fit_cvdn_0_res1 = 0.0;
07323   Double_t N_fit_cvdn_neg_res1 = 0.0;
07324   Double_t N_fit_upmu_res1 = 0.0;
07325   Double_t N_fit_upmu_pos_res1 = 0.0;
07326   Double_t N_fit_upmu_0_res1 = 0.0;
07327   Double_t N_fit_upmu_neg_res1 = 0.0;
07328 
07329   Double_t N_fit_cvup_res2 = 0.0;
07330   Double_t N_fit_cvup_pos_res2 = 0.0;
07331   Double_t N_fit_cvup_0_res2 = 0.0;
07332   Double_t N_fit_cvup_neg_res2 = 0.0;
07333   Double_t N_fit_cvdn_res2 = 0.0;
07334   Double_t N_fit_cvdn_pos_res2 = 0.0;
07335   Double_t N_fit_cvdn_0_res2 = 0.0;
07336   Double_t N_fit_cvdn_neg_res2 = 0.0;
07337   Double_t N_fit_upmu_res2 = 0.0;
07338   Double_t N_fit_upmu_pos_res2 = 0.0;
07339   Double_t N_fit_upmu_0_res2 = 0.0;
07340   Double_t N_fit_upmu_neg_res2 = 0.0;
07341 
07342   Double_t N_fit_cvup_res3 = 0.0;
07343   Double_t N_fit_cvup_pos_res3 = 0.0;
07344   Double_t N_fit_cvup_0_res3 = 0.0;
07345   Double_t N_fit_cvup_neg_res3 = 0.0;
07346   Double_t N_fit_cvdn_res3 = 0.0;
07347   Double_t N_fit_cvdn_pos_res3 = 0.0;
07348   Double_t N_fit_cvdn_0_res3 = 0.0;
07349   Double_t N_fit_cvdn_neg_res3 = 0.0;
07350   Double_t N_fit_upmu_res3 = 0.0;
07351   Double_t N_fit_upmu_pos_res3 = 0.0;
07352   Double_t N_fit_upmu_0_res3 = 0.0;
07353   Double_t N_fit_upmu_neg_res3 = 0.0;
07354 
07355   Double_t N_fit_cvup_res4 = 0.0;
07356   Double_t N_fit_cvup_pos_res4 = 0.0;
07357   Double_t N_fit_cvup_0_res4 = 0.0;
07358   Double_t N_fit_cvup_neg_res4 = 0.0;
07359   Double_t N_fit_cvdn_res4 = 0.0;
07360   Double_t N_fit_cvdn_pos_res4 = 0.0;
07361   Double_t N_fit_cvdn_0_res4 = 0.0;
07362   Double_t N_fit_cvdn_neg_res4 = 0.0;
07363   Double_t N_fit_upmu_res4 = 0.0;
07364   Double_t N_fit_upmu_pos_res4 = 0.0;
07365   Double_t N_fit_upmu_0_res4 = 0.0;
07366   Double_t N_fit_upmu_neg_res4 = 0.0;
07367 
07368 
07369   // separate charge
07370   // ===============
07371   Bool_t use_neg = 0;
07372   Bool_t use_0 = 0;
07373   Bool_t use_pos = 0;
07374 
07375   if( separate_charge ){
07376     if( use_negatives ) use_neg = 1;
07377     if( use_negatives && use_positives ) use_0 = 1;
07378     if( use_positives ) use_pos = 1;
07379   }
07380   else{
07381     use_neg = 1; use_0 = 1; use_pos = 1;
07382   }
07383 
07384   // add statistical errrors
07385   // =======================
07386   AtNuOscFitHistogram* hExpt = 0;
07387   AtNuOscFitHistogram* hFit = 0;
07388 
07389   // Electron Neutrinos
07390   // ==================
07391   if( fUseNUE ){
07392 
07393     // initialize log-likelihood
07394     // =========================
07395     myDeltaLnL = 0.0;
07396 
07397     // (0) NUE::LORES
07398     // ==============
07399     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kNUE,
07400                                                                AtNuResolutionType::kLoRes));
07401     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kNUE,
07402                                                                  AtNuResolutionType::kLoRes));
07403     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07404 
07405     myDeltaLnL += deltaLnL;
07406 
07407     N_obs_nue       += hExpt->GetTotalContent();
07408     N_fit_nue       += hFit->GetTotalContent();  
07409 
07410     // electron neutrinos
07411     if( N_fit_nue>0.0 ){
07412       myDeltaLnL += N_fit_nue - N_obs_nue*log(N_fit_nue);
07413     }
07414 
07415     // store delta log-likelihood
07416     // ==========================
07417     fLNL_NUE = myDeltaLnL;
07418 
07419     // add on log-likelihood
07420     // =====================
07421     dLnL += myDeltaLnL;
07422   }
07423 
07424   // Contained Muon Neutrinos
07425   // ========================
07426   if( fUseCVLORES ){
07427 
07428     // initialize log-likelihood
07429     // =========================
07430     myDeltaLnL = 0.0;
07431 
07432     // (1) CV::LORES
07433     // =============
07434     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07435                                                                AtNuResolutionType::kLoRes));
07436     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07437                                                                  AtNuResolutionType::kLoRes));
07438     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07439 
07440     myDeltaLnL += deltaLnL;
07441 
07442     N_obs_numu      += hExpt->GetTotalContent();
07443     N_fit_numu      += hFit->GetTotalContent();
07444 
07445     // contained vertex (low resolution)
07446     if( N_fit_numu>0.0 ){
07447       myDeltaLnL += N_fit_numu - N_obs_numu*log(N_fit_numu);
07448     }    
07449 
07450     // store delta log-likelihood
07451     // ==========================
07452     fLNL_CV_LORES = myDeltaLnL;
07453 
07454     // add on log-likelihood
07455     // =====================
07456     dLnL += myDeltaLnL;
07457   }
07458 
07459   if( fUseCVHIRES ){
07460 
07461     // initialize log-likelihood
07462     // =========================
07463     myDeltaLnL = 0.0;
07464 
07465 
07466     // (2) CV::HIRES1
07467     // ==============
07468     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07469                                                                AtNuResolutionType::kHiRes1));
07470     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07471                                                                  AtNuResolutionType::kHiRes1));
07472     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL); 
07473 
07474     myDeltaLnL += deltaLnL;
07475 
07476     if( use_pos ) N_obs_cvup_pos += hExpt->GetTotalContent(+1,+1);
07477     if( use_0 )   N_obs_cvup_0   += hExpt->GetTotalContent(+1,0);
07478     if( use_neg ) N_obs_cvup_neg += hExpt->GetTotalContent(+1,-1);
07479     if( use_pos ) N_obs_cvup     += hExpt->GetTotalContent(+1,+1);
07480     if( use_0 )   N_obs_cvup     += hExpt->GetTotalContent(+1,0);
07481     if( use_neg ) N_obs_cvup     += hExpt->GetTotalContent(+1,-1);
07482 
07483     if( use_pos ) N_obs_cvdn_pos += hExpt->GetTotalContent(-1,+1);
07484     if( use_0 )   N_obs_cvdn_0   += hExpt->GetTotalContent(-1,0);
07485     if( use_neg ) N_obs_cvdn_neg += hExpt->GetTotalContent(-1,-1);  
07486     if( use_pos ) N_obs_cvdn     += hExpt->GetTotalContent(-1,+1);
07487     if( use_0 )   N_obs_cvdn     += hExpt->GetTotalContent(-1,0);
07488     if( use_neg ) N_obs_cvdn     += hExpt->GetTotalContent(-1,-1);
07489 
07490     if( use_pos ) N_fit_cvup_pos += hFit->GetTotalContent(+1,+1);
07491     if( use_0 )   N_fit_cvup_0   += hFit->GetTotalContent(+1,0);
07492     if( use_neg ) N_fit_cvup_neg += hFit->GetTotalContent(+1,-1);
07493     if( use_pos ) N_fit_cvup     += hFit->GetTotalContent(+1,+1);
07494     if( use_0 )   N_fit_cvup     += hFit->GetTotalContent(+1,0);
07495     if( use_neg ) N_fit_cvup     += hFit->GetTotalContent(+1,-1);
07496 
07497     if( use_pos ) N_fit_cvdn_pos += hFit->GetTotalContent(-1,+1);
07498     if( use_0 )   N_fit_cvdn_0   += hFit->GetTotalContent(-1,0);
07499     if( use_neg ) N_fit_cvdn_neg += hFit->GetTotalContent(-1,-1);  
07500     if( use_pos ) N_fit_cvdn     += hFit->GetTotalContent(-1,+1);
07501     if( use_0 )   N_fit_cvdn     += hFit->GetTotalContent(-1,0);
07502     if( use_neg ) N_fit_cvdn     += hFit->GetTotalContent(-1,-1);
07503 
07504     if( use_pos ) N_obs_cvup_pos_res1 += hExpt->GetTotalContent(+1,+1);
07505     if( use_0 )   N_obs_cvup_0_res1   += hExpt->GetTotalContent(+1,0);
07506     if( use_neg ) N_obs_cvup_neg_res1 += hExpt->GetTotalContent(+1,-1);
07507     if( use_pos ) N_obs_cvup_res1     += hExpt->GetTotalContent(+1,+1);
07508     if( use_0 )   N_obs_cvup_res1     += hExpt->GetTotalContent(+1,0);
07509     if( use_neg ) N_obs_cvup_res1     += hExpt->GetTotalContent(+1,-1);
07510 
07511     if( use_pos ) N_obs_cvdn_pos_res1 += hExpt->GetTotalContent(-1,+1);
07512     if( use_0 )   N_obs_cvdn_0_res1   += hExpt->GetTotalContent(-1,0);
07513     if( use_neg ) N_obs_cvdn_neg_res1 += hExpt->GetTotalContent(-1,-1);  
07514     if( use_pos ) N_obs_cvdn_res1     += hExpt->GetTotalContent(-1,+1);
07515     if( use_0 )   N_obs_cvdn_res1     += hExpt->GetTotalContent(-1,0);
07516     if( use_neg ) N_obs_cvdn_res1     += hExpt->GetTotalContent(-1,-1);  
07517 
07518     if( use_pos ) N_fit_cvup_pos_res1 += hFit->GetTotalContent(+1,+1);
07519     if( use_0 )   N_fit_cvup_0_res1   += hFit->GetTotalContent(+1,0);
07520     if( use_neg ) N_fit_cvup_neg_res1 += hFit->GetTotalContent(+1,-1);
07521     if( use_pos ) N_fit_cvup_res1     += hFit->GetTotalContent(+1,+1);
07522     if( use_0 )   N_fit_cvup_res1     += hFit->GetTotalContent(+1,0);
07523     if( use_neg ) N_fit_cvup_res1     += hFit->GetTotalContent(+1,-1);
07524 
07525     if( use_pos ) N_fit_cvdn_pos_res1 += hFit->GetTotalContent(-1,+1);
07526     if( use_0 )   N_fit_cvdn_0_res1   += hFit->GetTotalContent(-1,0);
07527     if( use_neg ) N_fit_cvdn_neg_res1 += hFit->GetTotalContent(-1,-1);  
07528     if( use_pos ) N_fit_cvdn_res1     += hFit->GetTotalContent(-1,+1);
07529     if( use_0 )   N_fit_cvdn_res1     += hFit->GetTotalContent(-1,0);
07530     if( use_neg ) N_fit_cvdn_res1     += hFit->GetTotalContent(-1,-1);  
07531 
07532 
07533     // (3) CV::HIRES2
07534     // ==============
07535     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07536                                                                AtNuResolutionType::kHiRes2));
07537     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07538                                                                  AtNuResolutionType::kHiRes2));
07539     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07540 
07541     myDeltaLnL += deltaLnL;
07542 
07543     if( use_pos ) N_obs_cvup_pos += hExpt->GetTotalContent(+1,+1);
07544     if( use_0 )   N_obs_cvup_0   += hExpt->GetTotalContent(+1,0);
07545     if( use_neg ) N_obs_cvup_neg += hExpt->GetTotalContent(+1,-1);
07546     if( use_pos ) N_obs_cvup     += hExpt->GetTotalContent(+1,+1);
07547     if( use_0 )   N_obs_cvup     += hExpt->GetTotalContent(+1,0);
07548     if( use_neg ) N_obs_cvup     += hExpt->GetTotalContent(+1,-1);
07549 
07550     if( use_pos ) N_obs_cvdn_pos += hExpt->GetTotalContent(-1,+1);
07551     if( use_0 )   N_obs_cvdn_0   += hExpt->GetTotalContent(-1,0);
07552     if( use_neg ) N_obs_cvdn_neg += hExpt->GetTotalContent(-1,-1);  
07553     if( use_pos ) N_obs_cvdn     += hExpt->GetTotalContent(-1,+1);
07554     if( use_0 )   N_obs_cvdn     += hExpt->GetTotalContent(-1,0);
07555     if( use_neg ) N_obs_cvdn     += hExpt->GetTotalContent(-1,-1);
07556 
07557     if( use_pos ) N_fit_cvup_pos += hFit->GetTotalContent(+1,+1);
07558     if( use_0 )   N_fit_cvup_0   += hFit->GetTotalContent(+1,0);
07559     if( use_neg ) N_fit_cvup_neg += hFit->GetTotalContent(+1,-1);
07560     if( use_pos ) N_fit_cvup     += hFit->GetTotalContent(+1,+1);
07561     if( use_0 )   N_fit_cvup     += hFit->GetTotalContent(+1,0);
07562     if( use_neg ) N_fit_cvup     += hFit->GetTotalContent(+1,-1);
07563 
07564     if( use_pos ) N_fit_cvdn_pos += hFit->GetTotalContent(-1,+1);
07565     if( use_0 )   N_fit_cvdn_0   += hFit->GetTotalContent(-1,0);
07566     if( use_neg ) N_fit_cvdn_neg += hFit->GetTotalContent(-1,-1);  
07567     if( use_pos ) N_fit_cvdn     += hFit->GetTotalContent(-1,+1);
07568     if( use_0 )   N_fit_cvdn     += hFit->GetTotalContent(-1,0);
07569     if( use_neg ) N_fit_cvdn     += hFit->GetTotalContent(-1,-1);
07570 
07571     if( use_pos ) N_obs_cvup_pos_res2 += hExpt->GetTotalContent(+1,+1);
07572     if( use_0 )   N_obs_cvup_0_res2   += hExpt->GetTotalContent(+1,0);
07573     if( use_neg ) N_obs_cvup_neg_res2 += hExpt->GetTotalContent(+1,-1);
07574     if( use_pos ) N_obs_cvup_res2     += hExpt->GetTotalContent(+1,+1);
07575     if( use_0 )   N_obs_cvup_res2     += hExpt->GetTotalContent(+1,0);
07576     if( use_neg ) N_obs_cvup_res2     += hExpt->GetTotalContent(+1,-1);
07577 
07578     if( use_pos ) N_obs_cvdn_pos_res2 += hExpt->GetTotalContent(-1,+1);
07579     if( use_0 )   N_obs_cvdn_0_res2   += hExpt->GetTotalContent(-1,0);
07580     if( use_neg ) N_obs_cvdn_neg_res2 += hExpt->GetTotalContent(-1,-1);  
07581     if( use_pos ) N_obs_cvdn_res2     += hExpt->GetTotalContent(-1,+1);
07582     if( use_0 )   N_obs_cvdn_res2     += hExpt->GetTotalContent(-1,0);
07583     if( use_neg ) N_obs_cvdn_res2     += hExpt->GetTotalContent(-1,-1);
07584 
07585     if( use_pos ) N_fit_cvup_pos_res2 += hFit->GetTotalContent(+1,+1);
07586     if( use_0 )   N_fit_cvup_0_res2   += hFit->GetTotalContent(+1,0);
07587     if( use_neg ) N_fit_cvup_neg_res2 += hFit->GetTotalContent(+1,-1);
07588     if( use_pos ) N_fit_cvup_res2     += hFit->GetTotalContent(+1,+1);
07589     if( use_0 )   N_fit_cvup_res2     += hFit->GetTotalContent(+1,0);
07590     if( use_neg ) N_fit_cvup_res2     += hFit->GetTotalContent(+1,-1);
07591 
07592     if( use_pos ) N_fit_cvdn_pos_res2 += hFit->GetTotalContent(-1,+1);
07593     if( use_0 )   N_fit_cvdn_0_res2   += hFit->GetTotalContent(-1,0);
07594     if( use_neg ) N_fit_cvdn_neg_res2 += hFit->GetTotalContent(-1,-1); 
07595     if( use_pos ) N_fit_cvdn_res2     += hFit->GetTotalContent(-1,+1);
07596     if( use_0 )   N_fit_cvdn_res2     += hFit->GetTotalContent(-1,0);
07597     if( use_neg ) N_fit_cvdn_res2     += hFit->GetTotalContent(-1,-1); 
07598 
07599 
07600     // (4) CV::HIRES3
07601     // ==============
07602     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07603                                                                AtNuResolutionType::kHiRes3));
07604     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07605                                                                  AtNuResolutionType::kHiRes3));
07606     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07607 
07608     myDeltaLnL += deltaLnL;
07609 
07610     if( use_pos ) N_obs_cvup_pos += hExpt->GetTotalContent(+1,+1);
07611     if( use_0 )   N_obs_cvup_0   += hExpt->GetTotalContent(+1,0);
07612     if( use_neg ) N_obs_cvup_neg += hExpt->GetTotalContent(+1,-1);
07613     if( use_pos ) N_obs_cvup     += hExpt->GetTotalContent(+1,+1);
07614     if( use_0 )   N_obs_cvup     += hExpt->GetTotalContent(+1,0);
07615     if( use_neg ) N_obs_cvup     += hExpt->GetTotalContent(+1,-1);
07616 
07617     if( use_pos ) N_obs_cvdn_pos += hExpt->GetTotalContent(-1,+1);
07618     if( use_0 )   N_obs_cvdn_0   += hExpt->GetTotalContent(-1,0);
07619     if( use_neg ) N_obs_cvdn_neg += hExpt->GetTotalContent(-1,-1);  
07620     if( use_pos ) N_obs_cvdn     += hExpt->GetTotalContent(-1,+1);
07621     if( use_0 )   N_obs_cvdn     += hExpt->GetTotalContent(-1,0);
07622     if( use_neg ) N_obs_cvdn     += hExpt->GetTotalContent(-1,-1);
07623 
07624     if( use_pos ) N_fit_cvup_pos += hFit->GetTotalContent(+1,+1);
07625     if( use_0 )   N_fit_cvup_0   += hFit->GetTotalContent(+1,0);
07626     if( use_neg ) N_fit_cvup_neg += hFit->GetTotalContent(+1,-1);
07627     if( use_pos ) N_fit_cvup     += hFit->GetTotalContent(+1,+1);
07628     if( use_0 )   N_fit_cvup     += hFit->GetTotalContent(+1,0);
07629     if( use_neg ) N_fit_cvup     += hFit->GetTotalContent(+1,-1);
07630 
07631     if( use_pos ) N_fit_cvdn_pos += hFit->GetTotalContent(-1,+1);
07632     if( use_0 )   N_fit_cvdn_0   += hFit->GetTotalContent(-1,0);
07633     if( use_neg ) N_fit_cvdn_neg += hFit->GetTotalContent(-1,-1);  
07634     if( use_pos ) N_fit_cvdn     += hFit->GetTotalContent(-1,+1);
07635     if( use_0 )   N_fit_cvdn     += hFit->GetTotalContent(-1,0);
07636     if( use_neg ) N_fit_cvdn     += hFit->GetTotalContent(-1,-1);
07637 
07638     if( use_pos ) N_obs_cvup_pos_res3 += hExpt->GetTotalContent(+1,+1);
07639     if( use_0 )   N_obs_cvup_0_res3   += hExpt->GetTotalContent(+1,0);
07640     if( use_neg ) N_obs_cvup_neg_res3 += hExpt->GetTotalContent(+1,-1);
07641     if( use_pos ) N_obs_cvup_res3     += hExpt->GetTotalContent(+1,+1);
07642     if( use_0 )   N_obs_cvup_res3     += hExpt->GetTotalContent(+1,0);
07643     if( use_neg ) N_obs_cvup_res3     += hExpt->GetTotalContent(+1,-1);
07644 
07645     if( use_pos ) N_obs_cvdn_pos_res3 += hExpt->GetTotalContent(-1,+1);
07646     if( use_0 )   N_obs_cvdn_0_res3   += hExpt->GetTotalContent(-1,0);
07647     if( use_neg ) N_obs_cvdn_neg_res3 += hExpt->GetTotalContent(-1,-1);  
07648     if( use_pos ) N_obs_cvdn_res3     += hExpt->GetTotalContent(-1,+1);
07649     if( use_0 )   N_obs_cvdn_res3     += hExpt->GetTotalContent(-1,0);
07650     if( use_neg ) N_obs_cvdn_res3     += hExpt->GetTotalContent(-1,-1);  
07651 
07652     if( use_pos ) N_fit_cvup_pos_res3 += hFit->GetTotalContent(+1,+1);
07653     if( use_0 )   N_fit_cvup_0_res3   += hFit->GetTotalContent(+1,0);
07654     if( use_neg ) N_fit_cvup_neg_res3 += hFit->GetTotalContent(+1,-1);
07655     if( use_pos ) N_fit_cvup_res3     += hFit->GetTotalContent(+1,+1);
07656     if( use_0 )   N_fit_cvup_res3     += hFit->GetTotalContent(+1,0);
07657     if( use_neg ) N_fit_cvup_res3     += hFit->GetTotalContent(+1,-1);
07658 
07659     if( use_pos ) N_fit_cvdn_pos_res3 += hFit->GetTotalContent(-1,+1);
07660     if( use_0 )   N_fit_cvdn_0_res3   += hFit->GetTotalContent(-1,0);
07661     if( use_neg ) N_fit_cvdn_neg_res3 += hFit->GetTotalContent(-1,-1); 
07662     if( use_pos ) N_fit_cvdn_res3     += hFit->GetTotalContent(-1,+1);
07663     if( use_0 )   N_fit_cvdn_res3     += hFit->GetTotalContent(-1,0);
07664     if( use_neg ) N_fit_cvdn_res3     += hFit->GetTotalContent(-1,-1); 
07665 
07666 
07667     // (5) CV::HIRES4 
07668     // ==============
07669     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kCV,
07670                                                                AtNuResolutionType::kHiRes4));
07671     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kCV,
07672                                                                  AtNuResolutionType::kHiRes4));
07673     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07674 
07675     myDeltaLnL += deltaLnL;
07676 
07677     if( use_pos ) N_obs_cvup_pos += hExpt->GetTotalContent(+1,+1);
07678     if( use_0 )   N_obs_cvup_0   += hExpt->GetTotalContent(+1,0);
07679     if( use_neg ) N_obs_cvup_neg += hExpt->GetTotalContent(+1,-1);
07680     if( use_pos ) N_obs_cvup     += hExpt->GetTotalContent(+1,+1);
07681     if( use_0 )   N_obs_cvup     += hExpt->GetTotalContent(+1,0);
07682     if( use_neg ) N_obs_cvup     += hExpt->GetTotalContent(+1,-1);
07683 
07684     if( use_pos ) N_obs_cvdn_pos += hExpt->GetTotalContent(-1,+1);
07685     if( use_0 )   N_obs_cvdn_0   += hExpt->GetTotalContent(-1,0);
07686     if( use_neg ) N_obs_cvdn_neg += hExpt->GetTotalContent(-1,-1);  
07687     if( use_pos ) N_obs_cvdn     += hExpt->GetTotalContent(-1,+1);
07688     if( use_0 )   N_obs_cvdn     += hExpt->GetTotalContent(-1,0);
07689     if( use_neg ) N_obs_cvdn     += hExpt->GetTotalContent(-1,-1);
07690 
07691     if( use_pos ) N_fit_cvup_pos += hFit->GetTotalContent(+1,+1);
07692     if( use_0 )   N_fit_cvup_0   += hFit->GetTotalContent(+1,0);
07693     if( use_neg ) N_fit_cvup_neg += hFit->GetTotalContent(+1,-1);
07694     if( use_pos ) N_fit_cvup     += hFit->GetTotalContent(+1,+1);
07695     if( use_0 )   N_fit_cvup     += hFit->GetTotalContent(+1,0);
07696     if( use_neg ) N_fit_cvup     += hFit->GetTotalContent(+1,-1);
07697 
07698     if( use_pos ) N_fit_cvdn_pos += hFit->GetTotalContent(-1,+1);
07699     if( use_0 )   N_fit_cvdn_0   += hFit->GetTotalContent(-1,0);
07700     if( use_neg ) N_fit_cvdn_neg += hFit->GetTotalContent(-1,-1);  
07701     if( use_pos ) N_fit_cvdn     += hFit->GetTotalContent(-1,+1);
07702     if( use_0 )   N_fit_cvdn     += hFit->GetTotalContent(-1,0);
07703     if( use_neg ) N_fit_cvdn     += hFit->GetTotalContent(-1,-1);
07704 
07705     if( use_pos ) N_obs_cvup_pos_res4 += hExpt->GetTotalContent(+1,+1);
07706     if( use_0 )   N_obs_cvup_0_res4   += hExpt->GetTotalContent(+1,0);
07707     if( use_neg ) N_obs_cvup_neg_res4 += hExpt->GetTotalContent(+1,-1);
07708     if( use_pos ) N_obs_cvup_res4     += hExpt->GetTotalContent(+1,+1);
07709     if( use_0 )   N_obs_cvup_res4     += hExpt->GetTotalContent(+1,0);
07710     if( use_neg ) N_obs_cvup_res4     += hExpt->GetTotalContent(+1,-1);
07711 
07712     if( use_pos ) N_obs_cvdn_pos_res4 += hExpt->GetTotalContent(-1,+1);
07713     if( use_0 )   N_obs_cvdn_0_res4   += hExpt->GetTotalContent(-1,0);
07714     if( use_neg ) N_obs_cvdn_neg_res4 += hExpt->GetTotalContent(-1,-1);  
07715     if( use_pos ) N_obs_cvdn_res4     += hExpt->GetTotalContent(-1,+1);
07716     if( use_0 )   N_obs_cvdn_res4     += hExpt->GetTotalContent(-1,0);
07717     if( use_neg ) N_obs_cvdn_res4     += hExpt->GetTotalContent(-1,-1);  
07718 
07719     if( use_pos ) N_fit_cvup_pos_res4 += hFit->GetTotalContent(+1,+1);
07720     if( use_0 )   N_fit_cvup_0_res4   += hFit->GetTotalContent(+1,0);
07721     if( use_neg ) N_fit_cvup_neg_res4 += hFit->GetTotalContent(+1,-1);
07722     if( use_pos ) N_fit_cvup_res4     += hFit->GetTotalContent(+1,+1);
07723     if( use_0 )   N_fit_cvup_res4     += hFit->GetTotalContent(+1,0);
07724     if( use_neg ) N_fit_cvup_res4     += hFit->GetTotalContent(+1,-1);
07725 
07726     if( use_pos ) N_fit_cvdn_pos_res4 += hFit->GetTotalContent(-1,+1);
07727     if( use_0 )   N_fit_cvdn_0_res4   += hFit->GetTotalContent(-1,0);
07728     if( use_neg ) N_fit_cvdn_neg_res4 += hFit->GetTotalContent(-1,-1); 
07729     if( use_pos ) N_fit_cvdn_res4     += hFit->GetTotalContent(-1,+1);
07730     if( use_0 )   N_fit_cvdn_res4     += hFit->GetTotalContent(-1,0);
07731     if( use_neg ) N_fit_cvdn_res4     += hFit->GetTotalContent(-1,-1); 
07732 
07733 
07734     // store delta log-likelihood (shape)
07735     fLNL_CV_HIRES_SHAPE = myDeltaLnL;
07736 
07737     // contained vertex (high resolution)
07738     if( N_fit_cvup+N_fit_cvdn>0.0 ){
07739       
07740       myDeltaLnLnorm = (N_fit_cvup+N_fit_cvdn) - (N_obs_cvup+N_obs_cvdn)*log((N_fit_cvup+N_fit_cvdn));
07741       myDeltaLnLupdn = 0.0;
07742       myDeltaLnLres = 0.0;
07743 
07744        // up-going events
07745       if( separate_charge ){
07746         if( use_negatives ){
07747           if( N_fit_cvup_neg>0.0 ){
07748             myDeltaLnLupdn += -N_obs_cvup_neg*log(N_fit_cvup_neg/(N_fit_cvup+N_fit_cvdn));
07749             if( N_fit_cvup_neg_res1>0.0 ) myDeltaLnLres += -N_obs_cvup_neg_res1*log(N_fit_cvup_neg_res1/N_fit_cvup_neg);
07750             if( N_fit_cvup_neg_res2>0.0 ) myDeltaLnLres += -N_obs_cvup_neg_res2*log(N_fit_cvup_neg_res2/N_fit_cvup_neg);
07751             if( N_fit_cvup_neg_res3>0.0 ) myDeltaLnLres += -N_obs_cvup_neg_res3*log(N_fit_cvup_neg_res3/N_fit_cvup_neg);
07752             if( N_fit_cvup_neg_res4>0.0 ) myDeltaLnLres += -N_obs_cvup_neg_res4*log(N_fit_cvup_neg_res4/N_fit_cvup_neg);
07753           }
07754         }
07755         if( use_negatives 
07756          && use_positives ){
07757           if( N_fit_cvup_0>0.0 ){
07758             myDeltaLnLupdn += -N_obs_cvup_0*log(N_fit_cvup_0/(N_fit_cvup+N_fit_cvdn));
07759             if( N_fit_cvup_0_res1>0.0 ) myDeltaLnLres += -N_obs_cvup_0_res1*log(N_fit_cvup_0_res1/N_fit_cvup_0);
07760             if( N_fit_cvup_0_res2>0.0 ) myDeltaLnLres += -N_obs_cvup_0_res2*log(N_fit_cvup_0_res2/N_fit_cvup_0);
07761             if( N_fit_cvup_0_res3>0.0 ) myDeltaLnLres += -N_obs_cvup_0_res3*log(N_fit_cvup_0_res3/N_fit_cvup_0);
07762             if( N_fit_cvup_0_res4>0.0 ) myDeltaLnLres += -N_obs_cvup_0_res4*log(N_fit_cvup_0_res4/N_fit_cvup_0);
07763           }
07764         }
07765         if( use_positives ){
07766           if( N_fit_cvup_pos>0.0 ){
07767             myDeltaLnLupdn += -N_obs_cvup_pos*log(N_fit_cvup_pos/(N_fit_cvup+N_fit_cvdn));
07768             if( N_fit_cvup_pos_res1>0.0 ) myDeltaLnLres += -N_obs_cvup_pos_res1*log(N_fit_cvup_pos_res1/N_fit_cvup_pos);
07769             if( N_fit_cvup_pos_res2>0.0 ) myDeltaLnLres += -N_obs_cvup_pos_res2*log(N_fit_cvup_pos_res2/N_fit_cvup_pos);
07770             if( N_fit_cvup_pos_res3>0.0 ) myDeltaLnLres += -N_obs_cvup_pos_res3*log(N_fit_cvup_pos_res3/N_fit_cvup_pos);
07771             if( N_fit_cvup_pos_res4>0.0 ) myDeltaLnLres += -N_obs_cvup_pos_res4*log(N_fit_cvup_pos_res4/N_fit_cvup_pos);
07772           }
07773         }
07774       }
07775       else{
07776         if( N_fit_cvup>0.0 ){
07777           myDeltaLnLupdn += -N_obs_cvup*log(N_fit_cvup/(N_fit_cvup+N_fit_cvdn));
07778           if( N_fit_cvup_res1>0.0 ) myDeltaLnLres += -N_obs_cvup_res1*log(N_fit_cvup_res1/N_fit_cvup);
07779           if( N_fit_cvup_res2>0.0 ) myDeltaLnLres += -N_obs_cvup_res2*log(N_fit_cvup_res2/N_fit_cvup);
07780           if( N_fit_cvup_res3>0.0 ) myDeltaLnLres += -N_obs_cvup_res3*log(N_fit_cvup_res3/N_fit_cvup);
07781           if( N_fit_cvup_res4>0.0 ) myDeltaLnLres += -N_obs_cvup_res4*log(N_fit_cvup_res4/N_fit_cvup);
07782         }
07783       }
07784 
07785       // down-going events
07786       if( separate_charge ){
07787         if( use_negatives ){
07788           if( N_fit_cvdn_neg>0.0 ){
07789             myDeltaLnLupdn += -N_obs_cvdn_neg*log(N_fit_cvdn_neg/(N_fit_cvup+N_fit_cvdn));
07790             if( N_fit_cvdn_neg_res1>0.0 ) myDeltaLnLres += -N_obs_cvdn_neg_res1*log(N_fit_cvdn_neg_res1/N_fit_cvdn_neg);
07791             if( N_fit_cvdn_neg_res2>0.0 ) myDeltaLnLres += -N_obs_cvdn_neg_res2*log(N_fit_cvdn_neg_res2/N_fit_cvdn_neg);
07792             if( N_fit_cvdn_neg_res3>0.0 ) myDeltaLnLres += -N_obs_cvdn_neg_res3*log(N_fit_cvdn_neg_res3/N_fit_cvdn_neg);
07793             if( N_fit_cvdn_neg_res4>0.0 ) myDeltaLnLres += -N_obs_cvdn_neg_res4*log(N_fit_cvdn_neg_res4/N_fit_cvdn_neg);
07794           }
07795         }
07796         if( use_negatives 
07797          && use_positives ){
07798           if( N_fit_cvdn_0>0.0 ){
07799             myDeltaLnLupdn += -N_obs_cvdn_0*log(N_fit_cvdn_0/(N_fit_cvup+N_fit_cvdn));
07800             if( N_fit_cvdn_0_res1>0.0 ) myDeltaLnLres += -N_obs_cvdn_0_res1*log(N_fit_cvdn_0_res1/N_fit_cvdn_0);
07801             if( N_fit_cvdn_0_res2>0.0 ) myDeltaLnLres += -N_obs_cvdn_0_res2*log(N_fit_cvdn_0_res2/N_fit_cvdn_0);
07802             if( N_fit_cvdn_0_res3>0.0 ) myDeltaLnLres += -N_obs_cvdn_0_res3*log(N_fit_cvdn_0_res3/N_fit_cvdn_0);
07803             if( N_fit_cvdn_0_res4>0.0 ) myDeltaLnLres += -N_obs_cvdn_0_res4*log(N_fit_cvdn_0_res4/N_fit_cvdn_0);
07804           }
07805         }
07806         if( use_positives ){
07807           if( N_fit_cvdn_pos>0.0 ){
07808             myDeltaLnLupdn += -N_obs_cvdn_pos*log(N_fit_cvdn_pos/(N_fit_cvup+N_fit_cvdn));
07809             if( N_fit_cvdn_pos_res1>0.0 ) myDeltaLnLres += -N_obs_cvdn_pos_res1*log(N_fit_cvdn_pos_res1/N_fit_cvdn_pos);
07810             if( N_fit_cvdn_pos_res2>0.0 ) myDeltaLnLres += -N_obs_cvdn_pos_res2*log(N_fit_cvdn_pos_res2/N_fit_cvdn_pos);
07811             if( N_fit_cvdn_pos_res3>0.0 ) myDeltaLnLres += -N_obs_cvdn_pos_res3*log(N_fit_cvdn_pos_res3/N_fit_cvdn_pos);
07812             if( N_fit_cvdn_pos_res4>0.0 ) myDeltaLnLres += -N_obs_cvdn_pos_res4*log(N_fit_cvdn_pos_res4/N_fit_cvdn_pos);
07813           }
07814         }
07815       }
07816       else{
07817         if( N_fit_cvdn>0.0 ){
07818           myDeltaLnLupdn += -N_obs_cvdn*log(N_fit_cvdn/(N_fit_cvup+N_fit_cvdn));
07819           if( N_fit_cvdn_res1>0.0 ) myDeltaLnLres += -N_obs_cvdn_res1*log(N_fit_cvdn_res1/N_fit_cvdn);
07820           if( N_fit_cvdn_res2>0.0 ) myDeltaLnLres += -N_obs_cvdn_res2*log(N_fit_cvdn_res2/N_fit_cvdn);
07821           if( N_fit_cvdn_res3>0.0 ) myDeltaLnLres += -N_obs_cvdn_res3*log(N_fit_cvdn_res3/N_fit_cvdn);
07822           if( N_fit_cvdn_res4>0.0 ) myDeltaLnLres += -N_obs_cvdn_res4*log(N_fit_cvdn_res4/N_fit_cvdn);
07823         }
07824       }
07825 
07826       // store delta log-likelihood (normalization)
07827       fLNL_CV_HIRES_NORM = myDeltaLnLnorm;
07828       fLNL_CV_HIRES_UPDN = myDeltaLnLupdn;
07829 
07830       myDeltaLnL += myDeltaLnLnorm + myDeltaLnLupdn;
07831  
07832       if( fUseModifiedBayesLikelihood ){
07833         fLNL_CV_HIRES_SHAPE += myDeltaLnLres;
07834         myDeltaLnL += myDeltaLnLres;
07835       }
07836     }   
07837 
07838     // store log-likelihood
07839     // ====================
07840     fLNL_CV_HIRES = fLNL_CV_HIRES_SHAPE + fLNL_CV_HIRES_NORM + fLNL_CV_HIRES_UPDN;
07841 
07842     // add on log-likelihood
07843     // =====================
07844     dLnL += myDeltaLnL;
07845   }
07846 
07847   // Upward Muons
07848   // ============       
07849   if( fUseUPMUHIRES ){
07850 
07851     // initialize log-likelihood
07852     // =========================
07853     myDeltaLnL = 0.0;
07854 
07855 
07856     // (6) UPMU::HIRES1
07857     // ================
07858     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07859                                                                AtNuResolutionType::kHiRes1));
07860     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07861                                                                  AtNuResolutionType::kHiRes1));
07862     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07863 
07864     myDeltaLnL += deltaLnL;
07865 
07866     if( use_pos ) N_obs_upmu_pos  += hExpt->GetTotalContent(+1,+1);
07867     if( use_0 )   N_obs_upmu_0    += hExpt->GetTotalContent(+1,0);
07868     if( use_neg ) N_obs_upmu_neg  += hExpt->GetTotalContent(+1,-1);
07869     if( use_pos ) N_obs_upmu      += hExpt->GetTotalContent(+1,+1);
07870     if( use_0 )   N_obs_upmu      += hExpt->GetTotalContent(+1,0);
07871     if( use_neg ) N_obs_upmu      += hExpt->GetTotalContent(+1,-1);
07872 
07873     if( use_pos ) N_fit_upmu_pos  += hFit->GetTotalContent(+1,+1);
07874     if( use_0 )   N_fit_upmu_0    += hFit->GetTotalContent(+1,0);
07875     if( use_neg ) N_fit_upmu_neg  += hFit->GetTotalContent(+1,-1);
07876     if( use_pos ) N_fit_upmu      += hFit->GetTotalContent(+1,+1);
07877     if( use_0 )   N_fit_upmu      += hFit->GetTotalContent(+1,0);
07878     if( use_neg ) N_fit_upmu      += hFit->GetTotalContent(+1,-1);
07879 
07880     if( use_pos ) N_obs_upmu_pos_res1  += hExpt->GetTotalContent(+1,+1);
07881     if( use_0 )   N_obs_upmu_0_res1    += hExpt->GetTotalContent(+1,0);
07882     if( use_neg ) N_obs_upmu_neg_res1  += hExpt->GetTotalContent(+1,-1);
07883     if( use_pos ) N_obs_upmu_res1      += hExpt->GetTotalContent(+1,+1);
07884     if( use_0 )   N_obs_upmu_res1      += hExpt->GetTotalContent(+1,0);
07885     if( use_neg ) N_obs_upmu_res1      += hExpt->GetTotalContent(+1,-1);
07886 
07887     if( use_pos ) N_fit_upmu_pos_res1  += hFit->GetTotalContent(+1,+1);
07888     if( use_0 )   N_fit_upmu_0_res1    += hFit->GetTotalContent(+1,0);
07889     if( use_neg ) N_fit_upmu_neg_res1  += hFit->GetTotalContent(+1,-1);
07890     if( use_pos ) N_fit_upmu_res1      += hFit->GetTotalContent(+1,+1);
07891     if( use_0 )   N_fit_upmu_res1      += hFit->GetTotalContent(+1,0);
07892     if( use_neg ) N_fit_upmu_res1      += hFit->GetTotalContent(+1,-1);
07893 
07894 
07895     // (7) UPMU::HIRES2
07896     // ================
07897     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07898                                                                AtNuResolutionType::kHiRes2)); 
07899     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07900                                                                  AtNuResolutionType::kHiRes2));
07901     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07902 
07903     myDeltaLnL += deltaLnL;
07904 
07905     if( use_pos ) N_obs_upmu_pos  += hExpt->GetTotalContent(+1,+1);
07906     if( use_0 )   N_obs_upmu_0    += hExpt->GetTotalContent(+1,0);
07907     if( use_neg ) N_obs_upmu_neg  += hExpt->GetTotalContent(+1,-1);
07908     if( use_pos ) N_obs_upmu      += hExpt->GetTotalContent(+1,+1);
07909     if( use_0 )   N_obs_upmu      += hExpt->GetTotalContent(+1,0);
07910     if( use_neg ) N_obs_upmu      += hExpt->GetTotalContent(+1,-1);
07911 
07912     if( use_pos ) N_fit_upmu_pos  += hFit->GetTotalContent(+1,+1);
07913     if( use_0 )   N_fit_upmu_0    += hFit->GetTotalContent(+1,0);
07914     if( use_neg ) N_fit_upmu_neg  += hFit->GetTotalContent(+1,-1);
07915     if( use_pos ) N_fit_upmu      += hFit->GetTotalContent(+1,+1);
07916     if( use_0 )   N_fit_upmu      += hFit->GetTotalContent(+1,0);
07917     if( use_neg ) N_fit_upmu      += hFit->GetTotalContent(+1,-1);
07918 
07919     if( use_pos ) N_obs_upmu_pos_res2  += hExpt->GetTotalContent(+1,+1);
07920     if( use_0 )   N_obs_upmu_0_res2    += hExpt->GetTotalContent(+1,0);
07921     if( use_neg ) N_obs_upmu_neg_res2  += hExpt->GetTotalContent(+1,-1);
07922     if( use_pos ) N_obs_upmu_res2      += hExpt->GetTotalContent(+1,+1);
07923     if( use_0 )   N_obs_upmu_res2      += hExpt->GetTotalContent(+1,0);
07924     if( use_neg ) N_obs_upmu_res2      += hExpt->GetTotalContent(+1,-1);
07925 
07926     if( use_pos ) N_fit_upmu_pos_res2  += hFit->GetTotalContent(+1,+1);
07927     if( use_0 )   N_fit_upmu_0_res2    += hFit->GetTotalContent(+1,0);
07928     if( use_neg ) N_fit_upmu_neg_res2  += hFit->GetTotalContent(+1,-1);  
07929     if( use_pos ) N_fit_upmu_res2      += hFit->GetTotalContent(+1,+1);
07930     if( use_0 )   N_fit_upmu_res2      += hFit->GetTotalContent(+1,0);
07931     if( use_neg ) N_fit_upmu_res2      += hFit->GetTotalContent(+1,-1);
07932 
07933 
07934     // (8) UPMU::HIRES3
07935     // ================
07936     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07937                                                                AtNuResolutionType::kHiRes3));
07938     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07939                                                                  AtNuResolutionType::kHiRes3));
07940     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07941 
07942     myDeltaLnL += deltaLnL;
07943 
07944     if( use_pos ) N_obs_upmu_pos  += hExpt->GetTotalContent(+1,+1);
07945     if( use_0 )   N_obs_upmu_0    += hExpt->GetTotalContent(+1,0);
07946     if( use_neg ) N_obs_upmu_neg  += hExpt->GetTotalContent(+1,-1);
07947     if( use_pos ) N_obs_upmu      += hExpt->GetTotalContent(+1,+1);
07948     if( use_0 )   N_obs_upmu      += hExpt->GetTotalContent(+1,0);
07949     if( use_neg ) N_obs_upmu      += hExpt->GetTotalContent(+1,-1);
07950 
07951     if( use_pos ) N_fit_upmu_pos  += hFit->GetTotalContent(+1,+1);
07952     if( use_0 )   N_fit_upmu_0    += hFit->GetTotalContent(+1,0);
07953     if( use_neg ) N_fit_upmu_neg  += hFit->GetTotalContent(+1,-1);
07954     if( use_pos ) N_fit_upmu      += hFit->GetTotalContent(+1,+1);
07955     if( use_0 )   N_fit_upmu      += hFit->GetTotalContent(+1,0);
07956     if( use_neg ) N_fit_upmu      += hFit->GetTotalContent(+1,-1);
07957 
07958     if( use_pos ) N_obs_upmu_pos_res3  += hExpt->GetTotalContent(+1,+1);
07959     if( use_0 )   N_obs_upmu_0_res3    += hExpt->GetTotalContent(+1,0);
07960     if( use_neg ) N_obs_upmu_neg_res3  += hExpt->GetTotalContent(+1,-1); 
07961     if( use_pos ) N_obs_upmu_res3      += hExpt->GetTotalContent(+1,+1);
07962     if( use_0 )   N_obs_upmu_res3      += hExpt->GetTotalContent(+1,0);
07963     if( use_neg ) N_obs_upmu_res3      += hExpt->GetTotalContent(+1,-1);
07964 
07965     if( use_pos ) N_fit_upmu_pos_res3  += hFit->GetTotalContent(+1,+1);
07966     if( use_0 )   N_fit_upmu_0_res3    += hFit->GetTotalContent(+1,0);
07967     if( use_neg ) N_fit_upmu_neg_res3  += hFit->GetTotalContent(+1,-1); 
07968     if( use_pos ) N_fit_upmu_res3      += hFit->GetTotalContent(+1,+1);
07969     if( use_0 )   N_fit_upmu_res3      += hFit->GetTotalContent(+1,0);
07970     if( use_neg ) N_fit_upmu_res3      += hFit->GetTotalContent(+1,-1);
07971 
07972 
07973     // (9) UPMU::HIRES4
07974     // ================
07975     hFit = (AtNuOscFitHistogram*)(myTemplateFit->GetHistogram(AtNuResolutionEventType::kUPMU,
07976                                                                AtNuResolutionType::kHiRes4));
07977     hExpt = (AtNuOscFitHistogram*)(myTemplateExpt->GetHistogram(AtNuResolutionEventType::kUPMU,
07978                                                                  AtNuResolutionType::kHiRes4));
07979     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,hExpt,hFit,deltaLnL);
07980 
07981     myDeltaLnL += deltaLnL;
07982 
07983     if( use_pos ) N_obs_upmu_pos  += hExpt->GetTotalContent(+1,+1);
07984     if( use_0 )   N_obs_upmu_0    += hExpt->GetTotalContent(+1,0);
07985     if( use_neg ) N_obs_upmu_neg  += hExpt->GetTotalContent(+1,-1);
07986     if( use_pos ) N_obs_upmu      += hExpt->GetTotalContent(+1,+1);
07987     if( use_0 )   N_obs_upmu      += hExpt->GetTotalContent(+1,0);
07988     if( use_neg ) N_obs_upmu      += hExpt->GetTotalContent(+1,-1);
07989 
07990     if( use_pos ) N_fit_upmu_pos  += hFit->GetTotalContent(+1,+1);
07991     if( use_0 )   N_fit_upmu_0    += hFit->GetTotalContent(+1,0);
07992     if( use_neg ) N_fit_upmu_neg  += hFit->GetTotalContent(+1,-1);
07993     if( use_pos ) N_fit_upmu      += hFit->GetTotalContent(+1,+1);
07994     if( use_0 )   N_fit_upmu      += hFit->GetTotalContent(+1,0);
07995     if( use_neg ) N_fit_upmu      += hFit->GetTotalContent(+1,-1);
07996 
07997     if( use_pos ) N_obs_upmu_pos_res4  += hExpt->GetTotalContent(+1,+1);
07998     if( use_0 )   N_obs_upmu_0_res4    += hExpt->GetTotalContent(+1,0);
07999     if( use_neg ) N_obs_upmu_neg_res4  += hExpt->GetTotalContent(+1,-1);
08000     if( use_pos ) N_obs_upmu_res4      += hExpt->GetTotalContent(+1,+1);
08001     if( use_0 )   N_obs_upmu_res4      += hExpt->GetTotalContent(+1,0);
08002     if( use_neg ) N_obs_upmu_res4      += hExpt->GetTotalContent(+1,-1);
08003 
08004     if( use_pos ) N_fit_upmu_pos_res4  += hFit->GetTotalContent(+1,+1);
08005     if( use_0 )   N_fit_upmu_0_res4    += hFit->GetTotalContent(+1,0);
08006     if( use_neg ) N_fit_upmu_neg_res4  += hFit->GetTotalContent(+1,-1);
08007     if( use_pos ) N_fit_upmu_res4      += hFit->GetTotalContent(+1,+1);
08008     if( use_0 )   N_fit_upmu_res4      += hFit->GetTotalContent(+1,0);
08009     if( use_neg ) N_fit_upmu_res4      += hFit->GetTotalContent(+1,-1);
08010 
08011     // store delta log-likelihood (shape)
08012     fLNL_UPMU_HIRES_SHAPE = myDeltaLnL;
08013 
08014 
08015     // upward muons
08016     if( N_fit_upmu>0.0 ){
08017 
08018       myDeltaLnLnorm = N_fit_upmu - N_obs_upmu*log(N_fit_upmu);
08019       myDeltaLnLupdn = 0.0;
08020       myDeltaLnLres = 0.0;
08021 
08022       if( separate_charge ){
08023         if( use_negatives ){
08024           if( N_fit_upmu_neg>0.0 ){
08025             myDeltaLnLupdn += -N_obs_upmu_neg*log(N_fit_upmu_neg/N_fit_upmu);
08026             if( N_fit_upmu_neg_res1>0.0 ) myDeltaLnLres += -N_obs_upmu_neg_res1*log(N_fit_upmu_neg_res1/N_fit_upmu_neg);
08027             if( N_fit_upmu_neg_res2>0.0 ) myDeltaLnLres += -N_obs_upmu_neg_res2*log(N_fit_upmu_neg_res2/N_fit_upmu_neg);
08028             if( N_fit_upmu_neg_res3>0.0 ) myDeltaLnLres += -N_obs_upmu_neg_res3*log(N_fit_upmu_neg_res3/N_fit_upmu_neg);
08029             if( N_fit_upmu_neg_res4>0.0 ) myDeltaLnLres += -N_obs_upmu_neg_res4*log(N_fit_upmu_neg_res4/N_fit_upmu_neg);
08030           }
08031         }
08032         if( use_negatives 
08033          && use_positives ){
08034           if( N_fit_upmu_0>0.0 ){
08035             myDeltaLnLupdn += -N_obs_upmu_0*log(N_fit_upmu_0/N_fit_upmu);
08036             if( N_fit_upmu_0_res1>0.0 ) myDeltaLnLres += -N_obs_upmu_0_res1*log(N_fit_upmu_0_res1/N_fit_upmu_0);
08037             if( N_fit_upmu_0_res2>0.0 ) myDeltaLnLres += -N_obs_upmu_0_res2*log(N_fit_upmu_0_res2/N_fit_upmu_0);
08038             if( N_fit_upmu_0_res3>0.0 ) myDeltaLnLres += -N_obs_upmu_0_res3*log(N_fit_upmu_0_res3/N_fit_upmu_0);
08039             if( N_fit_upmu_0_res4>0.0 ) myDeltaLnLres += -N_obs_upmu_0_res4*log(N_fit_upmu_0_res4/N_fit_upmu_0);
08040           }
08041         }
08042         if( use_positives ){
08043           if( N_fit_upmu_pos>0.0 ){
08044             myDeltaLnLupdn += -N_obs_upmu_pos*log(N_fit_upmu_pos/N_fit_upmu);
08045             if( N_fit_upmu_pos_res1>0.0 ) myDeltaLnLres += -N_obs_upmu_pos_res1*log(N_fit_upmu_pos_res1/N_fit_upmu_pos);
08046             if( N_fit_upmu_pos_res2>0.0 ) myDeltaLnLres += -N_obs_upmu_pos_res2*log(N_fit_upmu_pos_res2/N_fit_upmu_pos);
08047             if( N_fit_upmu_pos_res3>0.0 ) myDeltaLnLres += -N_obs_upmu_pos_res3*log(N_fit_upmu_pos_res3/N_fit_upmu_pos);
08048             if( N_fit_upmu_pos_res4>0.0 ) myDeltaLnLres += -N_obs_upmu_pos_res4*log(N_fit_upmu_pos_res4/N_fit_upmu_pos);
08049           }
08050         }
08051       }      
08052 
08053       // store delta log-likelihood (normalization)
08054       fLNL_UPMU_HIRES_NORM = myDeltaLnLnorm;
08055       fLNL_UPMU_HIRES_UPDN = myDeltaLnLupdn;
08056 
08057       myDeltaLnL += myDeltaLnLnorm + myDeltaLnLupdn;
08058 
08059       if( fUseModifiedBayesLikelihood ){
08060         fLNL_UPMU_HIRES_SHAPE += myDeltaLnLres;
08061         myDeltaLnL += myDeltaLnLres;
08062       }
08063     }    
08064 
08065     // store log-likelihood
08066     // ====================
08067     fLNL_UPMU_HIRES = fLNL_UPMU_HIRES_SHAPE + fLNL_UPMU_HIRES_NORM + fLNL_UPMU_HIRES_UPDN;
08068 
08069     // add on log-likelihood
08070     // =====================
08071     dLnL += myDeltaLnL;
08072   }
08073 
08074   // return log-likelihood
08075   // =====================
08076   // dLnL = ...
08077 
08078   return;
08079 }

Double_t AtNuOscFit::GetDmsq ( Int_t  ibin  ) 

Definition at line 1391 of file AtNuOscFit.cxx.

References fNX, and fX.

01392 {
01393   if( fX ){
01394     if( ibin>=0 && ibin<fNX ) return fX[ibin];
01395     else if( ibin==-1 ) return 0.0;
01396   }
01397   return -999.9;
01398 }

Int_t AtNuOscFit::GetDmsqBin ( Double_t  dmsq  ) 

Definition at line 1418 of file AtNuOscFit.cxx.

References SnapToGridDmsq().

01419 {
01420   Int_t DmsqBin = -1;
01421 
01422   this->SnapToGridDmsq( dmsq, DmsqBin );
01423   
01424   return DmsqBin;
01425 }

Int_t AtNuOscFit::GetDmsqBins (  ) 

Definition at line 1386 of file AtNuOscFit.cxx.

References fNX.

01387 {
01388   return fNX;
01389 }

Double_t AtNuOscFit::GetDmsqMax ( Int_t  ibin  ) 

Definition at line 1409 of file AtNuOscFit.cxx.

References fNX, and fXedge.

Referenced by SetNuBarOscillations(), and SetNuOscillations().

01410 {
01411   if( fXedge ){
01412     if( ibin>=0 && ibin<fNX ) return fXedge[ibin+1];
01413     else if( ibin==-1 ) return fXedge[0];
01414   }
01415   return -999.9;
01416 }

Double_t AtNuOscFit::GetDmsqMin ( Int_t  ibin  ) 

Definition at line 1400 of file AtNuOscFit.cxx.

References fNX, and fXedge.

Referenced by SetNuBarOscillations(), and SetNuOscillations().

01401 {
01402   if( fXedge ){
01403     if( ibin>=0 && ibin<fNX ) return fXedge[ibin];
01404     else if( ibin==-1 ) return 0.0;
01405   }
01406   return -999.9;
01407 }

void AtNuOscFit::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  normupmu,
Double_t  elmu,
Double_t  ccnc,
Double_t  updn,
Double_t  chg,
Double_t  chgupmu,
Double_t  specnu,
Double_t  specnubar,
Double_t  emurange,
Double_t  emucurve,
Double_t  eshw,
Double_t  fsnu,
Double_t  fsnubar,
Double_t  dmnu,
Double_t  dmnubar,
AtNuOscFitTemplate *&  myTemplate 
)

Definition at line 1866 of file AtNuOscFit.cxx.

References GetExpectation().

01867 {
01868 
01869   this->GetExpectation(1,1,    
01870                        1,1,1, 
01871                        1,1,   
01872                        1,      
01873                        dmsq,sinsq,        
01874                        dmsqbar,sinsqbar,  
01875                        norm,normupmu,
01876                        elmu,ccnc,
01877                        updn,chg,chgupmu,
01878                        specnu,specnubar,  
01879                        emurange,emucurve,eshw,   
01880                        fsnu,fsnubar,    
01881                        dmnu,dmnubar,      
01882                        myTemplate); 
01883   return;
01884 }

void AtNuOscFit::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  norm,
Double_t  normupmu,
Double_t  elmu,
Double_t  ccnc,
Double_t  updn,
Double_t  chg,
Double_t  chgupmu,
Double_t  specnu,
Double_t  specnubar,
Double_t  emurange,
Double_t  emucurve,
Double_t  eshw,
Double_t  fsnu,
Double_t  dmnu,
AtNuOscFitTemplate *&  myTemplate 
)

Definition at line 1851 of file AtNuOscFit.cxx.

References GetExpectation().

01852 {
01853   this->GetExpectation(dmsq,sinsq,  
01854                        dmsq,sinsq,  
01855                        norm,normupmu,
01856                        elmu,ccnc,
01857                        updn,chg,chgupmu,
01858                        specnu,specnubar,  
01859                        emurange,emucurve,eshw,   
01860                        fsnu,fsnu,    
01861                        dmnu,dmnu,      
01862                        myTemplate); 
01863   return;
01864 }

void AtNuOscFit::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
AtNuOscFitTemplate *&  myTemplate 
)

Definition at line 1836 of file AtNuOscFit.cxx.

References GetExpectation().

01837 {
01838   this->GetExpectation(dmsq,sinsq,        
01839                        dmsqbar,sinsqbar,  
01840                        0.0,0.0,        
01841                        0.0,0.0,        
01842                        0.0,0.0,0.0,
01843                        0.0,0.0,  
01844                        0.0,0.0,0.0,    
01845                        0.0,0.0,       
01846                        0.0,0.0,  
01847                        myTemplate); 
01848   return;
01849 }

void AtNuOscFit::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
AtNuOscFitTemplate *&  myTemplate 
)

Definition at line 1828 of file AtNuOscFit.cxx.

References GetExpectation().

01829 {   
01830   this->GetExpectation(dmsq,sinsq,
01831                        dmsq,sinsq,
01832                        myTemplate); 
01833   return;
01834 }

void AtNuOscFit::GetExpectation ( Bool_t  atmoscv,
Bool_t  atmosupmu,
Bool_t  atmosnumu,
Bool_t  atmosnue,
Bool_t  atmosnutau,
Bool_t  atmoscc,
Bool_t  atmosnc,
Bool_t  cosmicbkg,
Int_t  nx,
Double_t  sinsq,
Int_t  nxbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  normupmu,
Double_t  elmu,
Double_t  ccnc,
Double_t  updn,
Double_t  chg,
Double_t  chgupmu,
Double_t  specnu,
Double_t  specnubar,
Double_t  emurange,
Double_t  emucurve,
Double_t  eshw,
Double_t  fsnu,
Double_t  fsnubar,
AtNuOscFitTemplate *&  myTemplate 
) [private]

Definition at line 2064 of file AtNuOscFit.cxx.

References AddToExpectation(), fChargeWeight, fHistAtmosNueCC, fHistAtmosNueNC, fHistAtmosNumuCC, fHistAtmosNumuNC, fHistAtmosNutauCC, fHistCosmics, fHistUpmuNueCC, fHistUpmuNueNC, fHistUpmuNumuCC, fHistUpmuNumuNC, fHistUpmuNutauCC, fNX, AtNuOscFitTemplate::Reset(), and AtNuOscFitTemplate::TruncateHistograms().

02065 {
02066   // sanity check
02067   // ============
02068   if( nx<-1 || nx>=fNX ){
02069     std::cout << "  ERROR: illegal dmsq bin [" << nx << "] " << std::endl;
02070   }
02071 
02072   if( nxbar<-1 || nxbar>=fNX ){
02073     std::cout << "  ERROR: illegal dmsqbar bin [" << nxbar << "] " << std::endl;
02074   }
02075 
02076 
02077   // oscillation parameters
02078   // ======================
02079   Int_t nxbin = -1; 
02080   if( nx>=0 ) nxbin = nx;
02081   if( nxbin>=fNX ) nxbin = fNX-1;
02082 
02083   Int_t nxbarbin = -1; 
02084   if( nxbar>=0 ) nxbarbin = nxbar;
02085   if( nxbarbin>=fNX ) nxbarbin = fNX-1;
02086 
02087 
02088   // get all templates
02089   // =================
02090   AtNuOscFitTemplate* myTemplateCosmics = 0;
02091   
02092   AtNuOscFitTemplate* myTemplateAtmosNumuCC = 0;
02093   AtNuOscFitTemplate* myTemplateAtmosNumuCCosc = 0;
02094   AtNuOscFitTemplate* myTemplateAtmosNutauCC = 0;
02095   AtNuOscFitTemplate* myTemplateAtmosNutauCCosc = 0;  
02096   AtNuOscFitTemplate* myTemplateAtmosNumuBarCC = 0;
02097   AtNuOscFitTemplate* myTemplateAtmosNumuBarCCosc = 0;
02098   AtNuOscFitTemplate* myTemplateAtmosNutauBarCC = 0;
02099   AtNuOscFitTemplate* myTemplateAtmosNutauBarCCosc = 0;
02100   AtNuOscFitTemplate* myTemplateAtmosNueCC = 0;
02101   AtNuOscFitTemplate* myTemplateAtmosNueNC = 0;
02102   AtNuOscFitTemplate* myTemplateAtmosNumuNC = 0;
02103   
02104   AtNuOscFitTemplate* myTemplateUpmuNumuCC = 0;
02105   AtNuOscFitTemplate* myTemplateUpmuNumuCCosc = 0;
02106   AtNuOscFitTemplate* myTemplateUpmuNutauCC = 0;
02107   AtNuOscFitTemplate* myTemplateUpmuNutauCCosc = 0;  
02108   AtNuOscFitTemplate* myTemplateUpmuNumuBarCC = 0;
02109   AtNuOscFitTemplate* myTemplateUpmuNumuBarCCosc = 0;
02110   AtNuOscFitTemplate* myTemplateUpmuNutauBarCC = 0;
02111   AtNuOscFitTemplate* myTemplateUpmuNutauBarCCosc = 0;
02112   AtNuOscFitTemplate* myTemplateUpmuNueCC = 0;
02113   AtNuOscFitTemplate* myTemplateUpmuNueNC = 0;
02114   AtNuOscFitTemplate* myTemplateUpmuNumuNC = 0;
02115 
02116   if( fHistCosmics )      myTemplateCosmics            = (AtNuOscFitTemplate*)(fHistCosmics[0].At(0));
02117   
02118   if( fHistAtmosNumuCC )  myTemplateAtmosNumuCC        = (AtNuOscFitTemplate*)(fHistAtmosNumuCC[0].At(0));
02119   if( fHistAtmosNumuCC )  myTemplateAtmosNumuCCosc     = (AtNuOscFitTemplate*)(fHistAtmosNumuCC[nxbin+1].At(0));
02120   if( fHistAtmosNutauCC ) myTemplateAtmosNutauCC       = (AtNuOscFitTemplate*)(fHistAtmosNutauCC[0].At(0));
02121   if( fHistAtmosNutauCC)  myTemplateAtmosNutauCCosc    = (AtNuOscFitTemplate*)(fHistAtmosNutauCC[nxbin+1].At(0));
02122   if( fHistAtmosNumuCC )  myTemplateAtmosNumuBarCC     = (AtNuOscFitTemplate*)(fHistAtmosNumuCC[0].At(0));
02123   if( fHistAtmosNumuCC )  myTemplateAtmosNumuBarCCosc  = (AtNuOscFitTemplate*)(fHistAtmosNumuCC[nxbarbin+1].At(0));
02124   if( fHistAtmosNutauCC ) myTemplateAtmosNutauBarCC    = (AtNuOscFitTemplate*)(fHistAtmosNutauCC[0].At(0));
02125   if( fHistAtmosNutauCC)  myTemplateAtmosNutauBarCCosc = (AtNuOscFitTemplate*)(fHistAtmosNutauCC[nxbarbin+1].At(0));
02126   if( fHistAtmosNueCC )   myTemplateAtmosNueCC         = (AtNuOscFitTemplate*)(fHistAtmosNueCC[0].At(0));
02127   if( fHistAtmosNueNC )   myTemplateAtmosNueNC         = (AtNuOscFitTemplate*)(fHistAtmosNueNC[0].At(0));
02128   if( fHistAtmosNumuNC )  myTemplateAtmosNumuNC        = (AtNuOscFitTemplate*)(fHistAtmosNumuNC[0].At(0));
02129 
02130   if( fHistUpmuNumuCC )   myTemplateUpmuNumuCC         = (AtNuOscFitTemplate*)(fHistUpmuNumuCC[0].At(0));
02131   if( fHistUpmuNumuCC )   myTemplateUpmuNumuCCosc      = (AtNuOscFitTemplate*)(fHistUpmuNumuCC[nxbin+1].At(0));
02132   if( fHistUpmuNutauCC )  myTemplateUpmuNutauCC        = (AtNuOscFitTemplate*)(fHistUpmuNutauCC[0].At(0));
02133   if( fHistUpmuNutauCC )  myTemplateUpmuNutauCCosc     = (AtNuOscFitTemplate*)(fHistUpmuNutauCC[nxbin+1].At(0));
02134   if( fHistUpmuNumuCC )   myTemplateUpmuNumuBarCC      = (AtNuOscFitTemplate*)(fHistUpmuNumuCC[0].At(0));
02135   if( fHistUpmuNumuCC )   myTemplateUpmuNumuBarCCosc   = (AtNuOscFitTemplate*)(fHistUpmuNumuCC[nxbarbin+1].At(0));
02136   if( fHistUpmuNutauCC )  myTemplateUpmuNutauBarCC     = (AtNuOscFitTemplate*)(fHistUpmuNutauCC[0].At(0));
02137   if( fHistUpmuNutauCC )  myTemplateUpmuNutauBarCCosc  = (AtNuOscFitTemplate*)(fHistUpmuNutauCC[nxbarbin+1].At(0));
02138   if( fHistUpmuNueCC )    myTemplateUpmuNueCC          = (AtNuOscFitTemplate*)(fHistUpmuNueCC[0].At(0));
02139   if( fHistUpmuNueNC )    myTemplateUpmuNueNC          = (AtNuOscFitTemplate*)(fHistUpmuNueNC[0].At(0));
02140   if( fHistUpmuNumuNC )   myTemplateUpmuNumuNC         = (AtNuOscFitTemplate*)(fHistUpmuNumuNC[0].At(0));
02141 
02142   if( myTemplate ) myTemplate->Reset();
02143 
02144 
02145   // make fitting template
02146   // =====================
02147 
02148   // cosmic muons 
02149   // ============
02150   if( myTemplateCosmics && cosmicbkg ){
02151     this->AddToExpectation( 1.0,         
02152                             1.0, 
02153                             1.0, 
02154                             1.0,
02155                             1.0,  
02156                             0.0, 0.0,      
02157                             0.0, 0.0, 0.0, 
02158                             myTemplateCosmics, myTemplate );
02159   }
02160 
02161   // atmospheric neutrinos
02162   // =====================
02163   if( myTemplateAtmosNumuCC && atmoscv && atmosnumu && atmoscc ){
02164     this->AddToExpectation( 1.0+norm,
02165                             1.0+0.5*updn, 
02166                             1.0-0.5*updn, 
02167                             (1.0-(sinsq+fsnu))*(1.0+0.5*chg*(1.0-fChargeWeight)), 
02168                             0.0,                            
02169                             specnu, specnubar, 
02170                             emurange, emucurve, eshw,
02171                             myTemplateAtmosNumuCC, myTemplate );
02172   }
02173 
02174   if( myTemplateAtmosNumuCCosc && atmoscv && atmosnumu && atmoscc ){
02175     this->AddToExpectation( 1.0+norm,
02176                             1.0+0.5*updn, 
02177                             1.0-0.5*updn, 
02178                             (sinsq+fsnu)*(1.0+0.5*chg*(1.0-fChargeWeight)), 
02179                             0.0,                            
02180                             specnu, specnubar, 
02181                             emurange, emucurve, eshw,
02182                             myTemplateAtmosNumuCCosc, myTemplate );
02183   }
02184 
02185   if( myTemplateAtmosNutauCC && atmoscv && atmosnutau && atmoscc ){
02186     this->AddToExpectation( 1.0+norm,
02187                             1.0,
02188                             1.0,
02189                             1.0-(sinsq+fsnu),
02190                             0.0,                            
02191                             0.0, 0.0,      
02192                             0.0, 0.0, 0.0, 
02193                             myTemplateAtmosNutauCC, myTemplate );
02194   }
02195 
02196   if( myTemplateAtmosNutauCCosc && atmoscv && atmosnutau && atmoscc ){
02197     this->AddToExpectation( 1.0+norm,
02198                             1.0,
02199                             1.0,
02200                             sinsq+fsnu,
02201                             0.0,                            
02202                             0.0, 0.0,       
02203                             0.0, 0.0, 0.0, 
02204                             myTemplateAtmosNutauCCosc, myTemplate );
02205   }
02206 
02207 
02208   if( myTemplateAtmosNumuBarCC && atmoscv && atmosnumu && atmoscc ){
02209     this->AddToExpectation( 1.0+norm,
02210                             1.0+0.5*updn, 
02211                             1.0-0.5*updn, 
02212                             0.0,
02213                             (1.0-(sinsqbar+fsnubar))*(1.0-0.5*chg*(1.0+fChargeWeight)),
02214                             specnu, specnubar, 
02215                             emurange, emucurve, eshw,
02216                             myTemplateAtmosNumuBarCC, myTemplate );
02217   }
02218 
02219   if( myTemplateAtmosNumuBarCCosc && atmoscv && atmosnumu && atmoscc ){
02220     this->AddToExpectation( 1.0+norm,
02221                             1.0+0.5*updn, 
02222                             1.0-0.5*updn, 
02223                             0.0,
02224                             (sinsqbar+fsnubar)*(1.0-0.5*chg*(1.0+fChargeWeight)),
02225                             specnu, specnubar, 
02226                             emurange, emucurve, eshw,
02227                             myTemplateAtmosNumuBarCCosc, myTemplate );
02228   }
02229 
02230   if( myTemplateAtmosNutauBarCC && atmoscv && atmosnutau && atmoscc ){
02231     this->AddToExpectation( 1.0+norm,
02232                             1.0,
02233                             1.0,
02234                             0.0,
02235                             1.0-(sinsqbar+fsnubar),
02236                             0.0, 0.0,      
02237                             0.0, 0.0, 0.0, 
02238                             myTemplateAtmosNutauBarCC, myTemplate );
02239   }
02240 
02241   if( myTemplateAtmosNutauBarCCosc && atmoscv && atmosnutau && atmoscc ){
02242     this->AddToExpectation( 1.0+norm,
02243                             1.0,     
02244                             1.0,
02245                             0.0,
02246                             sinsqbar+fsnubar,
02247                             0.0, 0.0,      
02248                             0.0, 0.0, 0.0, 
02249                             myTemplateAtmosNutauBarCCosc, myTemplate );
02250   }
02251 
02252   if( myTemplateAtmosNueCC && atmoscv && atmosnue && atmoscc ){
02253     this->AddToExpectation( (1.0+norm)*(1.0+elmu), 
02254                             1.0,           
02255                             1.0,           
02256                             1.0,           
02257                             1.0,           
02258                             specnu, specnubar,
02259                             0.0, 0.0, 0.0, 
02260                             myTemplateAtmosNueCC, myTemplate );
02261   }
02262 
02263   if( myTemplateAtmosNueNC && atmoscv && atmosnue && atmosnc ){
02264     this->AddToExpectation( (1.0+norm)*(1.0+elmu)*(1.0-ccnc), 
02265                             1.0,           
02266                             1.0,           
02267                             1.0,           
02268                             1.0,           
02269                             specnu, specnubar,      
02270                             0.0, 0.0, 0.0, 
02271                             myTemplateAtmosNueNC, myTemplate );
02272   }
02273 
02274   if( myTemplateAtmosNumuNC && atmoscv && atmosnumu && atmosnc ){
02275     this->AddToExpectation( (1.0+norm)*(1.0-ccnc), 
02276                             1.0,           
02277                             1.0,           
02278                             1.0,           
02279                             1.0,           
02280                             specnu, specnubar,      
02281                             0.0, 0.0, 0.0, 
02282                             myTemplateAtmosNumuNC, myTemplate );
02283   }
02284 
02285 
02286   // upward muons
02287   // ============
02288   if( myTemplateUpmuNumuCC && atmosupmu && atmosnumu && atmoscc ){
02289     this->AddToExpectation( 1.0+normupmu,
02290                             1.0,
02291                             1.0,
02292                             (1.0-(sinsq+fsnu))*(1.0+0.5*chgupmu*(1.0-fChargeWeight)), 
02293                             0.0,                            
02294                             0.0, 0.0,      
02295                             0.0, 0.0, 0.0, 
02296                             myTemplateUpmuNumuCC, myTemplate );
02297   }
02298 
02299   if( myTemplateUpmuNumuCCosc && atmosupmu && atmosnumu && atmoscc ){
02300     this->AddToExpectation( 1.0+normupmu,
02301                             1.0,
02302                             1.0,
02303                             (sinsq+fsnu)*(1.0+0.5*chgupmu*(1.0-fChargeWeight)), 
02304                             0.0,                            
02305                             0.0, 0.0,      
02306                             0.0, 0.0, 0.0, 
02307                             myTemplateUpmuNumuCCosc, myTemplate );
02308   }
02309 
02310   if( myTemplateUpmuNutauCC && atmosupmu && atmosnutau && atmoscc ){
02311     this->AddToExpectation( 1.0+normupmu,
02312                             1.0,
02313                             1.0,
02314                             1.0-(sinsq+fsnu),
02315                             0.0,                            
02316                             0.0, 0.0,      
02317                             0.0, 0.0, 0.0, 
02318                             myTemplateUpmuNutauCC, myTemplate );
02319   }
02320 
02321   if( myTemplateUpmuNutauCCosc && atmosupmu && atmosnutau && atmoscc ){
02322     this->AddToExpectation( 1.0+normupmu,
02323                             1.0,
02324                             1.0,
02325                             sinsq+fsnu,
02326                             0.0,                            
02327                             0.0, 0.0,      
02328                             0.0, 0.0, 0.0, 
02329                             myTemplateUpmuNutauCCosc, myTemplate );
02330   }
02331 
02332   if( myTemplateUpmuNumuBarCC && atmosupmu && atmosnumu && atmoscc ){
02333     this->AddToExpectation( 1.0+normupmu,
02334                             1.0,
02335                             1.0,
02336                             0.0,
02337                             (1.0-(sinsqbar+fsnubar))*(1.0-0.5*chgupmu*(1.0+fChargeWeight)),
02338                             0.0, 0.0,      
02339                             0.0, 0.0, 0.0, 
02340                             myTemplateUpmuNumuBarCC, myTemplate );
02341   }
02342 
02343   if( myTemplateUpmuNumuBarCCosc && atmosupmu && atmosnumu && atmoscc ){
02344     this->AddToExpectation( 1.0+normupmu,
02345                             1.0,
02346                             1.0,
02347                             0.0,
02348                             (sinsqbar+fsnubar)*(1.0-0.5*chgupmu*(1.0+fChargeWeight)),
02349                             0.0, 0.0,      
02350                             0.0, 0.0, 0.0, 
02351                             myTemplateUpmuNumuBarCCosc, myTemplate );
02352   }
02353 
02354   if( myTemplateUpmuNutauBarCC && atmosupmu && atmosnutau && atmoscc ){
02355     this->AddToExpectation( 1.0+normupmu,
02356                             1.0,
02357                             1.0,
02358                             0.0,
02359                             1.0-(sinsqbar+fsnubar),
02360                             0.0, 0.0,      
02361                             0.0, 0.0, 0.0, 
02362                             myTemplateUpmuNutauBarCC, myTemplate );
02363   }
02364 
02365   if( myTemplateUpmuNutauBarCCosc && atmosupmu && atmosnutau && atmoscc ){
02366     this->AddToExpectation( 1.0+normupmu,
02367                             1.0,
02368                             1.0,
02369                             0.0,
02370                             sinsqbar+fsnubar,
02371                             0.0, 0.0,      
02372                             0.0, 0.0, 0.0, 
02373                             myTemplateUpmuNutauBarCCosc, myTemplate );
02374   }
02375 
02376   if( myTemplateUpmuNueCC && atmosupmu && atmosnue && atmoscc ){
02377     this->AddToExpectation( 1.0+normupmu,
02378                             1.0,
02379                             1.0,
02380                             1.0,
02381                             1.0,
02382                             0.0, 0.0,      
02383                             0.0, 0.0, 0.0, 
02384                             myTemplateUpmuNueCC, myTemplate );
02385   }
02386 
02387   if( myTemplateUpmuNueNC && atmosupmu && atmosnue && atmosnc ){
02388     this->AddToExpectation( 1.0+normupmu,
02389                             1.0,
02390                             1.0,
02391                             1.0,
02392                             1.0,
02393                             0.0, 0.0,      
02394                             0.0, 0.0, 0.0, 
02395                             myTemplateUpmuNueNC, myTemplate );
02396   }
02397 
02398   if( myTemplateUpmuNumuNC && atmosupmu && atmosnumu && atmosnc ){
02399     this->AddToExpectation( 1.0+normupmu,
02400                             1.0,
02401                             1.0,
02402                             1.0,
02403                             1.0,
02404                             0.0, 0.0,      
02405                             0.0, 0.0, 0.0, 
02406                             myTemplateUpmuNumuNC, myTemplate );
02407   }
02408 
02409 
02410   // truncate negative expectations
02411   myTemplate->TruncateHistograms();
02412 
02413   return;
02414 }

void AtNuOscFit::GetExpectation ( Bool_t  atmoscv,
Bool_t  atmosupmu,
Bool_t  atmosnumu,
Bool_t  atmosnue,
Bool_t  atmosnutau,
Bool_t  atmoscc,
Bool_t  atmosnc,
Bool_t  cosmicbkg,
Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  normupmu,
Double_t  elmu,
Double_t  ccnc,
Double_t  updn,
Double_t  chg,
Double_t  chgupmu,
Double_t  specnu,
Double_t  specnubar,
Double_t  emurange,
Double_t  emucurve,
Double_t  eshw,
Double_t  fsnu,
Double_t  fsnubar,
Double_t  dmnu,
Double_t  dmnubar,
AtNuOscFitTemplate *&  myTemplate 
) [private]

Definition at line 1886 of file AtNuOscFit.cxx.

References AddToExpectation(), fNX, fTemplateMCdmsq00, fTemplateMCdmsq01, fTemplateMCdmsq10, fTemplateMCdmsq11, fUseDmsqInterp, fUseModifiedDmsqInterp, fX, n, AtNuOscFitTemplate::Reset(), and SnapToGridDmsq().

Referenced by GetExpectation(), GetLikelihood(), Run(), RunExpt(), RunFit(), RunWriteOscTemplates(), and RunWriteSystTemplates().

01887 {
01888   // Snap To Dmsq Grid
01889   // =================
01890   if( fUseDmsqInterp==0 ){
01891 
01892     Int_t nx = -1;
01893     Int_t nxbar = -1; 
01894  
01895     this->SnapToGridDmsq(dmsq,nx);
01896     this->SnapToGridDmsq(dmsqbar,nxbar);
01897 
01898     this->GetExpectation(atmoscv,atmosupmu,  
01899                          atmosnumu,atmosnue,atmosnutau,
01900                          atmoscc,atmosnc,
01901                          cosmicbkg,    
01902                          nx,sinsq,        
01903                          nxbar,sinsqbar,  
01904                          norm,normupmu,
01905                          elmu,ccnc,
01906                          updn,chg,chgupmu,
01907                          specnu,specnubar,  
01908                          emurange,emucurve,eshw,   
01909                          fsnu,fsnubar,              
01910                          myTemplate); 
01911     return;
01912   }
01913 
01914   // Interpolate Between Dmsq Bins
01915   // =============================
01916   else{
01917 
01918     // snap to grid
01919     Double_t dmsqtemp = dmsq;
01920     Double_t dmsqbartemp = dmsqbar;
01921     
01922     // 
01923     // --- for debugging ---
01924     // this->SnapToGridDmsq(dmsq,dmsqtemp);
01925     // this->SnapToGridDmsq(dmsqbar,dmsqbartemp);
01926     //
01927 
01928     // new interpolation
01929     Double_t delta = 0.0;
01930 
01931     // dmsq interpolation
01932     Int_t xbin = -1;
01933     Double_t alpha = 0.0;
01934     Double_t alphaNew = 0.0;
01935     Double_t dmsqfit = 0.0;
01936 
01937     if( dmsqtemp>0.0 ){
01938       dmsqfit = pow(10.0,log10(dmsqtemp)+dmnu);
01939       xbin = 0;
01940       for( Int_t n=0; n<fNX-1; n++ ){
01941         if( dmsqfit>=fX[n] ) xbin = n;
01942       }
01943       alpha = ( log10(dmsqtemp)+dmnu-log10(fX[xbin]) )/( log10(fX[xbin+1])-log10(fX[xbin]) );
01944       if( fUseModifiedDmsqInterp ){
01945         delta = alpha - floor(alpha);
01946         alphaNew = floor(alpha) + 3.0*delta*delta*(1.0-2.0*delta/3.0);
01947         alpha = alphaNew;
01948       }
01949     }
01950 
01951     // dmsqbar interpolation
01952     Int_t xbarbin = -1;
01953     Double_t beta = 0.0;
01954     Double_t betaNew = 0.0;
01955     Double_t dmsqbarfit = 0.0;
01956  
01957     if( dmsqbartemp>0.0 ){
01958       dmsqbarfit = pow(10.0,log10(dmsqbartemp)+dmnubar);
01959       xbarbin = 0;
01960       for( Int_t n=0; n<fNX-1; n++ ){
01961         if( dmsqbarfit>=fX[n] ) xbarbin = n;
01962       }
01963       beta = ( log10(dmsqbartemp)+dmnubar-log10(fX[xbarbin]) )/( log10(fX[xbarbin+1])-log10(fX[xbarbin]) );
01964       if( fUseModifiedDmsqInterp ){
01965         delta = beta - floor(beta);
01966         betaNew = floor(beta) + 3.0*delta*delta*(1.0-2.0*delta/3.0);
01967         beta = betaNew;
01968       }
01969     }
01970 
01971     // 
01972     // std::cout << " --- interpolate between dmsq/dmsqbar bins --- " << std::endl;
01973     // std::cout << "    xbin=" << xbin << " alpha=" << alpha << std::endl;
01974     // std::cout << "    xbarbin=" << xbarbin << " beta=" << beta << std::endl;
01975     // if( xbin>=0 ){
01976     //   std::cout << "    dmsq: " << fX[xbin] << " --> " << dmsqfit << " --> " << fX[xbin+1] << std::endl;
01977     //   std::cout << "      --> alpha = " << log10(dmsqtemp)+dmnu-log10(fX[xbin]) << "/" << log10(fX[xbin+1])-log10(fX[xbin]) << std::endl;
01978     // }
01979     // if( xbarbin>=0 ){
01980     //   std::cout << "    dmsqbar: " << fX[xbarbin] << " --> " << dmsqbarfit << " --> " << fX[xbarbin+1] << std::endl;
01981     //   std::cout << "      --> beta = " << log10(dmsqbartemp)+dmnubar-log10(fX[xbarbin]) << "/" << log10(fX[xbarbin+1])-log10(fX[xbarbin]) << std::endl;
01982     // }
01983     // 
01984 
01985     // reset template
01986     if( myTemplate ) myTemplate->Reset();
01987 
01988     // add expectation [xbin][xbarbin]
01989     this->GetExpectation(atmoscv,atmosupmu,  
01990                          atmosnumu,atmosnue,atmosnutau,
01991                          atmoscc,atmosnc,
01992                          cosmicbkg,    
01993                          xbin,sinsq,        
01994                          xbarbin,sinsqbar,  
01995                          norm,normupmu,
01996                          elmu,ccnc,
01997                          updn,chg,chgupmu,
01998                          specnu,specnubar,  
01999                          emurange,emucurve,eshw,   
02000                          fsnu,fsnubar,              
02001                          fTemplateMCdmsq00);   
02002 
02003     this->AddToExpectation( (1.0-alpha)*(1.0-beta), 
02004                             fTemplateMCdmsq00, myTemplate );
02005 
02006     // add expectation [xbin+1][xbarbin]
02007     this->GetExpectation(atmoscv,atmosupmu,  
02008                          atmosnumu,atmosnue,atmosnutau,
02009                          atmoscc,atmosnc,
02010                          cosmicbkg,    
02011                          xbin+1,sinsq,        
02012                          xbarbin,sinsqbar,  
02013                          norm,normupmu,
02014                          elmu,ccnc,
02015                          updn,chg,chgupmu,
02016                          specnu,specnubar,  
02017                          emurange,emucurve,eshw,   
02018                          fsnu,fsnubar,              
02019                          fTemplateMCdmsq01);     
02020 
02021     this->AddToExpectation( alpha*(1.0-beta), 
02022                             fTemplateMCdmsq01, myTemplate );
02023 
02024     // add expectation [xbin][xbarbin+1]
02025     this->GetExpectation(atmoscv,atmosupmu,  
02026                          atmosnumu,atmosnue,atmosnutau,
02027                          atmoscc,atmosnc,
02028                          cosmicbkg,    
02029                          xbin,sinsq,        
02030                          xbarbin+1,sinsqbar,  
02031                          norm,normupmu,
02032                          elmu,ccnc,
02033                          updn,chg,chgupmu,
02034                          specnu,specnubar,  
02035                          emurange,emucurve,eshw,   
02036                          fsnu,fsnubar,              
02037                          fTemplateMCdmsq10);        
02038 
02039     this->AddToExpectation( (1.0-alpha)*beta, 
02040                             fTemplateMCdmsq10, myTemplate );
02041 
02042     // add expectation [xbin+1][xbarbin+1]
02043     this->GetExpectation(atmoscv,atmosupmu,  
02044                          atmosnumu,atmosnue,atmosnutau,
02045                          atmoscc,atmosnc,
02046                          cosmicbkg,    
02047                          xbin+1,sinsq,        
02048                          xbarbin+1,sinsqbar,  
02049                          norm,normupmu,
02050                          elmu,ccnc,
02051                          updn,chg,chgupmu,
02052                          specnu,specnubar,  
02053                          emurange,emucurve,eshw,   
02054                          fsnu,fsnubar,              
02055                          fTemplateMCdmsq11);      
02056 
02057     this->AddToExpectation( alpha*beta, 
02058                             fTemplateMCdmsq11, myTemplate );  
02059   }
02060 
02061   return;
02062 }

void AtNuOscFit::GetLikelihood ( Double_t  norm,
Double_t  normupmu,
Double_t  elmu,
Double_t  ccnc,
Double_t  updn,
Double_t  chg,
Double_t  chgupmu,
Double_t  specnu,
Double_t  specnubar,
Double_t  emurange,
Double_t  emucurve,
Double_t  eshw,
Double_t  fsnu,
Double_t  fsnubar,
Double_t  dmnu,
Double_t  dmnubar,
Double_t &  f 
)

Definition at line 6728 of file AtNuOscFit.cxx.

References fAddPenaltyTerms, fDmsqBarFit, fDmsqFit, fDoChargeSeparation, fForceCPT, fLNL_CV_HIRES, fLNL_CV_HIRES_NORM, fLNL_CV_HIRES_SHAPE, fLNL_CV_HIRES_UPDN, fLNL_CV_LORES, fLNL_NUE, fLNL_PENALTY, fLNL_UPMU_HIRES, fLNL_UPMU_HIRES_NORM, fLNL_UPMU_HIRES_SHAPE, fLNL_UPMU_HIRES_UPDN, fPhysicalBoundary, fSigmaCCNC, fSigmaChg, fSigmaChgUpmu, fSigmaElMu, fSigmaEmuCurve, fSigmaEmuRange, fSigmaEshw, fSigmaNorm, fSigmaNormUpmu, fSigmaSpecNu, fSigmaSpecNuBar, fSigmaUpDn, fSinsqBarFit, fSinsqFit, fTemplateExpt, fTemplateFit, fUseCCNC, fUseChg, fUseChgUpmu, fUseElMu, fUseEmuCurve, fUseEmuRange, fUseEshw, fUseNegatives, fUseNorm, fUseNormUpmu, fUsePositives, fUseSpecNu, fUseSpecNuBar, fUseUpDn, GetExpectation(), and GetLikelihood().

06729 {    
06730   // reset log-likelihood
06731   // ====================
06732   fLNL_NUE = 0.0;
06733   fLNL_CV_LORES = 0.0;
06734   fLNL_CV_HIRES = 0.0;
06735   fLNL_CV_HIRES_SHAPE = 0.0;
06736   fLNL_CV_HIRES_NORM = 0.0;
06737   fLNL_CV_HIRES_UPDN = 0.0;
06738   fLNL_UPMU_HIRES = 0.0;
06739   fLNL_UPMU_HIRES_SHAPE = 0.0;
06740   fLNL_UPMU_HIRES_NORM = 0.0;
06741   fLNL_UPMU_HIRES_UPDN = 0.0;
06742   fLNL_PENALTY = 0.0;
06743 
06744   // log-likelihood
06745   // ==============
06746   Double_t myLnL = 0.0;              // likelihood
06747   Double_t myPenaltyLnL = 0.0;       // likelihood (penalty term)
06748 
06749   // input oscillations
06750   // ==================
06751   Double_t dmsq = fDmsqFit;
06752   Double_t sinsq = fSinsqFit;
06753   Double_t dmsqbar = fDmsqBarFit;
06754   Double_t sinsqbar = fSinsqBarFit;
06755 
06756   // input systematics
06757   // =================
06758   Double_t myNorm = norm;            // normalization
06759   Double_t myNormUpmu = normupmu;    // normalization (upmu)
06760   Double_t myElMu = elmu;            // flavour ratio
06761   Double_t myCCNC = ccnc;            // cc/nc ratio
06762   Double_t myUpDn = updn;            // up/down ratio
06763   Double_t myChg = chg;              // charge ratio
06764   Double_t myChgUpmu = chgupmu;      // charge ratio (upmu)
06765   Double_t mySpecNu = specnu;        // spectral index (neutrinos)
06766   Double_t mySpecNuBar = specnubar;  // spectral index (anti-neutrinos)
06767   Double_t myEmuRange = emurange;    // muon momentum (from range)
06768   Double_t myEmuCurve = emucurve;    // muon momentum (from curvature)
06769   Double_t myEshw = eshw;            // shower energy
06770   Double_t mySinNu = fsnu;           // shift in sinsq2theta (nu)
06771   Double_t mySinNuBar = fsnubar;     // shift in sinsq2theta (nubar)
06772   Double_t myDmsqNu = dmnu;          // shift in dmsq (nu)
06773   Double_t myDmsqNuBar = dmnubar;    // shift in dmsq (nubar)
06774 
06775   // force CPT symmetry
06776   // ==================
06777   if( fForceCPT ){
06778     dmsqbar     = dmsq;
06779     sinsqbar    = sinsq;
06780     mySinNuBar  = mySinNu;
06781     myDmsqNuBar = myDmsqNu;
06782   }
06783 
06784   // charge separation
06785   // =================
06786   Bool_t separate_charge = fDoChargeSeparation;
06787   Bool_t use_positives = fUsePositives;  // anti-neutrinos
06788   Bool_t use_negatives = fUseNegatives;  // neutrinos
06789 
06790   // add statistical errors
06791   // ======================
06792   AtNuOscFitTemplate* myTemplateExpt = 0; 
06793   AtNuOscFitTemplate* myTemplateFit = 0; 
06794   
06795   if( dmsq>=0 && dmsqbar>=0 ){
06796     this->GetExpectation(1,1,      
06797                          1,1,1,   
06798                          1,1,     
06799                          1,       
06800                          dmsq,sinsq,
06801                          dmsqbar,sinsqbar,
06802                          myNorm,myNormUpmu,
06803                          myElMu,myCCNC,
06804                          myUpDn,myChg,myChgUpmu,
06805                          mySpecNu,mySpecNuBar,
06806                          myEmuRange,myEmuCurve,myEshw,
06807                          mySinNu,mySinNuBar,
06808                          myDmsqNu,myDmsqNuBar,
06809                          fTemplateFit);
06810 
06811     myTemplateExpt = fTemplateExpt;
06812     myTemplateFit = fTemplateFit;
06813 
06814     this->GetLikelihood(separate_charge,use_negatives,use_positives,
06815                         myTemplateExpt,myTemplateFit,myLnL);
06816   }
06817 
06818   // add systematic errors
06819   // =====================
06820   if( fAddPenaltyTerms ){
06821    
06822     // penalty log-likelihood
06823     // =======================
06824     myPenaltyLnL = 0.0;
06825 
06826     // diagonal penalty terms
06827     // ======================
06828     if( fUseNorm && fSigmaNorm>0 )           myPenaltyLnL += (myNorm*myNorm)/(2.0*fSigmaNorm*fSigmaNorm);
06829     if( fUseNormUpmu && fSigmaNormUpmu>0 )   myPenaltyLnL += (myNormUpmu*myNormUpmu)/(2.0*fSigmaNormUpmu*fSigmaNormUpmu);
06830     if( fUseElMu && fSigmaElMu>0 )           myPenaltyLnL += (myElMu*myElMu)/(2.0*fSigmaElMu*fSigmaElMu);
06831     if( fUseCCNC && fSigmaCCNC>0 )           myPenaltyLnL += (myCCNC*myCCNC)/(2.0*fSigmaCCNC*fSigmaCCNC);
06832     if( fUseUpDn && fSigmaUpDn>0 )           myPenaltyLnL += (myUpDn*myUpDn)/(2.0*fSigmaUpDn*fSigmaUpDn);
06833     if( fUseChg && fSigmaChg>0 )             myPenaltyLnL += (myChg*myChg)/(2.0*fSigmaChg*fSigmaChg);
06834     if( fUseChgUpmu && fSigmaChgUpmu>0 )     myPenaltyLnL += (myChgUpmu*myChgUpmu)/(2.0*fSigmaChgUpmu*fSigmaChgUpmu);
06835     if( fUseSpecNu && fSigmaSpecNu>0 )       myPenaltyLnL += (mySpecNu*mySpecNu)/(2.0*fSigmaSpecNu*fSigmaSpecNu);
06836     if( fUseSpecNuBar && fSigmaSpecNuBar>0 ) myPenaltyLnL += (mySpecNuBar*mySpecNuBar)/(2.0*fSigmaSpecNuBar*fSigmaSpecNuBar);
06837     if( fUseEmuRange && fSigmaEmuRange>0 )   myPenaltyLnL += (myEmuRange*myEmuRange)/(2.0*fSigmaEmuRange*fSigmaEmuRange);
06838     if( fUseEmuCurve && fSigmaEmuCurve>0 )   myPenaltyLnL += (myEmuCurve*myEmuCurve)/(2.0*fSigmaEmuCurve*fSigmaEmuCurve);
06839     if( fUseEshw && fSigmaEshw>0 )           myPenaltyLnL += (myEshw*myEshw)/(2.0*fSigmaEshw*fSigmaEshw);
06840 
06841     // store delta log-likelihood
06842     // ==========================
06843     fLNL_PENALTY = myPenaltyLnL;
06844 
06845     // add to log-likelihood
06846     // =====================
06847     myLnL += myPenaltyLnL;
06848 
06849     // additional penalty terms
06850     // ========================
06851     // add correlation term to break degeneracy for energy systematics
06852   }
06853 
06854   // physical boundary 
06855   // =================
06856   if( fPhysicalBoundary ){
06857 
06858     Double_t fsinsq = 0.0;
06859     Double_t dsinsq = 0.0;
06860     fsinsq = sinsq + mySinNu;
06861     if( fsinsq>1.0 ) dsinsq = fsinsq-1.0;
06862     if( fsinsq<0.0 ) dsinsq = 0.0-fsinsq;
06863 
06864     Double_t fsinsqbar = 0.0;
06865     Double_t dsinsqbar = 0.0;
06866     fsinsqbar = sinsqbar + mySinNuBar;
06867     if( fsinsqbar>1.0 ) dsinsqbar = fsinsqbar-1.0;
06868     if( fsinsqbar<0.0 ) dsinsqbar = 0.0-fsinsqbar;
06869   
06870     myLnL += 1.0e5*(dsinsq*dsinsq + dsinsqbar*dsinsqbar);
06871   }
06872 
06873   // return log-likelihood
06874   // =====================
06875   if( myLnL>1.0e100 ) myLnL = 1.0e100;
06876 
06877   f = myLnL;
06878 
06879   return;
06880 }

void AtNuOscFit::GetLikelihood ( Bool_t  separate_charge,
Bool_t  use_negatives,
Bool_t  use_positives,
AtNuOscFitTemplate myTemplateExpt,
AtNuOscFitTemplate myTemplateFit,
Double_t &  LnL 
)

Definition at line 6930 of file AtNuOscFit.cxx.

References fUseBayesLikelihood, GetDeltaLikelihood(), and GetDeltaLikelihoodBayes().

06931 {  
06932   // log-likelihood
06933   // ==============
06934   Double_t deltaLnL = 0.0;  
06935 
06936   // add statistical errors
06937   // ======================
06938   if( fUseBayesLikelihood ){
06939     this->GetDeltaLikelihoodBayes(separate_charge,use_negatives,use_positives,
06940                                   myTemplateExpt,myTemplateFit,deltaLnL);
06941   }
06942   else{
06943     this->GetDeltaLikelihood(separate_charge,use_negatives,use_positives,
06944                              myTemplateExpt,myTemplateFit,deltaLnL);  
06945   }
06946 
06947   // return log-likelihood
06948   // =====================
06949   if( deltaLnL>1.0e100 ) deltaLnL = 1.0e100;
06950 
06951   dLnL = deltaLnL;
06952   
06953   return;
06954 }

void AtNuOscFit::GetLikelihood ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t &  norm,
Double_t &  normupmu,
Double_t &  elmu,
Double_t &  ccnc,
Double_t &  updn,
Double_t &  chg,
Double_t &  chgupmu,
Double_t &  specnu,
Double_t &  specnubar,
Double_t &  emurange,
Double_t &  emucurve,
Double_t &  eshw,
Double_t &  fsnu,
Double_t &  fsnubar,
Double_t &  dmnu,
Double_t &  dmnubar,
Double_t &  LnL 
)

Definition at line 5961 of file AtNuOscFit.cxx.

References fDoNestedFit, GetLikelihoodAll(), and GetLikelihoodNested().

05962 { 
05963   // do systematic fit
05964   // =================
05965   if( fDoNestedFit ){
05966 
05967     // nested fit (build up systematics in stages)
05968     this->GetLikelihoodNested( dmsq,sinsq,dmsqbar,sinsqbar,
05969                                norm,normupmu,elmu,ccnc,updn,chg,chgupmu,
05970                                specnu,specnubar,emurange,emucurve,eshw,
05971                                fsnu,fsnubar,dmnu,dmnubar,LnL );
05972   }
05973   else{
05974 
05975     // single fit (fit systematics all in one go)
05976     this->GetLikelihoodAll( dmsq,sinsq,dmsqbar,sinsqbar,
05977                             norm,normupmu,elmu,ccnc,updn,chg,chgupmu,
05978                             specnu,specnubar,emurange,emucurve,eshw,
05979                             fsnu,fsnubar,dmnu,dmnubar,LnL );
05980   }
05981  
05982   return;
05983 } 

void AtNuOscFit::GetLikelihood ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t &  LnL 
)

Definition at line 5904 of file AtNuOscFit.cxx.

References fDmsqBarFit, fDmsqFit, fFitCCNC, fFitChg, fFitChgUpmu, fFitDmsqNu, fFitDmsqNuBar, fFitElMu, fFitEmuCurve, fFitEmuRange, fFitEshw, fFitNorm, fFitNormUpmu, fFitSinNu, fFitSinNuBar, fFitSpecNu, fFitSpecNuBar, fFitUpDn, fSinsqBarFit, fSinsqFit, and GetLikelihood().

05905 {
05906   // do statistical fit
05907   // ==================
05908   fDmsqFit = dmsq;
05909   fSinsqFit = sinsq;
05910   fDmsqBarFit = dmsqbar;
05911   fSinsqBarFit = sinsqbar;
05912 
05913   fFitNorm = 0.0;
05914   fFitNormUpmu = 0.0;
05915   fFitElMu = 0.0;
05916   fFitCCNC = 0.0;           
05917   fFitUpDn = 0.0;           
05918   fFitChg = 0.0;     
05919   fFitChgUpmu = 0.0;           
05920   fFitSpecNu = 0.0;         
05921   fFitSpecNuBar = 0.0;      
05922   fFitEmuRange = 0.0;
05923   fFitEmuCurve = 0.0;            
05924   fFitEshw = 0.0;      
05925   fFitSinNu = 0.0;
05926   fFitSinNuBar = 0.0; 
05927   fFitDmsqNu = 0.0;
05928   fFitDmsqNuBar = 0.0;
05929 
05930   Double_t myNorm = 0.0;
05931   Double_t myNormUpmu = 0.0;
05932   Double_t myElMu = 0.0;
05933   Double_t myCCNC = 0.0;
05934   Double_t myUpDn = 0.0;
05935   Double_t myChg = 0.0;
05936   Double_t myChgUpmu = 0.0;
05937   Double_t mySpecNu = 0.0;
05938   Double_t mySpecNuBar = 0.0;
05939   Double_t myEmuRange = 0.0;
05940   Double_t myEmuCurve = 0.0;
05941   Double_t myEshw = 0.0;
05942   Double_t mySinNu = 0.0;
05943   Double_t mySinNuBar = 0.0;
05944   Double_t myDmsqNu = 0.0;
05945   Double_t myDmsqNuBar = 0.0;
05946   Double_t myLnL = 0.0;
05947 
05948   this->GetLikelihood(myNorm,myNormUpmu,
05949                       myElMu,myCCNC,myUpDn,myChg,myChgUpmu,
05950                       mySpecNu,mySpecNuBar,
05951                       myEmuRange,myEmuCurve,myEshw,
05952                       mySinNu,mySinNuBar,
05953                       myDmsqNu,myDmsqNuBar,myLnL);
05954 
05955   // return values
05956   LnL = myLnL;  
05957 
05958   return;
05959 }

void AtNuOscFit::GetLikelihood ( Double_t  dmsq,
Double_t  sinsq,
Double_t &  LnL 
)

Definition at line 5898 of file AtNuOscFit.cxx.

Referenced by GetLikelihood(), GetLikelihoodBase(), GetLikelihoodMinusBase(), GetLikelihoodNested(), Run(), and RunFit().

05899 { 
05900   this->GetLikelihood(dmsq,sinsq,
05901                       dmsq,sinsq, LnL);
05902 }

void AtNuOscFit::GetLikelihoodAll ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t &  norm,
Double_t &  normupmu,
Double_t &  elmu,
Double_t &  ccnc,
Double_t &  updn,
Double_t &  chg,
Double_t &  chgupmu,
Double_t &  specnu,
Double_t &  specnubar,
Double_t &  emurange,
Double_t &  emucurve,
Double_t &  eshw,
Double_t &  fsnu,
Double_t &  fsnubar,
Double_t &  dmnu,
Double_t &  dmnubar,
Double_t &  LnL 
) [private]

Definition at line 5985 of file AtNuOscFit.cxx.

References fDebug, fFIT_STATUS, fMaskCCNC, fMaskChg, fMaskChgUpmu, fMaskDmsqNu, fMaskDmsqNuBar, fMaskElMu, fMaskEmuCurve, fMaskEmuRange, fMaskEshw, fMaskNorm, fMaskNormUpmu, fMaskSinNu, fMaskSinNuBar, fMaskSpecNu, fMaskSpecNuBar, fMaskUpDn, GetLikelihoodSyst(), SnapToGridDmsq(), and SnapToGridSinsq().

Referenced by GetLikelihood().

05986 {   
05987   if( fDebug ){
05988     Int_t nx    = -1;  this->SnapToGridDmsq(dmsq,nx);
05989     Int_t ny    = -1;  this->SnapToGridSinsq(sinsq,ny);
05990     Int_t nxbar = -1;  this->SnapToGridDmsq(dmsqbar,nxbar);
05991     Int_t nybar = -1;  this->SnapToGridSinsq(sinsqbar,nybar);
05992     std::cout << "    Run Syst Fit (All): [" << nx << "][" << ny << "] [" << nxbar << "][" << nybar << "] " << std::endl;
05993   }
05994 
05995   // do systematic fit (all at once)
05996   // ===============================
05997   fFIT_STATUS = 0;
05998                  
05999   // initial values
06000   Double_t inputnorm      = 0.0;
06001   Double_t inputnormupmu  = 0.0;
06002   Double_t inputelmu      = 0.0;
06003   Double_t inputccnc      = 0.0;
06004   Double_t inputupdn      = 0.0;
06005   Double_t inputchg       = 0.0;
06006   Double_t inputchgupmu   = 0.0;
06007   Double_t inputspecnu    = 0.0;
06008   Double_t inputspecnubar = 0.0;
06009   Double_t inputemurange  = 0.0;
06010   Double_t inputemucurve  = 0.0;
06011   Double_t inputeshw      = 0.0;
06012   Double_t inputfsnu      = 0.0;
06013   Double_t inputfsnubar   = 0.0;
06014   Double_t inputdmnu      = 0.0;
06015   Double_t inputdmnubar   = 0.0;
06016 
06017   // output values
06018   Double_t outputnorm      = 0.0;
06019   Double_t outputnormupmu  = 0.0;
06020   Double_t outputelmu      = 0.0;
06021   Double_t outputccnc      = 0.0;
06022   Double_t outputupdn      = 0.0;
06023   Double_t outputchg       = 0.0;
06024   Double_t outputchgupmu   = 0.0;
06025   Double_t outputspecnu    = 0.0;
06026   Double_t outputspecnubar = 0.0;
06027   Double_t outputemurange  = 0.0;
06028   Double_t outputemucurve  = 0.0;
06029   Double_t outputeshw      = 0.0;
06030   Double_t outputfsnu      = 0.0;
06031   Double_t outputfsnubar   = 0.0;
06032   Double_t outputdmnu      = 0.0;
06033   Double_t outputdmnubar   = 0.0;
06034 
06035   // fit status
06036   Double_t outputLnL = 0.0;
06037   Bool_t status = 0;
06038 
06039   // fit all parameters at once
06040   // ==========================
06041   fMaskNorm      = 1;
06042   fMaskNormUpmu  = 1; 
06043   fMaskElMu      = 1;
06044   fMaskCCNC      = 1;
06045   fMaskUpDn      = 1;
06046   fMaskChg       = 1;
06047   fMaskChgUpmu   = 1;
06048   fMaskSpecNu    = 1;
06049   fMaskSpecNuBar = 1;
06050   fMaskEmuRange  = 1;
06051   fMaskEmuCurve  = 1;
06052   fMaskEshw      = 1;    
06053   fMaskSinNu     = 1;
06054   fMaskSinNuBar  = 1;
06055   fMaskDmsqNu    = 1;
06056   fMaskDmsqNuBar = 1;
06057 
06058   inputnorm      = outputnorm;
06059   inputnormupmu  = outputnormupmu;
06060   inputelmu      = outputelmu;
06061   inputccnc      = outputccnc;
06062   inputupdn      = outputupdn;
06063   inputchg       = outputchg;
06064   inputchgupmu   = outputchgupmu;
06065   inputspecnu    = outputspecnu;
06066   inputspecnubar = outputspecnubar;
06067   inputemurange  = outputemurange;
06068   inputemucurve  = outputemucurve;
06069   inputeshw      = outputeshw;
06070   inputfsnu      = outputfsnu;
06071   inputfsnubar   = outputfsnubar;
06072   inputdmnu      = outputdmnu;
06073   inputdmnubar   = outputdmnubar;
06074 
06075   this->GetLikelihoodSyst(dmsq, sinsq, dmsqbar, sinsqbar,
06076                           inputnorm, inputnormupmu, 
06077                           inputelmu, inputccnc, inputupdn, inputchg, inputchgupmu,
06078                           inputspecnu, inputspecnubar,
06079                           inputemurange, inputemucurve, inputeshw,
06080                           inputfsnu, inputfsnubar,
06081                           inputdmnu, inputdmnubar,
06082                           outputnorm, outputnormupmu, 
06083                           outputelmu, outputccnc, outputupdn, outputchg, outputchgupmu,
06084                           outputspecnu, outputspecnubar,
06085                           outputemurange, outputemucurve, outputeshw,
06086                           outputfsnu, outputfsnubar,
06087                           outputdmnu, outputdmnubar,
06088                           outputLnL, status); 
06089 
06090   if( status ) fFIT_STATUS = 1;
06091 
06092   // return values
06093   // =============
06094   norm      = outputnorm;
06095   normupmu  = outputnormupmu;
06096   elmu      = outputelmu;
06097   ccnc      = outputccnc;
06098   updn      = outputupdn;
06099   chg       = outputchg;
06100   chgupmu   = outputchgupmu;
06101   specnu    = outputspecnu;
06102   specnubar = outputspecnubar;
06103   emurange  = outputemurange;
06104   emucurve  = outputemucurve;
06105   eshw      = outputeshw;
06106   fsnu      = outputfsnu;
06107   fsnubar   = outputfsnubar;
06108   dmnu      = outputdmnu;
06109   dmnubar   = outputdmnubar;
06110 
06111   LnL = outputLnL;
06112 
06113   return;
06114 }

void AtNuOscFit::GetLikelihoodBase ( Double_t &  dLnL  ) 

Definition at line 6699 of file AtNuOscFit.cxx.

References fDoChargeSeparation, fTemplateExpt, fUseNegatives, fUsePositives, and GetLikelihood().

Referenced by GetLikelihoodMinusBase(), Run(), and RunFit().

06700 {  
06701   // log-likelihood
06702   // ==============
06703   Double_t myLnL = 0.0; 
06704   
06705   // charge separation
06706   // =================
06707   Bool_t separate_charge = fDoChargeSeparation;
06708   Bool_t use_positives = fUsePositives;  // anti-neutrinos
06709   Bool_t use_negatives = fUseNegatives;  // neutrinos
06710 
06711   // calculate base statistical error
06712   // ================================
06713   AtNuOscFitTemplate* myTemplateExpt = fTemplateExpt; 
06714   AtNuOscFitTemplate* myTemplateFit = fTemplateExpt;
06715 
06716   this->GetLikelihood(separate_charge,use_negatives,use_positives,
06717                       myTemplateExpt,myTemplateFit,myLnL);  
06718   
06719   // return log-likelihood
06720   // =====================
06721   if( myLnL>1.0e100 ) myLnL = 1.0e100;  
06722 
06723   LnL = myLnL;
06724 
06725   return;
06726 }

void AtNuOscFit::GetLikelihoodMinusBase ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  normupmu,
Double_t  elmu,
Double_t  ccnc,
Double_t  updn,
Double_t  chg,
Double_t  chgupmu,
Double_t  specnu,
Double_t  specnubar,
Double_t  emurange,
Double_t  emucurve,
Double_t  eshw,
Double_t &  LnL 
)

Definition at line 6905 of file AtNuOscFit.cxx.

References fDmsqBarFit, fDmsqFit, fSinsqBarFit, fSinsqFit, GetLikelihood(), and GetLikelihoodBase().

06906 {
06907   Double_t LnLbase = 0.0;
06908   Double_t LnLtotal = 0.0;
06909 
06910   fDmsqFit = dmsq;
06911   fSinsqFit = sinsq;
06912   fDmsqBarFit = dmsqbar;
06913   fSinsqBarFit = sinsqbar;
06914 
06915   this->GetLikelihoodBase( LnLbase ); 
06916 
06917   this->GetLikelihood( norm, normupmu,
06918                        elmu, ccnc, updn,     
06919                        chg, chgupmu,
06920                        specnu, specnubar,
06921                        emurange, emucurve, eshw,  
06922                        0.0, 0.0, 0.0, 0.0,
06923                        LnLtotal );
06924 
06925   LnL = LnLtotal-LnLbase;
06926 
06927   return;
06928 }

void AtNuOscFit::GetLikelihoodMinusBase ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t &  norm,
Double_t &  normupmu,
Double_t &  elmu,
Double_t &  ccnc,
Double_t &  updn,
Double_t &  chg,
Double_t &  chgupmu,
Double_t &  specnu,
Double_t &  specnubar,
Double_t &  emurange,
Double_t &  emucurve,
Double_t &  eshw,
Double_t &  fsnu,
Double_t &  fsnubar,
Double_t &  dmnu,
Double_t &  dmnubar,
Double_t &  LnL 
)

Definition at line 6882 of file AtNuOscFit.cxx.

References GetLikelihood(), and GetLikelihoodBase().

06883 {
06884   Double_t LnLbase = 0.0;
06885   Double_t LnLtotal = 0.0;
06886 
06887   this->GetLikelihoodBase( LnLbase );
06888 
06889   this->GetLikelihood( dmsq,     sinsq, 
06890                        dmsqbar,  sinsqbar,
06891                        norm,     normupmu,
06892                        elmu,     ccnc, 
06893                        updn,     chg,       chgupmu,
06894                        specnu,   specnubar,
06895                        emurange, emucurve,  eshw,  
06896                        fsnu,     fsnubar,
06897                        dmnu,     dmnubar,
06898                        LnLtotal );
06899 
06900   LnL = LnLtotal-LnLbase;
06901 
06902   return;
06903 }

void AtNuOscFit::GetLikelihoodNested ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t &  norm,
Double_t &  normupmu,
Double_t &  elmu,
Double_t &  ccnc,
Double_t &  updn,
Double_t &  chg,
Double_t &  chgupmu,
Double_t &  specnu,
Double_t &  specnubar,
Double_t &  emurange,
Double_t &  emucurve,
Double_t &  eshw,
Double_t &  fsnu,
Double_t &  fsnubar,
Double_t &  dmnu,
Double_t &  dmnubar,
Double_t &  LnL 
) [private]

Definition at line 6116 of file AtNuOscFit.cxx.

References fDebug, fDebugMinuit, fFIT_STATUS, fMaskCCNC, fMaskChg, fMaskChgUpmu, fMaskDmsqNu, fMaskDmsqNuBar, fMaskElMu, fMaskEmuCurve, fMaskEmuRange, fMaskEshw, fMaskNorm, fMaskNormUpmu, fMaskSinNu, fMaskSinNuBar, fMaskSpecNu, fMaskSpecNuBar, fMaskUpDn, fUseCCNC, fUseChg, fUseChgUpmu, fUseDmsqNu, fUseDmsqNuBar, fUseElMu, fUseEmuCurve, fUseEmuRange, fUseEshw, fUseNorm, fUseNormUpmu, fUseSinNu, fUseSinNuBar, fUseSpecNu, fUseSpecNuBar, fUseUpDn, GetLikelihood(), GetLikelihoodSyst(), SnapToGridDmsq(), and SnapToGridSinsq().

Referenced by GetLikelihood().

06117 {    
06118   if( fDebug ){
06119     Int_t nx    = -1;  this->SnapToGridDmsq(dmsq,nx);
06120     Int_t ny    = -1;  this->SnapToGridSinsq(sinsq,ny);
06121     Int_t nxbar = -1;  this->SnapToGridDmsq(dmsqbar,nxbar);
06122     Int_t nybar = -1;  this->SnapToGridSinsq(sinsqbar,nybar);
06123     std::cout << "    Run Syst Fit (Nested): [" << nx << "][" << ny << "] [" << nxbar << "][" << nybar << "] " << std::endl;
06124   }
06125 
06126   // do systematic fit (in stages)
06127   // =============================
06128   fFIT_STATUS = 0;
06129                  
06130   // input values
06131   Double_t inputnorm      = 0.0;
06132   Double_t inputnormupmu  = 0.0;
06133   Double_t inputelmu      = 0.0;
06134   Double_t inputccnc      = 0.0;
06135   Double_t inputupdn      = 0.0;
06136   Double_t inputchg       = 0.0;
06137   Double_t inputchgupmu   = 0.0;
06138   Double_t inputspecnu    = 0.0;
06139   Double_t inputspecnubar = 0.0;
06140   Double_t inputemurange  = 0.0;
06141   Double_t inputemucurve  = 0.0;
06142   Double_t inputeshw      = 0.0;
06143   Double_t inputfsnu      = 0.0;
06144   Double_t inputfsnubar   = 0.0;
06145   Double_t inputdmnu      = 0.0;
06146   Double_t inputdmnubar   = 0.0;
06147 
06148   // output values
06149   Double_t outputnorm      = 0.0;
06150   Double_t outputnormupmu  = 0.0;
06151   Double_t outputelmu      = 0.0;
06152   Double_t outputccnc      = 0.0;
06153   Double_t outputupdn      = 0.0;
06154   Double_t outputchg       = 0.0;
06155   Double_t outputchgupmu   = 0.0;
06156   Double_t outputspecnu    = 0.0;
06157   Double_t outputspecnubar = 0.0;
06158   Double_t outputemurange  = 0.0;
06159   Double_t outputemucurve  = 0.0;
06160   Double_t outputeshw      = 0.0;
06161   Double_t outputfsnu      = 0.0;
06162   Double_t outputfsnubar   = 0.0;
06163   Double_t outputdmnu      = 0.0;
06164   Double_t outputdmnubar   = 0.0;
06165 
06166   // output values
06167   Double_t outputLnL = 0.0;
06168   Bool_t status = 0;
06169 
06170   // do statistical fit first
06171   // ========================
06172   this->GetLikelihood(dmsq, sinsq, dmsqbar, sinsqbar,
06173                       outputLnL);   
06174                          
06175 
06176   // do systematic fit in stages
06177   // ===========================
06178   if( fDebugMinuit ){
06179     std::cout << "   -0- norm=" << outputnorm << " normupmu=" << outputnormupmu << std::endl
06180               << "       elmu=" << outputelmu << " ccnc=" << outputccnc << std::endl
06181               << "       chg=" << outputchg << " chgupmu=" << outputchgupmu << std::endl
06182               << "       specnu=" << outputspecnu << " specnubar=" << outputspecnubar << std::endl
06183               << "       emurange=" << outputemurange << " emucurve=" << outputemucurve << " eshw=" << outputeshw << std::endl
06184               << "       fsnu=" << outputfsnu << " fsnubar=" << outputfsnubar << std::endl
06185               << "       dmnu=" << outputdmnu << " dmnubar=" << outputdmnubar << std::endl;
06186   }
06187 
06188   // fit normalisation
06189   if( fUseNorm || fUseNormUpmu 
06190    || fUseSinNu || fUseSinNuBar 
06191    || fUseDmsqNu || fUseDmsqNuBar ) {
06192 
06193     fMaskNorm      = 1;
06194     fMaskNormUpmu  = 1; 
06195     fMaskElMu      = 0;
06196     fMaskCCNC      = 0;
06197     fMaskUpDn      = 0;
06198     fMaskChg       = 0;
06199     fMaskChgUpmu   = 0;
06200     fMaskSpecNu    = 0;
06201     fMaskSpecNuBar = 0;
06202     fMaskEmuRange  = 0;
06203     fMaskEmuCurve  = 0;
06204     fMaskEshw      = 0;    
06205     fMaskSinNu     = 1;
06206     fMaskSinNuBar  = 1;
06207     fMaskDmsqNu    = 1;
06208     fMaskDmsqNuBar = 1;
06209 
06210     inputnorm      = outputnorm;
06211     inputnormupmu  = outputnormupmu;
06212     inputelmu      = outputelmu;
06213     inputccnc      = outputccnc;
06214     inputupdn      = outputupdn;
06215     inputchg       = outputchg;
06216     inputchgupmu   = outputchgupmu;
06217     inputspecnu    = outputspecnu;
06218     inputspecnubar = outputspecnubar;
06219     inputemurange  = outputemurange;
06220     inputemucurve  = outputemucurve;
06221     inputeshw      = outputeshw;
06222     inputfsnu      = outputfsnu;
06223     inputfsnubar   = outputfsnubar;
06224     inputdmnu      = outputdmnu;
06225     inputdmnubar   = outputdmnubar;
06226 
06227     this->GetLikelihoodSyst(dmsq, sinsq, dmsqbar, sinsqbar,                 
06228                             inputnorm, inputnormupmu, 
06229                             inputelmu, inputccnc, inputupdn, inputchg, inputchgupmu,
06230                             inputspecnu, inputspecnubar,
06231                             inputemurange, inputemucurve, inputeshw,
06232                             inputfsnu, inputfsnubar,
06233                             inputdmnu, inputdmnubar,
06234                             outputnorm, outputnormupmu, 
06235                             outputelmu, outputccnc, outputupdn, outputchg, outputchgupmu,
06236                             outputspecnu, outputspecnubar,
06237                             outputemurange, outputemucurve, outputeshw,
06238                             outputfsnu, outputfsnubar,
06239                             outputdmnu, outputdmnubar,
06240                             outputLnL, status);   
06241 
06242     if( status ) fFIT_STATUS = 1;
06243   }
06244 
06245   if( fDebugMinuit ){
06246     std::cout << "   -1- norm=" << outputnorm << " normupmu=" << outputnormupmu << std::endl
06247               << "       elmu=" << outputelmu << " ccnc=" << outputccnc << std::endl
06248               << "       chg=" << outputchg << " chgupmu=" << outputchgupmu << std::endl
06249               << "       specnu=" << outputspecnu << " specnubar=" << outputspecnubar << std::endl
06250               << "       emurange=" << outputemurange << " emucurve=" << outputemucurve << " eshw=" << outputeshw << std::endl
06251               << "       fsnu=" << outputfsnu << " fsnubar=" << outputfsnubar << std::endl
06252               << "       dmnu=" << outputdmnu << " dmnubar=" << outputdmnubar << std::endl;
06253   }
06254 
06255   // fit normalisation + charge ratio + spectrum
06256   if( fUseChg || fUseChgUpmu 
06257    || fUseSpecNu || fUseSpecNuBar ) {
06258 
06259     fMaskNorm      = 1;
06260     fMaskNormUpmu  = 1; 
06261     fMaskElMu      = 0;
06262     fMaskCCNC      = 0;
06263     fMaskUpDn      = 0;
06264     fMaskChg       = 1;
06265     fMaskChgUpmu   = 1;
06266     fMaskSpecNu    = 1;
06267     fMaskSpecNuBar = 1;
06268     fMaskEmuRange  = 0;
06269     fMaskEmuCurve  = 0;
06270     fMaskEshw      = 0;    
06271     fMaskSinNu     = 1;
06272     fMaskSinNuBar  = 1;     
06273     fMaskDmsqNu    = 1;
06274     fMaskDmsqNuBar = 1; 
06275 
06276     inputnorm      = outputnorm;
06277     inputnormupmu  = outputnormupmu;
06278     inputelmu      = outputelmu;
06279     inputccnc      = outputccnc;
06280     inputupdn      = outputupdn;
06281     inputchg       = outputchg;
06282     inputchgupmu   = outputchgupmu;
06283     inputspecnu    = outputspecnu;
06284     inputspecnubar = outputspecnubar;
06285     inputemurange  = outputemurange;
06286     inputemucurve  = outputemucurve;
06287     inputeshw      = outputeshw;    
06288     inputfsnu      = outputfsnu;
06289     inputfsnubar   = outputfsnubar;    
06290     inputdmnu      = outputdmnu;
06291     inputdmnubar   = outputdmnubar;
06292 
06293     this->GetLikelihoodSyst(dmsq, sinsq, dmsqbar, sinsqbar,                 
06294                             inputnorm, inputnormupmu, 
06295                             inputelmu, inputccnc, inputupdn, inputchg, inputchgupmu,
06296                             inputspecnu, inputspecnubar,
06297                             inputemurange, inputemucurve, inputeshw,
06298                             inputfsnu, inputfsnubar,
06299                             inputdmnu, inputdmnubar,
06300                             outputnorm, outputnormupmu, 
06301                             outputelmu, outputccnc, outputupdn, outputchg, outputchgupmu,
06302                             outputspecnu, outputspecnubar,
06303                             outputemurange, outputemucurve, outputeshw,
06304                             outputfsnu, outputfsnubar,
06305                             outputdmnu, outputdmnubar,
06306                             outputLnL, status);   
06307 
06308     if( status ) fFIT_STATUS = 1;
06309   }
06310 
06311   if( fDebugMinuit ){
06312     std::cout << "   -2- norm=" << outputnorm << " normupmu=" << outputnormupmu << std::endl
06313               << "       elmu=" << outputelmu << " ccnc=" << outputccnc << std::endl
06314               << "       chg=" << outputchg << " chgupmu=" << outputchgupmu << std::endl
06315               << "       specnu=" << outputspecnu << " specnubar=" << outputspecnubar << std::endl
06316               << "       emurange=" << outputemurange << " emucurve=" << outputemucurve << " eshw=" << outputeshw << std::endl
06317               << "       fsnu=" << outputfsnu << " fsnubar=" << outputfsnubar << std::endl
06318               << "       dmnu=" << outputdmnu << " dmnubar=" << outputdmnubar << std::endl;
06319   }
06320 
06321   // fit normalisation + ratios + spectrum + energy
06322   if( fUseElMu || fUseCCNC || fUseUpDn 
06323    || fUseEmuRange || fUseEmuCurve || fUseEshw ){
06324 
06325     fMaskNorm      = 1;
06326     fMaskNormUpmu  = 1; 
06327     fMaskElMu      = 1;
06328     fMaskCCNC      = 1;
06329     fMaskUpDn      = 1;
06330     fMaskChg       = 1;
06331     fMaskChgUpmu   = 1;
06332     fMaskSpecNu    = 1;
06333     fMaskSpecNuBar = 1;
06334     fMaskEmuRange  = 1;
06335     fMaskEmuCurve  = 1;
06336     fMaskEshw      = 1;      
06337     fMaskSinNu     = 1;
06338     fMaskSinNuBar  = 1;    
06339     fMaskDmsqNu    = 1;
06340     fMaskDmsqNuBar = 1;
06341   
06342     inputnorm      = outputnorm;
06343     inputnormupmu  = outputnormupmu;
06344     inputelmu      = outputelmu;
06345     inputccnc      = outputccnc;
06346     inputupdn      = outputupdn;
06347     inputchg       = outputchg;
06348     inputchgupmu   = outputchgupmu;
06349     inputspecnu    = outputspecnu;
06350     inputspecnubar = outputspecnubar;
06351     inputemurange  = outputemurange;
06352     inputemucurve  = outputemucurve;
06353     inputeshw      = outputeshw;    
06354     inputfsnu      = outputfsnu;
06355     inputfsnubar   = outputfsnubar;
06356     inputdmnu      = outputdmnu;
06357     inputdmnubar   = outputdmnubar;
06358 
06359     this->GetLikelihoodSyst(dmsq, sinsq, dmsqbar, sinsqbar,                 
06360                             inputnorm, inputnormupmu, 
06361                             inputelmu, inputccnc, inputupdn, inputchg, inputchgupmu,
06362                             inputspecnu, inputspecnubar,
06363                             inputemurange, inputemucurve, inputeshw,
06364                             inputfsnu, inputfsnubar,
06365                             inputdmnu, inputdmnubar,
06366                             outputnorm, outputnormupmu, 
06367                             outputelmu, outputccnc, outputupdn, outputchg, outputchgupmu,
06368                             outputspecnu, outputspecnubar,
06369                             outputemurange, outputemucurve, outputeshw,
06370                             outputfsnu, outputfsnubar,
06371                             outputdmnu, outputdmnubar,
06372                             outputLnL, status);   
06373 
06374     if( status ) fFIT_STATUS = 1;
06375   }
06376 
06377   if( fDebugMinuit ){
06378     std::cout << "   -3- norm=" << outputnorm << " normupmu=" << outputnormupmu << std::endl
06379               << "       elmu=" << outputelmu << " ccnc=" << outputccnc << std::endl
06380               << "       chg=" << outputchg << " chgupmu=" << outputchgupmu << std::endl
06381               << "       specnu=" << outputspecnu << " specnubar=" << outputspecnubar << std::endl
06382               << "       emurange=" << outputemurange << " emucurve=" << outputemucurve << " eshw=" << outputeshw << std::endl
06383               << "       fsnu=" << outputfsnu << " fsnubar=" << outputfsnubar << std::endl
06384               << "       dmnu=" << outputdmnu << " dmnubar=" << outputdmnubar << std::endl;
06385   }
06386 
06387   // return values
06388   // =============
06389   norm      = outputnorm;
06390   normupmu  = outputnormupmu;
06391   elmu      = outputelmu;
06392   ccnc      = outputccnc;
06393   updn      = outputupdn;
06394   chg       = outputchg;
06395   chgupmu   = outputchgupmu;
06396   specnu    = outputspecnu;
06397   specnubar = outputspecnubar;
06398   emurange  = outputemurange;
06399   emucurve  = outputemucurve;
06400   eshw      = outputeshw;    
06401   fsnu      = outputfsnu;
06402   fsnubar   = outputfsnubar;
06403   dmnu      = outputdmnu;
06404   dmnubar   = outputdmnubar;
06405 
06406   LnL = outputLnL;
06407 
06408   return;
06409 }

void AtNuOscFit::GetLikelihoodSyst ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  inputnorm,
Double_t  inputnormupmu,
Double_t  inputelmu,
Double_t  inputccnc,
Double_t  inputupdn,
Double_t  inputchg,
Double_t  inputchgupmu,
Double_t  inputspecnu,
Double_t  inputspecnubar,
Double_t  inputemurange,
Double_t  inputemucurve,
Double_t  inputeshw,
Double_t  inputfsnu,
Double_t  inputfsnubar,
Double_t  inputdmnu,
Double_t  inputdmnubar,
Double_t &  outputnorm,
Double_t &  outputnormupmu,
Double_t &  outputelmu,
Double_t &  outputccnc,
Double_t &  outputupdn,
Double_t &  outputchg,
Double_t &  outputchgupmu,
Double_t &  outputspecnu,
Double_t &  outputspecnubar,
Double_t &  outputemurange,
Double_t &  outputemucurve,
Double_t &  outputeshw,
Double_t &  outputfsnu,
Double_t &  outputfsnubar,
Double_t &  outputdmnu,
Double_t &  outputdmnubar,
Double_t &  LnL,
Bool_t &  status 
) [private]

Definition at line 6411 of file AtNuOscFit.cxx.

References err(), fcn(), fDebugMinuit, fDmsqBarFit, fDmsqFit, fFitCCNC, fFitChg, fFitChgUpmu, fFitDmsqNu, fFitDmsqNuBar, fFitElMu, fFitEmuCurve, fFitEmuRange, fFitEshw, fFitNorm, fFitNormUpmu, fFitSinNu, fFitSinNuBar, fFitSpecNu, fFitSpecNuBar, fFitUpDn, fForceCPT, fMaskCCNC, fMaskChg, fMaskChgUpmu, fMaskDmsqNu, fMaskDmsqNuBar, fMaskElMu, fMaskEmuCurve, fMaskEmuRange, fMaskEshw, fMaskNorm, fMaskNormUpmu, fMaskSinNu, fMaskSinNuBar, fMaskSpecNu, fMaskSpecNuBar, fMaskUpDn, fMinuit, fSigmaCCNC, fSigmaChg, fSigmaChgUpmu, fSigmaElMu, fSigmaNorm, fSigmaNormUpmu, fSigmaUpDn, fSinsqBarFit, fSinsqFit, fUseCCNC, fUseChg, fUseChgUpmu, fUseDmsqInterp, fUseDmsqNu, fUseDmsqNuBar, fUseElMu, fUseEmuCurve, fUseEmuRange, fUseEshw, fUseNorm, fUseNormUpmu, fUseSinNu, fUseSinNuBar, fUseSpecNu, fUseSpecNuBar, fUseUpDn, fUsingCCNC, fUsingChg, fUsingChgUpmu, fUsingDmsqNu, fUsingDmsqNuBar, fUsingElMu, fUsingEmuCurve, fUsingEmuRange, fUsingEshw, fUsingNorm, fUsingNormUpmu, fUsingSinNu, fUsingSinNuBar, fUsingSpecNu, fUsingSpecNuBar, and fUsingUpDn.

Referenced by GetLikelihoodAll(), and GetLikelihoodNested().

06412 {
06413   // systematic fit
06414   // ==============
06415   fDmsqFit = dmsq;
06416   fSinsqFit = sinsq;
06417   fDmsqBarFit = dmsqbar;
06418   fSinsqBarFit = sinsqbar;
06419 
06420   fFitNorm      = inputnorm;
06421   fFitNormUpmu  = inputnormupmu; 
06422   fFitElMu      = inputelmu;
06423   fFitCCNC      = inputccnc;    
06424   fFitUpDn      = inputupdn;           
06425   fFitChg       = inputchg;       
06426   fFitChgUpmu   = inputchgupmu;          
06427   fFitSpecNu    = inputspecnu;         
06428   fFitSpecNuBar = inputspecnubar;      
06429   fFitEmuRange  = inputemurange;     
06430   fFitEmuCurve  = inputemucurve;          
06431   fFitEshw      = inputeshw;     
06432   fFitSinNu     = inputfsnu;
06433   fFitSinNuBar  = inputfsnubar;
06434   fFitDmsqNu    = inputdmnu;
06435   fFitDmsqNuBar = inputdmnubar;
06436 
06437   // initialise return values
06438   // ========================  
06439   Double_t myNorm      = inputnorm;
06440   Double_t myNormUpmu  = inputnormupmu;
06441   Double_t myElMu      = inputelmu;
06442   Double_t myCCNC      = inputccnc;
06443   Double_t myUpDn      = inputupdn;
06444   Double_t myChg       = inputchg;
06445   Double_t myChgUpmu   = inputchgupmu;
06446   Double_t mySpecNu    = inputspecnu;
06447   Double_t mySpecNuBar = inputspecnubar;
06448   Double_t myEmuRange  = inputemurange;
06449   Double_t myEmuCurve  = inputemucurve;
06450   Double_t myEshw      = inputeshw;
06451   Double_t mySinNu     = inputfsnu;
06452   Double_t mySinNuBar  = inputfsnubar;
06453   Double_t myDmsqNu    = inputdmnu;
06454   Double_t myDmsqNuBar = inputdmnubar;
06455 
06456   Double_t myLnL = 0.0;
06457   Int_t myStatus = 0;  
06458 
06459   Int_t err,flag;
06460   Double_t lnl,fedm,errdef;
06461   Int_t npari,nparx,istat;
06462 
06463   Double_t* arglist = new Double_t[10];
06464 
06465   Double_t* p0 = new Double_t[2];
06466   Double_t* p1 = new Double_t[2];
06467   Double_t* p2 = new Double_t[2];
06468   Double_t* p3 = new Double_t[2];
06469   Double_t* p4 = new Double_t[2];
06470   Double_t* p5 = new Double_t[2];
06471   Double_t* p6 = new Double_t[2];
06472   Double_t* p7 = new Double_t[2];
06473   Double_t* p8 = new Double_t[2];
06474   Double_t* p9 = new Double_t[2];
06475   Double_t* p10 = new Double_t[2];
06476   Double_t* p11 = new Double_t[2];
06477   Double_t* p12 = new Double_t[2];
06478   Double_t* p13 = new Double_t[2];
06479   Double_t* p14 = new Double_t[2];
06480   Double_t* p15 = new Double_t[2];
06481 
06482   // input parameters
06483   err=0; 
06484   arglist[0]=2; 
06485 
06486   // output parameters
06487   for( Int_t i=0; i<2; i++ ){
06488     p0[i] = 0.0;
06489     p1[i] = 0.0;
06490     p2[i] = 0.0;
06491     p3[i] = 0.0;
06492     p4[i] = 0.0;
06493     p5[i] = 0.0;
06494     p6[i] = 0.0;
06495     p7[i] = 0.0;
06496     p8[i] = 0.0;
06497     p9[i] = 0.0;
06498     p10[i] = 0.0;
06499     p11[i] = 0.0;
06500     p12[i] = 0.0;
06501     p13[i] = 0.0;
06502     p14[i] = 0.0;
06503     p15[i] = 0.0;
06504   }
06505 
06506   // which parameters to fit
06507   // =======================
06508   fUsingNorm = 0;
06509   fUsingNormUpmu = 0;
06510   fUsingUpDn = 0;
06511   fUsingElMu = 0;
06512   fUsingCCNC = 0;
06513   fUsingChg = 0;
06514   fUsingChgUpmu = 0;
06515   fUsingSpecNu = 0;
06516   fUsingSpecNuBar = 0;
06517   fUsingEmuRange = 0;
06518   fUsingEmuCurve = 0;
06519   fUsingEshw = 0;
06520   fUsingSinNu = 0;
06521   fUsingSinNuBar = 0;
06522   fUsingDmsqNu = 0;
06523   fUsingDmsqNuBar = 0;
06524 
06525   if( fUseNorm      && fMaskNorm )      fUsingNorm = 1;
06526   if( fUseNormUpmu  && fMaskNormUpmu )  fUsingNormUpmu = 1;
06527   if( fUseUpDn      && fMaskUpDn )      fUsingUpDn = 1;
06528   if( fUseElMu      && fMaskElMu )      fUsingElMu = 1;
06529   if( fUseCCNC      && fMaskCCNC )      fUsingCCNC = 1;
06530   if( fUseChg       && fMaskChg )       fUsingChg = 1; 
06531   if( fUseChgUpmu   && fMaskChgUpmu )   fUsingChgUpmu = 1;
06532   if( fUseSpecNu    && fMaskSpecNu )    fUsingSpecNu = 1;
06533   if( fUseSpecNuBar && fMaskSpecNuBar ) fUsingSpecNuBar = 1;
06534   if( fUseEmuRange  && fMaskEmuRange )  fUsingEmuRange = 1;
06535   if( fUseEmuCurve  && fMaskEmuCurve )  fUsingEmuCurve = 1;
06536   if( fUseEshw      && fMaskEshw )      fUsingEshw = 1;
06537   if( fUseSinNu     && fMaskSinNu )     fUsingSinNu = 1;
06538   if( fUseSinNuBar  && fMaskSinNuBar )  fUsingSinNuBar = 1;
06539 
06540   if( fUseDmsqNu    && fMaskDmsqNu    && fUseDmsqInterp ) fUsingDmsqNu = 1;
06541   if( fUseDmsqNuBar && fMaskDmsqNuBar && fUseDmsqInterp ) fUsingDmsqNuBar = 1;
06542 
06543   // force CPT symmetry
06544   // ==================
06545   if( fForceCPT ){
06546     fFitSinNuBar = 0.0;
06547     fFitDmsqNuBar = 0.0;
06548 
06549     mySinNuBar = 0.0;
06550     myDmsqNuBar = 0.0;
06551 
06552     if( fUsingSinNu || fUsingSinNuBar ){
06553       fUsingSinNu = 1;  fUsingSinNuBar = 0;
06554     }
06555 
06556     if( fUsingDmsqNu || fUsingDmsqNuBar ){
06557       fUsingDmsqNu = 1;  fUsingDmsqNuBar = 0;
06558     }
06559   }
06560 
06561   // initialise Minuit
06562   // =================
06563   fMinuit->mncler();
06564   fMinuit->mnexcm("SET STR",arglist,1,err);
06565   fMinuit->SetFCN(fcn);
06566 
06567   if( fUsingNorm )      fMinuit->mnparm(0,"p0",   inputnorm,      fSigmaNorm,     -2.5*fSigmaNorm,+2.5*fSigmaNorm,         err); 
06568   if( fUsingNormUpmu )  fMinuit->mnparm(1,"p1",   inputnormupmu,  fSigmaNormUpmu, -2.5*fSigmaNormUpmu,+2.5*fSigmaNormUpmu, err); 
06569   if( fUsingElMu )      fMinuit->mnparm(2,"p2",   inputelmu,      fSigmaElMu,     -2.5*fSigmaElMu,+2.5*fSigmaElMu,         err);
06570   if( fUsingCCNC )      fMinuit->mnparm(3,"p3",   inputccnc,      fSigmaCCNC,     -2.5*fSigmaCCNC,+2.5*fSigmaCCNC,         err);
06571   if( fUsingUpDn )      fMinuit->mnparm(4,"p4",   inputupdn,      fSigmaUpDn,     -2.5*fSigmaUpDn,+2.5*fSigmaUpDn,         err); 
06572   if( fUsingChg )       fMinuit->mnparm(5,"p5",   inputchg,       fSigmaChg,      -2.5*fSigmaChg,+2.5*fSigmaChg,           err); 
06573   if( fUsingChgUpmu )   fMinuit->mnparm(6,"p6",   inputchgupmu,   fSigmaChgUpmu,  -2.5*fSigmaChgUpmu,+2.5*fSigmaChgUpmu,   err); 
06574   if( fUsingSpecNu )    fMinuit->mnparm(7,"p7",   inputspecnu,    1.0,            -2.0,+2.0,                               err);
06575   if( fUsingSpecNuBar ) fMinuit->mnparm(8,"p8",   inputspecnubar, 1.0,            -2.0,+2.0,                               err);
06576   if( fUsingEmuRange )  fMinuit->mnparm(9,"p9",   inputemurange,  1.0,            -2.0,+2.0,                               err);
06577   if( fUsingEmuCurve )  fMinuit->mnparm(10,"p10", inputemucurve,  1.0,            -2.0,+2.0,                               err);
06578   if( fUsingEshw )      fMinuit->mnparm(11,"p11", inputeshw,      1.0,            -2.0,+2.0,                               err);
06579   if( fUsingSinNu )     fMinuit->mnparm(12,"p12", inputfsnu,      1.0,            -1.0,+1.0,                               err);
06580   if( fUsingSinNuBar )  fMinuit->mnparm(13,"p13", inputfsnubar,   1.0,            -1.0,+1.0,                               err);
06581   if( fUsingDmsqNu )    fMinuit->mnparm(14,"p14", inputdmnu,      5.0,            -5.0,+5.0,                               err);
06582   if( fUsingDmsqNuBar ) fMinuit->mnparm(15,"p15", inputdmnubar,   5.0,            -5.0,+5.0,                               err);
06583   
06584   // run Minuit
06585   // ==========
06586   flag = fMinuit->Migrad();
06587   fMinuit->GetParameter(0,p0[0],p0[1]);
06588   fMinuit->GetParameter(1,p1[0],p1[1]);
06589   fMinuit->GetParameter(2,p2[0],p2[1]);
06590   fMinuit->GetParameter(3,p3[0],p3[1]);
06591   fMinuit->GetParameter(4,p4[0],p4[1]);
06592   fMinuit->GetParameter(5,p5[0],p5[1]);
06593   fMinuit->GetParameter(6,p6[0],p6[1]);
06594   fMinuit->GetParameter(7,p7[0],p7[1]);
06595   fMinuit->GetParameter(8,p8[0],p8[1]);
06596   fMinuit->GetParameter(9,p9[0],p9[1]);
06597   fMinuit->GetParameter(10,p10[0],p10[1]);
06598   fMinuit->GetParameter(11,p11[0],p11[1]);
06599   fMinuit->GetParameter(12,p12[0],p12[1]);
06600   fMinuit->GetParameter(13,p13[0],p13[1]);
06601   fMinuit->GetParameter(14,p14[0],p14[1]);
06602   fMinuit->GetParameter(15,p15[0],p15[1]);
06603 
06604   fMinuit->mnstat(lnl,fedm,errdef,npari,nparx,istat);   
06605 
06606   if( fDebugMinuit ){
06607     std::cout << " RESULTS: " << std::endl;
06608     std::cout << "  p0=(" << p0[0] << "," << p0[1] << ") " << std::endl; 
06609     std::cout << "  p1=(" << p1[0] << "," << p1[1] << ") " << std::endl; 
06610     std::cout << "  p2=(" << p2[0] << "," << p2[1] << ") " << std::endl; 
06611     std::cout << "  p3=(" << p3[0] << "," << p3[1] << ") " << std::endl; 
06612     std::cout << "  p4=(" << p4[0] << "," << p4[1] << ") " << std::endl; 
06613     std::cout << "  p5=(" << p5[0] << "," << p5[1] << ") " << std::endl; 
06614     std::cout << "  p6=(" << p6[0] << "," << p6[1] << ") " << std::endl; 
06615     std::cout << "  p7=(" << p7[0] << "," << p7[1] << ") " << std::endl; 
06616     std::cout << "  p8=(" << p8[0] << "," << p8[1] << ") " << std::endl; 
06617     std::cout << "  p9=(" << p9[0] << "," << p9[1] << ") " << std::endl; 
06618     std::cout << "  p10=(" << p10[0] << "," << p10[1] << ") " << std::endl; 
06619     std::cout << "  p11=(" << p11[0] << "," << p11[1] << ") " << std::endl; 
06620     std::cout << "  p12=(" << p12[0] << "," << p12[1] << ") " << std::endl; 
06621     std::cout << "  p13=(" << p13[0] << "," << p13[1] << ") " << std::endl; 
06622     std::cout << "  p14=(" << p14[0] << "," << p14[1] << ") " << std::endl; 
06623     std::cout << "  p15=(" << p15[0] << "," << p15[1] << ") " << std::endl; 
06624   }
06625 
06626   // fitted values
06627   // =============
06628   if( fUsingNorm )      myNorm      = p0[0];
06629   if( fUsingNormUpmu )  myNormUpmu  = p1[0];
06630   if( fUsingElMu )      myElMu      = p2[0];
06631   if( fUsingCCNC )      myCCNC      = p3[0];
06632   if( fUsingUpDn )      myUpDn      = p4[0];
06633   if( fUsingChg )       myChg       = p5[0];
06634   if( fUsingChgUpmu )   myChgUpmu   = p6[0];
06635   if( fUsingSpecNu )    mySpecNu    = p7[0];
06636   if( fUsingSpecNuBar ) mySpecNuBar = p8[0];
06637   if( fUsingEmuRange )  myEmuRange  = p9[0];
06638   if( fUsingEmuCurve )  myEmuCurve  = p10[0];
06639   if( fUsingEshw )      myEshw      = p11[0];
06640   if( fUsingSinNu )     mySinNu     = p12[0];
06641   if( fUsingSinNuBar )  mySinNuBar  = p13[0];
06642   if( fUsingDmsqNu )    myDmsqNu    = p14[0];
06643   if( fUsingDmsqNuBar ) myDmsqNuBar = p15[0];
06644 
06645   myLnL = lnl; 
06646   myStatus = flag;
06647 
06648   delete [] p0;
06649   delete [] p1;
06650   delete [] p2;
06651   delete [] p3;
06652   delete [] p4;
06653   delete [] p5;
06654   delete [] p6;
06655   delete [] p7;
06656   delete [] p8;
06657   delete [] p9;
06658   delete [] p10;
06659   delete [] p11;
06660   delete [] p12;
06661   delete [] p13;
06662   delete [] p14;
06663   delete [] p15;
06664 
06665   delete [] arglist;
06666     
06667   // force CPT symmetry
06668   // ==================
06669   if( fForceCPT ){
06670     mySinNuBar = mySinNu;
06671     myDmsqNuBar = myDmsqNu;
06672   }
06673 
06674   // set return values
06675   // =================
06676   outputnorm      = myNorm;
06677   outputnormupmu  = myNormUpmu;
06678   outputelmu      = myElMu;
06679   outputccnc      = myCCNC;
06680   outputupdn      = myUpDn;
06681   outputchg       = myChg;
06682   outputchgupmu   = myChgUpmu;
06683   outputspecnu    = mySpecNu;
06684   outputspecnubar = mySpecNuBar;
06685   outputemurange  = myEmuRange;
06686   outputemucurve  = myEmuCurve;
06687   outputeshw      = myEshw;
06688   outputfsnu      = mySinNu;
06689   outputfsnubar   = mySinNuBar;
06690   outputdmnu      = myDmsqNu;
06691   outputdmnubar   = myDmsqNuBar;
06692 
06693   LnL = myLnL;  
06694   status = myStatus;
06695 
06696   return;
06697 } 

Double_t AtNuOscFit::GetSinsq ( Int_t  ibin  ) 

Definition at line 1432 of file AtNuOscFit.cxx.

References fNY, and fY.

01433 {
01434   if( fY ){
01435     if( ibin>=0 && ibin<fNY ) return fY[ibin];
01436     else if( ibin==-1 ) return 0.0;
01437   }
01438   return -999.9;
01439 }

Int_t AtNuOscFit::GetSinsqBin ( Double_t  sinsq  ) 

Definition at line 1459 of file AtNuOscFit.cxx.

References SnapToGridSinsq().

01460 {
01461   Int_t SinsqBin = -1;
01462   
01463   this->SnapToGridSinsq( sinsq, SinsqBin );
01464 
01465   return SinsqBin;
01466 }

Int_t AtNuOscFit::GetSinsqBins (  ) 

Definition at line 1427 of file AtNuOscFit.cxx.

References fNY.

01428 {
01429   return fNY;
01430 }

Double_t AtNuOscFit::GetSinsqMax ( Int_t  ibin  ) 

Definition at line 1450 of file AtNuOscFit.cxx.

References fNY, and fYedge.

Referenced by SetNuBarOscillations(), and SetNuOscillations().

01451 {
01452   if( fYedge ){
01453     if( ibin>=0 && ibin<fNY ) return fYedge[ibin+1];
01454     else if( ibin==-1 ) return fYedge[0];
01455   }
01456   return -999.9;
01457 }

Double_t AtNuOscFit::GetSinsqMin ( Int_t  ibin  ) 

Definition at line 1441 of file AtNuOscFit.cxx.

References fNY, and fYedge.

Referenced by SetNuBarOscillations(), and SetNuOscillations().

01442 {
01443   if( fYedge ){
01444     if( ibin>=0 && ibin<fNY ) return fYedge[ibin];
01445     else if( ibin==-1 ) return 0.0;
01446   }
01447   return -999.9;
01448 }

void AtNuOscFit::Initialize ( Int_t  nX = -1,
Double_t  X1 = 0.0,
Double_t  X2 = 0.0,
Int_t  nY = -1,
Double_t  Y1 = 0.0,
Double_t  Y2 = 0.0 
) [private]

Definition at line 114 of file AtNuOscFit.cxx.

References cptmarker, fAddPenaltyTerms, fChargeWeight, fCptCCNC, fCptChg, fCptChgUpmu, fCptDmsqNu, fCptDmsqNuBar, fCptElMu, fCptEmuCurve, fCptEmuRange, fCptEshw, fCptFit, fCptLnL, fCptLnL_CV_HIRES, fCptLnL_CV_HIRES_NORM, fCptLnL_CV_HIRES_SHAPE, fCptLnL_CV_HIRES_UPDN, fCptLnL_CV_LORES, fCptLnL_NUE, fCptLnL_PENALTY, fCptLnL_STATUS, fCptLnL_UPMU_HIRES, fCptLnL_UPMU_HIRES_NORM, fCptLnL_UPMU_HIRES_SHAPE, fCptLnL_UPMU_HIRES_UPDN, fCptNorm, fCptNormUpmu, fCptResultsFile, fCptSinNu, fCptSinNuBar, fCptSpecNu, fCptSpecNuBar, fCptUpDn, fDebug, fDebugMinuit, fDmsqBarBest, fDmsqBarFit, fDmsqBarTrue, fDmsqBest, fDmsqFit, fDmsqTrue, fDoChargeSeparation, fDoCptFit, fDoEnergySystematics, fDoInputSystematics, fDoNestedFit, fDoOscFit, fDoParallelRunning, fDoRandomizing, fDoScaling, fDoScalingSystematics, fFitAllSystematics, fFitCCNC, fFitChg, fFitChgUpmu, fFitDmsqNu, fFitDmsqNuBar, fFitElMu, fFitEmuCurve, fFitEmuRange, fFitEshw, fFitNorm, fFitNormUpmu, fFitSimpleSystematics, fFitSinNu, fFitSinNuBar, fFitSpecNu, fFitSpecNuBar, fFitSystematics, fFitUpDn, fFixNuBarOscillations, fFixNuOscillations, fForceCPT, fHistAtmosNueCC, fHistAtmosNueNC, fHistAtmosNumuCC, fHistAtmosNumuNC, fHistAtmosNutauCC, fHistCosmics, fHistData, fHistUpmuNueCC, fHistUpmuNueNC, fHistUpmuNumuCC, fHistUpmuNumuNC, fHistUpmuNutauCC, fInputCCNC, fInputChg, fInputChgUpmu, fInputElMu, fInputEmuCurve, fInputEmuRange, fInputEshw, fInputNorm, fInputNormUpmu, fInputSpecNu, fInputSpecNuBar, fInputUpDn, fInterpolation, fLinearInterpolation, fM0, fM1, fMaskCCNC, fMaskChg, fMaskChgUpmu, fMaskDmsqNu, fMaskDmsqNuBar, fMaskElMu, fMaskEmuCurve, fMaskEmuRange, fMaskEshw, fMaskNorm, fMaskNormUpmu, fMaskSinNu, fMaskSinNuBar, fMaskSpecNu, fMaskSpecNuBar, fMaskUpDn, fMinuit, fMockData, fNX, fNY, fOscCCNC, fOscChg, fOscChgUpmu, fOscDmsqNu, fOscDmsqNuBar, fOscElMu, fOscEmuCurve, fOscEmuRange, fOscEshw, fOscFile, fOscFileName, fOscFit, fOscLnL, fOscLnL_CV_HIRES, fOscLnL_CV_HIRES_NORM, fOscLnL_CV_HIRES_SHAPE, fOscLnL_CV_HIRES_UPDN, fOscLnL_CV_LORES, fOscLnL_NUE, fOscLnL_PENALTY, fOscLnL_STATUS, fOscLnL_UPMU_HIRES, fOscLnL_UPMU_HIRES_NORM, fOscLnL_UPMU_HIRES_SHAPE, fOscLnL_UPMU_HIRES_UPDN, fOscNorm, fOscNormUpmu, fOscResultsFile, fOscSinNu, fOscSinNuBar, fOscSpecNu, fOscSpecNuBar, fOscTree, fOscUpDn, fPhysicalBoundary, fRandom, fScale, fSigmaCCNC, fSigmaChg, fSigmaChgUpmu, fSigmaElMu, fSigmaEmuCurve, fSigmaEmuRange, fSigmaEshw, fSigmaNorm, fSigmaNormUpmu, fSigmaSpecNu, fSigmaSpecNuBar, fSigmaUpDn, fSinsqBarBest, fSinsqBarFit, fSinsqBarTrue, fSinsqBest, fSinsqFit, fSinsqTrue, fTemplateCptFit, fTemplateExpt, fTemplateFit, fTemplateMCatmosbkg, fTemplateMCcosmics, fTemplateMCdmsq00, fTemplateMCdmsq01, fTemplateMCdmsq10, fTemplateMCdmsq11, fTemplateMCnoosc, fTemplateMCsys, fTemplateMCtrueosc, fTemplateOscFit, fUseALL, fUseBayesLikelihood, fUseCCNC, fUseChg, fUseChgUpmu, fUseCVHIRES, fUseCVLORES, fUseDmsqInterp, fUseDmsqNu, fUseDmsqNuBar, fUseElMu, fUseEmuCurve, fUseEmuRange, fUseEshw, fUseModifiedBayesLikelihood, fUseModifiedDmsqInterp, fUseModifiedLikelihood, fUseNegatives, fUseNorm, fUseNormUpmu, fUseNUE, fUsePositives, fUseSinNu, fUseSinNuBar, fUseSpecNu, fUseSpecNuBar, fUseUpDn, fUseUPMUHIRES, fUseUPMULORES, fUsingCCNC, fUsingChg, fUsingChgUpmu, fUsingDmsqNu, fUsingDmsqNuBar, fUsingElMu, fUsingEmuCurve, fUsingEmuRange, fUsingEshw, fUsingNorm, fUsingNormUpmu, fUsingSinNu, fUsingSinNuBar, fUsingSpecNu, fUsingSpecNuBar, fUsingUpDn, fWriteHistograms, fWriteSystTemplates, fWriteTemplates, fX, fX1, fX2, fXedge, fY, fY1, fY2, fYedge, hcptBest, hcptbestCCNC, hcptbestChg, hcptbestChgUpmu, hcptbestDmsqNu, hcptbestDmsqNuBar, hcptbestElMu, hcptbestEmuCurve, hcptbestEmuRange, hcptbestEshw, hcptbestLnL, hcptbestNorm, hcptbestNormUpmu, hcptbestSinNu, hcptbestSinNuBar, hcptbestSpecNu, hcptbestSpecNuBar, hcptbestUpDn, hcptCCNC, hcptChg, hcptChgUpmu, hcptDmsqNu, hcptDmsqNuBar, hcptElMu, hcptEmuCurve, hcptEmuRange, hcptEshw, hcptFit, hcptLnL, hcptLnL_cv_hires, hcptLnL_cv_hires_norm, hcptLnL_cv_hires_shape, hcptLnL_cv_hires_updn, hcptLnL_cv_lores, hcptLnL_nue, hcptLnL_penalty, hcptLnL_status, hcptLnL_upmu_hires, hcptLnL_upmu_hires_norm, hcptLnL_upmu_hires_shape, hcptLnL_upmu_hires_updn, hcptNorm, hcptNormUpmu, hcptSinNu, hcptSinNuBar, hcptSpecNu, hcptSpecNuBar, hcptTrue, hcptUpDn, hexptCCNC, hexptChg, hexptChgUpmu, hexptElMu, hexptEmuCurve, hexptEmuRange, hexptEshw, hexptNorm, hexptNormUpmu, hexptSpecNu, hexptSpecNuBar, hexptUpDn, hoscBest, hoscbestCCNC, hoscbestChg, hoscbestChgUpmu, hoscbestDmsqNu, hoscbestDmsqNuBar, hoscbestElMu, hoscbestEmuCurve, hoscbestEmuRange, hoscbestEshw, hoscbestLnL, hoscbestNorm, hoscbestNormUpmu, hoscbestSinNu, hoscbestSinNuBar, hoscbestSpecNu, hoscbestSpecNuBar, hoscbestUpDn, hoscCCNC, hoscChg, hoscChgUpmu, hoscDmsqNu, hoscDmsqNuBar, hoscElMu, hoscEmuCurve, hoscEmuRange, hoscEshw, hoscFit, hoscLnL, hoscLnL_cv_hires, hoscLnL_cv_hires_norm, hoscLnL_cv_hires_shape, hoscLnL_cv_hires_updn, hoscLnL_cv_lores, hoscLnL_nue, hoscLnL_penalty, hoscLnL_status, hoscLnL_upmu_hires, hoscLnL_upmu_hires_norm, hoscLnL_upmu_hires_shape, hoscLnL_upmu_hires_updn, hoscNorm, hoscNormUpmu, hoscSinNu, hoscSinNuBar, hoscSpecNu, hoscSpecNuBar, hoscTrue, hoscUpDn, oscmarker, truecptmarker, and trueoscmarker.

Referenced by AtNuOscFit().

00116 {
00117   std::cout << " *** AtNuOscFit::Initialize(...) *** " << std::endl;
00118 
00119   // template arrays
00120   // ===============
00121 
00122   fHistData = 0;
00123   fHistCosmics = 0;
00124 
00125   fHistAtmosNueCC = 0;
00126   fHistAtmosNumuCC = 0;
00127   fHistAtmosNutauCC = 0;
00128   fHistAtmosNueNC = 0;
00129   fHistAtmosNumuNC = 0;
00130 
00131   fHistUpmuNueCC = 0;
00132   fHistUpmuNumuCC = 0;
00133   fHistUpmuNutauCC = 0;
00134   fHistUpmuNueNC = 0;
00135   fHistUpmuNumuNC = 0;
00136 
00137   // oscillation binning
00138   // ===================
00139 
00140   fNX = nX;
00141   fX1 = X1;
00142   fX2 = X2;
00143 
00144   fNY = nY;
00145   fY1 = Y1;
00146   fY2 = Y2;
00147 
00148   fX = 0;
00149   fY = 0;
00150 
00151   fXedge = 0;
00152   fYedge = 0;
00153 
00154   if( fNX>0 && fNY>0 ){
00155 
00156     fX = new Double_t[fNX];
00157     fY = new Double_t[fNY];
00158 
00159     fXedge = new Double_t[fNX+1];
00160     fYedge = new Double_t[fNY+1];
00161 
00162     std::cout << "  Dmsq Bins: " << fNX << " " << fX1 << " " << fX2 << std::endl
00163               << "  Sinsq Bins: " << fNY << " " << fY1 << " " << fY2 << std::endl;
00164 
00165     std::cout << "  Using: " << fNX << " x " << fNY << " grid " << std::endl;
00166 
00167     if( fX1==0 ) fX1 = 1.0e-5;
00168     Double_t tempX1 = log10(fX1);
00169     Double_t tempX2 = log10(fX2);
00170 
00171     if( fNX>1 ){
00172       for( Int_t i=0; i<fNX; i++ ){
00173         fX[i] = pow(10.0,tempX1+(tempX2-tempX1)*(i)/(fNX-1.0));
00174       }
00175       for( Int_t i=0; i<fNX+1; i++ ){
00176         fXedge[i] = pow(10.0,tempX1+(tempX2-tempX1)*(i-0.5)/(fNX-1.0));
00177       }
00178     }
00179     else{
00180       fX[0] = fX2;
00181       fXedge[0] = fX1; fXedge[1] = fX2;
00182     }
00183 
00184     if( fNY>1 ){
00185       for( Int_t j=0; j<fNY; j++ ){ 
00186         fY[j] = fY1+(fY2-fY1)*(j)/(fNY-1.0);
00187       }
00188       for( Int_t j=0; j<fNY+1; j++ ){ 
00189         fYedge[j] = fY1+(fY2-fY1)*(j-0.5)/(fNY-1.0);
00190       }
00191     }
00192     else{
00193       fY[0] = fY2;
00194       fYedge[0] = fY1; fYedge[1] = fY2;
00195     }
00196 
00197     std::cout << "  Dmsq(DmsqBar) Values: " << std::endl;
00198     for( Int_t i=0; i<fNX; i++ ){ 
00199       std::cout << "   " << i << ": " << fX[i] << " [" << fXedge[i]<< "->" << fXedge[i+1] << "]" << std::endl;
00200     }
00201 
00202     std::cout << "  Sinsq(SinsqBar) Values: " << std::endl;
00203     for( Int_t j=0; j<fNY; j++ ){ 
00204       std::cout << "   " << j << ": " << fY[j] << " [" << fYedge[j]<< "->" << fYedge[j+1] << "]" << std::endl;
00205     }
00206   }
00207 
00208   // fit settings
00209   // ============  
00210   fDoOscFit = 0;            // dmsq vs sinsq oscillation fit
00211   fDoCptFit = 0;            // dmsq vs dmsqbar oscillation fit
00212 
00213   fMockData = 0;            // using mock data
00214   fDoRandomizing = 0;       // do randomization
00215   fDoParallelRunning = 0;   // enable parallelization
00216   fWriteTemplates = 0;      // write templates
00217   fWriteSystTemplates = 0;  // write systematic templates
00218   fWriteHistograms = 0;
00219 
00220   fDoScaling = 0;           // scale templates by scale factor
00221   fScale = 1.0;             // scale factor
00222 
00223   fFixNuOscillations = 0;   // fix neutrino oscillations;
00224   fFixNuBarOscillations = 0;// fix anti-neutrino oscillations;
00225 
00226   fDebug = 0;               // print debug messages
00227   fDebugMinuit = 0;         // print debug messages (TMinuit)
00228 
00229   fForceCPT = 0;            // force CPT symmetry
00230 
00231   // true oscillations 
00232   // =================
00233                             // (parameters)
00234   fDmsqTrue = 0.0;          // true dmsq
00235   fSinsqTrue = 0.0;         // true sinsq2theta
00236   fDmsqBarTrue = 0.0;       // true dmsq(bar)
00237   fSinsqBarTrue = 0.0;      // true sinsq2theta(bar)
00238 
00239                             // (parameters)
00240   fDmsqBest = 0.0;          // best fit dmsq
00241   fSinsqBest = 0.0;         // best fit sinsq2theta
00242   fDmsqBarBest = 0.0;       // best fit dmsq(bar)
00243   fSinsqBarBest = 0.0;      // best fit sinsq2theta(bar)
00244 
00245                             // (current fit parameters)
00246   fDmsqFit = 0;             // current dmsq 
00247   fSinsqFit = 0;            // current sinsq2theta
00248   fDmsqBarFit = 0;          // current dmsq(bar)
00249   fSinsqBarFit = 0;         // current sinsq2theta(bar)
00250 
00251   fUseNorm = 0;             //
00252   fUseNormUpmu = 0;         //
00253   fUseElMu = 0;             //
00254   fUseCCNC = 0;             // 
00255   fUseUpDn = 0;             // which parameters to use in fit
00256   fUseChg = 0;              // (set from outside code)
00257   fUseChgUpmu = 0;          // 
00258   fUseSpecNu = 0;           //
00259   fUseSpecNuBar = 0;        //
00260   fUseEmuRange = 0;         //
00261   fUseEmuCurve = 0;         //
00262   fUseEshw = 0;             //
00263   fUseSinNu = 0;            //
00264   fUseSinNuBar = 0;         //
00265   fUseDmsqNu = 0;           //
00266   fUseDmsqNuBar = 0;        //
00267 
00268   fMaskNorm = 0;            //
00269   fMaskNormUpmu = 0;        //
00270   fMaskElMu = 0;            // 
00271   fMaskCCNC = 0;            //
00272   fMaskUpDn = 0;            // which parameters to use in fit
00273   fMaskChg = 0;             // (set from inside code)
00274   fMaskChgUpmu = 0;         //
00275   fMaskSpecNu = 0;          //
00276   fMaskSpecNuBar = 0;       //
00277   fMaskEmuRange = 0;        //
00278   fMaskEmuCurve = 0;        //
00279   fMaskEshw = 0;            //
00280   fMaskSinNu = 0;           //
00281   fMaskSinNuBar = 0;        //
00282   fMaskDmsqNu = 0;          //
00283   fMaskDmsqNuBar = 0;       //
00284 
00285   fUsingNorm = 0;           //
00286   fUsingNormUpmu = 0;       //
00287   fUsingElMu = 0;           //
00288   fUsingCCNC = 0;           // 
00289   fUsingUpDn = 0;           // which parameters to use in fit
00290   fUsingChg = 0;            // (Using = Use || Mask)
00291   fUsingChgUpmu = 0;        // 
00292   fUsingSpecNu = 0;         //
00293   fUsingSpecNuBar = 0;      //
00294   fUsingEmuRange = 0;       //
00295   fUsingEmuCurve = 0;       //
00296   fUsingEshw = 0;           //
00297   fUsingSinNu = 0;          //
00298   fUsingSinNuBar = 0;       //
00299   fUsingDmsqNu = 0;         //
00300   fUsingDmsqNuBar = 0;      //
00301 
00302   fFitNorm = 0.0;           //
00303   fFitNormUpmu = 0.0;       //
00304   fFitElMu = 0.0;           //
00305   fFitCCNC = 0.0;           // 
00306   fFitUpDn = 0.0;           // values of parameters
00307   fFitChg = 0.0;            // 
00308   fFitChgUpmu = 0.0;        // 
00309   fFitSpecNu = 0.0;         //
00310   fFitSpecNuBar = 0.0;      //
00311   fFitEmuRange = 0.0;       //
00312   fFitEmuCurve = 0.0;       //
00313   fFitEshw = 0.0;           //
00314   fFitSinNu = 0.0;          //
00315   fFitSinNuBar = 0.0;       //
00316   fFitDmsqNu = 0.0;         //
00317   fFitDmsqNuBar = 0.0;      //
00318 
00319   // samples to be used
00320   // ==================
00321   fUseALL = 1;              // use all selected events
00322   fUseNUE = 1;              // use selected electron neutrinos 
00323   fUseCVLORES = 1;          // use selected contained events (low res)
00324   fUseCVHIRES = 1;          // use selected contained events (high res)
00325   fUseUPMULORES = 1;        // use selected upward muons (low res)
00326   fUseUPMUHIRES = 1;        // use selected upward muons (high res)
00327 
00328   // charge separation
00329   // =================
00330   fDoChargeSeparation = 0;  // do charge separation
00331   fUseNegatives = 0;        // use neutrinos
00332   fUsePositives = 0;        // use anti-neutrinos
00333 
00334   // bayes likelihood
00335   // ================
00336   fUseBayesLikelihood = 0;  // use bayes likelihood
00337   fUseModifiedBayesLikelihood = 0; // use modified bayes likelihood
00338 
00339   // modified likelihood
00340   // ===================
00341   fUseModifiedLikelihood = 0;
00342   fM0 = 0.01;
00343   fM1 = 0.05;
00344 
00345   // interpolate dmsq bins
00346   // =====================
00347   fUseDmsqInterp = 0;
00348   fUseModifiedDmsqInterp = 0;
00349 
00350   // interpolate systematics
00351   // =======================
00352   fLinearInterpolation = 0;
00353 
00354   // systematic errors
00355   // =================  
00356   fDoScalingSystematics = 0;  // switch on scaling parameters
00357   fDoEnergySystematics = 0;   // switch on interpolation parameters
00358   fDoInputSystematics = 0;    // vary input systematics in mock data
00359 
00360   fFitSystematics = 0;        // fit systematics
00361   fFitSimpleSystematics = 0;  // fit scaling parameters only
00362   fFitAllSystematics = 0;     // fit scaling and interpolation parameters
00363 
00364   fDoNestedFit = 0;           // do nested oscillation fit
00365   fAddPenaltyTerms = 0;       // add on penalty terms in likelihood
00366   fPhysicalBoundary = 1;      // enforce physical boundary
00367 
00368   fSigmaNorm = 0.15;        // error in normalization
00369   fSigmaNormUpmu = 0.25;    // error in cv/up ratio 
00370   fSigmaUpDn = 0.03;        // error in up/down ratio
00371   fSigmaElMu = 0.05;        // error in flavour ratio
00372   fSigmaCCNC = 0.20;        // error in cc/nc ratio
00373   fSigmaChg = 0.10;         // error in charge ratio
00374   fSigmaChgUpmu = 0.125;    // error in upmu charge ratio
00375   fChargeWeight = +0.33;    // extra weight given to anti-neutrinos
00376                             // over neutrinos in charge ratio error
00377                             // (this is expected to be positive!)
00378                             //  fSigmaChgNu = (1.0-fChargeWeight)*fSigmaChg
00379                             //  fSigmaChgNuBar = (1.0+fChargeWeight)*fSigmaChg
00380 
00381   fSigmaSpecNu = 1.0;       // spectral index (neutrinos)
00382   fSigmaSpecNuBar = 1.0;    // spectral index (anti-neutrinos)
00383   fSigmaEmuRange = 1.0;     // muon momentum from range
00384   fSigmaEmuCurve = 1.0;     // muon momentum from curvature
00385   fSigmaEshw = 1.0;         // shower energy
00386                             // note: these are in units of sigma,
00387                             //       where sigma is specified in 
00388                             //       the template maker
00389 
00390   // input systematics
00391   // =================
00392   fInputNorm = 0.0;
00393   fInputNormUpmu = 0.0;
00394   fInputUpDn = 0.0;
00395   fInputElMu = 0.0;
00396   fInputCCNC = 0.0;
00397   fInputChg = 0.0;
00398   fInputChgUpmu = 0.0;
00399   fInputSpecNu = 0.0;
00400   fInputSpecNuBar = 0.0;
00401   fInputEmuRange = 0.0;
00402   fInputEmuCurve = 0.0;
00403   fInputEshw = 0.0;
00404 
00405   // random number generator
00406   // =======================
00407   fRandom = new TRandom(0);
00408 
00409   // minuit minimization
00410   // ===================
00411   fMinuit = new TMinuit();  
00412   fMinuit->SetPrintLevel(-1);
00413   fMinuit->SetMaxIterations(1000);
00414 
00415   // arrays for osc fit
00416   // ==================
00417   fOscFit = 0;
00418   fOscLnL = 0;
00419   fOscNorm = 0;
00420   fOscNormUpmu = 0;
00421   fOscElMu = 0;
00422   fOscCCNC = 0;
00423   fOscUpDn = 0;
00424   fOscChg = 0;
00425   fOscChgUpmu = 0;
00426   fOscSpecNu = 0;
00427   fOscSpecNuBar = 0;
00428   fOscEmuRange = 0;
00429   fOscEmuCurve = 0;
00430   fOscEshw = 0;
00431   fOscSinNu = 0;
00432   fOscSinNuBar = 0;
00433   fOscDmsqNu = 0;
00434   fOscDmsqNuBar = 0;
00435 
00436   fCptFit = 0;
00437   fCptLnL = 0;
00438   fCptNorm = 0;
00439   fCptNormUpmu = 0;
00440   fCptElMu = 0;
00441   fCptCCNC = 0;
00442   fCptUpDn = 0;
00443   fCptChg = 0;
00444   fCptChgUpmu = 0;
00445   fCptSpecNu = 0;
00446   fCptSpecNuBar = 0;
00447   fCptEmuRange = 0;
00448   fCptEmuCurve = 0;
00449   fCptEshw = 0;
00450   fCptSinNu = 0;
00451   fCptSinNuBar = 0;
00452   fCptDmsqNu = 0;
00453   fCptDmsqNuBar = 0;
00454 
00455   if( fNX>0 && fNY>0 ){
00456 
00457     fOscFit = new Double_t[fNX*fNY];
00458     fOscLnL = new Double_t[fNX*fNY];
00459     fOscNorm = new Double_t[fNX*fNY];
00460     fOscNormUpmu = new Double_t[fNX*fNY];
00461     fOscElMu = new Double_t[fNX*fNY];
00462     fOscCCNC = new Double_t[fNX*fNY];
00463     fOscUpDn = new Double_t[fNX*fNY];
00464     fOscChg = new Double_t[fNX*fNY];
00465     fOscChgUpmu = new Double_t[fNX*fNY];
00466     fOscSpecNu = new Double_t[fNX*fNY];
00467     fOscSpecNuBar = new Double_t[fNX*fNY];
00468     fOscEmuRange = new Double_t[fNX*fNY];
00469     fOscEmuCurve = new Double_t[fNX*fNY];
00470     fOscEshw = new Double_t[fNX*fNY];
00471     fOscSinNu = new Double_t[fNX*fNY];
00472     fOscSinNuBar = new Double_t[fNX*fNY];
00473     fOscDmsqNu = new Double_t[fNX*fNY];
00474     fOscDmsqNuBar = new Double_t[fNX*fNY];
00475 
00476     fOscLnL_NUE = new Double_t[fNX*fNY];
00477     fOscLnL_CV_LORES = new Double_t[fNX*fNY];
00478     fOscLnL_CV_HIRES = new Double_t[fNX*fNY];
00479     fOscLnL_CV_HIRES_SHAPE = new Double_t[fNX*fNY];
00480     fOscLnL_CV_HIRES_NORM = new Double_t[fNX*fNY];
00481     fOscLnL_CV_HIRES_UPDN = new Double_t[fNX*fNY];
00482     fOscLnL_UPMU_HIRES = new Double_t[fNX*fNY]; 
00483     fOscLnL_UPMU_HIRES_SHAPE = new Double_t[fNX*fNY];
00484     fOscLnL_UPMU_HIRES_NORM = new Double_t[fNX*fNY];
00485     fOscLnL_UPMU_HIRES_UPDN = new Double_t[fNX*fNY];
00486     fOscLnL_PENALTY = new Double_t[fNX*fNY];
00487     fOscLnL_STATUS = new Double_t[fNX*fNY];
00488 
00489     for( Int_t nx=0; nx<fNX; nx++ ){
00490       for( Int_t ny=0; ny<fNY; ny++ ){
00491         fOscFit[nx*fNY+ny] = 0.0;
00492         fOscLnL[nx*fNY+ny] = 0.0;
00493         fOscNorm[nx*fNY+ny] = 0.0;
00494         fOscNormUpmu[nx*fNY+ny] = 0.0;
00495         fOscElMu[nx*fNY+ny] = 0.0;
00496         fOscCCNC[nx*fNY+ny] = 0.0;
00497         fOscUpDn[nx*fNY+ny] = 0.0;
00498         fOscChg[nx*fNY+ny] = 0.0;
00499         fOscChgUpmu[nx*fNY+ny] = 0.0;
00500         fOscSpecNu[nx*fNY+ny] = 0.0;
00501         fOscSpecNuBar[nx*fNY+ny] = 0.0;
00502         fOscEmuRange[nx*fNY+ny] = 0.0;
00503         fOscEmuCurve[nx*fNY+ny] = 0.0;
00504         fOscEshw[nx*fNY+ny] = 0.0;  
00505         fOscSinNu[nx*fNY+ny] = 0.0; 
00506         fOscSinNuBar[nx*fNY+ny] = 0.0; 
00507         fOscDmsqNu[nx*fNY+ny] = 0.0; 
00508         fOscDmsqNuBar[nx*fNY+ny] = 0.0; 
00509 
00510         fOscLnL_NUE[nx*fNY+ny] = 0.0;
00511         fOscLnL_CV_LORES[nx*fNY+ny] = 0.0;
00512         fOscLnL_CV_HIRES[nx*fNY+ny] = 0.0;
00513         fOscLnL_CV_HIRES_SHAPE[nx*fNY+ny] = 0.0;
00514         fOscLnL_CV_HIRES_NORM[nx*fNY+ny] = 0.0;
00515         fOscLnL_CV_HIRES_UPDN[nx*fNY+ny] = 0.0;
00516         fOscLnL_UPMU_HIRES[nx*fNY+ny] = 0.0; 
00517         fOscLnL_UPMU_HIRES_SHAPE[nx*fNY+ny] = 0.0;
00518         fOscLnL_UPMU_HIRES_NORM[nx*fNY+ny] = 0.0;
00519         fOscLnL_UPMU_HIRES_UPDN[nx*fNY+ny] = 0.0;
00520         fOscLnL_PENALTY[nx*fNY+ny] = 0.0;
00521         fOscLnL_STATUS[nx*fNY+ny] = 0.0;
00522       }
00523     }
00524 
00525     // arrays for cpt fit
00526     // ==================
00527     fCptFit = new Double_t[fNX*fNX];
00528     fCptLnL = new Double_t[fNX*fNX];
00529     fCptNorm = new Double_t[fNX*fNX];
00530     fCptNormUpmu = new Double_t[fNX*fNX];
00531     fCptElMu = new Double_t[fNX*fNX];
00532     fCptCCNC = new Double_t[fNX*fNX];
00533     fCptUpDn = new Double_t[fNX*fNX];
00534     fCptChg = new Double_t[fNX*fNX];
00535     fCptChgUpmu = new Double_t[fNX*fNX];
00536     fCptSpecNu = new Double_t[fNX*fNX];
00537     fCptSpecNuBar = new Double_t[fNX*fNX];
00538     fCptEmuRange = new Double_t[fNX*fNX];
00539     fCptEmuCurve = new Double_t[fNX*fNX];
00540     fCptEshw = new Double_t[fNX*fNX];
00541     fCptSinNu = new Double_t[fNX*fNX];
00542     fCptSinNuBar = new Double_t[fNX*fNX];
00543     fCptDmsqNu = new Double_t[fNX*fNX];
00544     fCptDmsqNuBar = new Double_t[fNX*fNX];
00545 
00546     fCptLnL_NUE = new Double_t[fNX*fNX];
00547     fCptLnL_CV_LORES = new Double_t[fNX*fNX];
00548     fCptLnL_CV_HIRES = new Double_t[fNX*fNX];
00549     fCptLnL_CV_HIRES_SHAPE = new Double_t[fNX*fNX];
00550     fCptLnL_CV_HIRES_NORM = new Double_t[fNX*fNX];
00551     fCptLnL_CV_HIRES_UPDN = new Double_t[fNX*fNX];
00552     fCptLnL_UPMU_HIRES = new Double_t[fNX*fNX];
00553     fCptLnL_UPMU_HIRES_SHAPE = new Double_t[fNX*fNX];
00554     fCptLnL_UPMU_HIRES_NORM = new Double_t[fNX*fNX];
00555     fCptLnL_UPMU_HIRES_UPDN = new Double_t[fNX*fNX];
00556     fCptLnL_PENALTY = new Double_t[fNX*fNX];
00557     fCptLnL_STATUS = new Double_t[fNX*fNX];
00558 
00559     for( Int_t nx=0; nx<fNX; nx++ ){
00560       for( Int_t nxbar=0; nxbar<fNX; nxbar++ ){
00561         fCptFit[nx*fNX+nxbar] = 0.0;
00562         fCptLnL[nx*fNX+nxbar] = 0.0;
00563         fCptNorm[nx*fNX+nxbar] = 0.0;
00564         fCptNormUpmu[nx*fNX+nxbar] = 0.0;
00565         fCptElMu[nx*fNX+nxbar] = 0.0;
00566         fCptCCNC[nx*fNX+nxbar] = 0.0;
00567         fCptUpDn[nx*fNX+nxbar] = 0.0;
00568         fCptChg[nx*fNX+nxbar] = 0.0;
00569         fCptChgUpmu[nx*fNX+nxbar] = 0.0;
00570         fCptSpecNu[nx*fNX+nxbar] = 0.0;
00571         fCptSpecNuBar[nx*fNX+nxbar] = 0.0;
00572         fCptEmuRange[nx*fNX+nxbar] = 0.0;
00573         fCptEmuCurve[nx*fNX+nxbar] = 0.0;
00574         fCptEshw[nx*fNX+nxbar] = 0.0;  
00575         fCptSinNu[nx*fNX+nxbar] = 0.0; 
00576         fCptSinNuBar[nx*fNX+nxbar] = 0.0; 
00577         fCptDmsqNu[nx*fNX+nxbar] = 0.0; 
00578         fCptDmsqNuBar[nx*fNX+nxbar] = 0.0; 
00579 
00580         fCptLnL_NUE[nx*fNX+nxbar] = 0.0;
00581         fCptLnL_CV_LORES[nx*fNX+nxbar] = 0.0;
00582         fCptLnL_CV_HIRES[nx*fNX+nxbar] = 0.0;
00583         fCptLnL_CV_HIRES_SHAPE[nx*fNX+nxbar] = 0.0;
00584         fCptLnL_CV_HIRES_NORM[nx*fNX+nxbar] = 0.0;
00585         fCptLnL_CV_HIRES_UPDN[nx*fNX+nxbar] = 0.0;
00586         fCptLnL_UPMU_HIRES[nx*fNX+nxbar] = 0.0;
00587         fCptLnL_UPMU_HIRES_SHAPE[nx*fNX+nxbar] = 0.0;
00588         fCptLnL_UPMU_HIRES_NORM[nx*fNX+nxbar] = 0.0;
00589         fCptLnL_UPMU_HIRES_UPDN[nx*fNX+nxbar] = 0.0;
00590         fCptLnL_PENALTY[nx*fNX+nxbar] = 0.0;
00591         fCptLnL_STATUS[nx*fNX+nxbar] = 0.0;
00592       }
00593     }
00594   }
00595 
00596   // initialize histograms
00597   // =====================
00598   hexptNorm = 0;
00599   hexptNormUpmu = 0;
00600   hexptUpDn = 0;
00601   hexptElMu = 0;
00602   hexptCCNC = 0;
00603   hexptChg = 0; 
00604   hexptChgUpmu = 0;
00605   hexptSpecNu = 0;
00606   hexptSpecNuBar = 0;
00607   hexptEmuRange = 0;
00608   hexptEmuCurve = 0;
00609   hexptEshw = 0;    
00610     
00611   hoscFit = 0;
00612   hoscBest = 0;
00613   hoscTrue = 0;
00614   hoscLnL = 0;
00615   hoscNorm = 0;
00616   hoscNormUpmu = 0;
00617   hoscUpDn = 0;
00618   hoscElMu = 0;
00619   hoscCCNC = 0;
00620   hoscChg = 0;
00621   hoscChgUpmu = 0;
00622   hoscSpecNu = 0;
00623   hoscSpecNuBar = 0;
00624   hoscEmuRange = 0;
00625   hoscEmuCurve = 0;
00626   hoscEshw = 0;
00627   hoscSinNu = 0;
00628   hoscSinNuBar = 0;
00629   hoscDmsqNu = 0;
00630   hoscDmsqNuBar = 0;
00631 
00632   hoscLnL_nue = 0;
00633   hoscLnL_cv_lores = 0;
00634   hoscLnL_cv_hires = 0;
00635   hoscLnL_cv_hires_shape = 0;
00636   hoscLnL_cv_hires_norm = 0;
00637   hoscLnL_cv_hires_updn = 0;
00638   hoscLnL_upmu_hires = 0;
00639   hoscLnL_upmu_hires_shape = 0;
00640   hoscLnL_upmu_hires_norm = 0;
00641   hoscLnL_upmu_hires_updn = 0;
00642   hoscLnL_penalty = 0;
00643   hoscLnL_status = 0;
00644 
00645   hoscbestNorm = 0;
00646   hoscbestNormUpmu = 0;
00647   hoscbestUpDn = 0;
00648   hoscbestElMu = 0;
00649   hoscbestCCNC = 0;
00650   hoscbestChg = 0;
00651   hoscbestChgUpmu = 0;
00652   hoscbestSpecNu = 0;
00653   hoscbestSpecNuBar = 0;
00654   hoscbestEmuRange = 0;
00655   hoscbestEmuCurve = 0;
00656   hoscbestEshw = 0;
00657   hoscbestSinNu = 0;
00658   hoscbestSinNuBar = 0;
00659   hoscbestDmsqNu = 0;
00660   hoscbestDmsqNuBar = 0;
00661   hoscbestLnL = 0;
00662    
00663   hcptFit = 0;
00664   hcptBest = 0;
00665   hcptTrue = 0;
00666   hcptLnL = 0;
00667   hcptNorm = 0;
00668   hcptNormUpmu = 0;
00669   hcptUpDn = 0;
00670   hcptElMu = 0;
00671   hcptCCNC = 0;
00672   hcptChg = 0;
00673   hcptChgUpmu = 0;
00674   hcptSpecNu = 0;
00675   hcptSpecNuBar = 0;
00676   hcptEmuRange = 0;
00677   hcptEmuCurve = 0;
00678   hcptEshw = 0;
00679   hcptSinNu = 0;
00680   hcptSinNuBar = 0;
00681   hcptDmsqNu = 0;
00682   hcptDmsqNuBar = 0;
00683 
00684   hcptLnL_nue = 0;
00685   hcptLnL_cv_lores = 0;
00686   hcptLnL_cv_hires = 0;
00687   hcptLnL_cv_hires_shape = 0;
00688   hcptLnL_cv_hires_norm = 0;
00689   hcptLnL_cv_hires_updn = 0;
00690   hcptLnL_upmu_hires = 0;
00691   hcptLnL_upmu_hires_shape = 0;
00692   hcptLnL_upmu_hires_norm = 0;
00693   hcptLnL_upmu_hires_updn = 0;
00694   hcptLnL_penalty = 0;
00695   hcptLnL_status = 0;
00696 
00697   hcptbestNorm = 0;
00698   hcptbestNormUpmu = 0;
00699   hcptbestUpDn = 0;
00700   hcptbestElMu = 0;
00701   hcptbestCCNC = 0;
00702   hcptbestChg = 0;
00703   hcptbestChgUpmu = 0;
00704   hcptbestSpecNu = 0;
00705   hcptbestSpecNuBar = 0;
00706   hcptbestEmuRange = 0;
00707   hcptbestEmuCurve = 0;
00708   hcptbestEshw = 0;
00709   hcptbestSinNu = 0;
00710   hcptbestSinNuBar = 0;
00711   hcptbestDmsqNu = 0;
00712   hcptbestDmsqNuBar = 0;
00713   hcptbestLnL = 0;
00714 
00715   // initialize markers
00716   // ==================
00717   oscmarker = 0;
00718   trueoscmarker = 0;
00719 
00720   cptmarker = 0;
00721   truecptmarker = 0;
00722 
00723   // output file
00724   // ===========
00725   fOscFileName = "atnuresults.root";
00726   fOscFile = 0;
00727   fOscTree = 0;
00728 
00729   fOscResultsFile = 0;
00730   fCptResultsFile = 0;
00731 
00732   // fitting templates
00733   // =================
00734   fTemplateMCnoosc = 0;
00735   fTemplateMCtrueosc = 0;
00736   fTemplateMCcosmics = 0;
00737   fTemplateMCatmosbkg = 0;
00738   fTemplateMCsys = 0;
00739 
00740   fTemplateExpt = 0;  
00741   fTemplateFit = 0;
00742   
00743   fTemplateOscFit = 0;
00744   fTemplateCptFit = 0;
00745 
00746   fTemplateMCdmsq00 = 0;
00747   fTemplateMCdmsq01 = 0;
00748   fTemplateMCdmsq10 = 0;
00749   fTemplateMCdmsq11 = 0;
00750 
00751   // interpolation
00752   // =============
00753   fInterpolation = new AtNuOscFitInterpolation();
00754 }

AtNuOscFit * AtNuOscFit::Instance ( Int_t  nX,
Double_t  X1,
Double_t  X2,
Int_t  nY,
Double_t  Y1,
Double_t  Y2 
) [static]

Definition at line 85 of file AtNuOscFit.cxx.

References AtNuOscFit(), and fAtNuOscFit.

00087 {
00088   std::cout << " *** AtNuOscFit::Instance(...) *** " << std::endl;
00089 
00090   if( !fAtNuOscFit ){
00091     fAtNuOscFit = new AtNuOscFit(nX,X1,X2,
00092                                  nY,Y1,Y2);
00093   }
00094 
00095   return fAtNuOscFit;
00096 }

AtNuOscFit * AtNuOscFit::Instance (  )  [static]

Definition at line 78 of file AtNuOscFit.cxx.

References fAtNuOscFit.

00079 {
00080   assert(fAtNuOscFit);
00081 
00082   return fAtNuOscFit;
00083 }

void AtNuOscFit::LoadTemplates ( const char *  myFileName,
TObjArray *&  myArray,
Int_t  dmsqBins = 0 
) [private]

Definition at line 1661 of file AtNuOscFit.cxx.

Referenced by AddAtmosNueCC(), AddAtmosNueNC(), AddAtmosNumuCC(), AddAtmosNumuNC(), AddAtmosNutauCC(), AddCosmics(), AddData(), AddUpmuNueCC(), AddUpmuNueNC(), AddUpmuNumuCC(), AddUpmuNumuNC(), and AddUpmuNutauCC().

01662 {
01663   std::cout << " *** AtNuOscFit::LoadTemplates(...) *** " << std::endl;
01664   std::cout << "   loading templates from file: " << myFileName << std::endl;
01665 
01666   // number of templates
01667   // ===================
01668   Int_t tempNX = 0;
01669   AtNuOscFitTemplate* myTemplate = 0;
01670 
01671   if( dmsqBins>0 ){
01672     tempNX = dmsqBins;
01673   }
01674 
01675   tempNX += 1;
01676 
01677   // create template array
01678   // =====================
01679   if( myArray ){
01680     std::cout << "   WARNING: already loaded templates of this type... " << std::endl;
01681     std::cout << "        ... these templates will be overwritten" << std::endl;
01682 
01683     for( Int_t nx=0; nx<tempNX; nx++ ){
01684       myArray[nx].Delete();
01685     }
01686 
01687     delete [] myArray;
01688   }
01689 
01690   myArray = new TObjArray[tempNX];
01691 
01692   // load templates
01693   // ==============
01694   for( Int_t nx=0; nx<tempNX; nx++ ){    // Dmsq
01695     TString filename = myFileName;
01696 
01697     if( tempNX>1 ){
01698       TString tempfilename("");
01699       tempfilename.Append(".");
01700       if( nx<100 ) tempfilename.Append("0");
01701       if( nx<10 ) tempfilename.Append("0");
01702       tempfilename+=nx;
01703         
01704       if( filename.EndsWith(".root") ){
01705         filename.Insert(filename.Length()-5,tempfilename);
01706       }
01707       else{
01708         filename.Append(tempfilename);
01709       }
01710     }
01711 
01712     myTemplate = new AtNuOscFitTemplate(filename);
01713     myArray[nx].Add(myTemplate);
01714   }
01715 
01716   return;
01717 } 

void AtNuOscFit::MakeHistograms (  ) 

Definition at line 3500 of file AtNuOscFit.cxx.

References fNX, fNY, fWriteHistograms, fXedge, fYedge, hcptBest, hcptbestCCNC, hcptbestChg, hcptbestChgUpmu, hcptbestDmsqNu, hcptbestDmsqNuBar, hcptbestElMu, hcptbestEmuCurve, hcptbestEmuRange, hcptbestEshw, hcptbestLnL, hcptbestNorm, hcptbestNormUpmu, hcptbestSinNu, hcptbestSinNuBar, hcptbestSpecNu, hcptbestSpecNuBar, hcptbestUpDn, hcptCCNC, hcptChg, hcptChgUpmu, hcptDmsqNu, hcptDmsqNuBar, hcptElMu, hcptEmuCurve, hcptEmuRange, hcptEshw, hcptFit, hcptLnL, hcptLnL_cv_hires, hcptLnL_cv_hires_norm, hcptLnL_cv_hires_shape, hcptLnL_cv_hires_updn, hcptLnL_cv_lores, hcptLnL_nue, hcptLnL_penalty, hcptLnL_status, hcptLnL_upmu_hires, hcptLnL_upmu_hires_norm, hcptLnL_upmu_hires_shape, hcptLnL_upmu_hires_updn, hcptNorm, hcptNormUpmu, hcptSinNu, hcptSinNuBar, hcptSpecNu, hcptSpecNuBar, hcptTrue, hcptUpDn, hexptCCNC, hexptChg, hexptChgUpmu, hexptElMu, hexptEmuCurve, hexptEmuRange, hexptEshw, hexptNorm, hexptNormUpmu, hexptSpecNu, hexptSpecNuBar, hexptUpDn, hoscBest, hoscbestCCNC, hoscbestChg, hoscbestChgUpmu, hoscbestDmsqNu, hoscbestDmsqNuBar, hoscbestElMu, hoscbestEmuCurve, hoscbestEmuRange, hoscbestEshw, hoscbestLnL, hoscbestNorm, hoscbestNormUpmu, hoscbestSinNu, hoscbestSinNuBar, hoscbestSpecNu, hoscbestSpecNuBar, hoscbestUpDn, hoscCCNC, hoscChg, hoscChgUpmu, hoscDmsqNu, hoscDmsqNuBar, hoscElMu, hoscEmuCurve, hoscEmuRange, hoscEshw, hoscFit, hoscLnL, hoscLnL_cv_hires, hoscLnL_cv_hires_norm, hoscLnL_cv_hires_shape, hoscLnL_cv_hires_updn, hoscLnL_cv_lores, hoscLnL_nue, hoscLnL_penalty, hoscLnL_status, hoscLnL_upmu_hires, hoscLnL_upmu_hires_norm, hoscLnL_upmu_hires_shape, hoscLnL_upmu_hires_updn, hoscNorm, hoscNormUpmu, hoscSinNu, hoscSinNuBar, hoscSpecNu, hoscSpecNuBar, hoscTrue, and hoscUpDn.

Referenced by Run().

03501 {
03502   std::cout << " *** AtNuOscFit::MakeHistograms() *** " << std::endl;
03503 
03504   // initialize histograms for input systematics
03505   // ===========================================
03506   if( hexptNorm )      delete hexptNorm;
03507   if( hexptNormUpmu )  delete hexptNormUpmu;
03508   if( hexptElMu )      delete hexptElMu;
03509   if( hexptCCNC )      delete hexptCCNC;
03510   if( hexptUpDn )      delete hexptUpDn;
03511   if( hexptChg )       delete hexptChg;
03512   if( hexptChgUpmu )   delete hexptChgUpmu;
03513   if( hexptSpecNu )    delete hexptSpecNu;
03514   if( hexptSpecNuBar ) delete hexptSpecNuBar;
03515   if( hexptEmuRange )  delete hexptEmuRange;
03516   if( hexptEmuCurve )  delete hexptEmuCurve;
03517   if( hexptEshw )      delete hexptEshw;
03518 
03519   hexptNorm = new TH1D("hexptNorm","normalization",45,-2.25,+2.25);
03520   hexptNormUpmu = new TH1D("hexptNormUpmu","normalization (upmu)",45,-2.25,+2.25);
03521   hexptElMu = new TH1D("hexptElMu","el/mu ratio",45,-2.25,+2.25);
03522   hexptCCNC = new TH1D("hexptCCNC","cc/nc ratio",45,-2.25,+2.25);
03523   hexptUpDn = new TH1D("hexptUpDn","up/down ratio",45,-2.25,+2.25);
03524   hexptChg = new TH1D("hexptChg","charge ratio",45,-2.25,+2.25);
03525   hexptChgUpmu = new TH1D("hexptChgUpmu","charge ratio (upmu)",45,-2.25,+2.25);
03526   hexptSpecNu = new TH1D("hexptSpecNu","spectrum (nu)",45,-2.25,+2.25); 
03527   hexptSpecNuBar = new TH1D("hexptSpecNuBar","spectrum (nubar)",45,-2.25,+2.25);
03528   hexptEmuRange = new TH1D("hexptEmuRange","emu (range)",45,-2.25,+2.25);
03529   hexptEmuCurve = new TH1D("hexptEmuCurve","emu (curve)",45,-2.25,+2.25);
03530   hexptEshw = new TH1D("hexptEshw","eshower",45,-2.25,+2.25);
03531   
03532   // initialize histograms for osc fit
03533   // =================================
03534   if( hoscbestNorm )      delete hoscbestNorm;       hoscbestNorm = 0;
03535   if( hoscbestNormUpmu )  delete hoscbestNormUpmu;   hoscbestNormUpmu = 0;
03536   if( hoscbestElMu )      delete hoscbestElMu;       hoscbestElMu = 0;
03537   if( hoscbestCCNC )      delete hoscbestCCNC;       hoscbestCCNC = 0;
03538   if( hoscbestUpDn )      delete hoscbestUpDn;       hoscbestUpDn = 0;
03539   if( hoscbestChg )       delete hoscbestChg;        hoscbestChg = 0;
03540   if( hoscbestChgUpmu )   delete hoscbestChgUpmu;    hoscbestChgUpmu = 0;
03541   if( hoscbestSpecNu )    delete hoscbestSpecNu;     hoscbestSpecNu = 0;
03542   if( hoscbestSpecNuBar ) delete hoscbestSpecNuBar;  hoscbestSpecNuBar = 0;
03543   if( hoscbestEmuRange )  delete hoscbestEmuRange;   hoscbestEmuRange = 0;
03544   if( hoscbestEmuCurve )  delete hoscbestEmuCurve;   hoscbestEmuCurve = 0;
03545   if( hoscbestEshw )      delete hoscbestEshw;       hoscbestEshw = 0;
03546   if( hoscbestSinNu )     delete hoscbestSinNu;      hoscbestSinNu = 0;
03547   if( hoscbestSinNuBar )  delete hoscbestSinNuBar;   hoscbestSinNuBar = 0;
03548   if( hoscbestDmsqNu )    delete hoscbestDmsqNu;     hoscbestDmsqNu = 0;
03549   if( hoscbestDmsqNuBar ) delete hoscbestDmsqNuBar;  hoscbestDmsqNuBar = 0;
03550   if( hoscbestLnL )       delete hoscbestLnL;        hoscbestLnL = 0;
03551 
03552   if( hoscFit )       delete hoscFit;        hoscFit = 0;
03553   if( hoscBest )      delete hoscBest;       hoscBest = 0;
03554   if( hoscTrue )      delete hoscTrue;       hoscTrue = 0;
03555   if( hoscNorm )      delete hoscNorm;       hoscNorm = 0;
03556   if( hoscNormUpmu )  delete hoscNormUpmu;   hoscNormUpmu = 0;
03557   if( hoscElMu )      delete hoscElMu;       hoscElMu = 0;
03558   if( hoscCCNC )      delete hoscCCNC;       hoscCCNC = 0;
03559   if( hoscUpDn )      delete hoscUpDn;       hoscUpDn = 0;
03560   if( hoscChg )       delete hoscChg;        hoscChg = 0;
03561   if( hoscChgUpmu )   delete hoscChgUpmu;    hoscChgUpmu = 0;
03562   if( hoscSpecNu )    delete hoscSpecNu;     hoscSpecNu = 0;
03563   if( hoscSpecNuBar ) delete hoscSpecNuBar;  hoscSpecNuBar = 0;
03564   if( hoscEmuRange )  delete hoscEmuRange;   hoscEmuRange = 0;
03565   if( hoscEmuCurve )  delete hoscEmuCurve;   hoscEmuCurve = 0;
03566   if( hoscEshw )      delete hoscEshw;       hoscEshw = 0;
03567   if( hoscSinNu )     delete hoscSinNu;      hoscSinNu = 0;
03568   if( hoscSinNuBar )  delete hoscSinNuBar;   hoscSinNuBar = 0;
03569   if( hoscDmsqNu )    delete hoscDmsqNu;     hoscDmsqNu = 0;
03570   if( hoscDmsqNuBar ) delete hoscDmsqNuBar;  hoscDmsqNuBar = 0;
03571   if( hoscLnL )       delete hoscLnL;        hoscLnL = 0;
03572 
03573   if( hoscLnL_nue )              delete hoscLnL_nue;              hoscLnL_nue = 0;
03574   if( hoscLnL_cv_lores )         delete hoscLnL_cv_lores;         hoscLnL_cv_lores = 0;
03575   if( hoscLnL_cv_hires )         delete hoscLnL_cv_hires;         hoscLnL_cv_hires = 0;
03576   if( hoscLnL_cv_hires_shape )   delete hoscLnL_cv_hires_shape;   hoscLnL_cv_hires_shape = 0;
03577   if( hoscLnL_cv_hires_norm )    delete hoscLnL_cv_hires_norm;    hoscLnL_cv_hires_norm = 0;
03578   if( hoscLnL_cv_hires_updn )    delete hoscLnL_cv_hires_updn;    hoscLnL_cv_hires_updn = 0;
03579   if( hoscLnL_upmu_hires )       delete hoscLnL_upmu_hires;       hoscLnL_upmu_hires = 0;
03580   if( hoscLnL_upmu_hires_shape ) delete hoscLnL_upmu_hires_shape; hoscLnL_upmu_hires_shape = 0;
03581   if( hoscLnL_upmu_hires_norm )  delete hoscLnL_upmu_hires_norm;  hoscLnL_upmu_hires_norm = 0;
03582   if( hoscLnL_upmu_hires_updn )  delete hoscLnL_upmu_hires_updn;  hoscLnL_upmu_hires_updn = 0;
03583   if( hoscLnL_penalty )          delete hoscLnL_penalty;          hoscLnL_penalty = 0;      
03584   if( hoscLnL_status )           delete hoscLnL_status;           hoscLnL_status = 0;             
03585 
03586   // (1D HIST) store histogram to store best fit OSC systematics
03587   hoscbestNorm = new TH1D("hoscbestNorm","normalization",45,-2.25,+2.25);
03588   hoscbestNormUpmu = new TH1D("hoscbestNormUpmu","normalization (upmu)",45,-2.25,+2.25);
03589   hoscbestUpDn = new TH1D("hoscbestUpDn","up/down ratio",45,-2.25,+2.25);
03590   hoscbestElMu = new TH1D("hoscbestElMu","el/mu ratio",45,-2.25,+2.25);
03591   hoscbestCCNC = new TH1D("hoscbestCCNC","cc/nc ratio",45,-2.25,+2.25);
03592   hoscbestChg = new TH1D("hoscbestChg","charge ratio",45,-2.25,+2.25);
03593   hoscbestChgUpmu = new TH1D("hoscbestChgUpmu","charge ratio (upmu)",45,-2.25,+2.25);
03594   hoscbestSpecNu = new TH1D("hoscbestSpecNu","spectrum (nu)",45,-2.25,+2.25);
03595   hoscbestSpecNuBar = new TH1D("hoscbestSpecNuBar","spectrum (nubar)",45,-2.25,+2.25);
03596   hoscbestEmuRange = new TH1D("hoscbestEmuRange","emu (range)",45,-2.25,+2.25);
03597   hoscbestEmuCurve = new TH1D("hoscbestEmuCurve","emu (curve)",45,-2.25,+2.25);
03598   hoscbestEshw = new TH1D("hoscbestEshw","eshower",45,-2.25,+2.25);
03599   hoscbestSinNu = new TH1D("hoscbestSinNu","sinsq (nu)",fNY,fYedge);
03600   hoscbestSinNuBar = new TH1D("hoscbestSinNuBar","sinsq (nubar)",fNY,fYedge);
03601   hoscbestDmsqNu = new TH1D("hoscbestDmsqNu","dmsq (nu)",fNX,fXedge);
03602   hoscbestDmsqNuBar = new TH1D("hoscbestDmsqNuBar","dmsq (nubar)",fNX,fXedge);
03603 
03604   // (1D HIST) store best fit likelihood
03605   // note: histogram should peak at 2*lnL ~ chi^2 ~ N 
03606   //      (N = degrees of freedom ~ number of bins in fit)
03607   hoscbestLnL = new TH1D("hoscbestLnL","",1001,-1.0,1000.0);    
03608 
03609   // (2D HIST) store template histogram
03610   hoscFit = new TH2D("hoscFit","",fNY,fYedge,fNX,fXedge);
03611 
03612   // (2D HIST) store best fit and true oscillation parameters
03613   hoscBest = new TH2D("hoscBest","",fNY,fYedge,fNX,fXedge);
03614   hoscTrue = new TH2D("hoscTrue","",fNY,fYedge,fNX,fXedge);
03615 
03616   // (2D HIST) store 2D surfaces in oscillation parameter space  
03617   hoscNorm = new TH2D("hoscNorm","normalization",fNY,fYedge,fNX,fXedge);
03618   hoscNormUpmu = new TH2D("hoscNormUpmu","normalization (upmu)",fNY,fYedge,fNX,fXedge);
03619   hoscElMu = new TH2D("hoscElMu","el/mu ratio",fNY,fYedge,fNX,fXedge);
03620   hoscCCNC = new TH2D("hoscCCNC","cc/nc ratio",fNY,fYedge,fNX,fXedge);
03621   hoscUpDn = new TH2D("hoscUpDn","up/down ratio",fNY,fYedge,fNX,fXedge);
03622   hoscChg = new TH2D("hoscChg","charge ratio",fNY,fYedge,fNX,fXedge);
03623   hoscChgUpmu = new TH2D("hoscChgUpmu","charge ratio (upmu)",fNY,fYedge,fNX,fXedge);
03624   hoscSpecNu = new TH2D("hoscSpecNu","spectrum (nu)",fNY,fYedge,fNX,fXedge);
03625   hoscSpecNuBar = new TH2D("hoscSpecNuBar","spectrum (nubar)",fNY,fYedge,fNX,fXedge);
03626   hoscEmuRange = new TH2D("hoscEmuRange","emu (range)",fNY,fYedge,fNX,fXedge);
03627   hoscEmuCurve = new TH2D("hoscEmuCurve","emu (curve)",fNY,fYedge,fNX,fXedge);
03628   hoscEshw = new TH2D("hoscEshw","eshower",fNY,fYedge,fNX,fXedge);
03629   hoscSinNu = new TH2D("hoscSinNu","sinsq (nu)",fNY,fYedge,fNX,fXedge);
03630   hoscSinNuBar = new TH2D("hoscSinNuBar","sinsq (nubar)",fNY,fYedge,fNX,fXedge);
03631   hoscDmsqNu = new TH2D("hoscDmsqNu","dmsq (nu)",fNY,fYedge,fNX,fXedge);
03632   hoscDmsqNuBar = new TH2D("hoscDmsqNuBar","dmsq (nubar)",fNY,fYedge,fNX,fXedge);
03633   hoscLnL = new TH2D("hoscLnL","",fNY,fYedge,fNX,fXedge);  
03634 
03635   hoscLnL_nue = new TH2D("hoscLnL_nue","delta LnL (nue)",fNY,fYedge,fNX,fXedge);
03636   hoscLnL_cv_lores = new TH2D("hoscLnL_cv_lores","delta LnL (cv_lores)",fNY,fYedge,fNX,fXedge);
03637   hoscLnL_cv_hires = new TH2D("hoscLnL_cv_hires","delta LnL (cv_hires)",fNY,fYedge,fNX,fXedge);
03638   hoscLnL_cv_hires_shape = new TH2D("hoscLnL_cv_hires_shape","delta LnL (cv_hires_shape)",fNY,fYedge,fNX,fXedge);
03639   hoscLnL_cv_hires_norm = new TH2D("hoscLnL_cv_hires_norm","delta LnL (cv_hires_norm)",fNY,fYedge,fNX,fXedge);
03640   hoscLnL_cv_hires_updn = new TH2D("hoscLnL_cv_hires_updn","delta LnL (cv_hires_updn)",fNY,fYedge,fNX,fXedge);
03641   hoscLnL_upmu_hires = new TH2D("hoscLnL_upmu_hires","delta LnL (upmu_hires)",fNY,fYedge,fNX,fXedge);
03642   hoscLnL_upmu_hires_shape = new TH2D("hoscLnL_upmu_hires_shape","delta LnL (upmu_hires_shape)",fNY,fYedge,fNX,fXedge);
03643   hoscLnL_upmu_hires_norm = new TH2D("hoscLnL_upmu_hires_norm","delta LnL (upmu_hires_norm)",fNY,fYedge,fNX,fXedge);
03644   hoscLnL_upmu_hires_updn = new TH2D("hoscLnL_upmu_hires_updn","delta LnL (upmu_hires_updn)",fNY,fYedge,fNX,fXedge);
03645   hoscLnL_penalty = new TH2D("hoscLnL_penalty","delta LnL (penalty)",fNY,fYedge,fNX,fXedge);
03646   hoscLnL_status = new TH2D("hoscLnL_status","fit status",fNY,fYedge,fNX,fXedge);
03647 
03648 
03649   // initialize histogrsms for cpt fit
03650   // =================================
03651   if( hcptbestNorm )      delete hcptbestNorm;       hcptbestNorm = 0;
03652   if( hcptbestNormUpmu )  delete hcptbestNormUpmu;   hcptbestNormUpmu = 0;
03653   if( hcptbestElMu )      delete hcptbestElMu;       hcptbestElMu = 0;
03654   if( hcptbestCCNC )      delete hcptbestCCNC;       hcptbestCCNC = 0;
03655   if( hcptbestUpDn )      delete hcptbestUpDn;       hcptbestUpDn = 0;
03656   if( hcptbestChg )       delete hcptbestChg;        hcptbestChg = 0;
03657   if( hcptbestChgUpmu )   delete hcptbestChgUpmu;    hcptbestChgUpmu = 0;
03658   if( hcptbestSpecNu )    delete hcptbestSpecNu;     hcptbestSpecNu = 0;
03659   if( hcptbestSpecNuBar ) delete hcptbestSpecNuBar;  hcptbestSpecNuBar = 0;
03660   if( hcptbestEmuRange )  delete hcptbestEmuRange;   hcptbestEmuRange = 0;
03661   if( hcptbestEmuCurve )  delete hcptbestEmuCurve;   hcptbestEmuCurve = 0;
03662   if( hcptbestEshw )      delete hcptbestEshw;       hcptbestEshw = 0;
03663   if( hcptbestSinNu )     delete hcptbestSinNu;      hcptbestSinNu = 0;
03664   if( hcptbestSinNuBar )  delete hcptbestSinNuBar;   hcptbestSinNuBar = 0;
03665   if( hcptbestDmsqNu )    delete hcptbestDmsqNu;     hcptbestDmsqNu = 0;
03666   if( hcptbestDmsqNuBar ) delete hcptbestDmsqNuBar;  hcptbestDmsqNuBar = 0;
03667   if( hcptbestLnL )       delete hcptbestLnL;        hcptbestLnL = 0;
03668 
03669   if( hcptFit )       delete hcptFit;        hcptFit = 0;
03670   if( hcptBest )      delete hcptBest;       hcptBest = 0;
03671   if( hcptTrue )      delete hcptTrue;       hcptTrue = 0;
03672   if( hcptNorm )      delete hcptNorm;       hcptNorm = 0;
03673   if( hcptNormUpmu )  delete hcptNormUpmu;   hcptNormUpmu = 0;
03674   if( hcptElMu )      delete hcptElMu;       hcptElMu = 0;
03675   if( hcptCCNC )      delete hcptCCNC;       hcptCCNC = 0;
03676   if( hcptUpDn )      delete hcptUpDn;       hcptUpDn = 0;
03677   if( hcptChg )       delete hcptChg;        hcptChg = 0;
03678   if( hcptChgUpmu )   delete hcptChgUpmu;    hcptChgUpmu = 0;
03679   if( hcptSpecNu )    delete hcptSpecNu;     hcptSpecNu = 0;
03680   if( hcptSpecNuBar ) delete hcptSpecNuBar;  hcptSpecNuBar = 0;
03681   if( hcptEmuRange )  delete hcptEmuRange;   hcptEmuRange = 0;
03682   if( hcptEmuCurve )  delete hcptEmuCurve;   hcptEmuCurve = 0;
03683   if( hcptEshw )      delete hcptEshw;       hcptEshw = 0;
03684   if( hcptSinNu )     delete hcptSinNu;      hcptSinNu = 0;
03685   if( hcptSinNuBar )  delete hcptSinNuBar;   hcptSinNuBar = 0;
03686   if( hcptDmsqNu )    delete hcptDmsqNu;     hcptDmsqNu = 0;
03687   if( hcptDmsqNuBar ) delete hcptDmsqNuBar;  hcptDmsqNuBar = 0;
03688   if( hcptLnL )       delete hcptLnL;        hcptLnL = 0;
03689 
03690   if( hcptLnL_nue )              delete hcptLnL_nue;              hcptLnL_nue = 0;
03691   if( hcptLnL_cv_lores )         delete hcptLnL_cv_lores;         hcptLnL_cv_lores = 0;
03692   if( hcptLnL_cv_hires )         delete hcptLnL_cv_hires;         hcptLnL_cv_hires = 0;
03693   if( hcptLnL_cv_hires_shape )   delete hcptLnL_cv_hires_shape;   hcptLnL_cv_hires_shape = 0;
03694   if( hcptLnL_cv_hires_norm )    delete hcptLnL_cv_hires_norm;    hcptLnL_cv_hires_norm = 0;
03695   if( hcptLnL_cv_hires_updn )    delete hcptLnL_cv_hires_updn;    hcptLnL_cv_hires_updn = 0;
03696   if( hcptLnL_upmu_hires )       delete hcptLnL_upmu_hires;       hcptLnL_upmu_hires = 0; 
03697   if( hcptLnL_upmu_hires_shape ) delete hcptLnL_upmu_hires_shape; hcptLnL_upmu_hires_shape = 0;
03698   if( hcptLnL_upmu_hires_norm )  delete hcptLnL_upmu_hires_norm;  hcptLnL_upmu_hires_norm = 0;
03699   if( hcptLnL_upmu_hires_updn )  delete hcptLnL_upmu_hires_updn;  hcptLnL_upmu_hires_updn = 0;
03700   if( hcptLnL_penalty )          delete hcptLnL_penalty;          hcptLnL_penalty = 0;    
03701   if( hcptLnL_status )           delete hcptLnL_status;           hcptLnL_status = 0;    
03702 
03703   // (1D HIST) store histogram to store best fit OSC systematics
03704   hcptbestNorm = new TH1D("hcptbestNorm","normalization",45,-2.25,+2.25);
03705   hcptbestNormUpmu = new TH1D("hcptbestNormUpmu","normalization (upmu)",45,-2.25,+2.25);
03706   hcptbestUpDn = new TH1D("hcptbestUpDn","up/down ratio",45,-2.25,+2.25);
03707   hcptbestElMu = new TH1D("hcptbestElMu","el/mu ratio",45,-2.25,+2.25);
03708   hcptbestCCNC = new TH1D("hcptbestCCNC","cc/nc ratio",45,-2.25,+2.25);
03709   hcptbestChg = new TH1D("hcptbestChg","charge ratio",45,-2.25,+2.25);
03710   hcptbestChgUpmu = new TH1D("hcptbestChgUpmu","charge ratio (upmu)",45,-2.25,+2.25);
03711   hcptbestSpecNu = new TH1D("hcptbestSpecNu","spectrum (nu)",45,-2.25,+2.25);
03712   hcptbestSpecNuBar = new TH1D("hcptbestSpecNuBar","spectrum (nubar)",45,-2.25,+2.25);
03713   hcptbestEmuRange = new TH1D("hcptbestEmuRange","emu (range)",45,-2.25,+2.25);
03714   hcptbestEmuCurve = new TH1D("hcptbestEmuCurve","emu (curve)",45,-2.25,+2.25);
03715   hcptbestEshw = new TH1D("hcptbestEshw","eshower",45,-2.25,+2.25);
03716   hcptbestSinNu = new TH1D("hcptbestSinNu","sinsq (nu)",fNY,fYedge);
03717   hcptbestSinNuBar = new TH1D("hcptbestSinNuBar","sinsq (nubar)",fNY,fYedge);
03718   hcptbestDmsqNu = new TH1D("hcptbestDmsqNu","dmsq (nu)",fNX,fXedge);
03719   hcptbestDmsqNuBar = new TH1D("hcptbestDmsqNuBar","dmsq (nubar)",fNX,fXedge);
03720 
03721   // (1D HIST) store best fit likelihood
03722   // note: histogram should peak at 2*lnL ~ chi^2 ~ N 
03723   //      (N = degrees of freedom ~ number of bins in fit)
03724   hcptbestLnL = new TH1D("hcptbestLnL","",1001,-1.0,1000.0);    
03725 
03726   // (2D HIST) store template histogram
03727   hcptFit = new TH2D("hcptFit","",fNX,fXedge,fNX,fXedge);
03728  
03729   // (2D HIST) store best fit and true oscillation parameters
03730   hcptBest = new TH2D("hcptBest","",fNX,fXedge,fNX,fXedge);
03731   hcptTrue = new TH2D("hcptTrue","",fNX,fXedge,fNX,fXedge);
03732 
03733   // (2D HIST) store 2D surfaces in oscillation parameter space  
03734   hcptNorm = new TH2D("hcptNorm","normalization",fNX,fXedge,fNX,fXedge);
03735   hcptNormUpmu = new TH2D("hcptNormUpmu","normalization (upmu)",fNX,fXedge,fNX,fXedge);
03736   hcptElMu = new TH2D("hcptElMu","el/mu ratio",fNX,fXedge,fNX,fXedge);
03737   hcptCCNC = new TH2D("hcptCCNC","cc/nc ratio",fNX,fXedge,fNX,fXedge);
03738   hcptUpDn = new TH2D("hcptUpDn","up/down ratio",fNX,fXedge,fNX,fXedge);
03739   hcptChg = new TH2D("hcptChg","charge ratio",fNX,fXedge,fNX,fXedge);
03740   hcptChgUpmu = new TH2D("hcptChgUpmu","charge ratio (upmu)",fNX,fXedge,fNX,fXedge);
03741   hcptSpecNu = new TH2D("hcptSpecNu","spectrum (nu)",fNX,fXedge,fNX,fXedge);
03742   hcptSpecNuBar = new TH2D("hcptSpecNuBar","spectrum (nubar)",fNX,fXedge,fNX,fXedge);
03743   hcptEmuRange = new TH2D("hcptEmuRange","emu (range)",fNX,fXedge,fNX,fXedge);
03744   hcptEmuCurve = new TH2D("hcptEmuCurve","emu (curve)",fNX,fXedge,fNX,fXedge);
03745   hcptEshw = new TH2D("hcptEshw","eshower",fNX,fXedge,fNX,fXedge);
03746   hcptSinNu = new TH2D("hcptSinNu","sinsq (nu)",fNX,fXedge,fNX,fXedge);
03747   hcptSinNuBar = new TH2D("hcptSinNuBar","sinsq (nubar)",fNX,fXedge,fNX,fXedge);
03748   hcptDmsqNu = new TH2D("hcptDmsqNu","dmsq (nu)",fNX,fXedge,fNX,fXedge);
03749   hcptDmsqNuBar = new TH2D("hcptDmsqNuBar","dmsq (nubar)",fNX,fXedge,fNX,fXedge);
03750   hcptLnL = new TH2D("hcptLnL","",fNX,fXedge,fNX,fXedge);    
03751 
03752   hcptLnL_nue = new TH2D("hcptLnL_nue","delta LnL (nue)",fNX,fXedge,fNX,fXedge);
03753   hcptLnL_cv_lores = new TH2D("hcptLnL_cv_lores","delta LnL (cv_lores)",fNX,fXedge,fNX,fXedge);
03754   hcptLnL_cv_hires = new TH2D("hcptLnL_cv_hires","delta LnL (cv_hires)",fNX,fXedge,fNX,fXedge);
03755   hcptLnL_cv_hires_shape = new TH2D("hcptLnL_cv_hires_shape","delta LnL (cv_hires_shape)",fNX,fXedge,fNX,fXedge);
03756   hcptLnL_cv_hires_norm = new TH2D("hcptLnL_cv_hires_norm","delta LnL (cv_hires_norm)",fNX,fXedge,fNX,fXedge);
03757   hcptLnL_cv_hires_updn = new TH2D("hcptLnL_cv_hires_updn","delta LnL (cv_hires_updn)",fNX,fXedge,fNX,fXedge);
03758   hcptLnL_upmu_hires = new TH2D("hcptLnL_upmu_hires","delta LnL (upmu_hires)",fNX,fXedge,fNX,fXedge);
03759   hcptLnL_upmu_hires_shape = new TH2D("hcptLnL_upmu_hires_shape","delta LnL (upmu_hires_shape)",fNX,fXedge,fNX,fXedge);
03760   hcptLnL_upmu_hires_norm = new TH2D("hcptLnL_upmu_hires_norm","delta LnL (upmu_hires_norm)",fNX,fXedge,fNX,fXedge);
03761   hcptLnL_upmu_hires_updn = new TH2D("hcptLnL_upmu_hires_updn","delta LnL (upmu_hires_updn)",fNX,fXedge,fNX,fXedge);
03762   hcptLnL_penalty = new TH2D("hcptLnL_penalty","delta LnL (penalty)",fNX,fXedge,fNX,fXedge);
03763   hcptLnL_status = new TH2D("hcptLnL_status","fit status",fNX,fXedge,fNX,fXedge);
03764 
03765   // set histogram flag
03766   fWriteHistograms = 1;
03767   
03768   return;
03769 }

void AtNuOscFit::MergeHistograms ( const char *  filename  ) 

Definition at line 3771 of file AtNuOscFit.cxx.

References fWriteHistograms, hcptCCNC, hcptChg, hcptChgUpmu, hcptDmsqNu, hcptDmsqNuBar, hcptElMu, hcptEmuCurve, hcptEmuRange, hcptEshw, hcptFit, hcptLnL, hcptLnL_cv_hires, hcptLnL_cv_hires_norm, hcptLnL_cv_hires_shape, hcptLnL_cv_hires_updn, hcptLnL_cv_lores, hcptLnL_nue, hcptLnL_penalty, hcptLnL_status, hcptLnL_upmu_hires, hcptLnL_upmu_hires_norm, hcptLnL_upmu_hires_shape, hcptLnL_upmu_hires_updn, hcptNorm, hcptNormUpmu, hcptSinNu, hcptSinNuBar, hcptSpecNu, hcptSpecNuBar, hcptTrue, hcptUpDn, hoscCCNC, hoscChg, hoscChgUpmu, hoscDmsqNu, hoscDmsqNuBar, hoscElMu, hoscEmuCurve, hoscEmuRange, hoscEshw, hoscFit, hoscLnL, hoscLnL_cv_hires, hoscLnL_cv_hires_norm, hoscLnL_cv_hires_shape, hoscLnL_cv_hires_updn, hoscLnL_cv_lores, hoscLnL_nue, hoscLnL_penalty, hoscLnL_status, hoscLnL_upmu_hires, hoscLnL_upmu_hires_norm, hoscLnL_upmu_hires_shape, hoscLnL_upmu_hires_updn, hoscNorm, hoscNormUpmu, hoscSinNu, hoscSinNuBar, hoscSpecNu, hoscSpecNuBar, hoscTrue, and hoscUpDn.

03772 {
03773   std::cout << " *** AtNuOscFit::MergeHistograms() *** " << std::endl;
03774 
03775   // check that histograms exist
03776   // ===========================
03777   if( fWriteHistograms==0 ){
03778     std::cout << "   ERROR: No Histograms [RETURN] " << std::endl;
03779     return;
03780   }
03781 
03782   // add histograms
03783   // ==============
03784   
03785   TDirectory* tmpd = gDirectory;
03786   TFile* file = new TFile(filename,"read");
03787 
03788   if( file ){
03789     std::cout << "   adding histograms from: " << filename << std::endl;
03790 
03791     std::cout << "    getting histograms (oscfit) " << std::endl;
03792     TH2D* temp_hoscFit = (TH2D*)(file->Get("hoscFit"));
03793     TH2D* temp_hoscTrue = (TH2D*)(file->Get("hoscTrue"));
03794     TH2D* temp_hoscLnL = (TH2D*)(file->Get("hoscLnL"));
03795     TH2D* temp_hoscNorm = (TH2D*)(file->Get("hoscNorm"));
03796     TH2D* temp_hoscNormUpmu = (TH2D*)(file->Get("hoscNormUpmu"));
03797     TH2D* temp_hoscUpDn = (TH2D*)(file->Get("hoscUpDn"));
03798     TH2D* temp_hoscElMu = (TH2D*)(file->Get("hoscElMu"));
03799     TH2D* temp_hoscCCNC = (TH2D*)(file->Get("hoscCCNC"));
03800     TH2D* temp_hoscChg = (TH2D*)(file->Get("hoscChg"));
03801     TH2D* temp_hoscChgUpmu = (TH2D*)(file->Get("hoscChgUpmu"));
03802     TH2D* temp_hoscSpecNu = (TH2D*)(file->Get("hoscSpecNu"));
03803     TH2D* temp_hoscSpecNuBar = (TH2D*)(file->Get("hoscSpecNuBar"));
03804     TH2D* temp_hoscEmuRange = (TH2D*)(file->Get("hoscEmuRange"));
03805     TH2D* temp_hoscEmuCurve = (TH2D*)(file->Get("hoscEmuCurve"));
03806     TH2D* temp_hoscEshw = (TH2D*)(file->Get("hoscEshw"));
03807     TH2D* temp_hoscSinNu = (TH2D*)(file->Get("hoscSinNu"));
03808     TH2D* temp_hoscSinNuBar = (TH2D*)(file->Get("hoscSinNuBar"));
03809     TH2D* temp_hoscDmsqNu = (TH2D*)(file->Get("hoscDmsqNu"));
03810     TH2D* temp_hoscDmsqNuBar = (TH2D*)(file->Get("hoscDmsqNuBar"));
03811 
03812     TH2D* temp_hoscLnL_nue = (TH2D*)(file->Get("hoscLnL_nue"));
03813     TH2D* temp_hoscLnL_cv_lores = (TH2D*)(file->Get("hoscLnL_cv_lores"));
03814     TH2D* temp_hoscLnL_cv_hires = (TH2D*)(file->Get("hoscLnL_cv_hires"));
03815     TH2D* temp_hoscLnL_cv_hires_shape = (TH2D*)(file->Get("hoscLnL_cv_hires_shape"));
03816     TH2D* temp_hoscLnL_cv_hires_norm = (TH2D*)(file->Get("hoscLnL_cv_hires_norm"));
03817     TH2D* temp_hoscLnL_cv_hires_updn = (TH2D*)(file->Get("hoscLnL_cv_hires_updn"));
03818     TH2D* temp_hoscLnL_upmu_hires = (TH2D*)(file->Get("hoscLnL_upmu_hires"));
03819     TH2D* temp_hoscLnL_upmu_hires_shape = (TH2D*)(file->Get("hoscLnL_upmu_hires_shape"));
03820     TH2D* temp_hoscLnL_upmu_hires_norm = (TH2D*)(file->Get("hoscLnL_upmu_hires_norm"));
03821     TH2D* temp_hoscLnL_upmu_hires_updn = (TH2D*)(file->Get("hoscLnL_upmu_hires_updn"));
03822     TH2D* temp_hoscLnL_penalty = (TH2D*)(file->Get("hoscLnL_penalty"));
03823     TH2D* temp_hoscLnL_status = (TH2D*)(file->Get("hoscLnL_status"));
03824 
03825     std::cout << "    adding histograms (oscfit) " << std::endl;
03826     if(temp_hoscFit) std::cout << "     hoscFit" << std::endl;
03827     if(temp_hoscFit)       hoscFit->Add(temp_hoscFit);
03828     if(temp_hoscTrue) std::cout << "     hoscTrue" << std::endl;
03829     if(temp_hoscTrue)      hoscTrue->Add(temp_hoscTrue);
03830     if(temp_hoscLnL) std::cout << "     hoscLnL" << std::endl;
03831     if(temp_hoscLnL)       hoscLnL->Add(temp_hoscLnL);
03832     if(temp_hoscNorm) std::cout << "     hoscNorm" << std::endl;
03833     if(temp_hoscNorm)      hoscNorm->Add(temp_hoscNorm);
03834     if(temp_hoscNormUpmu) std::cout << "     hoscNormUpmu" << std::endl;
03835     if(temp_hoscNormUpmu)  hoscNormUpmu->Add(temp_hoscNormUpmu);
03836     if(temp_hoscUpDn) std::cout << "     hoscUpDn" << std::endl;
03837     if(temp_hoscUpDn)      hoscUpDn->Add(temp_hoscUpDn);
03838     if(temp_hoscElMu) std::cout << "     hoscElMu" << std::endl;
03839     if(temp_hoscElMu)      hoscElMu->Add(temp_hoscElMu);
03840     if(temp_hoscCCNC) std::cout << "     hoscCCNC" << std::endl;
03841     if(temp_hoscCCNC)      hoscCCNC->Add(temp_hoscCCNC);
03842     if(temp_hoscChg) std::cout << "     hoscChg" << std::endl;
03843     if(temp_hoscChg)       hoscChg->Add(temp_hoscChg);
03844     if(temp_hoscChgUpmu) std::cout << "     hoscChgUpmu" << std::endl;
03845     if(temp_hoscChgUpmu)   hoscChgUpmu->Add(temp_hoscChgUpmu);
03846     if(temp_hoscSpecNu) std::cout << "     hoscSpecNu" << std::endl;
03847     if(temp_hoscSpecNu)    hoscSpecNu->Add(temp_hoscSpecNu);
03848     if(temp_hoscSpecNuBar) std::cout << "     hoscSpecNuBar" << std::endl;
03849     if(temp_hoscSpecNuBar) hoscSpecNuBar->Add(temp_hoscSpecNuBar);
03850     if(temp_hoscEmuRange) std::cout << "     hoscEmuRange" << std::endl;
03851     if(temp_hoscEmuRange)  hoscEmuRange->Add(temp_hoscEmuRange);
03852     if(temp_hoscEmuCurve) std::cout << "     hoscEmuCurve" << std::endl;
03853     if(temp_hoscEmuCurve)  hoscEmuCurve->Add(temp_hoscEmuCurve);
03854     if(temp_hoscEshw) std::cout << "     hoscEshw" << std::endl;
03855     if(temp_hoscEshw)      hoscEshw->Add(temp_hoscEshw);
03856     if(temp_hoscSinNu) std::cout << "     hoscSinNu" << std::endl;
03857     if(temp_hoscSinNu)     hoscSinNu->Add(temp_hoscSinNu);
03858     if(temp_hoscSinNuBar) std::cout << "     hoscSinNuBar" << std::endl;
03859     if(temp_hoscSinNuBar)  hoscSinNuBar->Add(temp_hoscSinNuBar);
03860     if(temp_hoscDmsqNu) std::cout << "     hoscDmsqNu" << std::endl;
03861     if(temp_hoscDmsqNu)    hoscDmsqNu->Add(temp_hoscDmsqNu);
03862     if(temp_hoscDmsqNuBar) std::cout << "     hoscDmsqNuBar" << std::endl;
03863     if(temp_hoscDmsqNuBar) hoscDmsqNuBar->Add(temp_hoscDmsqNuBar);
03864 
03865     if(temp_hoscLnL_nue) std::cout << "     hoscLnL_nue" << std::endl;
03866     if(temp_hoscLnL_nue)              hoscLnL_nue->Add(temp_hoscLnL_nue);
03867     if(temp_hoscLnL_cv_lores) std::cout << "     hoscLnL_cv_lores" << std::endl;
03868     if(temp_hoscLnL_cv_lores)         hoscLnL_cv_lores->Add(temp_hoscLnL_cv_lores);
03869     if(temp_hoscLnL_cv_hires) std::cout << "     hoscLnL_cv_hires" << std::endl;
03870     if(temp_hoscLnL_cv_hires)         hoscLnL_cv_hires->Add(temp_hoscLnL_cv_hires);
03871     if(temp_hoscLnL_cv_hires_shape) std::cout << "     hoscLnL_cv_hires_shape" << std::endl;
03872     if(temp_hoscLnL_cv_hires_shape)   hoscLnL_cv_hires_shape->Add(temp_hoscLnL_cv_hires_shape);
03873     if(temp_hoscLnL_cv_hires_norm) std::cout << "     hoscLnL_cv_hires_norm" << std::endl;
03874     if(temp_hoscLnL_cv_hires_norm)    hoscLnL_cv_hires_norm->Add(temp_hoscLnL_cv_hires_norm);
03875     if(temp_hoscLnL_cv_hires_updn) std::cout << "     hoscLnL_cv_hires_updn" << std::endl;
03876     if(temp_hoscLnL_cv_hires_updn)    hoscLnL_cv_hires_updn->Add(temp_hoscLnL_cv_hires_updn);
03877     if(temp_hoscLnL_upmu_hires) std::cout << "     hoscLnL_upmu_hires" << std::endl;
03878     if(temp_hoscLnL_upmu_hires)       hoscLnL_upmu_hires->Add(temp_hoscLnL_upmu_hires);
03879     if(temp_hoscLnL_upmu_hires_shape) std::cout << "     hoscLnL_upmu_hires_shape" << std::endl;
03880     if(temp_hoscLnL_upmu_hires_shape) hoscLnL_upmu_hires_shape->Add(temp_hoscLnL_upmu_hires_shape);
03881     if(temp_hoscLnL_upmu_hires_norm) std::cout << "     hoscLnL_upmu_hires_norm" << std::endl;
03882     if(temp_hoscLnL_upmu_hires_norm)