musrfit
1.9.2
|
#include <PRunSingleHistoRRF.h>
Public Member Functions | |
PRunSingleHistoRRF () | |
PRunSingleHistoRRF (PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag, Bool_t theoAsData) | |
virtual | ~PRunSingleHistoRRF () |
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 () |
virtual UInt_t | GetNoOfFitBins () |
virtual void | SetFitRangeBin (const TString fitRange) |
virtual Int_t | GetStartTimeBin () |
virtual Int_t | GetEndTimeBin () |
virtual void | CalcNoOfFitBins () |
![]() | |
PRunBase () | |
PRunBase (PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag) | |
virtual | ~PRunBase () |
virtual void | SetFitRange (PDoublePairVector fitRange) |
virtual UInt_t | GetRunNo () |
returns the number of runs of the msr-file More... | |
virtual PRunData * | GetData () |
returns the data to be fitted More... | |
virtual void | CleanUp () |
virtual Bool_t | IsValid () |
returns if the state is valid More... | |
Protected Member Functions | |
virtual Bool_t | PrepareData () |
virtual Bool_t | PrepareFitData (PRawRunData *runData, const UInt_t histoNo) |
virtual Bool_t | PrepareViewData (PRawRunData *runData, const UInt_t histoNo) |
![]() | |
virtual void | CalculateKaiserFilterCoeff (Double_t wc, Double_t A, Double_t dw) |
virtual void | FilterTheo () |
Private Member Functions | |
virtual Bool_t | GetProperT0 (PRawRunData *runData, PMsrGlobalBlock *globalBlock, PUIntVector &histoNo) |
virtual Bool_t | GetProperDataRange () |
virtual void | GetProperFitRange (PMsrGlobalBlock *globalBlock) |
virtual Double_t | GetMainFrequency (PDoubleVector &data) |
virtual Double_t | EstimateN0 (Double_t &errN0, Double_t freqMax) |
virtual Bool_t | EstimateBkg (UInt_t histoNo) |
Private Attributes | |
Double_t | fN0EstimateEndTime |
end time in (us) over which N0 is estimated. More... | |
UInt_t | fNoOfFitBins |
number of bins to be fitted More... | |
Double_t | fBackground |
needed if background range is given (units: 1/bin) More... | |
Double_t | fBkgErr |
estimate error on the estimated background More... | |
Int_t | fRRFPacking |
RRF packing for this particular run. Given in the GLOBAL-block. More... | |
Bool_t | fTheoAsData |
true=only calculate the theory points at the data points, false=calculate more points for the theory as compared to data are calculated which lead to 'nicer' Fouriers More... | |
Int_t | fGoodBins [2] |
keep first/last good bins. 0=fgb, 1=lgb More... | |
Int_t | fStartTimeBin |
bin at which the fit starts More... | |
Int_t | fEndTimeBin |
bin at which the fit ends More... | |
PDoubleVector | fForward |
forward histo data More... | |
PDoubleVector | fM |
vector holding M(t) = [N(t)-N_bkg] exp(+t/tau). Needed to estimate N0. More... | |
PDoubleVector | fMerr |
vector holding the error of M(t): M_err = exp(+t/tau) sqrt(N(t)). More... | |
PDoubleVector | fW |
vector holding the weight needed to estimate N0, and errN0. More... | |
PDoubleVector | fAerr |
vector holding the errors of estimated A(t) More... | |
Additional Inherited Members | |
![]() | |
Bool_t | fValid |
flag showing if the state of the class is valid More... | |
EPMusrHandleTag | fHandleTag |
tag telling whether this is used for fit, view, ... More... | |
Int_t | fRunNo |
number of the run within the msr-file More... | |
PMsrHandler * | fMsrInfo |
msr-file handler More... | |
PMsrRunBlock * | fRunInfo |
run info used to filter out needed infos of a run More... | |
PRunDataHandler * | fRawData |
holds the raw run data More... | |
PRunData | fData |
data to be fitted, viewed, i.e. binned data More... | |
Double_t | fTimeResolution |
time resolution in (us) More... | |
PMetaData | fMetaData |
keeps the meta data from the data file like field, temperature, energy, ... More... | |
PDoubleVector | fT0s |
all t0 bins of a run! The derived classes will handle it. More... | |
std::vector< PDoubleVector > | fAddT0s |
all t0 bins of all addrun's of a run! The derived classes will handle it. More... | |
Double_t | fFitStartTime |
fit start time More... | |
Double_t | fFitEndTime |
fit end time More... | |
PDoubleVector | fFuncValues |
is keeping the values of the functions from the FUNCTIONS block More... | |
std::unique_ptr< PTheory > | fTheory |
theory needed to calculate chi-square More... | |
PDoubleVector | fKaiserFilter |
stores the Kaiser filter vector (needed for the RRF). More... | |
Class handling single histogram fit type.
Definition at line 38 of file PRunSingleHistoRRF.h.
PRunSingleHistoRRF::PRunSingleHistoRRF | ( | ) |
Constructor
Definition at line 58 of file PRunSingleHistoRRF.cpp.
References fBackground, fBkgErr, fGoodBins, fN0EstimateEndTime, fNoOfFitBins, fRRFPacking, and fTheoAsData.
PRunSingleHistoRRF::PRunSingleHistoRRF | ( | PMsrHandler * | msrInfo, |
PRunDataHandler * | rawData, | ||
UInt_t | runNo, | ||
EPMusrHandleTag | tag, | ||
Bool_t | theoAsData | ||
) |
Constructor
msrInfo | pointer to the msr-file handler |
rawData | raw run data |
runNo | number of the run within the msr-file |
tag | tag showing what shall be done: kFit == fitting, kView == viewing |
Definition at line 85 of file PRunSingleHistoRRF.cpp.
References fGoodBins, fN0EstimateEndTime, fNoOfFitBins, fRRFPacking, PRunBase::fValid, PMsrHandler::GetMsrGlobal(), PMsrGlobalBlock::GetRRFPacking(), PMsrGlobalBlock::GetRRFUnit(), PMsrGlobalBlock::IsPresent(), and PrepareData().
|
virtual |
|
virtual |
Calculate chi-square.
return:
par | parameter vector iterated by minuit2 |
Implements PRunBase.
Definition at line 152 of file PRunSingleHistoRRF.cpp.
References PMsrHandler::EvalFunc(), PRunBase::fData, fEndTimeBin, PRunBase::fFuncValues, PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRunInfo, fStartTimeBin, PRunBase::fTheory, PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PRunData::GetError(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetNoOfFuncs(), and PRunData::GetValue().
|
virtual |
Calculate expected chi-square.
return:
par | parameter vector iterated by minuit2 |
Definition at line 199 of file PRunSingleHistoRRF.cpp.
References PMsrHandler::EvalFunc(), PRunBase::fData, fEndTimeBin, PRunBase::fFuncValues, PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRunInfo, fStartTimeBin, PRunBase::fTheory, PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetNoOfFuncs(), and PRunData::GetValue().
|
virtual |
Calculate log maximum-likelihood. See http://pdg.lbl.gov/index.html
return:
par | parameter vector iterated by minuit2 |
Implements PRunBase.
Definition at line 248 of file PRunSingleHistoRRF.cpp.
|
virtual |
Calculate the number of fitted bins for the current fit range.
Definition at line 399 of file PRunSingleHistoRRF.cpp.
References PRunBase::fData, fEndTimeBin, PRunBase::fFitEndTime, PRunBase::fFitStartTime, fNoOfFitBins, fStartTimeBin, PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), and PRunData::GetValue().
Referenced by GetNoOfFitBins(), and PrepareFitData().
|
virtual |
Calculate theory for a given set of fit-parameters.
Implements PRunBase.
Definition at line 261 of file PRunSingleHistoRRF.cpp.
References PRunData::AppendTheoryValue(), PMsrHandler::EvalFunc(), PRunBase::fData, PRunBase::fFuncValues, PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRunInfo, PRunBase::fTheory, PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetMsrParamList(), PMsrHandler::GetNoOfFuncs(), and PRunData::GetValue().
|
privatevirtual |
Estimate the background for a given interval.
return:
histoNo | forward histogram number of the run |
Definition at line 1154 of file PRunSingleHistoRRF.cpp.
References ACCEL_PERIOD_PSI, ACCEL_PERIOD_RAL, ACCEL_PERIOD_TRIUMF, fBackground, fBkgErr, fForward, PRunBase::fRunInfo, PRunBase::fTimeResolution, PMsrRunBlock::GetBkgRange(), PMsrRunBlock::GetInstitute(), and PMsrRunBlock::SetBkgEstimated().
Referenced by PrepareFitData().
|
privatevirtual |
Estimate the N0 for the given run.
errN0 |
Definition at line 1115 of file PRunSingleHistoRRF.cpp.
References fM, fMerr, fN0EstimateEndTime, PRunBase::fTimeResolution, and fW.
Referenced by PrepareFitData().
|
inlinevirtual |
Definition at line 55 of file PRunSingleHistoRRF.h.
References fEndTimeBin.
|
privatevirtual |
gets the maximum frequency of the given data.
raw | data set. |
Definition at line 1065 of file PRunSingleHistoRRF.cpp.
References F_APODIZATION_STRONG, fGoodBins, FOURIER_UNIT_FREQ, PRunBase::fT0s, and PRunBase::fTimeResolution.
Referenced by PrepareFitData().
|
virtual |
Calculate the number of fitted bins for the current fit range.
return: number of fitted bins.
Definition at line 296 of file PRunSingleHistoRRF.cpp.
References CalcNoOfFitBins(), and fNoOfFitBins.
|
privatevirtual |
Get the proper data range, i.e. first/last good bin (fgb/lgb).
return:
Definition at line 943 of file PRunSingleHistoRRF.cpp.
References fForward, fGoodBins, PRunBase::fMsrInfo, PRunBase::fRunInfo, PRunBase::fT0s, PRunBase::fTimeResolution, PMsrGlobalBlock::GetDataRange(), PMsrRunBlock::GetDataRange(), PMsrHandler::GetMsrGlobal(), and PMsrRunBlock::SetDataRange().
Referenced by PrepareData().
|
privatevirtual |
Get the proper fit range. There are two possible fit range commands: fit <start> <end> given in (usec), or fit fgb+offset_0 lgb-offset_1 given in (bins), therefore it works the following way:
globalBlock | pointer to the GLOBAL block information form the msr-file. |
Definition at line 1024 of file PRunSingleHistoRRF.cpp.
References PRunBase::fFitEndTime, PRunBase::fFitStartTime, fGoodBins, PRunBase::fRunInfo, PRunBase::fT0s, PRunBase::fTimeResolution, PMsrGlobalBlock::GetFitRange(), PMsrRunBlock::GetFitRange(), PMsrGlobalBlock::GetFitRangeOffset(), PMsrRunBlock::GetFitRangeOffset(), PMsrGlobalBlock::IsFitRangeInBin(), PMsrRunBlock::IsFitRangeInBin(), PMUSR_UNDEFINED, PMsrGlobalBlock::SetFitRange(), and PMsrRunBlock::SetFitRange().
Referenced by PrepareData().
|
privatevirtual |
Get the proper t0 for the single histogram run.
runData | pointer to the current RUN block entry from the msr-file |
globalBlock | pointer to the GLOBLA block entry from the msr-file |
histoNo | histogram number vector of forward; histoNo = msr-file forward + redGreen_offset - 1 |
return:
Definition at line 812 of file PRunSingleHistoRRF.cpp.
References PRunBase::fAddT0s, PRunBase::fRawData, PRunBase::fRunInfo, PRunBase::fT0s, PMsrRunBlock::GetAddT0Bin(), PRawRunData::GetDataBin(), PMsrRunBlock::GetForwardHistoNoSize(), PRunDataHandler::GetRunData(), PMsrRunBlock::GetRunName(), PMsrRunBlock::GetRunNameSize(), PRawRunData::GetT0Bin(), PMsrGlobalBlock::GetT0Bin(), PMsrRunBlock::GetT0Bin(), PRawRunData::GetT0BinEstimated(), PMsrGlobalBlock::GetT0BinSize(), PMsrRunBlock::GetT0BinSize(), PMsrRunBlock::SetAddT0Bin(), and PMsrRunBlock::SetT0Bin().
Referenced by PrepareData().
|
inlinevirtual |
Definition at line 54 of file PRunSingleHistoRRF.h.
References fStartTimeBin.
|
protectedvirtual |
Prepare data for fitting or viewing. What is already processed at this stage:
return:
Implements PRunBase.
Definition at line 431 of file PRunSingleHistoRRF.cpp.
References PRunBase::fAddT0s, PMetaData::fEnergy, PMetaData::fField, fForward, PRunBase::fHandleTag, PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRawData, PRunBase::fRunInfo, PRunBase::fT0s, PMetaData::fTemp, PRunBase::fTimeResolution, PRunBase::fValid, PRawRunData::GetDataBin(), PRawRunData::GetEnergy(), PRawRunData::GetField(), PMsrRunBlock::GetForwardHistoNo(), PMsrRunBlock::GetForwardHistoNoSize(), PMsrHandler::GetMsrGlobal(), PRawRunData::GetNoOfTemperatures(), GetProperDataRange(), GetProperFitRange(), GetProperT0(), PRunDataHandler::GetRunData(), PMsrRunBlock::GetRunName(), PMsrRunBlock::GetRunNameSize(), PRawRunData::GetTemperature(), PRawRunData::GetTimeResolution(), PRawRunData::IsPresent(), kFit, kView, PrepareFitData(), and PrepareViewData().
Referenced by PRunSingleHistoRRF().
|
protectedvirtual |
Take the pre-processed data (i.e. grouping and addrun are preformed) and form the RRF histogram for fitting. The following steps are preformed:
return:
runData | raw run data handler |
histoNo | forward histogram number |
Definition at line 579 of file PRunSingleHistoRRF.cpp.
References PRunData::AppendErrorValue(), PRunData::AppendValue(), CalcNoOfFitBins(), EstimateBkg(), EstimateN0(), fAerr, fBackground, fBkgErr, PRunBase::fData, fForward, fGoodBins, fM, fMerr, PRunBase::fMsrInfo, fRRFPacking, PRunBase::fRunInfo, PRunBase::fT0s, PRunBase::fTimeResolution, fW, PMsrRunBlock::GetBkgFix(), PMsrRunBlock::GetBkgRange(), GetMainFrequency(), PMsrHandler::GetMsrGlobal(), PMsrGlobalBlock::GetRRFFreq(), PMsrGlobalBlock::GetRRFPhase(), PMUON_LIFETIME, PMUSR_UNDEFINED, PMsrRunBlock::SetBkgRange(), PRunData::SetDataTimeStart(), and PRunData::SetDataTimeStep().
Referenced by PrepareData(), and PrepareViewData().
|
protectedvirtual |
Take the pre-processed data (i.e. grouping and addrun are preformed) and form the histogram for viewing with life time correction, i.e. the exponential decay is removed.
The following steps are preformed:
return:
runData | raw run data handler |
histoNo | forward histogram number |
Definition at line 730 of file PRunSingleHistoRRF.cpp.
References PRunData::AppendTheoryValue(), PMsrHandler::EvalFunc(), PRunBase::fData, fForward, PRunBase::fFuncValues, PRunBase::fMetaData, PRunBase::fMsrInfo, fRRFPacking, PRunBase::fRunInfo, fTheoAsData, PRunBase::fTheory, PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetMsrParamList(), PMsrHandler::GetMsrPlotList(), PMsrHandler::GetNoOfFuncs(), PRunData::GetTheoryTimeStart(), PRunData::GetTheoryTimeStep(), PrepareFitData(), PRunData::SetTheoryTimeStart(), and PRunData::SetTheoryTimeStep().
Referenced by PrepareData().
|
virtual |
Allows to change the fit range on the fly. Used in the COMMAND block. The syntax of the string is: FIT_RANGE fgb[+n00] lgb[-n01] [fgb[+n10] lgb[-n11] ... fgb[+nN0] lgb[-nN1]]. If only one pair of fgb/lgb is given, it is used for all runs in the RUN block section. If multiple fgb/lgb's are given, the number N has to be the number of RUN blocks in the msr-file.
nXY are offsets which can be used to shift, limit the fit range.
fitRange | string containing the necessary information. |
Definition at line 317 of file PRunSingleHistoRRF.cpp.
References PRunBase::fFitEndTime, PRunBase::fFitStartTime, fGoodBins, PRunBase::fRunNo, PRunBase::fT0s, and PRunBase::fTimeResolution.
|
private |
vector holding the errors of estimated A(t)
Definition at line 82 of file PRunSingleHistoRRF.h.
Referenced by PrepareFitData().
|
private |
needed if background range is given (units: 1/bin)
Definition at line 68 of file PRunSingleHistoRRF.h.
Referenced by EstimateBkg(), PrepareFitData(), and PRunSingleHistoRRF().
|
private |
estimate error on the estimated background
Definition at line 69 of file PRunSingleHistoRRF.h.
Referenced by EstimateBkg(), PrepareFitData(), and PRunSingleHistoRRF().
|
private |
bin at which the fit ends
Definition at line 76 of file PRunSingleHistoRRF.h.
Referenced by CalcChiSquare(), CalcChiSquareExpected(), CalcNoOfFitBins(), and GetEndTimeBin().
|
private |
forward histo data
Definition at line 78 of file PRunSingleHistoRRF.h.
Referenced by EstimateBkg(), GetProperDataRange(), PrepareData(), PrepareFitData(), PrepareViewData(), and ~PRunSingleHistoRRF().
|
private |
keep first/last good bins. 0=fgb, 1=lgb
Definition at line 73 of file PRunSingleHistoRRF.h.
Referenced by GetMainFrequency(), GetProperDataRange(), GetProperFitRange(), PrepareFitData(), PRunSingleHistoRRF(), and SetFitRangeBin().
|
private |
vector holding M(t) = [N(t)-N_bkg] exp(+t/tau). Needed to estimate N0.
Definition at line 79 of file PRunSingleHistoRRF.h.
Referenced by EstimateN0(), and PrepareFitData().
|
private |
vector holding the error of M(t): M_err = exp(+t/tau) sqrt(N(t)).
Definition at line 80 of file PRunSingleHistoRRF.h.
Referenced by EstimateN0(), and PrepareFitData().
|
private |
end time in (us) over which N0 is estimated.
Definition at line 65 of file PRunSingleHistoRRF.h.
Referenced by EstimateN0(), and PRunSingleHistoRRF().
|
private |
number of bins to be fitted
Definition at line 67 of file PRunSingleHistoRRF.h.
Referenced by CalcNoOfFitBins(), GetNoOfFitBins(), and PRunSingleHistoRRF().
|
private |
RRF packing for this particular run. Given in the GLOBAL-block.
Definition at line 70 of file PRunSingleHistoRRF.h.
Referenced by PrepareFitData(), PrepareViewData(), and PRunSingleHistoRRF().
|
private |
bin at which the fit starts
Definition at line 75 of file PRunSingleHistoRRF.h.
Referenced by CalcChiSquare(), CalcChiSquareExpected(), CalcNoOfFitBins(), and GetStartTimeBin().
|
private |
true=only calculate the theory points at the data points, false=calculate more points for the theory as compared to data are calculated which lead to 'nicer' Fouriers
Definition at line 71 of file PRunSingleHistoRRF.h.
Referenced by PrepareViewData(), and PRunSingleHistoRRF().
|
private |
vector holding the weight needed to estimate N0, and errN0.
Definition at line 81 of file PRunSingleHistoRRF.h.
Referenced by EstimateN0(), and PrepareFitData().