diff --git a/ChangeLog b/ChangeLog index 465063d8..a9e9a442 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,17 @@ or https://bitbucket.org/muonspin/musrfit/commits/all +Release of V1.2.0, 2017/10/26 +============================= + +Adopted to be ready for rpm builds in a first step. This will be followed by debian style +packages. + +Release of V1.1.0, 2017/10/26 +============================= + +Added full DKS support, i.e. additionally to CUDA also OpenCL for GPU's and CPU's in place. + Release of V1.0.0, 2017/05/18 ============================= diff --git a/configure.ac b/configure.ac index 9e6f5936..39ca5ca6 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],[1.1.0],[andreas.suter@psi.ch]) +AC_INIT([musrfit],[1.2.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=1 -MUSR_MINOR_VERSION=1 +MUSR_MINOR_VERSION=2 MUSR_MICRO_VERSION=0 #release versioning @@ -1212,11 +1212,24 @@ else INSTALLDIR="${prefix}" fi -if test -d "${INSTALLDIR}/doc" +dnl only define DOCDIR if not already present. This allows +dnl to feed DOCDIR on the configure level which is useful when +dnl for instance building a rpm. DOCDIR2 is needed for rpmbuild only +if test "x${DOCDIR}" = "x" then - DOCDIR="${INSTALLDIR}/doc/musrfit" + if test -d "${INSTALLDIR}/doc" + then + DOCDIR="${INSTALLDIR}/doc/musrfit" + else + DOCDIR="${INSTALLDIR}/share/doc/musrfit" + fi else - DOCDIR="${INSTALLDIR}/share/doc/musrfit" + if test -d "${INSTALLDIR}/doc" + then + DOCDIR2="${INSTALLDIR}/doc/musrfit" + else + DOCDIR2="${INSTALLDIR}/share/doc/musrfit" + fi fi AC_SUBST(DOCDIR) @@ -1441,12 +1454,21 @@ echo "" dnl -------------- dnl create header file that musredit knows at runtime where to find the documentation +dnl the DOCDIR2 tag is used for rpmbuild only dnl -------------- if test "x$enable_editor" != "xno" && test "x${QMAKEBIN}" != "x" && test "x${QTEDITOR}" = "xmusredit_qt5"; then echo \#define MUSRFIT_PREFIX \"${INSTALLDIR}\" > src/musredit_qt5/musrfit-info.h - echo \#define MUSRFIT_DOC_DIR \"${DOCDIR}\" >> src/musredit_qt5/musrfit-info.h + if test "x$DOCDIR2" = "x"; then + echo \#define MUSRFIT_DOC_DIR \"${DOCDIR}\" >> src/musredit_qt5/musrfit-info.h + else + echo \#define MUSRFIT_DOC_DIR \"${DOCDIR2}\" >> src/musredit_qt5/musrfit-info.h + fi fi if test "x$enable_editor" != "xno" && test "x${QMAKEBIN}" != "x" && test "x${QTEDITOR}" = "xmusredit"; then echo \#define MUSRFIT_PREFIX \"${INSTALLDIR}\" > src/musredit/musrfit-info.h - echo \#define MUSRFIT_DOC_DIR \"${DOCDIR}\" >> src/musredit/musrfit-info.h + if test "x$DOCDIR2" = "x"; then + echo \#define MUSRFIT_DOC_DIR \"${DOCDIR}\" >> src/musredit/musrfit-info.h + else + echo \#define MUSRFIT_DOC_DIR \"${DOCDIR2}\" >> src/musredit/musrfit-info.h + fi fi diff --git a/doc/examples/data/deltat_tdc_dolly_1020.bin b/doc/examples/data/deltat_tdc_dolly_1020.bin new file mode 100644 index 00000000..d8d20925 Binary files /dev/null and b/doc/examples/data/deltat_tdc_dolly_1020.bin differ diff --git a/doc/examples/test-asy-LF-BaB6.msr b/doc/examples/test-asy-LF-BaB6.msr new file mode 100644 index 00000000..a65ea437 --- /dev/null +++ b/doc/examples/test-asy-LF-BaB6.msr @@ -0,0 +1,60 @@ +BaB6 T20K LF5G +############################################################### +FITPARAMETER +# Nr. Name Value Step Pos_Error Boundaries + 1 alpha 0.7 0 none 0 none + 2 asy 0.2091 -0.0013 0.0013 0 0.33 + 3 field 2.127 0 none 0 none + 4 width 0.5387 -0.0054 0.0055 0 100 + 5 hopp 0.119 -0.013 0.014 0 100 + 6 asyConst 0 0 none + +############################################################### +THEORY +asymmetry 2 +dynGssKTLF fun1 4 5 (frequency damping hopping-rate) ++ +asymmetry 6 + +############################################################### +FUNCTIONS +fun1 = par3 * gamma_mu + +############################################################### +RUN data/deltat_tdc_dolly_1020 PIE1 PSI PSI-BIN (name beamline institute data-file-format) +fittype 2 (asymmetry fit) +alpha 1 +map 0 0 0 0 0 0 0 0 0 0 +forward 2 +backward 1 +background 15 146 13 148 # estimated bkg: 20.4846 / 4.8731 +data 170 9956 168 9110 +t0 160.0 161.0 +fit 0.25 10 +packing 5 + +############################################################### +COMMANDS +MINIMIZE +MINOS +SAVE + +############################################################### +FOURIER +units Gauss # units either 'Gauss', 'MHz', or 'Mc/s' +fourier_power 12 +apodization STRONG # NONE, WEAK, MEDIUM, STRONG +plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE +phase 8 +#range_for_phase_correction 50.0 70.0 +range 0 800 + +############################################################### +PLOT 2 (asymmetry plot) +runs 1 +range 0 9.5 -0.15 0.3 +view_packing 150 + +############################################################### +STATISTIC --- 2013-07-01 20:40:44 + chisq = 1911.7, NDF = 1905, chisq/NDF = 1.003494 diff --git a/src/classes/PFitter.cpp b/src/classes/PFitter.cpp index b124490d..09733447 100644 --- a/src/classes/PFitter.cpp +++ b/src/classes/PFitter.cpp @@ -1138,7 +1138,12 @@ Bool_t PFitter::ExecuteHesse() TString str = TString::Format("Hesse: %.3f sec", (end-start)/1.0e3); fElapsedTime.push_back(str); if (!mnState.IsValid()) { - cerr << endl << ">> PFitter::ExecuteHesse(): **WARNING** Hesse encountered some problems!"; + cerr << endl << ">> PFitter::ExecuteHesse(): **WARNING** Hesse encountered a problem! The state found is invalid."; + cerr << endl; + return false; + } + if (!mnState.HasCovariance()) { + cerr << endl << ">> PFitter::ExecuteHesse(): **WARNING** Hesse encountered a problem! No covariance matrix available."; cerr << endl; return false; } diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index e53c0472..70106d68 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -163,6 +163,9 @@ Int_t PMsrHandler::ReadMsrFile() continue; } + // remove leading spaces + line.Remove(TString::kLeading, ' '); + if (!line.IsWhitespace()) { // if not an empty line, handle it // check for a msr block if (line_no == 1) { // title @@ -3184,14 +3187,14 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) Bool_t error = false; Bool_t runLinePresent = false; - TString str; + TString str, line; TObjArray *tokens = 0; TObjString *ostr = 0; UInt_t addT0Counter = 0; Int_t ival; - Double_t dval; + Double_t dval; iter = lines.begin(); while ((iter != lines.end()) && !error) { @@ -3209,8 +3212,13 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) return false; } + // copy of the current line + line = iter->fLine; + // strip leading spaces from the begining + line.Remove(TString::kLeading, ' '); + // RUN line ---------------------------------------------- - if (iter->fLine.BeginsWith("run", TString::kIgnoreCase)) { + if (line.BeginsWith("run", TString::kIgnoreCase)) { runLinePresent = true; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3247,7 +3255,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // ADDRUN line --------------------------------------------- - if (iter->fLine.BeginsWith("addrun", TString::kIgnoreCase)) { + if (line.BeginsWith("addrun", TString::kIgnoreCase)) { if (!runLinePresent) { cerr << endl << ">> PMsrHandler::HandleRunEntry: **ERROR** Found ADDRUN without prior RUN, or"; @@ -3282,7 +3290,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // fittype ------------------------------------------------- - if (iter->fLine.BeginsWith("fittype", TString::kIgnoreCase)) { + if (line.BeginsWith("fittype", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3310,7 +3318,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // alpha ------------------------------------------------- - if (iter->fLine.BeginsWith("alpha", TString::kIgnoreCase)) { + if (line.BeginsWith("alpha", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3332,7 +3340,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // beta ------------------------------------------------- - if (iter->fLine.BeginsWith("beta", TString::kIgnoreCase)) { + if (line.BeginsWith("beta", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3354,7 +3362,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // norm ------------------------------------------------- - if (iter->fLine.BeginsWith("norm", TString::kIgnoreCase)) { + if (line.BeginsWith("norm", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3378,7 +3386,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // backgr.fit -------------------------------------------- - if (iter->fLine.BeginsWith("backgr.fit", TString::kIgnoreCase)) { + if (line.BeginsWith("backgr.fit", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3400,7 +3408,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // lifetime ------------------------------------------------ - if (iter->fLine.BeginsWith("lifetime ", TString::kIgnoreCase)) { + if (line.BeginsWith("lifetime ", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3422,7 +3430,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // lifetimecorrection --------------------------------------- - if (iter->fLine.BeginsWith("lifetimecorrection", TString::kIgnoreCase)) { + if (line.BeginsWith("lifetimecorrection", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3430,7 +3438,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // map ------------------------------------------------------ - if (iter->fLine.BeginsWith("map", TString::kIgnoreCase)) { + if (line.BeginsWith("map", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3460,7 +3468,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // forward ------------------------------------------------ - if (iter->fLine.BeginsWith("forward", TString::kIgnoreCase)) { + if (line.BeginsWith("forward", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3485,7 +3493,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // backward ----------------------------------------------- - if (iter->fLine.BeginsWith("backward", TString::kIgnoreCase)) { + if (line.BeginsWith("backward", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3510,7 +3518,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // backgr.fix ---------------------------------------------- - if (iter->fLine.BeginsWith("backgr.fix", TString::kIgnoreCase)) { + if (line.BeginsWith("backgr.fix", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3529,7 +3537,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // background --------------------------------------------- - if (iter->fLine.BeginsWith("background", TString::kIgnoreCase)) { + if (line.BeginsWith("background", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3553,7 +3561,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // data -------------------------------------------------- - if (iter->fLine.BeginsWith("data", TString::kIgnoreCase)) { + if (line.BeginsWith("data", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3577,7 +3585,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // t0 ----------------------------------------------------- - if (iter->fLine.BeginsWith("t0", TString::kIgnoreCase)) { + if (line.BeginsWith("t0", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3601,7 +3609,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // addt0 ----------------------------------------------------- - if (iter->fLine.BeginsWith("addt0", TString::kIgnoreCase)) { + if (line.BeginsWith("addt0", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3627,7 +3635,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // fit ----------------------------------------------------- - if (iter->fLine.BeginsWith("fit ", TString::kIgnoreCase)) { + if (line.BeginsWith("fit ", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3682,7 +3690,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // packing -------------------------------------------------- - if (iter->fLine.BeginsWith("packing", TString::kIgnoreCase)) { + if (line.BeginsWith("packing", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following @@ -3704,7 +3712,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } // xy-data ----------------------------------------------- - if (iter->fLine.BeginsWith("xy-data", TString::kIgnoreCase)) { + if (line.BeginsWith("xy-data", TString::kIgnoreCase)) { runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 195bd081..9af99112 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -1502,12 +1502,25 @@ void PMusrCanvas::HandleMenuPopup(Int_t id) */ void PMusrCanvas::LastCanvasClosed() { -// cout << endl << ">> in last canvas closed check ..."; +// cerr << ">> in last canvas closed check. gROOT->GetListOfCanvases()->GetEntries()=" << gROOT->GetListOfCanvases()->GetEntries() << endl; if (gROOT->GetListOfCanvases()->IsEmpty()) { Done(0); } } +//-------------------------------------------------------------------------- +// WindowClosed (SLOT) +//-------------------------------------------------------------------------- +/** + *
Slot called when the canvas is closed. Seems to be necessary on some systems.
+ */
+void PMusrCanvas::WindowClosed()
+{
+// cerr << ">> fMainCanvas->GetName()=" << fMainCanvas->GetName() << endl;
+ gROOT->GetListOfCanvases()->Remove(fMainCanvas);
+ LastCanvasClosed();
+}
+
//--------------------------------------------------------------------------
// SaveGraphicsAndQuit
//--------------------------------------------------------------------------
@@ -2374,9 +2387,12 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy,
return;
}
+ fMainCanvas->Connect("Closed()", "PMusrCanvas", this, "LastCanvasClosed()");
+
// add canvas menu if not in batch mode
if (!fBatchMode) {
fImp = (TRootCanvas*)fMainCanvas->GetCanvasImp();
+ fImp->Connect("CloseWindow()", "PMusrCanvas", this, "WindowClosed()");
fBar = fImp->GetMenuBar();
fPopupMain = fBar->AddPopup("&Musrfit");
diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp
index e4517dd5..494225d4 100644
--- a/src/classes/PRunAsymmetry.cpp
+++ b/src/classes/PRunAsymmetry.cpp
@@ -1774,11 +1774,17 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2]
return false;
}
// 3rd check if end is within proper bounds
- if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
- cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin doesn't make any sense!";
+ if (end[i] < 0) {
+ cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!";
cerr << endl;
return false;
}
+ if (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size()) {
+ cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ").";
+ cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
+ cerr << endl;
+ end[i] = (Int_t)runData->GetDataBin(histoNo[i])->size()-1;
+ }
// 4th check if t0 is within proper bounds
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
diff --git a/src/classes/PRunAsymmetryRRF.cpp b/src/classes/PRunAsymmetryRRF.cpp
index 68723bd7..8830c6e5 100644
--- a/src/classes/PRunAsymmetryRRF.cpp
+++ b/src/classes/PRunAsymmetryRRF.cpp
@@ -1414,11 +1414,17 @@ Bool_t PRunAsymmetryRRF::GetProperDataRange(PRawRunData* runData, UInt_t histoNo
return false;
}
// 3rd check if end is within proper bounds
- if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
- cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** end data bin doesn't make any sense!";
+ if (end[i] < 0) {
+ cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!";
cerr << endl;
return false;
}
+ if (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size()) {
+ cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ").";
+ cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
+ cerr << endl;
+ end[i] = (Int_t)runData->GetDataBin(histoNo[i])->size()-1;
+ }
// 4th check if t0 is within proper bounds
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp
index 4e09ff33..adf28d7a 100644
--- a/src/classes/PRunSingleHisto.cpp
+++ b/src/classes/PRunSingleHisto.cpp
@@ -1560,11 +1560,17 @@ Bool_t PRunSingleHisto::GetProperDataRange()
return false;
}
// 3rd check if end is within proper bounds
- if ((end < 0) || (end > (Int_t)fForward.size())) {
+ if (end < 0) {
cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
cerr << endl;
return false;
}
+ if (end > (Int_t)fForward.size()) {
+ cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << (Int_t)fForward.size() << ").";
+ cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
+ cerr << endl;
+ end = (Int_t)fForward.size()-1;
+ }
// keep good bins for potential later use
fGoodBins[0] = start;
diff --git a/src/classes/PRunSingleHistoRRF.cpp b/src/classes/PRunSingleHistoRRF.cpp
index a1b38bc5..801e02f9 100644
--- a/src/classes/PRunSingleHistoRRF.cpp
+++ b/src/classes/PRunSingleHistoRRF.cpp
@@ -969,11 +969,17 @@ Bool_t PRunSingleHistoRRF::GetProperDataRange()
return false;
}
// 3rd check if end is within proper bounds
- if ((end < 0) || (end > (Int_t)fForward.size())) {
+ if (end < 0) {
cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!";
cerr << endl;
return false;
}
+ if (end > (Int_t)fForward.size()) {
+ cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << (Int_t)fForward.size() << ").";
+ cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl;
+ cerr << endl;
+ end = (Int_t)fForward.size()-1;
+ }
// keep good bins for potential later use
fGoodBins[0] = start;
diff --git a/src/classes/PTheory.cpp b/src/classes/PTheory.cpp
index 30174ce8..cfa21852 100644
--- a/src/classes/PTheory.cpp
+++ b/src/classes/PTheory.cpp
@@ -2687,14 +2687,14 @@ void PTheory::CalculateGaussLFIntegral(const Double_t *val) const
fLFIntegral.push_back(0.0); // start value of the integral
ft = 0.0;
- Double_t step = 0.0, lastStep = 1.0, diff = 0.0;
+ Double_t step = 0.0, lastft = 1.0, diff = 0.0;
do {
t += dt;
step = 0.5*dt*preFactor*(exp(-0.5*pow(Delta * (t-dt), 2.0))*sin(w0*(t-dt))+
exp(-0.5*pow(Delta * t, 2.0))*sin(w0*t));
- diff = fabs(fabs(step)-fabs(lastStep));
- lastStep = step;
ft += step;
+ diff = fabs(fabs(lastft)-fabs(ft));
+ lastft = ft;
fLFIntegral.push_back(ft);
} while ((t <= 20.0) && (diff > 1.0e-10));
}
@@ -2762,13 +2762,13 @@ void PTheory::CalculateLorentzLFIntegral(const Double_t *val) const
ft += 0.5*dt*preFactor*(1.0+sin(w0*t)/(w0*t)*exp(-a*t));
fLFIntegral.push_back(ft);
// calculate all the other integral bin values
- Double_t step = 0.0, lastStep = 1.0, diff = 0.0;
+ Double_t step = 0.0, lastft = 1.0, diff = 0.0;
do {
t += dt;
step = 0.5*dt*preFactor*(sin(w0*(t-dt))/(w0*(t-dt))*exp(-a*(t-dt))+sin(w0*t)/(w0*t)*exp(-a*t));
- diff = fabs(fabs(step)-fabs(lastStep));
- lastStep = step;
ft += step;
+ diff = fabs(fabs(lastft)-fabs(ft));
+ lastft = ft;
fLFIntegral.push_back(ft);
} while ((t <= 20.0) && (diff > 1.0e-10));
}
@@ -2792,7 +2792,7 @@ Double_t PTheory::GetLFIntegralValue(const Double_t t) const
if (idx + 2 > fLFIntegral.size())
return fLFIntegral.back();
- // linearly interpolate between the two relvant function bins
+ // linearly interpolate between the two relevant function bins
Double_t df = (fLFIntegral[idx+1]-fLFIntegral[idx])*(t/fSamplingTime-static_cast load a msr-file.
*
* \param f filename
* \param index if == -1, add the file as a new tab, otherwise, replace the contents of the tab at index.
@@ -2215,7 +2215,12 @@ void PTextEdit::musrMsr2Data()
cmd.append("new");
}
- PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
+ // if NO tab is present use the local directory
+ QString workDir = QString("./");
+ if (fTabWidget->count() != 0) {
+ workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
+ }
+ PFitOutputHandler fitOutputHandler(workDir, cmd);
fitOutputHandler.setModal(true);
fFileSystemWatcherActive = false;
fitOutputHandler.exec();
@@ -2239,7 +2244,11 @@ void PTextEdit::musrMsr2Data()
else
fln += fMsr2DataParam->msrFileExtension + ".msr";
- load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln);
+ workDir = QString("./");
+ if (fTabWidget->count() != 0) {
+ workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
+ }
+ load(workDir + "/" + fln);
}
break;
case 1: // run list file
@@ -2261,7 +2270,11 @@ void PTextEdit::musrMsr2Data()
else
fln += fMsr2DataParam->msrFileExtension + ".msr";
- load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln);
+ workDir = QString("./");
+ if (fTabWidget->count() != 0) {
+ workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
+ }
+ load(workDir + "/" + fln);
}
}
@@ -2589,7 +2602,8 @@ void PTextEdit::musrSwapMsrMlog()
// get current file name
QString currentFileName = *fFilenames.find( currentEditor() );
QString swapFileName;
- QString tempFileName = QString("__swap__.msr");
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ QString tempFileName = QString("%1/.musrfit/__swap__.msr").arg(env.value("HOME"));
// check if it is a msr-, mlog-, or another file
int idx;
diff --git a/src/musrview.cpp b/src/musrview.cpp
index 0c0da86b..278991cd 100644
--- a/src/musrview.cpp
+++ b/src/musrview.cpp
@@ -325,8 +325,6 @@ int main(int argc, char *argv[])
ok = false;
break;
}
- // connect signal/slot
- TQObject::Connect("TCanvas", "Closed()", "PMusrCanvas", musrCanvas, "LastCanvasClosed()");
musrCanvas->SetTimeout(timeout);