musrfit
1.9.2
|
#include <PRunAsymmetry.h>
Public Member Functions | |
PRunAsymmetry () | |
PRunAsymmetry (PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag, Bool_t theoAsData) | |
virtual | ~PRunAsymmetry () |
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 Int_t | GetPacking () |
virtual void | CalcNoOfFitBins () |
Public Member Functions inherited from PRunBase | |
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 () |
virtual Bool_t | PrepareViewData (PRawRunData *runData, UInt_t histoNo[2]) |
virtual Bool_t | PrepareRRFViewData (PRawRunData *runData, UInt_t histoNo[2]) |
Protected Member Functions inherited from PRunBase | |
virtual void | CalculateKaiserFilterCoeff (Double_t wc, Double_t A, Double_t dw) |
virtual void | FilterTheo () |
Private Member Functions | |
Bool_t | SubtractFixBkg () |
Bool_t | SubtractEstimatedBkg () |
virtual Bool_t | GetProperT0 (PRawRunData *runData, PMsrGlobalBlock *globalBlock, PUIntVector &forwardHisto, PUIntVector &backwardHistoNo) |
virtual Bool_t | GetProperDataRange (PRawRunData *runData, UInt_t histoNo[2]) |
virtual void | GetProperFitRange (PMsrGlobalBlock *globalBlock) |
Private Attributes | |
UInt_t | fAlphaBetaTag |
; ; ; . More... | |
UInt_t | fNoOfFitBins |
number of bins to be be fitted More... | |
Int_t | fPacking |
packing for this particular run. Either given in the RUN- or 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... | |
PDoubleVector | fForward |
forward histo data More... | |
PDoubleVector | fForwardErr |
forward histo errors More... | |
PDoubleVector | fBackward |
backward histo data More... | |
PDoubleVector | fBackwardErr |
backward histo errors More... | |
Int_t | fGoodBins [4] |
keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward) More... | |
Int_t | fStartTimeBin |
bin at which the fit starts More... | |
Int_t | fEndTimeBin |
bin at which the fit ends More... | |
Additional Inherited Members | |
Protected Attributes inherited from PRunBase | |
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 the asymmetry fit.
Definition at line 39 of file PRunAsymmetry.h.
PRunAsymmetry::PRunAsymmetry | ( | ) |
Constructor
Definition at line 55 of file PRunAsymmetry.cpp.
References fEndTimeBin, fGoodBins, fNoOfFitBins, fPacking, fStartTimeBin, and fTheoAsData.
PRunAsymmetry::PRunAsymmetry | ( | 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 81 of file PRunAsymmetry.cpp.
References fAlphaBetaTag, fEndTimeBin, fGoodBins, PRunBase::fMsrInfo, fPacking, PRunBase::fRunInfo, fStartTimeBin, PRunBase::fValid, PMsrRunBlock::GetAlphaParamNo(), PMsrRunBlock::GetBetaParamNo(), PMsrHandler::GetMsrGlobal(), PMsrHandler::GetMsrParamList(), PMsrHandler::GetNoOfFuncs(), PMsrGlobalBlock::GetPacking(), PMsrRunBlock::GetPacking(), MSR_PARAM_FUN_OFFSET, and PrepareData().
|
virtual |
Destructor.
Definition at line 176 of file PRunAsymmetry.cpp.
References fBackward, fBackwardErr, fForward, and fForwardErr.
|
virtual |
Calculate chi-square.
return:
par | parameter vector iterated by minuit2 |
Implements PRunBase.
Definition at line 195 of file PRunAsymmetry.cpp.
References PMsrHandler::EvalFunc(), fAlphaBetaTag, PRunBase::fData, fEndTimeBin, PRunBase::fFuncValues, PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRunInfo, fStartTimeBin, PRunBase::fTheory, PMsrRunBlock::GetAlphaParamNo(), PMsrRunBlock::GetBetaParamNo(), PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PRunData::GetError(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetNoOfFuncs(), PRunData::GetValue(), and MSR_PARAM_FUN_OFFSET.
|
virtual |
Calculate expected chi-square. Currently not implemented since not clear what to be done.
return:
par | parameter vector iterated by minuit2 |
Definition at line 297 of file PRunAsymmetry.cpp.
|
virtual |
NOT IMPLEMENTED!!
par | parameter vector iterated by minuit2 |
Implements PRunBase.
Definition at line 310 of file PRunAsymmetry.cpp.
|
virtual |
Calculate the number of fitted bins for the current fit range.
Definition at line 428 of file PRunAsymmetry.cpp.
References PRunBase::fData, fEndTimeBin, PRunBase::fFitEndTime, PRunBase::fFitStartTime, fNoOfFitBins, fStartTimeBin, PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), and PRunData::GetValue().
Referenced by GetNoOfFitBins(), PrepareFitData(), and PrepareViewData().
|
virtual |
Calculate theory for a given set of fit-parameters.
Implements PRunBase.
Definition at line 450 of file PRunAsymmetry.cpp.
References PRunData::AppendTheoryValue(), PMsrHandler::EvalFunc(), fAlphaBetaTag, PRunBase::fData, PRunBase::fFuncValues, PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRunInfo, PRunBase::fTheory, PMsrRunBlock::GetAlphaParamNo(), PMsrRunBlock::GetBetaParamNo(), PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetMsrParamList(), PMsrHandler::GetNoOfFuncs(), PRunData::GetValue(), and MSR_PARAM_FUN_OFFSET.
|
inlinevirtual |
Definition at line 56 of file PRunAsymmetry.h.
References fEndTimeBin.
|
virtual |
Calculate the number of fitted bins for the current fit range.
return: number of fitted bins.
Definition at line 325 of file PRunAsymmetry.cpp.
References CalcNoOfFitBins(), and fNoOfFitBins.
|
inlinevirtual |
Definition at line 57 of file PRunAsymmetry.h.
References fPacking.
|
privatevirtual |
Get the proper data range, i.e. first/last good bin (fgb/lgb).
runData | raw run data needed to perform some crosschecks |
histoNo | histogram number (within a run). histoNo[0]: forward histogram number, histNo[1]: backward histogram number |
return:
Definition at line 1868 of file PRunAsymmetry.cpp.
References fGoodBins, PRunBase::fMsrInfo, PRunBase::fRunInfo, PRunBase::fT0s, PRunBase::fTimeResolution, PRawRunData::GetDataBin(), 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 1996 of file PRunAsymmetry.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 |
forwardHistoNo | histogram number vector of forward; forwardHistoNo = msr-file forward + redGreen_offset - 1 |
backwardHistoNo | histogram number vector of backwardward; backwardHistoNo = msr-file backward + redGreen_offset - 1 |
return:
Definition at line 1693 of file PRunAsymmetry.cpp.
References PRunBase::fAddT0s, PRunBase::fRawData, PRunBase::fRunInfo, PRunBase::fT0s, PMsrRunBlock::GetAddT0Bin(), PMsrRunBlock::GetAddT0BinSize(), PRawRunData::GetDataBin(), 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 55 of file PRunAsymmetry.h.
References fStartTimeBin.
|
protectedvirtual |
Prepare data for fitting or viewing. What is already processed at this stage:
Error propagation for :
return:
Implements PRunBase.
Definition at line 550 of file PRunAsymmetry.cpp.
References PRunBase::fAddT0s, fBackward, PMetaData::fEnergy, PMetaData::fField, fForward, PRunBase::fHandleTag, PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRawData, PRunBase::fRunInfo, PRunBase::fT0s, PMetaData::fTemp, PRunBase::fTimeResolution, PRunBase::fValid, PMsrRunBlock::GetBackwardHistoNo(), PMsrRunBlock::GetBackwardHistoNoSize(), PMsrRunBlock::GetBkgFix(), PMsrRunBlock::GetBkgRange(), PRawRunData::GetDataBin(), PRawRunData::GetEnergy(), PRawRunData::GetField(), PMsrRunBlock::GetForwardHistoNo(), PMsrRunBlock::GetForwardHistoNoSize(), PMsrHandler::GetMsrGlobal(), PMsrHandler::GetMsrPlotList(), PRawRunData::GetNoOfTemperatures(), GetProperDataRange(), GetProperFitRange(), GetProperT0(), PRunDataHandler::GetRunData(), PMsrRunBlock::GetRunName(), PMsrRunBlock::GetRunNameSize(), PRawRunData::GetTemperature(), PRawRunData::GetTimeResolution(), PRawRunData::IsPresent(), kFit, kView, PMUSR_UNDEFINED, PrepareFitData(), PrepareRRFViewData(), PrepareViewData(), PMsrRunBlock::SetBkgRange(), status, SubtractEstimatedBkg(), and SubtractFixBkg().
Referenced by PRunAsymmetry().
|
protectedvirtual |
Take the pre-processed data (i.e. grouping and addrun are preformed) and form the asymmetry for fitting. Before forming the asymmetry, the following checks will be performed:
Definition at line 953 of file PRunAsymmetry.cpp.
References PRunData::AppendErrorValue(), PRunData::AppendValue(), CalcNoOfFitBins(), fBackward, fBackwardErr, PRunBase::fData, fForward, fForwardErr, fGoodBins, fPacking, PRunBase::fT0s, PRunBase::fTimeResolution, PRunData::GetError(), PRunData::GetValue(), PRunData::SetDataTimeStart(), and PRunData::SetDataTimeStep().
Referenced by PrepareData().
|
protectedvirtual |
Prepares the RRF data set for visual representation. This is done the following way:
runData | raw run data needed to perform some crosschecks |
histoNo | array of the histo numbers form which to build the asymmetry |
Definition at line 1356 of file PRunAsymmetry.cpp.
References PRunData::AppendErrorValue(), PRunData::AppendTheoryValue(), PRunData::AppendValue(), PRunBase::CalculateKaiserFilterCoeff(), PMsrHandler::EvalFunc(), fAlphaBetaTag, fBackward, fBackwardErr, PRunBase::fData, fForward, fForwardErr, PRunBase::fFuncValues, fGoodBins, PRunBase::FilterTheo(), PRunBase::fMetaData, PRunBase::fMsrInfo, PRunBase::fRunInfo, PRunBase::fT0s, PRunBase::fTheory, PRunBase::fTimeResolution, GAMMA_BAR_MUON, PMsrRunBlock::GetAlphaParamNo(), PMsrRunBlock::GetBetaParamNo(), PRawRunData::GetDataBin(), PRunData::GetDataTimeStart(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetMsrParamList(), PMsrHandler::GetMsrPlotList(), PMsrHandler::GetNoOfFuncs(), PRunData::GetTheory(), PRunData::GetTheoryTimeStart(), PRunData::GetTheoryTimeStep(), MSR_PARAM_FUN_OFFSET, PRunData::ReplaceTheory(), RRF_UNIT_G, RRF_UNIT_kHz, RRF_UNIT_Mcs, RRF_UNIT_MHz, RRF_UNIT_T, PRunData::SetDataTimeStart(), PRunData::SetDataTimeStep(), PRunData::SetTheoryTimeStart(), and PRunData::SetTheoryTimeStep().
Referenced by PrepareData().
|
protectedvirtual |
Take the pre-processed data (i.e. grouping and addrun are preformed) and form the asymmetry for view representation. Before forming the asymmetry, the following checks will be performed:
runData | raw run data needed to perform some crosschecks |
histoNo | histogram number (within a run). histoNo[0]: forward histogram number, histNo[1]: backward histogram number |
Definition at line 1072 of file PRunAsymmetry.cpp.
References PRunData::AppendErrorValue(), PRunData::AppendTheoryValue(), PRunData::AppendValue(), CalcNoOfFitBins(), PMsrHandler::EvalFunc(), fAlphaBetaTag, fBackward, fBackwardErr, PRunBase::fData, fForward, fForwardErr, PRunBase::fFuncValues, fGoodBins, PRunBase::fMetaData, PRunBase::fMsrInfo, fPacking, PRunBase::fRunInfo, PRunBase::fT0s, fTheoAsData, PRunBase::fTheory, PRunBase::fTimeResolution, PMsrRunBlock::GetAlphaParamNo(), PMsrRunBlock::GetBetaParamNo(), PRawRunData::GetDataBin(), PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PRunData::GetError(), PMsrHandler::GetFuncNo(), PMsrRunBlock::GetMap(), PMsrHandler::GetMsrParamList(), PMsrHandler::GetMsrPlotList(), PMsrHandler::GetNoOfFuncs(), PRunData::GetTheoryTimeStart(), PRunData::GetTheoryTimeStep(), PRunData::GetValue(), MSR_PARAM_FUN_OFFSET, PRunData::SetDataTimeStart(), PRunData::SetDataTimeStep(), 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 346 of file PRunAsymmetry.cpp.
References PRunBase::fFitEndTime, PRunBase::fFitStartTime, fGoodBins, PRunBase::fRunNo, PRunBase::fT0s, and PRunBase::fTimeResolution.
|
private |
Subtracts the background which is estimated from a given interval (typically before t0).
The background corrected histogramms are: , where is the raw data histogram, the background estimate, and background corrected histogram. The error on is
The background error is
where is the number of bins over which the background is formed.
return:
Definition at line 837 of file PRunAsymmetry.cpp.
References ACCEL_PERIOD_PSI, ACCEL_PERIOD_RAL, ACCEL_PERIOD_TRIUMF, fBackward, fBackwardErr, fForward, fForwardErr, fPacking, PRunBase::fRunInfo, PRunBase::fTimeResolution, PMsrRunBlock::GetBkgRange(), PMsrRunBlock::GetInstitute(), and PMsrRunBlock::SetBkgEstimated().
Referenced by PrepareData().
|
private |
Subtracts a fixed background from the raw data. The background is given in units of (1/bin); for the Asymmetry representation (1/ns) doesn't make too much sense. The error propagation is done the following way: it is assumed that the error of the background is Poisson like, i.e. .
Error propagation:
where is the background corrected histogram, the raw histogram and the fix given background.
return:
Definition at line 779 of file PRunAsymmetry.cpp.
References fBackward, fBackwardErr, fForward, fForwardErr, PRunBase::fRunInfo, PMsrRunBlock::GetBkgFix(), and PMUSR_UNDEFINED.
Referenced by PrepareData().
|
private |
; ; ; .
Definition at line 68 of file PRunAsymmetry.h.
Referenced by CalcChiSquare(), CalcTheory(), PrepareRRFViewData(), PrepareViewData(), and PRunAsymmetry().
|
private |
backward histo data
Definition at line 75 of file PRunAsymmetry.h.
Referenced by PrepareData(), PrepareFitData(), PrepareRRFViewData(), PrepareViewData(), SubtractEstimatedBkg(), SubtractFixBkg(), and ~PRunAsymmetry().
|
private |
backward histo errors
Definition at line 76 of file PRunAsymmetry.h.
Referenced by PrepareFitData(), PrepareRRFViewData(), PrepareViewData(), SubtractEstimatedBkg(), SubtractFixBkg(), and ~PRunAsymmetry().
|
private |
bin at which the fit ends
Definition at line 81 of file PRunAsymmetry.h.
Referenced by CalcChiSquare(), CalcNoOfFitBins(), GetEndTimeBin(), and PRunAsymmetry().
|
private |
forward histo data
Definition at line 73 of file PRunAsymmetry.h.
Referenced by PrepareData(), PrepareFitData(), PrepareRRFViewData(), PrepareViewData(), SubtractEstimatedBkg(), SubtractFixBkg(), and ~PRunAsymmetry().
|
private |
forward histo errors
Definition at line 74 of file PRunAsymmetry.h.
Referenced by PrepareFitData(), PrepareRRFViewData(), PrepareViewData(), SubtractEstimatedBkg(), SubtractFixBkg(), and ~PRunAsymmetry().
|
private |
keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward)
Definition at line 78 of file PRunAsymmetry.h.
Referenced by GetProperDataRange(), GetProperFitRange(), PrepareFitData(), PrepareRRFViewData(), PrepareViewData(), PRunAsymmetry(), and SetFitRangeBin().
|
private |
number of bins to be be fitted
Definition at line 69 of file PRunAsymmetry.h.
Referenced by CalcNoOfFitBins(), GetNoOfFitBins(), and PRunAsymmetry().
|
private |
packing for this particular run. Either given in the RUN- or GLOBAL-block.
Definition at line 70 of file PRunAsymmetry.h.
Referenced by GetPacking(), PrepareFitData(), PrepareViewData(), PRunAsymmetry(), and SubtractEstimatedBkg().
|
private |
bin at which the fit starts
Definition at line 80 of file PRunAsymmetry.h.
Referenced by CalcChiSquare(), CalcNoOfFitBins(), GetStartTimeBin(), and PRunAsymmetry().
|
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 PRunAsymmetry.h.
Referenced by PrepareViewData(), and PRunAsymmetry().