add feature that mupp_plotter can show/hide lines between the data points.

This commit is contained in:
suter_a 2022-12-03 11:02:20 +01:00
parent 62c3600fb7
commit 3e534d11f7
5 changed files with 39 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# - musrfit --- DKS ----------------------------------------------------------- # - musrfit --- DKS -----------------------------------------------------------
cmake_minimum_required(VERSION 3.17) 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 ------------------------------------------------- #--- musrfit specific options -------------------------------------------------
option(dks "build musrfit with DKS (GPU/MIC) support" ON) option(dks "build musrfit with DKS (GPU/MIC) support" ON)

View File

@ -169,6 +169,9 @@ void PMuppCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
Done(0); Done(0);
} else if (x == 'b') { // about } else if (x == 'b') { // about
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2018", kMBIconAsterisk); 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) 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(); ExportData();
} else if (id == P_MENU_ID_ABOUT) { } else if (id == P_MENU_ID_ABOUT) {
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2017", kMBIconAsterisk); 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(); fBar = fImp->GetMenuBar();
fPopupMain = fBar->AddPopup("&Mupp"); fPopupMain = fBar->AddPopup("&Mupp");
fPopupMain->AddEntry("Toggle with&Line", P_MENU_ID_WITH_LINE);
fPopupMain->AddEntry("Export &Data", P_MENU_ID_EXPORT); fPopupMain->AddEntry("Export &Data", P_MENU_ID_EXPORT);
fPopupMain->AddSeparator(); fPopupMain->AddSeparator();
fPopupMain->AddEntry("A&bout", P_MENU_ID_ABOUT); fPopupMain->AddEntry("A&bout", P_MENU_ID_ABOUT);
@ -599,10 +606,14 @@ void PMuppCanvas::UpdateGraphs()
} }
for (UInt_t i=0; i<fGraphE.size(); i++) { for (UInt_t i=0; i<fGraphE.size(); i++) {
fMultiGraph->Add(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 // set x-axis limits. This is needed that the graphs x-axis starts at 0.0
Double_t xmin=fMultiGraph->GetXaxis()->GetXmin(); Double_t xmin=fMultiGraph->GetXaxis()->GetXmin();

View File

@ -46,8 +46,9 @@
#include "mupp.h" #include "mupp.h"
// Canvas menu id's // Canvas menu id's
#define P_MENU_ID_EXPORT 10001 #define P_MENU_ID_WITH_LINE 10001
#define P_MENU_ID_ABOUT 10002 #define P_MENU_ID_EXPORT 10002
#define P_MENU_ID_ABOUT 10003
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
struct PDataPoint { struct PDataPoint {
@ -113,6 +114,8 @@ private:
PDoubleVector fMarkerSizeList; PDoubleVector fMarkerSizeList;
PIntVector fColorList; PIntVector fColorList;
bool fWithLines{false};
virtual void CreateStyle(); virtual void CreateStyle();
virtual void InitMuppCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh); virtual void InitMuppCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);

View File

@ -169,6 +169,9 @@ void PMuppCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
Done(0); Done(0);
} else if (x == 'b') { // about } else if (x == 'b') { // about
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2018", kMBIconAsterisk); 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) 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(); ExportData();
} else if (id == P_MENU_ID_ABOUT) { } else if (id == P_MENU_ID_ABOUT) {
new TGMsgBox(gClient->GetRoot(), 0, "About mupp", "created by Andreas Suter\nPSI/NUM/LMU/LEM\n2017", kMBIconAsterisk); 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(); fBar = fImp->GetMenuBar();
fPopupMain = fBar->AddPopup("&Mupp"); fPopupMain = fBar->AddPopup("&Mupp");
fPopupMain->AddEntry("Toggle with&Line", P_MENU_ID_WITH_LINE);
fPopupMain->AddEntry("Export &Data", P_MENU_ID_EXPORT); fPopupMain->AddEntry("Export &Data", P_MENU_ID_EXPORT);
fPopupMain->AddSeparator(); fPopupMain->AddSeparator();
fPopupMain->AddEntry("A&bout", P_MENU_ID_ABOUT); fPopupMain->AddEntry("A&bout", P_MENU_ID_ABOUT);
@ -599,10 +606,14 @@ void PMuppCanvas::UpdateGraphs()
} }
for (UInt_t i=0; i<fGraphE.size(); i++) { for (UInt_t i=0; i<fGraphE.size(); i++) {
fMultiGraph->Add(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 // set x-axis limits. This is needed that the graphs x-axis starts at 0.0
Double_t xmin=fMultiGraph->GetXaxis()->GetXmin(); Double_t xmin=fMultiGraph->GetXaxis()->GetXmin();

View File

@ -46,8 +46,9 @@
#include "mupp.h" #include "mupp.h"
// Canvas menu id's // Canvas menu id's
#define P_MENU_ID_EXPORT 10001 #define P_MENU_ID_WITH_LINE 10001
#define P_MENU_ID_ABOUT 10002 #define P_MENU_ID_EXPORT 10002
#define P_MENU_ID_ABOUT 10003
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
struct PDataPoint { struct PDataPoint {
@ -113,6 +114,8 @@ private:
PDoubleVector fMarkerSizeList; PDoubleVector fMarkerSizeList;
PIntVector fColorList; PIntVector fColorList;
bool fWithLines{false};
virtual void CreateStyle(); virtual void CreateStyle();
virtual void InitMuppCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh); virtual void InitMuppCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);