Diana Software
QGHistogramEditWindow.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <set>
4 #include <string>
5 #include "QGCanvasWindow.hh"
6 #include "QGCutsFrame.hh"
7 #include "QGDropDownBox.hh"
8 #include "QGFileHandler.hh"
9 #include "QGHistogram.hh"
12 #include "QGPlotStyleFrame.hh"
13 #include "TGButton.h"
14 #include "TGTextEntry.h"
15 
17 
18 using std::cout;
19 using std::endl;
20 using std::set;
21 using std::string;
22 
23 QGHistogramEditWindow::QGHistogramEditWindow(const TGWindow *p, UInt_t w, UInt_t h) :
24 QGPlotEditWindow(p, w, h),
25 fHistogram(0)
26 {
28  ShowCutsFrame();
31 
32  Resize(GetDefaultSize());
33  MapSubwindows();
35  Resize(w, h);
36  MapWindow();
37  fCutsFrame->GetCutsListBox()->Layout();
38 }
39 
41 {
42  if (fHistogram) {
44  }
45 }
46 
48 {
50  fCutsFrame->GetDropDownBox()->RemoveAll();
53  set<string> aliases = fHistogram->GetCanvasWindow()->GetFileHandler()->GetSetOfAliases();
54  set<string> leaves = fHistogram->GetCanvasWindow()->GetFileHandler()->GetSetOfLeaves();
55  set<string>::const_iterator iter;
56  for (iter = aliases.begin(); iter != aliases.end(); ++iter) {
59  }
60  for (iter = leaves.begin(); iter != leaves.end(); ++iter) {
63  }
64  }
66 }
67 
69 {
70  if (QGHistogram *histogram = dynamic_cast<QGHistogram*>(plot)) {
71  fHistogram = histogram;
72  string windowName = "Diana GUI: ";
73  windowName += histogram->GetName();
74  SetWindowName(windowName.c_str());
75  fCutsFrame->SetCuts(histogram->GetCuts());
76  fHistogramParametersFrame->SetXVariable(histogram->GetXVariable());
77  fHistogramParametersFrame->SetXUnits(histogram->GetXUnits());
78  if (histogram->IsXMinSet()) {
79  fHistogramParametersFrame->SetXMin(histogram->GetXMin());
80  }
81  if (histogram->IsXMaxSet()) {
82  fHistogramParametersFrame->SetXMax(histogram->GetXMax());
83  }
84  if (histogram->IsBinWidthSet()) {
85  fHistogramParametersFrame->SetBinWidth(histogram->GetBinWidth());
86  }
87  if (histogram->IsNumberOfBinsSet()) {
88  fHistogramParametersFrame->SetNumberOfBins(histogram->GetNumberOfBins());
90  }
91  fHistogramParametersFrame->SetSuperimpose(histogram->IsSuperimposeSet());
92  if (histogram->GetCanvasWindow()) {
95  }
96  } else {
97  cout << "QGHistogramEditWindow::SetPlot(QGPlot *plot) Warning: dynamic_cast<QGHistogram*> failed" << endl;
98  }
99 }
100 
102 {
104  AddFrame(fHistogramParametersFrame, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 0));
105 }
ClassImp(QObject)
QGFileHandler * GetFileHandler() const
Get pointer to file handler.
TGListBox * GetCutsListBox()
Get pointer to cuts list box.
Definition: QGCutsFrame.hh:45
QGDropDownBox * GetDropDownBox()
Get drop down box.
Definition: QGCutsFrame.hh:48
void SetCuts(const std::vector< std::string > &cuts)
Set cuts.
Definition: QGCutsFrame.cc:192
void AddEntryS(const std::string &entry)
Add entry.
std::set< std::string > GetSetOfLeaves()
Get the names of the leaves of the tree.
std::set< std::string > GetSetOfAliases()
Get the aliases defined in the tree.
Class for histogram edit window.
QGHistogramEditWindow(const TGWindow *p=0, UInt_t w=280, UInt_t h=450)
Constructor.
QGHistogramParametersFrame * fHistogramParametersFrame
Histogram parameters frame.
QGHistogram * fHistogram
Pointer to QGHistogram.
virtual ~QGHistogramEditWindow()
Destructor.
void ShowHistogramParametersFrame()
Show parameters frame.
void FillVariablesDropDownBoxes()
Fill drop down boxes with variables from the chain.
void SetPlot(QGPlot *plot)
Set pointer to plot.
Part of a histogram edit window for inputting parameters.
void SetNumberOfBins(Int_t n)
Set the number of bins.
void SetXMin(Double_t min)
Set the x-axis minimum.
void AutoSetBinWidth()
Set bin width automatically.
void SetXVariable(const std::string &x)
Set the x-axis variable.
void SetSuperimpose(bool flag=true)
Set whether the superimpose box is checked.
void SetBinWidth(Double_t width)
Set the bin width.
void SetXUnits(const std::string &units)
Set the x-axis units.
QGDropDownBox * GetXDropDownBox()
Get pointer to x-axis variable drop down box.
void SetXMax(Double_t max)
Set the x-axis maximum.
std::string GetXVariable()
Get x-axis variable.
Class for GUI histograms.
Definition: QGHistogram.hh:19
const char * GetName() const
Get name of histogram.
Definition: QGHistogram.cc:321
void ShowDefaultDisplay()
Show default display.
void FillWindowDropDownBox()
Fill drop down box with names of canvas windows.
Base class for plot edit windows.
void ShowPlotStyleFrame()
Show plot style frame.
void ShowCutsFrame()
Show cuts frame.
QGCutsFrame * fCutsFrame
Cuts frame.
QGPlotEditButtonsFrame * fButtonsFrame
Buttons frame.
void ShowButtonsFrame()
Show buttons frame.
Base class for GUI plots including histograms, scatter plots, pulses, and graphical cuts.
Definition: QGPlot.hh:21
virtual QGCanvasWindow * GetCanvasWindow() const
Get pointer to the canvas window to which the plot is associated.
Definition: QGPlot.hh:60
virtual void SetPlotEditWindow(QGPlotEditWindow *window)
Set plot edit window.
Definition: QGPlot.hh:123
virtual void SetWindowName(const char *name=0)
Set name of window.
Definition: QGWindow.cc:52
std::string Resize(const std::string &s, size_t len)
resize a string to len, adding spaces if necessary