diff --git a/CMakeLists.txt b/CMakeLists.txt
index c1454891..666337f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
# - musrfit
cmake_minimum_required(VERSION 3.17)
-project(musrfit VERSION 1.8.1 LANGUAGES C CXX)
+project(musrfit VERSION 1.8.2 LANGUAGES C CXX)
#--- musrfit specific options -------------------------------------------------
option(nexus "build optional NeXus support. Needed for ISIS" OFF)
diff --git a/src/classes/PMsr2Data.cpp b/src/classes/PMsr2Data.cpp
index f9bbd177..818ddf7b 100644
--- a/src/classes/PMsr2Data.cpp
+++ b/src/classes/PMsr2Data.cpp
@@ -2495,12 +2495,14 @@ void PMsr2Data::WriteValue(std::fstream &outFile, const double &value, const uns
//-------------------------------------------------------------
/**
- *
+ *
Write a value to the outFile stream. The string length is determined on its error.
+ * E.g. 17.0023 +- 0.0018, or 73212.081 +- 0.033, etc.
*
- * \param outFile
- * \param value
- * \param errValue
- * \param width
+ * \param outFile output stream object
+ * \param value to be written to stream outFile
+ * \param errValue error of the value. needed to determine the needed accuracy
+ * \param width field width for outFile for formatted output
+ * \param db true for db-file output, false for dat-file output. Needed to have at least on space between numbers for dat-file output
*/
void PMsr2Data::WriteValue(std::fstream &outFile, const double &value, const double &errValue, const unsigned int &width, const bool &db) const
{
@@ -2528,9 +2530,12 @@ void PMsr2Data::WriteValue(std::fstream &outFile, const double &value, const dou
//-------------------------------------------------------------
/**
- *
+ *
Determines the first significant digit of the provided number value.
+ * E.g. for value=2.03 it will return 1, for value=0.00023 it will return 4, etc.
*
- * \param value
+ * \param value for which the first significant digit needs to be determined.
+ *
+ * \return first significant digit of the provided number value
*/
int PMsr2Data::GetFirstSignificantDigit(const double &value) const
{
@@ -2554,7 +2559,13 @@ int PMsr2Data::GetFirstSignificantDigit(const double &value) const
//-------------------------------------------------------------
/**
+ *
Checks paramValue is found in the paramList. If paramList
+ * is empty, ALL paramValues will be accepted, i.e. return true.
*
+ * \param paramValue paramValue to be checked
+ * \param paramList parameter list
+ *
+ * \return true if the paramValue if found in paramList, or true if paramList is empty.
*/
bool PMsr2Data::InParameterList(const unsigned int ¶mValue, const std::vector ¶mList) const
{
diff --git a/src/musredit_qt5/mupp/plotter/PMuppCanvas.cpp b/src/musredit_qt5/mupp/plotter/PMuppCanvas.cpp
index 7ac028c0..84635563 100644
--- a/src/musredit_qt5/mupp/plotter/PMuppCanvas.cpp
+++ b/src/musredit_qt5/mupp/plotter/PMuppCanvas.cpp
@@ -169,6 +169,9 @@ void PMuppCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
Done(0);
} else if (x == 'b') { // about
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2018", kMBIconAsterisk);
+ } else if (x == 'l') { // draw with lines
+ fWithLines = !fWithLines;
+ UpdateGraphs();
}
}
@@ -182,7 +185,10 @@ void PMuppCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
*/
void PMuppCanvas::HandleMenuPopup(Int_t id)
{
- if (id == P_MENU_ID_EXPORT) {
+ if (id == P_MENU_ID_WITH_LINE) {
+ fWithLines = !fWithLines;
+ UpdateGraphs();
+ } else if (id == P_MENU_ID_EXPORT) {
ExportData();
} else if (id == P_MENU_ID_ABOUT) {
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2017", kMBIconAsterisk);
@@ -267,6 +273,7 @@ void PMuppCanvas::InitMuppCanvas(const Char_t *title, Int_t wtopx, Int_t wtopy,
fBar = fImp->GetMenuBar();
fPopupMain = fBar->AddPopup("&Mupp");
+ fPopupMain->AddEntry("Toggle with&Line", P_MENU_ID_WITH_LINE);
fPopupMain->AddEntry("Export &Data", P_MENU_ID_EXPORT);
fPopupMain->AddSeparator();
fPopupMain->AddEntry("A&bout", P_MENU_ID_ABOUT);
@@ -599,10 +606,14 @@ void PMuppCanvas::UpdateGraphs()
}
for (UInt_t i=0; iAdd(fGraphE[i], "p");
+ fMultiGraph->Add(fGraphE[i]);
}
- fMultiGraph->Draw("a");
+ if (fWithLines) {
+ fMultiGraph->Draw("ALP");
+ } else {
+ fMultiGraph->Draw("AP");
+ }
// set x-axis limits. This is needed that the graphs x-axis starts at 0.0
Double_t xmin=fMultiGraph->GetXaxis()->GetXmin();
diff --git a/src/musredit_qt5/mupp/plotter/PMuppCanvas.h b/src/musredit_qt5/mupp/plotter/PMuppCanvas.h
index 9cbe61d8..9e78e4bb 100644
--- a/src/musredit_qt5/mupp/plotter/PMuppCanvas.h
+++ b/src/musredit_qt5/mupp/plotter/PMuppCanvas.h
@@ -46,8 +46,9 @@
#include "mupp.h"
// Canvas menu id's
-#define P_MENU_ID_EXPORT 10001
-#define P_MENU_ID_ABOUT 10002
+#define P_MENU_ID_WITH_LINE 10001
+#define P_MENU_ID_EXPORT 10002
+#define P_MENU_ID_ABOUT 10003
//--------------------------------------------------------------------------
struct PDataPoint {
@@ -113,6 +114,8 @@ private:
PDoubleVector fMarkerSizeList;
PIntVector fColorList;
+ bool fWithLines{false};
+
virtual void CreateStyle();
virtual void InitMuppCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
diff --git a/src/musredit_qt6/mupp/plotter/PMuppCanvas.cpp b/src/musredit_qt6/mupp/plotter/PMuppCanvas.cpp
index 7ac028c0..84635563 100644
--- a/src/musredit_qt6/mupp/plotter/PMuppCanvas.cpp
+++ b/src/musredit_qt6/mupp/plotter/PMuppCanvas.cpp
@@ -169,6 +169,9 @@ void PMuppCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
Done(0);
} else if (x == 'b') { // about
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2018", kMBIconAsterisk);
+ } else if (x == 'l') { // draw with lines
+ fWithLines = !fWithLines;
+ UpdateGraphs();
}
}
@@ -182,7 +185,10 @@ void PMuppCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
*/
void PMuppCanvas::HandleMenuPopup(Int_t id)
{
- if (id == P_MENU_ID_EXPORT) {
+ if (id == P_MENU_ID_WITH_LINE) {
+ fWithLines = !fWithLines;
+ UpdateGraphs();
+ } else if (id == P_MENU_ID_EXPORT) {
ExportData();
} else if (id == P_MENU_ID_ABOUT) {
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2017", kMBIconAsterisk);
@@ -267,6 +273,7 @@ void PMuppCanvas::InitMuppCanvas(const Char_t *title, Int_t wtopx, Int_t wtopy,
fBar = fImp->GetMenuBar();
fPopupMain = fBar->AddPopup("&Mupp");
+ fPopupMain->AddEntry("Toggle with&Line", P_MENU_ID_WITH_LINE);
fPopupMain->AddEntry("Export &Data", P_MENU_ID_EXPORT);
fPopupMain->AddSeparator();
fPopupMain->AddEntry("A&bout", P_MENU_ID_ABOUT);
@@ -599,10 +606,14 @@ void PMuppCanvas::UpdateGraphs()
}
for (UInt_t i=0; iAdd(fGraphE[i], "p");
+ fMultiGraph->Add(fGraphE[i]);
}
- fMultiGraph->Draw("a");
+ if (fWithLines) {
+ fMultiGraph->Draw("ALP");
+ } else {
+ fMultiGraph->Draw("AP");
+ }
// set x-axis limits. This is needed that the graphs x-axis starts at 0.0
Double_t xmin=fMultiGraph->GetXaxis()->GetXmin();
diff --git a/src/musredit_qt6/mupp/plotter/PMuppCanvas.h b/src/musredit_qt6/mupp/plotter/PMuppCanvas.h
index 9cbe61d8..9e78e4bb 100644
--- a/src/musredit_qt6/mupp/plotter/PMuppCanvas.h
+++ b/src/musredit_qt6/mupp/plotter/PMuppCanvas.h
@@ -46,8 +46,9 @@
#include "mupp.h"
// Canvas menu id's
-#define P_MENU_ID_EXPORT 10001
-#define P_MENU_ID_ABOUT 10002
+#define P_MENU_ID_WITH_LINE 10001
+#define P_MENU_ID_EXPORT 10002
+#define P_MENU_ID_ABOUT 10003
//--------------------------------------------------------------------------
struct PDataPoint {
@@ -113,6 +114,8 @@ private:
PDoubleVector fMarkerSizeList;
PIntVector fColorList;
+ bool fWithLines{false};
+
virtual void CreateStyle();
virtual void InitMuppCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
diff --git a/src/tests/rgeHandler/main.cpp b/src/tests/rgeHandler/main.cpp
index 91c2835e..eb4c2990 100644
--- a/src/tests/rgeHandler/main.cpp
+++ b/src/tests/rgeHandler/main.cpp
@@ -43,6 +43,7 @@ void syntax()
std::cout << " -x, --xml : path-name of the xml-startup file." << std::endl;
std::cout << " -d, --dump : dump rge-infos." << std::endl;
std::cout << " -s, --set : dump rge-vector number ." << std::endl;
+ std::cout << " -c, --cum-freq : dump vector of the cumulative frequency of rge set ." << std::endl;
std::cout << " -v, --version : rgeHandlerTest version" << std::endl;
std::cout << " -h, --help : this help." << std::endl;
std::cout << std::endl;
@@ -58,6 +59,7 @@ int main(int argc, char* argv[])
std::string fln("");
bool dump(false);
int set_no = -1;
+ bool cumFreq(false);
for (int i=1; i= argc) {
@@ -72,7 +74,7 @@ int main(int argc, char* argv[])
} else if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--dump")) {
dump = true;
} else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--set")) {
- if (i+1 > argc) {
+ if (i+1 >= argc) {
std::cout << std::endl;
std::cout << "**ERROR** found -s/--set without rge set number." << std::endl;
std::cout << std::endl;
@@ -98,6 +100,34 @@ int main(int argc, char* argv[])
return 3;
}
i++;
+ } else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--cum-freq")) {
+ if (i+1 >= argc) {
+ std::cout << std::endl;
+ std::cout << "**ERROR** found -c/--cum-freq without rge set number." << std::endl;
+ std::cout << std::endl;
+ syntax();
+ return 1;
+ }
+ try {
+ set_no = std::stoi(argv[i+1]);
+ } catch(std::invalid_argument& e) {
+ std::cout << std::endl;
+ std::cout << "**ERROR** set number '" << argv[i+1] << "' is not a number." << std::endl;
+ std::cout << std::endl;
+ return 3;
+ } catch(std::out_of_range& e) {
+ std::cout << std::endl;
+ std::cout << "**ERROR** set number '" << argv[i+1] << "' is out-of-range." << std::endl;
+ std::cout << std::endl;
+ return 3;
+ } catch(...) {
+ std::cout << std::endl;
+ std::cout << "**ERROR** set number '" << argv[i+1] << "' leads to an unexpected error." << std::endl;
+ std::cout << std::endl;
+ return 3;
+ }
+ cumFreq=true;
+ i++;
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
std::cout << std::endl;
#ifdef HAVE_CONFIG_H
@@ -135,7 +165,7 @@ int main(int argc, char* argv[])
}
std::cout << std::endl;
}
- if (set_no != -1) {
+ if ((set_no != -1) && !cumFreq) { // dump rge-set
PRgeDataList list = rgeHandler->GetRgeData();
if (set_no > list.size()) {
std::cout << std::endl;
@@ -150,12 +180,35 @@ int main(int argc, char* argv[])
delete rgeHandler;
return 4;
}
- std::cout << "rge-data set " << set_no << ": energy: " << list[set_no-1].energy << " (eV), no-of-particles: " << list[set_no-1].noOfParticles << std::endl;
- std::cout << "depth (nm), ampl, amplNorm" << std::endl;
+ std::cout << "# rge-data set " << set_no << ": energy: " << list[set_no-1].energy << " (eV), no-of-particles: " << list[set_no-1].noOfParticles << std::endl;
+ std::cout << "# depth (nm), ampl, amplNorm" << std::endl;
for (int i=0; iGetRgeData();
+ if (set_no > list.size()) {
+ std::cout << std::endl;
+ std::cout << "**ERROR** requested set number " << set_no << " > number of rge-data sets (" << list.size() << ")." << std::endl;
+ std::cout << std::endl;
+ delete rgeHandler;
+ return 4;
+ } else if (set_no == 0) {
+ std::cout << std::endl;
+ std::cout << "**ERROR** rge set-number count start at 1 not 0." << std::endl;
+ std::cout << std::endl;
+ delete rgeHandler;
+ return 4;
+ }
+ std::cout << "# cumulative frequency of rge-data set " << set_no << ": energy: " << list[set_no-1].energy << " (eV), no-of-particles: " << list[set_no-1].noOfParticles << std::endl;
+ std::cout << "# depth (nm), ampl, amplNorm, cumFreq" << std::endl;
+ double cumFreqVal(0.0);
+ for (int i=0; i