diff --git a/ChangeLog b/ChangeLog index 909699b4..60c674e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ changes since 0.13.0 =================================== +NEW 2015-02-20 add a switch to musrview that it plots initially the Fouier data rather + than the time domain data. NEW 2015-02-19 added a first preliminary user interface for musrFT within musredit. NEW 2015-02-16 changed the data export handling from musrview. It is now more main line and follows the implementation of musrFT. diff --git a/configure.ac b/configure.ac index 1b82b9a2..d91c0836 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_REVISION([m4_esyscmd_s([git describe --always])]) AC_PREREQ(2.63) -AC_INIT([musrfit],[0.13.0],[andreas.suter@psi.ch]) +AC_INIT([musrfit],[0.14.0],[andreas.suter@psi.ch]) AC_CONFIG_AUX_DIR(admin) AC_CANONICAL_HOST #AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}]) @@ -35,7 +35,7 @@ dnl ----------------------------------------------- #release versioning MUSR_MAJOR_VERSION=0 -MUSR_MINOR_VERSION=13 +MUSR_MINOR_VERSION=14 MUSR_MICRO_VERSION=0 #release versioning diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 0819bd22..226374aa 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -2861,29 +2861,6 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) fGlobal = global; } -/* - cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fittype : " << fGlobal.GetFitType(); - cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: data bin range: "; - for (UInt_t i=0; i<4; i++) { - cout << fGlobal.GetDataRange(i) << ", "; - } - cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: t0's : "; - for (UInt_t i=0; i PMsrHandler::HandleGlobalEntry: Global: addt0's : "; - for (UInt_t i=0; i --> " << i << ": "; - for (UInt_t j=0; j<(UInt_t)fGlobal.GetAddT0BinSize(i); j++) { - cout << fGlobal.GetAddT0Bin(i,j) << ", "; - } - } - cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit in bin: " << fGlobal.IsFitRangeInBin(); - cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit offset: " << fGlobal.GetFitRangeOffset(0) << ", " << fGlobal.GetFitRangeOffset(1); - cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit : " << fGlobal.GetFitRange(0) << ", " << fGlobal.GetFitRange(1); - cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: packing : " << fGlobal.GetPacking(); - cout << endl; -*/ - return !error; } diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 9cdbe4d3..bb553957 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -185,8 +185,8 @@ 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) : - fBatchMode(batch), fPlotNumber(number) + const Bool_t batch, const Bool_t fourier) : + fStartWithFourier(fourier), fBatchMode(batch), fPlotNumber(number) { fTimeout = 0; fTimeoutTimer = 0; @@ -240,8 +240,8 @@ 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) : - fBatchMode(batch), + const Bool_t batch, const Bool_t fourier) : + fStartWithFourier(fourier), fBatchMode(batch), fPlotNumber(number), fFourier(fourierDefault), fMarkerList(markerList), fColorList(colorList) { @@ -707,7 +707,49 @@ void PMusrCanvas::UpdateDataTheoryPad() } // generate the histo plot - PlotData(); + if (!fStartWithFourier || (fPlotType == MSR_PLOT_NON_MUSR)) { + PlotData(); + } else { // show Fourier straight ahead. + // set the menu properly + fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber); + + // filter proper Fourier plot tag, and set the menu tags properly + switch (fFourier.fPlotTag) { + case FOURIER_PLOT_REAL: + fCurrentPlotView = PV_FOURIER_REAL; + fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL); + fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS); + fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS); + break; + case FOURIER_PLOT_IMAG: + fCurrentPlotView = PV_FOURIER_IMAG; + fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG); + fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS); + fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS); + break; + case FOURIER_PLOT_REAL_AND_IMAG: + fCurrentPlotView = PV_FOURIER_REAL_AND_IMAG; + fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL_AND_IMAG); + fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS); + fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS); + break; + case FOURIER_PLOT_POWER: + fCurrentPlotView = PV_FOURIER_PWR; + fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR); + break; + case FOURIER_PLOT_PHASE: + fCurrentPlotView = PV_FOURIER_PHASE; + fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE); + break; + default: + fCurrentPlotView = PV_FOURIER_PWR; + fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR); + break; + } + + HandleFourier(); + PlotFourier(); + } } //-------------------------------------------------------------------------- @@ -3351,10 +3393,14 @@ void PMusrCanvas::HandleFourier() // check if fourier needs to be calculated if (fData[0].dataFourierRe == 0) { Int_t bin; - bin = fHistoFrame->GetXaxis()->GetFirst(); - double startTime = fHistoFrame->GetBinCenter(bin); - bin = fHistoFrame->GetXaxis()->GetLast(); - double endTime = fHistoFrame->GetBinCenter(bin); + double startTime = fXmin; + double endTime = fXmax; + if (!fStartWithFourier) { // fHistoFrame presen, hence get start/end from it + bin = fHistoFrame->GetXaxis()->GetFirst(); + startTime = fHistoFrame->GetBinCenter(bin); + bin = fHistoFrame->GetXaxis()->GetLast(); + endTime = fHistoFrame->GetBinCenter(bin); + } for (UInt_t i=0; isetTitleFromDataFileFlag(flag); break; + case eMusrviewShowFourier: + if (str == "y") + flag = true; + else + flag = false; + fAdmin->setMusrviewShowFourierFlag(flag); + break; case eEnableMusrT0: if (str == "y") flag = true; @@ -603,6 +612,8 @@ PAdmin::PAdmin() : QObject() fInstitute = QString(""); fFileFormat = QString(""); + fMusrviewShowFourier = false; + fTitleFromDataFile = false; fEnableMusrT0 = false; fLifetimeCorrection = true; diff --git a/src/musredit/PAdmin.h b/src/musredit/PAdmin.h index e4071085..998a0e3a 100644 --- a/src/musredit/PAdmin.h +++ b/src/musredit/PAdmin.h @@ -69,7 +69,7 @@ class PAdminXMLParser : public QXmlDefaultHandler private: enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot, - eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eEnableMusrT0, + eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eMusrviewShowFourier, eEnableMusrT0, eFontName, eFontSize, eExecPath, eDefaultSavePath, eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel, @@ -118,6 +118,7 @@ class PAdmin : public QObject QString getExecPath() { return fExecPath; } QString getDefaultSavePath() { return fDefaultSavePath; } bool getTitleFromDataFileFlag() { return fTitleFromDataFile; } + bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; } bool getEnableMusrT0Flag() { return fEnableMusrT0; } bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; } bool getDumpAsciiFlag() { return fDumpAscii; } @@ -139,6 +140,7 @@ class PAdmin : public QObject void setTimeout(const int ival) { fTimeout = ival; } void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; } + void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; } void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; } void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; } void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; } @@ -180,13 +182,14 @@ class PAdmin : public QObject QVector fRecentFile; ///< keep vector of recent path-file names - bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no) - bool fDumpAscii; ///< flag indicating if musrfit shall make an ascii-dump file (for debugging purposes, default: no). - bool fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no). - bool fTitleFromDataFile; ///< flag indicating if the title should be extracted from the data file (default: yes). - bool fChisqPreRunBlock; ///< flag indicating if musrfit shall write 'per run block' chisq to the msr-file (default: no). - bool fEstimateN0; ///< flag indicating if musrfit shall estimate N0 for single histogram fits (default: yes). - bool fEnableMusrT0; ///< flag indicating if musrT0 shall be enabled at startup from within musredit (default: yes). + bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true). + bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no) + bool fDumpAscii; ///< flag indicating if musrfit shall make an ascii-dump file (for debugging purposes, default: no). + bool fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no). + bool fTitleFromDataFile; ///< flag indicating if the title should be extracted from the data file (default: yes). + bool fChisqPreRunBlock; ///< flag indicating if musrfit shall write 'per run block' chisq to the msr-file (default: no). + bool fEstimateN0; ///< flag indicating if musrfit shall estimate N0 for single histogram fits (default: yes). + bool fEnableMusrT0; ///< flag indicating if musrT0 shall be enabled at startup from within musredit (default: yes). QString fBeamline; ///< name of the beamline. Used to generate default run header lines. QString fInstitute; ///< name of the institute. Used to generate default run header lines. diff --git a/src/musredit/PPrefsDialog.cpp b/src/musredit/PPrefsDialog.cpp index fb18d832..a6fb9ca3 100644 --- a/src/musredit/PPrefsDialog.cpp +++ b/src/musredit/PPrefsDialog.cpp @@ -61,6 +61,7 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin) fEnableMusrT0_checkBox->setChecked(fAdmin->getEnableMusrT0Flag()); fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag()); fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag()); + fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag()); fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout())); fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit)); diff --git a/src/musredit/PPrefsDialog.h b/src/musredit/PPrefsDialog.h index 7bf6d89f..5f113eb1 100644 --- a/src/musredit/PPrefsDialog.h +++ b/src/musredit/PPrefsDialog.h @@ -46,6 +46,7 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog public: PPrefsDialog(PAdmin *admin); + bool getMusrviewShowFourierFlag() { return fFourier_checkBox->isChecked(); } bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); } bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); } bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); } diff --git a/src/musredit/PTextEdit.cpp b/src/musredit/PTextEdit.cpp index 99a603b6..94334ab3 100644 --- a/src/musredit/PTextEdit.cpp +++ b/src/musredit/PTextEdit.cpp @@ -2191,7 +2191,10 @@ void PTextEdit::musrView() str = *fFilenames.find( currentEditor() ); QString numStr; numStr.setNum(fAdmin->getTimeout()); - cmd += str + "\" --timeout " + numStr + " &"; + cmd += str + "\" --timeout " + numStr; + if (fAdmin->getMusrviewShowFourierFlag()) + cmd += " -f "; + cmd += " &"; int status=system(cmd.toLatin1()); } @@ -2272,6 +2275,7 @@ void PTextEdit::musrPrefs() } if (dlg->exec() == QDialog::Accepted) { + fAdmin->setMusrviewShowFourierFlag(dlg->getMusrviewShowFourierFlag()); fAdmin->setKeepMinuit2OutputFlag(dlg->getKeepMinuit2OutputFlag()); fAdmin->setTitleFromDataFileFlag(dlg->getTitleFromDataFileFlag()); fAdmin->setEnableMusrT0Flag(dlg->getEnableMusrT0Flag()); diff --git a/src/musredit/forms/PPrefsDialog.ui b/src/musredit/forms/PPrefsDialog.ui index c77f5d71..90f3e0b9 100644 --- a/src/musredit/forms/PPrefsDialog.ui +++ b/src/musredit/forms/PPrefsDialog.ui @@ -33,9 +33,9 @@ - 1 + 0 - + general @@ -75,7 +75,7 @@ - + musrfit @@ -158,7 +158,25 @@ - + + + musrview + + + + + 10 + 10 + 141 + 22 + + + + start with Fourier + + + + musrt0 diff --git a/src/musrview.cpp b/src/musrview.cpp index 111ed2b2..f91dd6fd 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -57,9 +57,12 @@ using namespace std; */ void musrview_syntax() { - cout << endl << "usage: musrview [--] [--timeout ] | --version | --help"; + cout << endl << "usage: musrview [Options]"; cout << endl << " : msr/mlog input file"; - cout << endl << " 'musrview ' will execute musrview"; + cout << endl << " Options:"; + cout << endl << " --help : display this help and exit."; + cout << endl << " --version : output version information and exit."; + cout << endl << " -f, --fourier: will directly present the Fourier transform of the ."; cout << endl << " --: "; cout << endl << " will produce a graphics-output-file without starting a root session."; cout << endl << " the name is based on the , e.g. 3310.msr -> 3310_0.png"; @@ -71,9 +74,6 @@ void musrview_syntax() cout << endl << " will produce an ascii dump of the data and fit as plotted."; cout << endl << " --timeout : given in seconds after which musrview terminates."; cout << endl << " If <= 0, no timeout will take place. Default is 0."; - cout << endl; - cout << endl << " 'musrview' or 'musrview --help' will show this help"; - cout << endl << " 'musrview --version' will print the musrview version"; cout << endl << endl; } @@ -101,6 +101,7 @@ int main(int argc, char *argv[]) int status; bool success = true; char fileName[128]; + bool fourier = false; bool graphicsOutput = false; bool asciiOutput = false; char graphicsExtension[128]; @@ -132,6 +133,8 @@ int main(int argc, char *argv[]) } else if (!strcmp(argv[i], "--help")) { show_syntax = true; break; + } else if (!strcmp(argv[i], "-f") || !strcmp(argv[i], "--fourier")) { + fourier = true; } else if (!strcmp(argv[i], "--eps") || !strcmp(argv[i], "--pdf") || !strcmp(argv[i], "--gif") || !strcmp(argv[i], "--jpg") || !strcmp(argv[i], "--png") || !strcmp(argv[i], "--svg") || !strcmp(argv[i], "--xpm") || !strcmp(argv[i], "--root")) { @@ -304,10 +307,13 @@ int main(int argc, char *argv[]) startupHandler->GetFourierDefaults(), startupHandler->GetMarkerList(), startupHandler->GetColorList(), - graphicsOutput||asciiOutput); + graphicsOutput||asciiOutput, + fourier); else musrCanvas = new PMusrCanvas(i, msrHandler->GetMsrTitle()->Data(), - 10+i*100, 10+i*100, 800, 600, graphicsOutput||asciiOutput); + 10+i*100, 10+i*100, 800, 600, + graphicsOutput||asciiOutput, + fourier); if (!musrCanvas->IsValid()) { cerr << endl << ">> musrview **SEVERE ERROR** Couldn't invoke all necessary objects, will quit.";