musrfit  1.9.2
PRunSingleHistoRRF Class Reference

#include <PRunSingleHistoRRF.h>

Inheritance diagram for PRunSingleHistoRRF:
Collaboration diagram for PRunSingleHistoRRF:

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 ()
 
- 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 PRunDataGetData ()
 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)
 
- Protected Member Functions inherited from PRunBase
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

- 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...
 
PMsrHandlerfMsrInfo
 msr-file handler More...
 
PMsrRunBlockfRunInfo
 run info used to filter out needed infos of a run More...
 
PRunDataHandlerfRawData
 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< PDoubleVectorfAddT0s
 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< PTheoryfTheory
 theory needed to calculate chi-square More...
 
PDoubleVector fKaiserFilter
 stores the Kaiser filter vector (needed for the RRF). More...
 

Detailed Description

Class handling single histogram fit type.

Definition at line 38 of file PRunSingleHistoRRF.h.

Constructor & Destructor Documentation

◆ PRunSingleHistoRRF() [1/2]

PRunSingleHistoRRF::PRunSingleHistoRRF ( )

Constructor

Definition at line 58 of file PRunSingleHistoRRF.cpp.

References fBackground, fBkgErr, fGoodBins, fN0EstimateEndTime, fNoOfFitBins, fRRFPacking, and fTheoAsData.

◆ PRunSingleHistoRRF() [2/2]

PRunSingleHistoRRF::PRunSingleHistoRRF ( PMsrHandler msrInfo,
PRunDataHandler rawData,
UInt_t  runNo,
EPMusrHandleTag  tag,
Bool_t  theoAsData 
)

Constructor

Parameters
msrInfopointer to the msr-file handler
rawDataraw run data
runNonumber of the run within the msr-file
tagtag 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().

◆ ~PRunSingleHistoRRF()

PRunSingleHistoRRF::~PRunSingleHistoRRF ( )
virtual

Destructor

Definition at line 136 of file PRunSingleHistoRRF.cpp.

References fForward.

Member Function Documentation

◆ CalcChiSquare()

Double_t PRunSingleHistoRRF::CalcChiSquare ( const std::vector< Double_t > &  par)
virtual

◆ CalcChiSquareExpected()

Double_t PRunSingleHistoRRF::CalcChiSquareExpected ( const std::vector< Double_t > &  par)
virtual

◆ CalcMaxLikelihood()

Double_t PRunSingleHistoRRF::CalcMaxLikelihood ( const std::vector< Double_t > &  par)
virtual

Calculate log maximum-likelihood. See http://pdg.lbl.gov/index.html

return:

  • log maximum-likelihood value
Parameters
parparameter vector iterated by minuit2

Implements PRunBase.

Definition at line 248 of file PRunSingleHistoRRF.cpp.

◆ CalcNoOfFitBins()

void PRunSingleHistoRRF::CalcNoOfFitBins ( )
virtual

◆ CalcTheory()

◆ EstimateBkg()

Bool_t PRunSingleHistoRRF::EstimateBkg ( UInt_t  histoNo)
privatevirtual

Estimate the background for a given interval.

return:

  • true, if everything went smooth
  • false, otherwise
Parameters
histoNoforward 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().

◆ EstimateN0()

Double_t PRunSingleHistoRRF::EstimateN0 ( Double_t &  errN0,
Double_t  freqMax 
)
privatevirtual

Estimate the N0 for the given run.

Parameters
errN0

Definition at line 1115 of file PRunSingleHistoRRF.cpp.

References fM, fMerr, fN0EstimateEndTime, PRunBase::fTimeResolution, and fW.

Referenced by PrepareFitData().

◆ GetEndTimeBin()

virtual Int_t PRunSingleHistoRRF::GetEndTimeBin ( )
inlinevirtual

Definition at line 55 of file PRunSingleHistoRRF.h.

References fEndTimeBin.

◆ GetMainFrequency()

Double_t PRunSingleHistoRRF::GetMainFrequency ( PDoubleVector data)
privatevirtual

gets the maximum frequency of the given data.

Parameters
rawdata 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().

◆ GetNoOfFitBins()

UInt_t PRunSingleHistoRRF::GetNoOfFitBins ( )
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.

◆ GetProperDataRange()

Bool_t PRunSingleHistoRRF::GetProperDataRange ( )
privatevirtual

Get the proper data range, i.e. first/last good bin (fgb/lgb).

  1. get fgb/lgb from the RUN block
  2. if fgb/lgb still undefined, try to get it from the GLOBAL block
  3. if fgb/lgb still undefined, try to estimate them.

return:

  • true if everthing went smooth
  • false, otherwise.

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().

◆ GetProperFitRange()

void PRunSingleHistoRRF::GetProperFitRange ( PMsrGlobalBlock globalBlock)
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:

  1. get fit range assuming given in time from RUN block
  2. if fit range in RUN block is given in bins, replace start/end
  3. if fit range is NOT given yet, try fit range assuming given in time from GLOBAL block
  4. if fit range in GLOBAL block is given in bins, replace start/end
  5. if still no fit range is given, use fgb/lgb.
Parameters
globalBlockpointer 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().

◆ GetProperT0()

Bool_t PRunSingleHistoRRF::GetProperT0 ( PRawRunData runData,
PMsrGlobalBlock globalBlock,
PUIntVector histoNo 
)
privatevirtual

