GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4MacroDialog.cpp
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4MacroDialog.h"
15 
17  : QDialog( parent )
18 {
19  setObjectName("Go4MacroDialog");
20  setupUi(this);
21  QObject::connect(MacroListBox, &QListWidget::currentTextChanged, this, &TGo4MacroDialog::setCommand);
22  setCommand("Add");
23 }
24 
25 void TGo4MacroDialog::setCommand( const QString & selection )
26 {
27  if (selection.contains("Add")) {
28  fxCommand = "addhistos(\"\",\"\",1,kTRUE);";
29  SyntaxLabel->setText("Bool_t addhistos(const char *histo1, const char *histo2, Double_t factor, Bool_t draw)");
30  setToolTip("Add histograms: result=histo1 + factor * histo2. \n If draw==true, display in new viewpanel, "
31  "otherwise just update existing displays");
32  } else if (selection.contains("Divide")) {
33  fxCommand = "divhistos(\"\",\"\",kTRUE, kTRUE);";
34  SyntaxLabel->setText("Bool_t divhistos(const char *histo1, const char *histo2, Bool_t draw, Bool_t floatresult)");
35  setToolTip("Divide histograms: result=histo1 by histo2.\n If draw==true, display in new viewpanel, otherwise "
36  "just update existing displays. \n If floatresult==true, result histogram will be TH1F, otherwise "
37  "same type as original histograms");
38  } else if (selection.contains("Rebin")) {
39  fxCommand = "rebin(\"\",2,0,kTRUE);";
40  SyntaxLabel->setText("Bool_t rebin(const char *histo, int ngroupX, int ngroupY, Bool_t draw)");
41  setToolTip("Rebin histogram histo by merging ngroup neighboured channels together. \n If draw=true, display in "
42  "new viewpanel, otherwise just update existing displays ");
43  } else if (selection.contains("Projection X")) {
44  fxCommand = "projectionX(\"\",\"\",-1,-1,kTRUE);";
45  SyntaxLabel->setText(
46  "Bool_t projectionX(const char *histo, const char *polycon, Int_t firstybin, Int_t lastybin, Bool_t draw)");
47  setToolTip(
48  " Do projection to X axis for 2d histogram histo.\n Optional polygon condition.\n Parameters firstybin, "
49  "lastybin for y range. \n If draw==true, display in new viewpanel, otherwise just update existing displays ");
50  } else if (selection.contains("Projection Y")) {
51  fxCommand = "projectionY(\"\",\"\",-1,-1,kTRUE);";
52  SyntaxLabel->setText(
53  "Bool_t projectionY(const char *histo, const char *polycon, Int_t firstxbin, Int_t lastxbin, Bool_t draw)");
54  setToolTip(
55  " Do projection to Y axis for 2d histogram histo. \n Optional polygon condition.\n Parameters firstxbin, "
56  "lastxbin for x range. \n If draw==true, display in new viewpanel, otherwise just update existing displays ");
57  } else if (selection.contains("Correlate")) {
58  fxCommand = "corrhistos(\"\",\"\",kTRUE);";
59  SyntaxLabel->setText("Bool_t corrhistos(const char *histo1, const char *histo2, Bool_t draw)");
60  setToolTip(" Correlate bin contents of two histograms in a graph.\n If draw==true, display in new viewpanel, "
61  "otherwise just update existing displays ");
62  } else if (selection.contains("Histogram of")) {
63  fxCommand = "hishisto(\"\",1000,kTRUE);";
64  SyntaxLabel->setText("Bool_t hishisto(const char *histo, Int_t bins, Bool_t draw)");
65  setToolTip(" Create histogram and fill with contents of histogram histo. \n If draw==true, display in new "
66  "viewpanel, otherwise just update existing displays ");
67  } else if (selection.contains("Profile X")) {
68  fxCommand = "profileX(\"\",-1,-1,kTRUE);";
69  SyntaxLabel->setText("Bool_t profileX(const char *histo, Int_t firstybin, Int_t lastybin, Bool_t draw)");
70  setToolTip(" Do profile to X axis for 2d histogram histo. \n Parameters firstybin, lastybin for y range. \n If "
71  "draw==true, display in new viewpanel, otherwise just update existing displays ");
72  } else if (selection.contains("Profile Y")) {
73  fxCommand = "profileY(\"\",-1,-1,kTRUE);";
74  SyntaxLabel->setText("Bool_t profileY(const char *histo, Int_t firstxbin, Int_t lastxbin, Bool_t draw)");
75  setToolTip(" Do profile to Y axis for 2d histogram histo. \n Parameters firstxbin, lastxbin for x range. \n If "
76  "draw==true, display in new viewpanel, otherwise just update existing displays ");
77  } else if (selection.contains("Scale X")) {
78  fxCommand = "scalex(\"\",1,0,kTRUE);";
79  SyntaxLabel->setText("Bool_t scalex(const char *histo, Double_t a1, Double_t a0, Bool_t draw)");
80  setToolTip(" Scale x axis of histogram histo by linear function. \n Parameters: x'= a1*x + a0. \n If draw==true, "
81  "display in new viewpanel, otherwise just update existing displays ");
82  } else if (selection.contains("Fourier")) {
83  fxCommand = "fft(\"\",\"R2C M\",kTRUE);";
84  SyntaxLabel->setText("Bool_t fft(const char *histo, Option_t opt, Bool_t draw)");
85  setToolTip(" Do fast fourier transform of 1d histogram. \n Parameters: option string of TVirtualFFT::FFT() \n If "
86  "draw==true, display in new viewpanel, otherwise just update existing displays ");
87  } else {
88  fxCommand = "unknown macro function";
89  }
90 }
91 
93 {
94  return fxCommand;
95 }
const QString & getCommand()
TGo4MacroDialog(QWidget *parent=nullptr)
virtual void setCommand(const QString &selection)