musrview gets the new feature: calculate theory points only at data points.

Conflicts:
	doc/html/searchindex.js
	doc/html/setup-dks.html
	src/classes/PMusrCanvas.cpp
	src/include/PMusrCanvas.h
	src/musrview.cpp
This commit is contained in:
2020-08-29 11:15:02 +02:00
parent ae105bacb4
commit 3b5060c061
75 changed files with 5223 additions and 35364 deletions

View File

@@ -189,9 +189,10 @@ PMusrCanvas::PMusrCanvas()
*/
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, const Bool_t avg, const Bool_t useDKS) :
fStartWithFourier(fourier), fStartWithAvg(avg), fUseDKS(useDKS),
fBatchMode(batch), fPlotNumber(number)
const Bool_t batch, const Bool_t fourier, const Bool_t avg,
const Bool_t theoAsData, const Bool_t useDKS) :
fTheoAsData(theoAsData), fStartWithFourier(fourier), fStartWithAvg(avg),
fUseDKS(useDKS), fBatchMode(batch), fPlotNumber(number)
{
fTimeout = 0;
fTimeoutTimer = nullptr;
@@ -246,8 +247,9 @@ PMusrCanvas::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, const Bool_t avg, const Bool_t useDKS) :
fStartWithFourier(fourier), fStartWithAvg(avg), fUseDKS(useDKS),
const Bool_t batch, const Bool_t fourier, const Bool_t avg,
const Bool_t theoAsData, const Bool_t useDKS) :
fTheoAsData(theoAsData), fStartWithFourier(fourier), fStartWithAvg(avg), fUseDKS(useDKS),
fBatchMode(batch), fPlotNumber(number), fFourier(fourierDefault),
fMarkerList(markerList), fColorList(colorList)
{
@@ -3469,27 +3471,35 @@ void PMusrCanvas::HandleFourier()
fData[i].dataFourierPhase->SetMarkerStyle(fData[i].data->GetMarkerStyle());
// calculate fourier transform of the theory
Int_t powerPad = (Int_t)round(log((endTime-startTime)/fData[i].theory->GetBinWidth(1))/log(2))+3;
Bool_t useFFTW = true;
PFourier *fourierTheory = nullptr;
if (fTheoAsData) { // theory only at the data points
fourierTheory = new PFourier(fData[i].theory, fFourier.fUnits, startTime, endTime, fFourier.fDCCorrected, fFourier.fFourierPower, useFFTW);
} else {
Int_t powerPad = fFourier.fFourierPower+5; // +5 means 8 times more points on theo (+3) + 4 times more points in fourier (+2)
#ifdef HAVE_DKS
if ((powerPad >= 20) && fUseDKS)
useFFTW = false; // i.e. use DKS
if ((powerPad >= 20) && fUseDKS)
useFFTW = false; // i.e. use DKS
#endif
PFourier fourierTheory(fData[i].theory, fFourier.fUnits, startTime, endTime, fFourier.fDCCorrected, powerPad, useFFTW);
if (!fourierTheory.IsValid()) {
fourierTheory = new PFourier(fData[i].theory, fFourier.fUnits, startTime, endTime, fFourier.fDCCorrected, powerPad, useFFTW);
}
if (!fourierTheory->IsValid()) {
std::cerr << std::endl << ">> PMusrCanvas::HandleFourier(): **SEVERE ERROR** couldn't invoke PFourier to calculate the Fourier theory ..." << std::endl;
return;
}
fourierTheory.Transform(fFourier.fApodization);
fourierTheory->Transform(fFourier.fApodization);
scale = sqrt(fData[0].theory->GetBinWidth(1)/(endTime-startTime)*fData[0].theory->GetBinWidth(1)/fData[0].data->GetBinWidth(1));
// get real part of the data
fData[i].theoryFourierRe = fourierTheory.GetRealFourier(scale);
fData[i].theoryFourierRe = fourierTheory->GetRealFourier(scale);
// get imaginary part of the data
fData[i].theoryFourierIm = fourierTheory.GetImaginaryFourier(scale);
fData[i].theoryFourierIm = fourierTheory->GetImaginaryFourier(scale);
// get power part of the data
fData[i].theoryFourierPwr = fourierTheory.GetPowerFourier(scale);
fData[i].theoryFourierPwr = fourierTheory->GetPowerFourier(scale);
// get phase part of the data
fData[i].theoryFourierPhase = fourierTheory.GetPhaseFourier();
fData[i].theoryFourierPhase = fourierTheory->GetPhaseFourier();
// clean up
delete fourierTheory;
// set line colors for the theory
fData[i].theoryFourierRe->SetLineColor(fData[i].theory->GetLineColor());