allow multiple Fourier phase parameters for phase shifted real Fourier. Autophasing still missing.

This commit is contained in:
2018-10-15 16:09:17 +02:00
parent e9e39bb8a6
commit 357d46aac4
7 changed files with 436 additions and 70 deletions

View File

@@ -154,7 +154,6 @@ PMusrCanvas::PMusrCanvas()
InitFourier();
InitAverage();
fCurrentFourierPhase = fFourier.fPhaseIncrement;
fCurrentFourierPhaseText = 0;
fRRFText = 0;
@@ -207,7 +206,6 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
CreateStyle();
InitMusrCanvas(title, wtopx, wtopy, ww, wh);
fCurrentFourierPhase = 0.0;
fCurrentFourierPhaseText = 0;
fRRFText = 0;
@@ -264,7 +262,6 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
CreateStyle();
InitMusrCanvas(title, wtopx, wtopy, ww, wh);
fCurrentFourierPhase = 0.0;
fCurrentFourierPhaseText = 0;
fRRFText = 0;
@@ -324,10 +321,6 @@ PMusrCanvas::~PMusrCanvas()
CleanupDataSet(fNonMusrData[i]);
fNonMusrData.clear();
}
if (fCurrentFourierPhaseText) {
delete fCurrentFourierPhaseText;
fCurrentFourierPhaseText = 0;
}
if (fMultiGraphLegend) {
fMultiGraphLegend->Clear();
delete fMultiGraphLegend;
@@ -396,9 +389,8 @@ void PMusrCanvas::SetMsrHandler(PMsrHandler *msrHandler)
if (fMsrHandler->GetMsrFourierList()->fPlotTag != FOURIER_PLOT_NOT_GIVEN) {
fFourier.fPlotTag = fMsrHandler->GetMsrFourierList()->fPlotTag;
}
if (fMsrHandler->GetMsrFourierList()->fPhase != -999.0) {
fFourier.fPhase = fMsrHandler->GetMsrFourierList()->fPhase;
}
fFourier.fPhase = fMsrHandler->GetMsrFourierList()->fPhase;
if ((fMsrHandler->GetMsrFourierList()->fRangeForPhaseCorrection[0] != -1.0) &&
(fMsrHandler->GetMsrFourierList()->fRangeForPhaseCorrection[1] != -1.0)) {
fFourier.fRangeForPhaseCorrection[0] = fMsrHandler->GetMsrFourierList()->fRangeForPhaseCorrection[0];
@@ -2314,7 +2306,8 @@ void PMusrCanvas::InitFourier()
fFourier.fFourierPower = 0; // no zero padding
fFourier.fApodization = FOURIER_APOD_NONE; // no apodization
fFourier.fPlotTag = FOURIER_PLOT_REAL_AND_IMAG; // initial plot tag, plot real and imaginary part
fFourier.fPhase = 0.0; // fourier phase 0°
fFourier.fPhaseParamNo.clear();
fFourier.fPhase.clear();
for (UInt_t i=0; i<2; i++) {
fFourier.fRangeForPhaseCorrection[i] = -1.0; // frequency range for phase correction, default: {-1, -1} = NOT GIVEN
fFourier.fPlotRange[i] = -1.0; // fourier plot range, default: {-1, -1} = NOT GIVEN
@@ -3471,13 +3464,20 @@ void PMusrCanvas::HandleFourier()
}
// apply global phase if present
if (fFourier.fPhase != 0.0) {
const double cp = TMath::Cos(fFourier.fPhase/180.0*TMath::Pi());
const double sp = TMath::Sin(fFourier.fPhase/180.0*TMath::Pi());
if (fFourier.fPhase.size() != 0.0) {
double cp;
double sp;
fCurrentFourierPhase = fFourier.fPhase;
for (UInt_t i=0; i<fData.size(); i++) { // loop over all data sets
if (fFourier.fPhase.size() == 1) {
cp = TMath::Cos(fFourier.fPhase[0]/180.0*TMath::Pi());
sp = TMath::Sin(fFourier.fPhase[0]/180.0*TMath::Pi());
} else {
cp = TMath::Cos(fFourier.fPhase[i]/180.0*TMath::Pi());
sp = TMath::Sin(fFourier.fPhase[i]/180.0*TMath::Pi());
}
if ((fData[i].dataFourierRe != 0) && (fData[i].dataFourierIm != 0)) {
for (Int_t j=0; j<fData[i].dataFourierRe->GetNbinsX(); j++) { // loop over a fourier data set
// calculate new fourier data set value
@@ -3574,16 +3574,23 @@ void PMusrCanvas::HandleDifferenceFourier()
fData[i].diffFourierTag = 1; // d-f
}
// apply global phase
if (fFourier.fPhase != 0.0) {
// apply phase
if (fFourier.fPhase.size() != 0.0) {
double re, im;
const double cp = TMath::Cos(fFourier.fPhase/180.0*TMath::Pi());
const double sp = TMath::Sin(fFourier.fPhase/180.0*TMath::Pi());
double cp;
double sp;
fCurrentFourierPhase = fFourier.fPhase;
for (UInt_t i=0; i<fData.size(); i++) { // loop over all data sets
if ((fData[i].diffFourierRe != 0) && (fData[i].diffFourierIm != 0)) {
if (fFourier.fPhase.size() == 1) {
cp = TMath::Cos(fFourier.fPhase[0]/180.0*TMath::Pi());
sp = TMath::Sin(fFourier.fPhase[0]/180.0*TMath::Pi());
} else {
cp = TMath::Cos(fFourier.fPhase[i]/180.0*TMath::Pi());
sp = TMath::Sin(fFourier.fPhase[i]/180.0*TMath::Pi());
}
for (Int_t j=0; j<fData[i].diffFourierRe->GetNbinsX(); j++) { // loop over a fourier data set
// calculate new fourier data set value
re = fData[i].diffFourierRe->GetBinContent(j) * cp + fData[i].diffFourierIm->GetBinContent(j) * sp;
@@ -6046,7 +6053,10 @@ void PMusrCanvas::PlotFourierPhaseValue(Bool_t unzoom)
// plot Fourier phase
str = TString("phase = ");
str += fCurrentFourierPhase;
str += fCurrentFourierPhase[0];
if (fFourier.fPhase.size() > 1) { // if more than one phase is present, do NOT plot phase info
str = TString("");
}
x = 0.7;
y = 0.85;
fCurrentFourierPhaseText = new TLatex();
@@ -6298,7 +6308,8 @@ void PMusrCanvas::IncrementFourierPhase()
const double cp = TMath::Cos(fFourier.fPhaseIncrement/180.0*TMath::Pi());
const double sp = TMath::Sin(fFourier.fPhaseIncrement/180.0*TMath::Pi());
fCurrentFourierPhase += fFourier.fPhaseIncrement;
for (UInt_t i=0; i<fCurrentFourierPhase.size(); i++)
fCurrentFourierPhase[i] += fFourier.fPhaseIncrement;
PlotFourierPhaseValue();
for (UInt_t i=0; i<fData.size(); i++) { // loop over all data sets
@@ -6350,7 +6361,8 @@ void PMusrCanvas::DecrementFourierPhase()
const double cp = TMath::Cos(fFourier.fPhaseIncrement/180.0*TMath::Pi());
const double sp = TMath::Sin(fFourier.fPhaseIncrement/180.0*TMath::Pi());
fCurrentFourierPhase -= fFourier.fPhaseIncrement;
for (UInt_t i=0; i<fCurrentFourierPhase.size(); i++)
fCurrentFourierPhase[i] -= fFourier.fPhaseIncrement;
PlotFourierPhaseValue();
for (UInt_t i=0; i<fData.size(); i++) { // loop over all data sets