Get the proper t0 for the single histogram run.

  1. the t0 vector size = number of detectors (grouping) for forward.
  2. initialize t0's with -1
  3. fill t0's from RUN block
  4. if t0's are missing (i.e. t0 == -1), try to fill from the GLOBAL block.
  5. if t0's are missing, try t0's from the data file
  6. if t0's are missing, try to estimate them
Parameters
runDatapointer to the current RUN block entry from the msr-file
globalBlockpointer to the GLOBLA block entry from the msr-file
histoNohistogram number vector of forward; histoNo = msr-file forward + redGreen_offset - 1

return:

  • true if everthing went smooth
  • false, otherwise.

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().

◆ GetStartTimeBin()

virtual Int_t PRunSingleHistoRRF::GetStartTimeBin ( )
inlinevirtual

Definition at line 54 of file PRunSingleHistoRRF.h.

References fStartTimeBin.

◆ PrepareData()

Bool_t PRunSingleHistoRRF::PrepareData ( )
protectedvirtual

Prepare data for fitting or viewing. What is already processed at this stage:

  1. get proper raw run data
  2. get all needed forward histograms
  3. get time resolution
  4. get t0's and perform necessary cross checks (e.g. if t0 of msr-file (if present) are consistent with t0 of the data files, etc.)
  5. add runs (if addruns are present)
  6. group histograms (if grouping is present)

return:

  • true if everthing went smooth
  • false, otherwise.

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().

◆ PrepareFitData()

Bool_t PRunSingleHistoRRF::PrepareFitData ( PRawRunData runData,
const UInt_t  histoNo 
)
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:

  1. get fit start/stop time
  2. check that 'first good data bin', 'last good data bin', and 't0' make any sense
  3. check how the background shall be handled, i.e. fitted, subtracted from background estimate data range, or subtacted from a given fixed background.
  4. estimate N0
  5. RRF transformation
  6. packing (i.e rebinning)

return:

  • true, if everything went smooth
  • false, otherwise
Parameters
runDataraw run data handler
histoNoforward 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().

◆ PrepareViewData()

Bool_t PRunSingleHistoRRF::PrepareViewData ( PRawRunData runData,
const UInt_t  histoNo 
)
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:

  1. check if view packing is whished.
  2. check that 'first good data bin', 'last good data bin', and 't0' makes any sense
  3. transform data sets (see below).
  4. calculate theory

return:

  • true, if everything went smooth
  • false, otherwise
Parameters
runDataraw run data handler
histoNoforward 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().

◆ SetFitRangeBin()

void PRunSingleHistoRRF::SetFitRangeBin ( const TString  fitRange)
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.

Parameters
fitRangestring 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.

Member Data Documentation

◆ fAerr

PDoubleVector PRunSingleHistoRRF::fAerr
private

vector holding the errors of estimated A(t)

Definition at line 82 of file PRunSingleHistoRRF.h.

Referenced by PrepareFitData().

◆ fBackground

Double_t PRunSingleHistoRRF::fBackground
private

needed if background range is given (units: 1/bin)

Definition at line 68 of file PRunSingleHistoRRF.h.

Referenced by EstimateBkg(), PrepareFitData(), and PRunSingleHistoRRF().

◆ fBkgErr

Double_t PRunSingleHistoRRF::fBkgErr
private

estimate error on the estimated background

Definition at line 69 of file PRunSingleHistoRRF.h.

Referenced by EstimateBkg(), PrepareFitData(), and PRunSingleHistoRRF().

◆ fEndTimeBin

Int_t PRunSingleHistoRRF::fEndTimeBin
private

bin at which the fit ends

Definition at line 76 of file PRunSingleHistoRRF.h.

Referenced by CalcChiSquare(), CalcChiSquareExpected(), CalcNoOfFitBins(), and GetEndTimeBin().

◆ fForward

PDoubleVector PRunSingleHistoRRF::fForward
private

◆ fGoodBins

Int_t PRunSingleHistoRRF::fGoodBins[2]
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().

◆ fM

PDoubleVector PRunSingleHistoRRF::fM
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().

◆ fMerr

PDoubleVector PRunSingleHistoRRF::fMerr
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().

◆ fN0EstimateEndTime

Double_t PRunSingleHistoRRF::fN0EstimateEndTime
private

end time in (us) over which N0 is estimated.

Definition at line 65 of file PRunSingleHistoRRF.h.

Referenced by EstimateN0(), and PRunSingleHistoRRF().

◆ fNoOfFitBins

UInt_t PRunSingleHistoRRF::fNoOfFitBins
private

number of bins to be fitted

Definition at line 67 of file PRunSingleHistoRRF.h.

Referenced by CalcNoOfFitBins(), GetNoOfFitBins(), and PRunSingleHistoRRF().

◆ fRRFPacking

Int_t PRunSingleHistoRRF::fRRFPacking
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().

◆ fStartTimeBin

Int_t PRunSingleHistoRRF::fStartTimeBin
private

bin at which the fit starts

Definition at line 75 of file PRunSingleHistoRRF.h.

Referenced by CalcChiSquare(), CalcChiSquareExpected(), CalcNoOfFitBins(), and GetStartTimeBin().

◆ fTheoAsData

Bool_t PRunSingleHistoRRF::fTheoAsData
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().

◆ fW

PDoubleVector PRunSingleHistoRRF::fW
private

vector holding the weight needed to estimate N0, and errN0.

Definition at line 81 of file PRunSingleHistoRRF.h.

Referenced by EstimateN0(), and PrepareFitData().


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