resolved merge conflicts with master

This commit is contained in:
2016-12-23 14:16:22 +01:00
54 changed files with 2297 additions and 829 deletions

View File

@@ -35,6 +35,8 @@
#endif
#ifndef HAVE_DKS
#include <vector>
using namespace std;
#include "fftw3.h"
#else
#include <complex>
@@ -42,6 +44,8 @@ using namespace std;
#include "DKSBase.h"
#endif
#include "Minuit2/FCNBase.h"
#include "PMusr.h"
#define F_APODIZATION_NONE 1
@@ -49,6 +53,52 @@ using namespace std;
#define F_APODIZATION_MEDIUM 3
#define F_APODIZATION_STRONG 4
/**
* Re Fourier phase correction
*/
class PFTPhaseCorrection : public ROOT::Minuit2::FCNBase
{
public:
PFTPhaseCorrection(const Int_t minBin=-1, const Int_t maxBin=-1);
PFTPhaseCorrection(vector<Double_t> &reFT, vector<Double_t> &imFT, const Int_t minBin=-1, const Int_t maxBin=-1);
virtual ~PFTPhaseCorrection() {}
virtual Bool_t IsValid() { return fValid; }
virtual void Minimize();
virtual void SetGamma(const Double_t gamma) { fGamma = gamma; }
virtual void SetPh(const Double_t c0, const Double_t c1) { fPh_c0 = c0; fPh_c1 = c1; CalcPhasedFT(); CalcRealPhFTDerivative(); }
virtual Double_t GetGamma() { return fGamma; }
virtual Double_t GetPhaseCorrectionParam(UInt_t idx);
virtual Double_t GetMinimum();
private:
Bool_t fValid;
vector<Double_t> fReal; /// original real Fourier data set
vector<Double_t> fImag; /// original imag Fourier data set
mutable vector<Double_t> fRealPh; /// phased real Fourier data set
mutable vector<Double_t> fImagPh; /// phased imag Fourier data set
mutable vector<Double_t> fRealPhD; /// 1st derivative of fRealPh
Double_t fMinBin; /// minimum bin from Fourier range to be used for the phase correction estimate
Double_t fMaxBin; /// maximum bin from Fourier range to be used for the phase correction estimate
mutable Double_t fPh_c0; /// constant part of the phase dispersion used for the phase correction
mutable Double_t fPh_c1; /// linear part of the phase dispersion used for the phase correction
Double_t fGamma; /// gamma parameter to balance between entropy and penalty
Double_t fMin; /// keeps the minimum of the entropy/penalty minimization
virtual void Init();
virtual void CalcPhasedFT() const;
virtual void CalcRealPhFTDerivative() const;
virtual Double_t Penalty() const;
virtual Double_t Entropy() const;
virtual Double_t Up() const { return 1.0; }
virtual Double_t operator()(const vector<Double_t>&) const;
};
/**
* muSR Fourier class.
*/
@@ -70,11 +120,13 @@ class PFourier
virtual Double_t GetResolution() { return fResolution; }
virtual Double_t GetMaxFreq();
virtual TH1F* GetRealFourier(const Double_t scale = 1.0);
virtual TH1F* GetPhaseOptRealFourier(Double_t &phase, const Double_t scale = 1.0, const Double_t min = -1.0, const Double_t max = -1.0);
virtual TH1F* GetImaginaryFourier(const Double_t scale = 1.0);
virtual TH1F* GetPowerFourier(const Double_t scale = 1.0);
virtual TH1F* GetPhaseFourier(const Double_t scale = 1.0);
static TH1F* GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Double_t> &phase,
const Double_t scale = 1.0, const Double_t min = -1.0, const Double_t max = -1.0);
virtual Bool_t IsValid() { return fValid; }
virtual Bool_t IsUseFFTW() { return fUseFFTW; }

View File

@@ -71,7 +71,7 @@ typedef struct {
TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhaseOptReal; ///< phase otpimized real Fourier transform of the data histogram
Double_t optPhase; ///< optimal phase which maximizes the real Fourier
vector<Double_t> optPhase; ///< optimal phase which maximizes the real Fourier
} PFourierCanvasDataSet;
//------------------------------------------------------------------------
@@ -159,6 +159,7 @@ class PFourierCanvas : public TObject, public TQObject
virtual void InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
virtual void CleanupAverage();
virtual void HandleAverage();
virtual void CalcPhaseOptReal();
virtual void PlotFourier();
virtual void PlotFourierPhaseValue();

