added expected chisq calculation for single histogram fits (MUSR-194)
This commit is contained in:
@@ -48,9 +48,11 @@ class PFitterFcn : public ROOT::Minuit2::FCNBase
|
||||
~PFitterFcn();
|
||||
|
||||
Double_t Up() const { return fUp; }
|
||||
Double_t operator()(const std::vector<Double_t>&) const;
|
||||
Double_t operator()(const std::vector<Double_t> &par) const;
|
||||
|
||||
UInt_t GetTotalNoOfFittedBins() { return fRunListCollection->GetTotalNoOfBinsFitted(); }
|
||||
UInt_t GetNoOfFittedBins(const UInt_t idx);
|
||||
void CalcExpectedChiSquare(const std::vector<Double_t> &par, Double_t &totalExpectedChisq, std::vector<Double_t> &expectedChisqPerRun);
|
||||
|
||||
private:
|
||||
Double_t fUp; ///< for chisq == 1.0, i.e. errors are 1 std. deviation errors. for log max-likelihood == 0.5, i.e. errors are 1 std. deviation errors (for details see the minuit2 user manual).
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
class PMsrHandler
|
||||
{
|
||||
public:
|
||||
PMsrHandler(const Char_t *fileName);
|
||||
PMsrHandler(const Char_t *fileName, const Bool_t writeExpectedChisq=false);
|
||||
virtual ~PMsrHandler();
|
||||
|
||||
virtual Int_t ReadMsrFile();
|
||||
@@ -95,6 +95,7 @@ class PMsrHandler
|
||||
virtual Double_t EvalFunc(UInt_t i, vector<Int_t> map, vector<Double_t> param)
|
||||
{ return fFuncHandler->Eval(i,map,param); }
|
||||
|
||||
virtual UInt_t GetNoOfFitParameters(UInt_t idx);
|
||||
virtual Int_t ParameterInUse(UInt_t paramNo);
|
||||
virtual Bool_t CheckRunBlockIntegrity();
|
||||
virtual Bool_t CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY);
|
||||
@@ -105,6 +106,8 @@ class PMsrHandler
|
||||
virtual void CheckMaxLikelihood();
|
||||
|
||||
private:
|
||||
Bool_t fWriteExpectedChisq; ///< flag shows if expected chisq shall be written to the msr-file
|
||||
|
||||
TString fFileName; ///< file name of the msr-file
|
||||
TString fMsrFileDirectoryPath; ///< msr-file directory path
|
||||
TString fTitle; ///< holds the title string of the msr-file
|
||||
|
||||
@@ -582,9 +582,12 @@ typedef struct {
|
||||
Bool_t fValid; ///< flag showing if the statistics block is valid, i.e. a fit took place which converged
|
||||
PMsrLines fStatLines; ///< statistics block in msr-file clear text
|
||||
TString fDate; ///< string holding fitting date and time
|
||||
Bool_t fChisq; ///< flag telling if min = chi2 or min = max.likelyhood
|
||||
Double_t fMin; ///< chi2 or max. likelyhood
|
||||
Bool_t fChisq; ///< flag telling if min = chi2 or min = max.likelihood
|
||||
Double_t fMin; ///< chi2 or max. likelihood
|
||||
UInt_t fNdf; ///< number of degrees of freedom
|
||||
Double_t fMinExpected; ///< expected total chi2 or max. likelihood
|
||||
PDoubleVector fMinExpectedPerHisto; ///< expected pre histo chi2 or max. likelihood
|
||||
PUIntVector fNdfPerHisto; ///< number of degrees of freedom per histo
|
||||
} PMsrStatisticStructure;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
@@ -74,8 +74,6 @@ class PRunBase
|
||||
PMsrRunBlock *fRunInfo; ///< run info used to filter out needed infos of a run
|
||||
PRunDataHandler *fRawData; ///< holds the raw run data
|
||||
|
||||
PIntVector fParamNo; ///< vector of parameter numbers for the specifc run
|
||||
|
||||
PRunData fData; ///< data to be fitted, viewed, i.e. binned data
|
||||
Double_t fTimeResolution; ///< time resolution in (us)
|
||||
PIntVector fT0s; ///< all t0's of a run! The derived classes will handle it
|
||||
|
||||
@@ -59,6 +59,7 @@ class PRunListCollection
|
||||
virtual void SetFitRange(const PDoublePairVector fitRange);
|
||||
|
||||
virtual Double_t GetSingleHistoChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetSingleHistoChisqExpected(const std::vector<Double_t>& par, const UInt_t idx) const;
|
||||
virtual Double_t GetAsymmetryChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetMuMinusChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetNonMusrChisq(const std::vector<Double_t>& par) const;
|
||||
@@ -68,6 +69,7 @@ class PRunListCollection
|
||||
virtual Double_t GetMuMinusMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetNonMusrMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
|
||||
virtual UInt_t GetNoOfBinsFitted(const UInt_t idx) const;
|
||||
virtual UInt_t GetTotalNoOfBinsFitted() const;
|
||||
|
||||
virtual UInt_t GetNoOfSingleHisto() const { return fRunSingleHistoList.size(); } ///< returns the number of single histogram data sets present in the msr-file
|
||||
@@ -91,10 +93,10 @@ class PRunListCollection
|
||||
PMsrHandler *fMsrInfo; ///< pointer to the msr-file handler
|
||||
PRunDataHandler *fData; ///< pointer to the run-data handler
|
||||
|
||||
vector<PRunSingleHisto*> fRunSingleHistoList; ///< stores all precessed single histogram data
|
||||
vector<PRunAsymmetry*> fRunAsymmetryList; ///< stores all precessed asymmetry data
|
||||
vector<PRunMuMinus*> fRunMuMinusList; ///< stores all precessed mu-minus data
|
||||
vector<PRunNonMusr*> fRunNonMusrList; ///< stores all precessed non-muSR data
|
||||
vector<PRunSingleHisto*> fRunSingleHistoList; ///< stores all processed single histogram data
|
||||
vector<PRunAsymmetry*> fRunAsymmetryList; ///< stores all processed asymmetry data
|
||||
vector<PRunMuMinus*> fRunMuMinusList; ///< stores all processed mu-minus data
|
||||
vector<PRunNonMusr*> fRunNonMusrList; ///< stores all processed non-muSR data
|
||||
};
|
||||
|
||||
#endif // _PRUNLISTCOLLECTION_H_
|
||||
|
||||
@@ -45,6 +45,7 @@ class PRunSingleHisto : public PRunBase
|
||||
virtual ~PRunSingleHisto();
|
||||
|
||||
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcChiSquareExpected(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
|
||||
virtual void CalcTheory();
|
||||
|
||||
|
||||
@@ -75,13 +75,14 @@ class PStartupHandler : public TObject, public TQObject
|
||||
|
||||
virtual void CheckLists();
|
||||
|
||||
virtual const Bool_t GetWriteExpectedChisq() { return fWriteExpectedChisq; } ///< returns the write_expected_chisq flag
|
||||
virtual PMsrFourierStructure GetFourierDefaults() { return fFourierDefaults; } ///< returns the Fourier defaults
|
||||
virtual const PStringVector GetDataPathList() const { return fDataPathList; } ///< returns the search data path list
|
||||
virtual const PIntVector GetMarkerList() const { return fMarkerList; } ///< returns the marker list
|
||||
virtual const PIntVector GetColorList() const { return fColorList; } ///< returns the color list
|
||||
|
||||
private:
|
||||
enum EKeyWords {eEmpty, eComment, eDataPath,
|
||||
enum EKeyWords {eEmpty, eComment, eDataPath, eWriteExpectedChisq,
|
||||
eFourierSettings, eUnits, eFourierPower, eApodization, ePlot, ePhase, ePhaseIncrement,
|
||||
eRootSettings, eMarkerList, eMarker,
|
||||
eColorList, eColor};
|
||||
@@ -89,6 +90,7 @@ class PStartupHandler : public TObject, public TQObject
|
||||
|
||||
Bool_t fStartupFileFound; ///< startup file found flag
|
||||
TString fStartupFilePath; ///< full musrfit_startup.xml startup file paths
|
||||
Bool_t fWriteExpectedChisq; ///< flag showing if the expected chisq shall be written to the msr-file
|
||||
PMsrFourierStructure fFourierDefaults; ///< Fourier defaults
|
||||
PStringVector fDataPathList; ///< search data path list
|
||||
PIntVector fMarkerList; ///< marker list
|
||||
|
||||
Reference in New Issue
Block a user