Merged master into beta-NMR

This commit is contained in:
Zaher Salman
2018-12-18 10:01:28 +01:00
49 changed files with 1603 additions and 266 deletions

View File

@@ -28,6 +28,7 @@
***************************************************************************/
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
@@ -152,7 +153,6 @@ PMusrCanvas::PMusrCanvas()
InitFourier();
InitAverage();
fCurrentFourierPhase = fFourier.fPhaseIncrement;
fCurrentFourierPhaseText = 0;
fRRFText = 0;
@@ -205,7 +205,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;
@@ -262,7 +261,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;
@@ -322,10 +320,6 @@ PMusrCanvas::~PMusrCanvas()
CleanupDataSet(fNonMusrData[i]);
fNonMusrData.clear();
}
if (fCurrentFourierPhaseText) {
delete fCurrentFourierPhaseText;
fCurrentFourierPhaseText = 0;
}
if (fMultiGraphLegend) {
fMultiGraphLegend->Clear();
delete fMultiGraphLegend;
@@ -394,9 +388,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];
@@ -2221,10 +2214,10 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
// write data/theory
for (UInt_t j=0; j<dumpVector.size()-1; j++) {
if (i<dumpVector[j].dataX.size()) {
fout << dumpVector[j].dataX[i] << ", ";
fout << dumpVector[j].data[i] << ", ";
fout << setprecision(9) << dumpVector[j].dataX[i] << ", ";
fout << setprecision(9) << dumpVector[j].data[i] << ", ";
if (dumpVector[j].dataErr.size() > 0)
fout << dumpVector[j].dataErr[i] << ", ";
fout << setprecision(9) << dumpVector[j].dataErr[i] << ", ";
} else {
if (dumpVector[j].dataErr.size() > 0)
fout << " , , , ";
@@ -2234,8 +2227,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
}
// write last data/theory entry
if (i<dumpVector[dumpVector.size()-1].dataX.size()) {
fout << dumpVector[dumpVector.size()-1].dataX[i] << ", ";
fout << dumpVector[dumpVector.size()-1].data[i];
fout << setprecision(9) << dumpVector[dumpVector.size()-1].dataX[i] << ", ";
fout << setprecision(9) << dumpVector[dumpVector.size()-1].data[i];
} else {
fout << " , ";
}
@@ -2326,7 +2319,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
@@ -3480,13 +3474,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
@@ -3583,16 +3584,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;
@@ -6074,7 +6082,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();
@@ -6336,7 +6347,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
@@ -6388,7 +6400,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