View File

@@ -109,7 +109,6 @@ class PMsrHandler
virtual void GetGroupingString(Int_t runNo, TString detector, TString &groupingStr);
virtual Bool_t EstimateN0();
virtual Double_t GetAlphaEstimateN0();
virtual std::string GetDKSTheoryString();
virtual UInt_t GetDKSTag();

View File

@@ -822,13 +822,12 @@ typedef struct {
//-------------------------------------------------------------
/**
* <p>Holds the informations for the any2many converter program
* <p>Holds information given at startup
*/
typedef struct {
Bool_t writeExpectedChisq; ///< if set to true, expected chisq per block will be written
Bool_t estimateN0; ///< if set to true, for single histogram fits N0 will be estimated
Double_t alphaEstimateN0; ///< relates the Bkg to N0, i.e. Bkg = alpha*N0
Bool_t useDKS; ///< if set to true, use DKS if present and "sensible"
Bool_t writeExpectedChisq; ///< if set to true, expected chisq and chisq per block will be written (from command line)
Bool_t estimateN0; ///< if set to true, for single histogram fits N0 will be estimated (from command line)
Bool_t useDKS; ///< if set to true, use DKS if present and "sensible" (from xml)
} PStartupOptions;
//-------------------------------------------------------------

View File

@@ -55,12 +55,13 @@
#define XTHEO 0.75
// Current Plot Views
#define PV_DATA 1
#define PV_FOURIER_REAL 2
#define PV_FOURIER_IMAG 3
#define PV_FOURIER_REAL_AND_IMAG 4
#define PV_FOURIER_PWR 5
#define PV_FOURIER_PHASE 6
#define PV_DATA 1
#define PV_FOURIER_REAL 2
#define PV_FOURIER_IMAG 3
#define PV_FOURIER_REAL_AND_IMAG 4
#define PV_FOURIER_PWR 5
#define PV_FOURIER_PHASE 6
#define PV_FOURIER_PHASE_OPT_REAL 7
// Canvas menu id's
#define P_MENU_ID_DATA 10001
@@ -71,13 +72,14 @@
#define P_MENU_PLOT_OFFSET 1000
#define P_MENU_ID_FOURIER_REAL 100
#define P_MENU_ID_FOURIER_IMAG 101
#define P_MENU_ID_FOURIER_REAL_AND_IMAG 102
#define P_MENU_ID_FOURIER_PWR 103
#define P_MENU_ID_FOURIER_PHASE 104
#define P_MENU_ID_FOURIER_PHASE_PLUS 105
#define P_MENU_ID_FOURIER_PHASE_MINUS 106
#define P_MENU_ID_FOURIER_REAL 100
#define P_MENU_ID_FOURIER_IMAG 101
#define P_MENU_ID_FOURIER_REAL_AND_IMAG 102
#define P_MENU_ID_FOURIER_PWR 103
#define P_MENU_ID_FOURIER_PHASE 104
#define P_MENU_ID_FOURIER_PHASE_OPT_REAL 105
#define P_MENU_ID_FOURIER_PHASE_PLUS 106
#define P_MENU_ID_FOURIER_PHASE_MINUS 107
//------------------------------------------------------------------------
/**
@@ -122,16 +124,19 @@ typedef struct {
TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhaseOptReal; ///< phase optimized real part spectrum Fourier transform of the data histogram
TH1F *theory; ///< theory histogram belonging to the data histogram
TH1F *theoryFourierRe; ///< real part of the Fourier transform of the theory histogram
TH1F *theoryFourierIm; ///< imaginary part of the Fourier transform of the theory histogram
TH1F *theoryFourierPwr; ///< power spectrum of the Fourier transform of the theory histogram
TH1F *theoryFourierPhase; ///< phase spectrum of the Fourier transform of the theory histogram
TH1F *theoryFourierPhaseOptReal; ///< phase optimized real part spectrum Fourier transform of the theory histogram
TH1F *diff; ///< difference histogram, i.e. data-theory
TH1F *diffFourierRe; ///< real part of the Fourier transform of the diff histogram
TH1F *diffFourierIm; ///< imaginary part of the Fourier transform of the diff histogram
TH1F *diffFourierPwr; ///< power spectrum of the Fourier transform of the diff histogram
TH1F *diffFourierPhase; ///< phase spectrum of the Fourier transform of the diff histogram
TH1F *diffFourierPhaseOptReal; ///< phase optimized real part spectrum Fourier transform of the diff histogram
PMusrCanvasPlotRange *dataRange; ///< keep the msr-file plot data range
UInt_t diffFourierTag; ///< 0=not relevant, 1=d-f (Fourier of difference time spectra), 2=f-d (difference of Fourier spectra)
} PMusrCanvasDataSet;
@@ -201,12 +206,12 @@ class PMusrCanvas : public TObject, public TQObject
PMusrCanvas();
PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch,
const Bool_t fourier=false, const Bool_t useDKS=false);
const Bool_t fourier=false, const Bool_t avg=false, const Bool_t useDKS=false);
PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
PMsrFourierStructure fourierDefault,
const PIntVector markerList, const PIntVector colorList, const Bool_t batch,
const Bool_t fourier=false, const Bool_t useDKS=false);
const Bool_t fourier=false, const Bool_t avg=false, const Bool_t useDKS=false);
virtual ~PMusrCanvas();
virtual Bool_t IsValid() { return fValid; }
@@ -231,6 +236,7 @@ class PMusrCanvas : public TObject, public TQObject
private:
Bool_t fStartWithFourier; ///< flag if true, the Fourier transform will be presented bypassing the time domain representation
Bool_t fStartWithAvg; ///< flag if true, the averaged data/Fourier will be presented
Bool_t fUseDKS; ///< flag if true, use DKS if it is enabled
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
Bool_t fScaleN0AndBkg; ///< true=N0 and background is scaled to (1/ns), otherwise (1/bin) for the single histogram case
@@ -303,12 +309,12 @@ class PMusrCanvas : public TObject, public TQObject
virtual void HandleDifferenceFourier();
virtual void HandleFourierDifference();
virtual void HandleAverage();
virtual Double_t FindOptimalFourierPhase();
virtual void CleanupDifference();
virtual void CleanupFourier();
virtual void CleanupFourierDifference();
virtual void CleanupAverage();
virtual void CalcPhaseOptReFT();
virtual Double_t CalculateDiff(const Double_t x, const Double_t y, TH1F *theo);
virtual Double_t CalculateDiff(const Double_t x, const Double_t y, TGraphErrors *theo);
virtual Int_t FindBin(const Double_t x, TGraphErrors *graph);

View File

@@ -95,6 +95,9 @@ 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 Double_t GetSingleHistoMaximumLikelihoodExpected(const std::vector<Double_t>& par, const UInt_t idx) const;
virtual Double_t GetSingleRunMaximumLikelihood(const std::vector<Double_t>& par, const UInt_t idx) const;
virtual UInt_t GetNoOfBinsFitted(const UInt_t idx) const;
virtual UInt_t GetTotalNoOfBinsFitted() const;

View File

@@ -45,6 +45,7 @@ class PRunSingleHisto : public PRunBase
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 Double_t CalcMaxLikelihoodExpected(const std::vector<Double_t>& par);
virtual void CalcTheory();
virtual UInt_t GetNoOfFitBins();

View File

@@ -79,11 +79,10 @@ class PStartupHandler : public TObject, public TQObject
virtual const PIntVector GetMarkerList() const { return fMarkerList; } ///< returns the marker list
virtual const PIntVector GetColorList() const { return fColorList; } ///< returns the color list
virtual void SetStartupOptions(const PStartupOptions opt) { fStartupOptions = opt; }
private:
enum EKeyWords {eEmpty, eComment, eDataPath, eOptions, eWritePerRunBlockChisq, eEstimateN0, eAlphaEstimateN0, eUseDKS,
eFourierSettings, eUnits, eFourierPower, eApodization, ePlot, ePhase, ePhaseIncrement,
enum EKeyWords {eEmpty, eComment, eDataPath, eOptions, eUseDKS,
eFourierSettings, eUnits, eFourierPower,
eApodization, ePlot, ePhase, ePhaseIncrement,
eRootSettings, eMarkerList, eMarker,
eColorList, eColor};
EKeyWords fKey; ///< xml filter key