Diana Software
QGPulseParametersFrame.cc
Go to the documentation of this file.
2 #include <sstream>
3 #include "QGDropDownBox.hh"
4 #include "QGPulseEditWindow.hh"
5 #include "TGButton.h"
6 #include "TGLabel.h"
7 #include "TGNumberEntry.h"
8 #include "TGPicture.h"
9 #include "TGTextEntry.h"
10 
11 // Images
12 #include "ImageLeftArrow.xpm"
13 #include "ImageRightArrow.xpm"
14 
16 
17 using std::flush;
18 using std::string;
19 using std::stringstream;
20 
22 TGCompositeFrame(p, w, h),
23 fPulseEditWindow(p)
24 {
25  SetCleanup(kDeepCleanup);
26 
27 
28 
29  fPreviousNextFrame = new TGHorizontalFrame(this, w, 25);
30  AddFrame(fPreviousNextFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
31 
32  fPreviousButton = new TGPictureButton(fPreviousNextFrame, gClient->GetPicturePool()->GetPicture("LeftArrow", (char**)ImageLeftArrow));
33  fPreviousNextFrame->AddFrame(fPreviousButton, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 0, 0, 0));
34  fPreviousButton->SetToolTipText("Show previous pulse");
35  fPreviousButton->Connect("Clicked()", "QGPulseParametersFrame", this, "HandlePreviousButton()");
36 
37  fPreviousNextFrame->AddFrame(new TGLabel(fPreviousNextFrame, "Event"), new TGLayoutHints(kLHintsCenterY, 2, 0, 0, 0));
38 
39  fPulseNumberBox = new TGNumberEntryField(fPreviousNextFrame);
40  fPreviousNextFrame->AddFrame(fPulseNumberBox, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 0, 0, 0));
41  fPulseNumberBox->Resize(60, 25);
42  fPulseNumberBox->SetFormat(TGNumberFormat::kNESInteger);
43  fPulseNumberBox->SetToolTipText("Number of event ordered by variable below");
44  fPulseNumberBox->Connect("ReturnPressed()", "QGPulseParametersFrame", this, "HandlePulseNumberBox()");
45 
46  fPreviousNextFrame->AddFrame(new TGLabel(fPreviousNextFrame, "of"), new TGLayoutHints(kLHintsCenterY, 2, 0, 0, 0));
47 
48  fNumberOfPulsesBox = new TGNumberEntryField(fPreviousNextFrame);
49  fPreviousNextFrame->AddFrame(fNumberOfPulsesBox, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 0, 0, 0));
50  fNumberOfPulsesBox->Resize(60, 25);
51  fNumberOfPulsesBox->SetToolTipText("Number of events that pass the cuts");
52  fNumberOfPulsesBox->SetEnabled(kFALSE);
53 
54  fNextButton = new TGPictureButton(fPreviousNextFrame, gClient->GetPicturePool()->GetPicture("RightArrow", (char**)ImageRightArrow));
55  fPreviousNextFrame->AddFrame(fNextButton, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 0, 0, 0));
56  fNextButton->SetToolTipText("Show next pulse");
57  fNextButton->Connect("Clicked()", "QGPulseParametersFrame", this, "HandleNextButton()");
58 
59  fSamplesLabelFrame = new TGHorizontalFrame(this, w, 25);
60  AddFrame(fSamplesLabelFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
61  fSamplesLabel= new TGLabel(fSamplesLabelFrame, "Samples: ");
62  fSamplesLabelFrame->AddFrame(fSamplesLabel, new TGLayoutHints(kLHintsCenterY, 0, 0, 0, 0));
64  fSamplesLabelFrame->AddFrame(fSamplesLabelDropDownBox, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 0, 0, 0));
66  fSamplesLabelDropDownBox->Resize(fSamplesLabelDropDownBox->GetDefaultWidth(), 25);
67  fSamplesLabelDropDownBox->GetTextEntry()->SetToolTipText("Enter samples to show");
68 
69  fOrderedByFrame = new TGHorizontalFrame(this, w, 25);
70  AddFrame(fOrderedByFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
71  fOrderedByLabel = new TGLabel(fOrderedByFrame, "Ordered by:");
72  fOrderedByFrame->AddFrame(fOrderedByLabel, new TGLayoutHints(kLHintsCenterY, 0, 0, 0, 0));
74  fOrderedByFrame->AddFrame(fOrderedByDropDownBox, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 0, 0, 0));
76  fOrderedByDropDownBox->Resize(fOrderedByDropDownBox->GetDefaultWidth(), 25);
77  fOrderedByDropDownBox->GetTextEntry()->SetToolTipText("Enter variable by which to order the pulses");
78 
79 
80  fOptionsFrame = new TGHorizontalFrame(this,w,50);
81  AddFrame(fOptionsFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
82 
83  fSuperimposeBox = new TGCheckButton(fOptionsFrame, "Superimpose");
84  fOptionsFrame->AddFrame(fSuperimposeBox, new TGLayoutHints(kLHintsCenterY, 0, 0, 0, 0));
85  fSuperimposeBox->SetToolTipText("Check to superimpose pulse on existing pulse");
86 
87  fUseADCUnitsBox = new TGCheckButton(fOptionsFrame, "ADC Units");
88  fOptionsFrame->AddFrame(fUseADCUnitsBox, new TGLayoutHints(kLHintsCenterY, 7, 0, 0, 0));
89  fUseADCUnitsBox->SetToolTipText("Check to use ADC units");
90 
91  fShowLegendsBox = new TGCheckButton(fOptionsFrame, "Legend");
92  fOptionsFrame->AddFrame(fShowLegendsBox, new TGLayoutHints(kLHintsCenterY, 20, 0, 0, 0));
93  fShowLegendsBox->SetToolTipText("Check to show pulse info legends on the plot");
94 
95  fOptionsFrame2 = new TGHorizontalFrame(this,w,50);
96  AddFrame(fOptionsFrame2, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
97 
98 
99  fZeroOffsetBox = new TGCheckButton(fOptionsFrame2, "Zero offset");
100  fOptionsFrame2->AddFrame(fZeroOffsetBox, new TGLayoutHints(kLHintsCenterY, 0, 0, 0, 0));
101  fZeroOffsetBox->SetToolTipText("Check to subtract the value of first sample to the entire pulse");
102 
103  fUnitaryBox = new TGCheckButton(fOptionsFrame2, "Unitary");
104  fOptionsFrame2->AddFrame(fUnitaryBox, new TGLayoutHints(kLHintsCenterY, 20, 0, 0, 0));
105  fUnitaryBox->SetToolTipText("Check to normalize to the pulse amplitude");
106 }
107 
109 {
110  Cleanup();
111 }
112 
114 {
115  return fPulseNumberBox->GetIntNumber() - 1;
116 }
117 
119 {
120  return fOrderedByDropDownBox->GetTextEntry()->GetText();
121 }
123 {
124  return fSamplesLabelDropDownBox->GetTextEntry()->GetText();
125 }
126 
127 
129 {
130  if (fPulseNumberBox->GetIntNumber() < fNumberOfPulsesBox->GetIntNumber()) {
131  fPulseNumberBox->SetIntNumber(fPulseNumberBox->GetIntNumber() + 1);
133  }
134 }
135 
137 {
138  if (fPulseNumberBox->GetIntNumber() > 1) {
139  fPulseNumberBox->SetIntNumber(fPulseNumberBox->GetIntNumber() - 1);
141  }
142 }
143 
145 {
147 }
148 
150 {
151  return fSuperimposeBox->IsOn();
152 }
153 
155 {
156  return fUseADCUnitsBox->IsOn();
157 }
158 
160 {
161  return fShowLegendsBox->IsOn();
162 }
163 
165 {
166  return fZeroOffsetBox->IsOn();
167 }
168 
170 {
171  return fUnitaryBox->IsOn();
172 }
173 
174 
175 
176 
178 {
179  fPulseNumberBox->SetIntNumber(index + 1);
180 }
181 
183 {
184  fNumberOfPulsesBox->SetIntNumber(number);
185  if (number == 0) {
186  fPulseNumberBox->SetIntNumber(0);
187  }
188 }
189 
191 {
192  fOrderedByDropDownBox->GetTextEntry()->SetText(orderVariable.c_str());
193 }
194 
196 {
197  fSamplesLabelDropDownBox->GetTextEntry()->SetText(samplesLabel.c_str());
198 }
199 
200 
202 {
203  if (flag == true) {
204  fSuperimposeBox->SetState(kButtonDown);
205  }
206  else {
207  fSuperimposeBox->SetState(kButtonUp);
208  }
209 }
210 
212 {
213  if (flag == true) {
214  fUseADCUnitsBox->SetState(kButtonDown);
215  }
216  else {
217  fUseADCUnitsBox->SetState(kButtonUp);
218  }
219 }
220 
222 {
223  if (flag == true) {
224  fShowLegendsBox->SetState(kButtonDown);
225  }
226  else {
227  fShowLegendsBox->SetState(kButtonUp);
228  }
229 }
231 {
232  if (flag == true) {
233  fZeroOffsetBox->SetState(kButtonDown);
234  }
235  else {
236  fZeroOffsetBox->SetState(kButtonUp);
237  }
238 }
240 {
241  if (flag == true) {
242  fUnitaryBox->SetState(kButtonDown);
243  }
244  else {
245  fUnitaryBox->SetState(kButtonUp);
246  }
247 }
ClassImp(QObject)
Drop down box with tab-complete.
void EnableTabCompletion()
Enable tab completion.
virtual void Plot()
Plot this in the associated canvas window, generating it if necessary.
Definition: QGPlot.cc:195
Class for pulse edit window.
QGPlot * GetPlot()
Get pointer to the pulse plot.
Part of a pulse edit window for inputting parameters.
TGHorizontalFrame * fOrderedByFrame
Horizontal frame for ordered-by.
TGNumberEntryField * fNumberOfPulsesBox
Number of pulses box.
std::string GetOrderVariable() const
Get ordered-by variable.
TGLabel * fOrderedByLabel
Ordered-by label.
TGCheckButton * fUseADCUnitsBox
Use ADC Units check box.
void SetShowLegends(bool flag=true)
Set whether the legends box is checked.
void SetSuperimpose(bool flag=true)
Set whether the superimpose box is checked.
TGCheckButton * fSuperimposeBox
Superimpose check box.
TGHorizontalFrame * fOptionsFrame2
Secondary Horizontal frame for options boxes.
bool IsUseADCUnitsSet()
Return true if use ADC units box is checked.
QGPulseEditWindow * fPulseEditWindow
Pointer to parent pulse edit window.
bool IsZeroOffsetSet()
Return true if zero offset box is checked.
void SetUnitary(bool flag=true)
Set whether the unitary box is checked.
void HandlePreviousButton()
Handle previous button.
TGHorizontalFrame * fOptionsFrame
Horizontal frame for options boxes.
Long_t GetEventIndex() const
Get event index.
void SetOrderVariable(std::string orderVariable)
Set ordered-by variable.
TGCheckButton * fShowLegendsBox
Show Legends check box.
void SetNumberOfEvents(Long_t number)
Set number of events.
void SetZeroOffset(bool flag=true)
Set whether the zero offset box is checked.
TGLabel * fSamplesLabel
sampleslabel
virtual ~QGPulseParametersFrame()
Destructor.
TGNumberEntryField * fPulseNumberBox
Pulse number box.
void SetEventIndex(Long_t index)
Set event index.
bool IsShowLegendsSet()
Return true if legends box is checked.
TGHorizontalFrame * fPreviousNextFrame
Horizontal frame for previous/next buttons.
QGPulseParametersFrame(QGPulseEditWindow *p=0, UInt_t w=100, UInt_t h=100)
Constructor.
QGDropDownBox * fSamplesLabelDropDownBox
samples label box
void HandlePulseNumberBox()
Handle pulse number box.
TGCheckButton * fZeroOffsetBox
ZeroOffset check box.
bool IsUnitarySet()
Return true if unitary box is checked.
QGDropDownBox * fOrderedByDropDownBox
Ordered-by box.
TGCheckButton * fUnitaryBox
Unitary check box.
TGHorizontalFrame * fSamplesLabelFrame
Horizontal frame for samples.
void SetUseADCUnits(bool flag=true)
Set whether the use ADC units box is checked.
bool IsSuperimposeSet()
Return true if superimpose box is checked.
TGPictureButton * fPreviousButton
Previous button.
TGPictureButton * fNextButton
Next button.
std::string GetSamplesLabel() const
Get samples label.
void HandleNextButton()
Handle next button.
void SetSamplesLabel(std::string samplesVariable)
Set samples label.