Diana Software
QGPulseEditWindow.cc
Go to the documentation of this file.
1 #include "QGPulseEditWindow.hh"
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"
10 #include "QGPlotStyleFrame.hh"
11 #include "QGPulse.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 QGPulseEditWindow::QGPulseEditWindow(const TGWindow *p, UInt_t w, UInt_t h) :
24 QGPlotEditWindow(p, w, h),
25 fPulse(0)
26 {
28  ShowCutsFrame();
32 
33  Resize(GetDefaultSize());
34  MapSubwindows();
36  Resize(w, h);
37  MapWindow();
38  fCutsFrame->GetCutsListBox()->Layout();
39  fEventDataFrame->GetCutsListBox()->Layout();
40 }
41 
43 {
44  if (fPulse) {
46  }
47 }
48 
50 {
51  string orderVariable = fPulseParametersFrame->GetOrderVariable();
52  string samplesLabel = fPulseParametersFrame->GetSamplesLabel();
53  fCutsFrame->GetDropDownBox()->RemoveAll();
54  fEventDataFrame->GetDropDownBox()->RemoveAll();
57  if (fPulse && fPulse->GetCanvasWindow()) {
58  set<string> aliases = fPulse->GetCanvasWindow()->GetFileHandler()->GetSetOfAliases();
59  set<string> qvectoraliases = fPulse->GetCanvasWindow()->GetFileHandler()->GetSetOfQVectorAliases();
60  set<string> leaves = fPulse->GetCanvasWindow()->GetFileHandler()->GetSetOfLeaves();
61  set<string> qvectorleaves = fPulse->GetCanvasWindow()->GetFileHandler()->GetSetOfQVectorLeaves();
62  set<string>::const_iterator iter;
63  for (iter = aliases.begin(); iter != aliases.end(); ++iter) {
67  }
68 
69  for (iter = qvectoraliases.begin(); iter != qvectoraliases.end(); ++iter) {
71  }
72  for (iter = leaves.begin(); iter != leaves.end(); ++iter) {
76  }
77  for (iter = qvectorleaves.begin(); iter != qvectorleaves.end(); ++iter) {
80  && samplesLabel.empty()) samplesLabel = *iter;
81  }
82  }
83  fPulseParametersFrame->GetOrderedByDropDownBox()->GetTextEntry()->SetText(orderVariable.c_str());
84  fPulseParametersFrame->GetSamplesLabelDropDownBox()->GetTextEntry()->SetText(samplesLabel.c_str());
85 }
86 
88 {
89  if (QGPulse *pulse = dynamic_cast<QGPulse*>(plot)) {
90  fPulse = pulse;
91  string windowName = "Diana GUI: ";
92  windowName += pulse->GetName();
93  SetWindowName(windowName.c_str());
94  fCutsFrame->SetCuts(pulse->GetCuts());
95  fEventDataFrame->SetCuts(pulse->GetEventData());
96  fPulseParametersFrame->SetEventIndex(pulse->GetEventIndex());
97  fPulseParametersFrame->SetNumberOfEvents(pulse->GetNumberOfEvents());
98  fPulseParametersFrame->SetOrderVariable(pulse->GetOrderVariable());
99  fPulseParametersFrame->SetSamplesLabel(pulse->GetSamplesLabel());
100  fPulseParametersFrame->SetSuperimpose(pulse->IsSuperimposeSet());
101  fPulseParametersFrame->SetUseADCUnits(pulse->IsUseADCUnitsSet());
102  if (pulse->GetCanvasWindow()) {
105  }
106  } else {
107  cout << "QGPulseEditWindow::SetPlot(QGPlot *plot) Warning: dynamic_cast<QGPulse*> failed" << endl;
108  }
109 }
110 
112 {
113  fEventDataFrame = new QGCutsFrame(this);
114  AddFrame(fEventDataFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 5, 0));
115  fEventDataFrame->SetLabel("Event Data");
116 }
117 
119 {
121  AddFrame(fPulseParametersFrame, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 0));
122 }
123 
125 {
126  if (fPulse) {
130  }
131 }
ClassImp(QObject)
QGFileHandler * GetFileHandler() const
Get pointer to file handler.
Frame to handle editing of cuts.
Definition: QGCutsFrame.hh:21
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 SetLabel(const std::string &label)
Set label.
Definition: QGCutsFrame.cc:203
void AddEntryS(const std::string &entry)
Add entry.
std::set< std::string > GetSetOfQVectorAliases()
Get the aliases defined in the tree.
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.
std::string GetDefaultPulseLabel() const
Get the names of the leaves of the tree.
std::set< std::string > GetSetOfQVectorLeaves()
Get the names of the leaves of the tree.
virtual const char * GetName() const
Get graph name.
Definition: QGGraph.cc:21
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
Class for pulse edit window.
QGCutsFrame * fEventDataFrame
Event data frame.
void FillVariablesDropDownBoxes()
Fill drop down boxes with variables from the chain.
void ShowEventDataFrame()
Show event data frame.
void ShowPulseParametersFrame()
Show parameters frame.
virtual ~QGPulseEditWindow()
Destructor.
void SetPlot(QGPlot *plot)
Set pointer to the pulse.
void UpdateEventData()
Update event data.
QGPulseParametersFrame * fPulseParametersFrame
Pulse parameters frame.
QGPulseEditWindow(const TGWindow *p=0, UInt_t w=280, UInt_t h=600)
Constructor.
QGPulse * fPulse
Pointer to the QGPulse.
Part of a pulse edit window for inputting parameters.
std::string GetOrderVariable() const
Get ordered-by variable.
void SetSuperimpose(bool flag=true)
Set whether the superimpose box is checked.
QGDropDownBox * GetSamplesLabelDropDownBox()
Get pointer to the samples label drop down box.
void SetOrderVariable(std::string orderVariable)
Set ordered-by variable.
QGDropDownBox * GetOrderedByDropDownBox()
Get pointer to the ordered-by drop down box.
void SetNumberOfEvents(Long_t number)
Set number of events.
void SetEventIndex(Long_t index)
Set event index.
void SetUseADCUnits(bool flag=true)
Set whether the use ADC units box is checked.
std::string GetSamplesLabel() const
Get samples label.
void SetSamplesLabel(std::string samplesVariable)
Set samples label.
Class for GUI pulse plots.
Definition: QGPulse.hh:18
Int_t GetNumberOfEvents()
Get number of events that pass the cuts.
Definition: QGPulse.cc:320
const std::vector< std::string > & GetEventData() const
Get event data for displayed pulse.
Definition: QGPulse.hh:54
Int_t GetEventIndex()
Get event index of displayed pulse.
Definition: QGPulse.hh:57
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