From 4a832f6fe823513c9645fceb11d8ddbe583fca9a Mon Sep 17 00:00:00 2001 From: nemu Date: Mon, 22 Dec 2008 10:26:42 +0000 Subject: [PATCH] various little extensions to handle Fourier --- src/classes/PMusrCanvas.cpp | 16 +++++++++++++--- src/classes/PStartupHandler.cpp | 19 +++++++++++++++++++ src/include/PMusr.h | 1 + src/include/PStartupHandler.h | 2 +- src/musrfit_startup.xml | 1 + 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 17e51170..2ab8cd3a 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -330,12 +330,13 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) HandleDifference(); } else if (x == 'f') { if (fPlotType != MSR_PLOT_NON_MUSR) { + HandleFourier(-1); cout << endl << ">> will show the Fourier transform, to be implemented yet." << endl; } } else if (x == '+') { - cout << endl << ">> if Fourier is shown, will add +1° to the Fourier." << endl; + cout << endl << ">> if Fourier is shown, will add " << fFourier->fPhaseIncerement << "° to the Fourier." << endl; } else if (x == '-') { - cout << endl << ">> if Fourier is shown, will add -1° to the Fourier." << endl; + cout << endl << ">> if Fourier is shown, will subtract " << fFourier->fPhaseIncerement << "° to the Fourier." << endl; } else { // do all the necessary stuff **TO BE DONE** fMainCanvas->Update(); @@ -2007,7 +2008,16 @@ void PMusrCanvas::SaveDataDb() */ void PMusrCanvas::HandleFourier(int tag) { - switch (tag) { + if (fMsrHandler->GetMsrFourierList()->fFourierBlockPresent) { +cout << endl << ">> fourier block in msr-file present" << endl; + fFourier = fMsrHandler->GetMsrFourierList(); + } + + if (tag == -1) { // called via cmd key 'f' + tag = fFourier->fPlotTag; + } + + switch (tag) { // called via popup menu case FOURIER_PLOT_REAL: cout << endl << ">> will handle Real Part Fourier ..." << endl; break; diff --git a/src/classes/PStartupHandler.cpp b/src/classes/PStartupHandler.cpp index d639031b..3e625aa0 100644 --- a/src/classes/PStartupHandler.cpp +++ b/src/classes/PStartupHandler.cpp @@ -85,6 +85,7 @@ void PStartupHandler::OnStartDocument() fFourierDefaults.fRangeForPhaseCorrection[1] = 0.0; fFourierDefaults.fPlotRange[0] = 0.0; fFourierDefaults.fPlotRange[1] = 0.0; + fFourierDefaults.fPhaseIncerement = 1.0; } //-------------------------------------------------------------------------- @@ -126,6 +127,8 @@ void PStartupHandler::OnStartElement(const char *str, const TList *attributes) fKey = ePlot; } else if (!strcmp(str, "phase")) { fKey = ePhase; + } else if (!strcmp(str, "phase_increment")) { + fKey = ePhaseIncrement; } } @@ -291,6 +294,22 @@ void PStartupHandler::OnCharacters(const char *str) } break; case ePhase: + tstr = TString(str); + if (tstr.IsFloat()) { + fFourierDefaults.fPhase = tstr.Atof(); + } else { + cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase, will ignore it."; + cout << endl; + } + break; + case ePhaseIncrement: + tstr = TString(str); + if (tstr.IsFloat()) { + fFourierDefaults.fPhaseIncerement = tstr.Atof(); + } else { + cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase increment, will ignore it."; + cout << endl; + } break; default: break; diff --git a/src/include/PMusr.h b/src/include/PMusr.h index 0038fa67..5a488e65 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -293,6 +293,7 @@ typedef struct { double fPhase; ///< phase double fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction double fPlotRange[2]; ///< field/frequency plot range + double fPhaseIncerement; ///< phase increment for manual phase optimization } PMsrFourierStructure; //------------------------------------------------------------- diff --git a/src/include/PStartupHandler.h b/src/include/PStartupHandler.h index 4c14e2ac..5bbcc732 100644 --- a/src/include/PStartupHandler.h +++ b/src/include/PStartupHandler.h @@ -65,7 +65,7 @@ class PStartupHandler : public TObject, public TQObject private: enum EKeyWords {eEmpty, eComment, eDataPath, - eFourierSettings, eUnits, eFourierPower, eApodization, ePlot, ePhase, + eFourierSettings, eUnits, eFourierPower, eApodization, ePlot, ePhase, ePhaseIncrement, eRootSettings, eMarkerList, eMarker, eColorList, eColor}; EKeyWords fKey; diff --git a/src/musrfit_startup.xml b/src/musrfit_startup.xml index 04bef1da..0f330ce4 100644 --- a/src/musrfit_startup.xml +++ b/src/musrfit_startup.xml @@ -12,6 +12,7 @@ none real_and_imag 0.0 + 1.0