From 56cb9749d21fd1b9500d4b8f553d81033b086419 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Wed, 17 Dec 2014 15:40:43 +0100 Subject: [PATCH] added addt0 to the GLOBAL block --- src/classes/PMusr.cpp | 74 +++++++++++++++++++++++++++++++++++++++++++ src/include/PMusr.h | 7 +++- 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index 0756c25f..9ce62938 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -799,6 +799,80 @@ void PMsrGlobalBlock::SetT0Bin(Double_t dval, Int_t idx) fT0[idx] = dval; } +//-------------------------------------------------------------------------- +// GetAddT0BinSize (public) +//-------------------------------------------------------------------------- +/** + *

get add T0 size of the addrun at index addRunIdx + * + * return: + * - addt0 value, if idx is within proper boundaries + * - -1, otherwise + * + * \param addRunIdx index of the addrun + */ +Int_t PMsrGlobalBlock::GetAddT0BinSize(UInt_t addRunIdx) +{ + if (fAddT0.empty()) + return -1; + + if (addRunIdx >= fAddT0.size()) + return -1; + + return fAddT0[addRunIdx].size(); +} + +//-------------------------------------------------------------------------- +// GetAddT0Bin (public) +//-------------------------------------------------------------------------- +/** + *

get add T0 of the addrun (index addRunIdx) at index histoIdx + * + * return: + * - addt0 value, if indices are within proper boundaries + * - -1, otherwise + * + * \param addRunIdx index of the addrun + * \param histoIdx index of the add backward histo number value + */ +Double_t PMsrGlobalBlock::GetAddT0Bin(UInt_t addRunIdx, UInt_t histoIdx) +{ + if (fAddT0.empty()) + return -1.0; + + if (addRunIdx >= fAddT0.size()) + return -1.0; + + if (fAddT0[addRunIdx].empty()) + return -1.0; + + if (histoIdx >= fAddT0[addRunIdx].size()) + return -1.0; + + return fAddT0[addRunIdx][histoIdx]; +} + +//-------------------------------------------------------------------------- +// SetAddT0Bin (public) +//-------------------------------------------------------------------------- +/** + *

set add T0 bin of the addrun at index histoNoIdx + * + * \param ival T0 bin + * \param addRunIdx addrun index + * \param histoNoIdx index whithin the fAddT0 vector where to set the value. + */ +void PMsrGlobalBlock::SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx) +{ + if (addRunIdx >= fAddT0.size()) + fAddT0.resize(addRunIdx+1); + + if (histoNoIdx >= fAddT0[addRunIdx].size()) + fAddT0[addRunIdx].resize(histoNoIdx+1); + + fAddT0[addRunIdx][histoNoIdx] = dval; +} + //-------------------------------------------------------------------------- // GetFitRange (public) //-------------------------------------------------------------------------- diff --git a/src/include/PMusr.h b/src/include/PMusr.h index d58da6e4..3728aa29 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -537,6 +537,9 @@ class PMsrGlobalBlock { virtual Int_t GetDataRange(UInt_t idx); virtual UInt_t GetT0BinSize() { return fT0.size(); } virtual Double_t GetT0Bin(UInt_t idx=0); + virtual UInt_t GetAddT0BinEntries() { return fAddT0.size(); } + virtual Int_t GetAddT0BinSize(UInt_t addRunIdx); + virtual Double_t GetAddT0Bin(UInt_t addRunIdx, UInt_t histoIdx); virtual Bool_t IsFitRangeInBin() { return fFitRangeInBins; } virtual Double_t GetFitRange(UInt_t idx); virtual Int_t GetFitRangeOffset(UInt_t idx); @@ -545,6 +548,7 @@ class PMsrGlobalBlock { virtual void SetFitType(Int_t ival) { fFitType = ival; } virtual void SetDataRange(Int_t ival, Int_t idx); virtual void SetT0Bin(Double_t dval, Int_t idx=-1); + virtual void SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx); virtual void SetFitRangeInBins(Bool_t bval) { fFitRangeInBins = bval; } virtual void SetFitRange(Double_t dval, UInt_t idx); virtual void SetFitRangeOffset(Int_t ival, UInt_t idx); @@ -553,7 +557,8 @@ class PMsrGlobalBlock { private: Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=mu^- single histo fit, 8=non muSR fit Int_t fDataRange[4]; ///< data bin range (fit type 0, 2, 4) - PDoubleVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type + PDoubleVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ... + vector fAddT0; ///< addt0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ... Bool_t fFitRangeInBins; ///< flag telling if fit range is given in time or in bins Double_t fFitRange[2]; ///< fit range in (us) Int_t fFitRangeOffset[2]; ///< if fit range is given in bins it can have the form fit fgb+n0 lgb-n1. This variable holds the n0 and n1.