CbmRoot
Loading...
Searching...
No Matches
CbmTsEveAnimationControl.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau[committer] */
4
5/*
6 * FairEveAnimationControl.cxx
7 *
8 * Created on: 26 maj 2020
9 * Author: Daniel Wielanek
10 * E-mail: daniel.wielanek@gmail.com
11 * Warsaw University of Technology, Faculty of Physics
12 */
15
16CbmTsEveAnimationControl::CbmTsEveAnimationControl(TGedFrame* frame, TGCompositeFrame* tab, TString functionName,
17 TString name, Int_t width)
18 : fWidth(width)
19 , fParent(frame)
20 , fFunctionName(functionName)
21 , fTab(tab)
22{
23 SetName(name);
24}
25
27
29{
30 TGGroupFrame* animCtrl = new TGGroupFrame(fTab, GetName());
31 animCtrl->SetTitlePos(TGGroupFrame::kCenter);
32
33 // -------------------------------- Start "holy" button --------------------------------------------------------------
34 fStartButton = new TGTextButton(animCtrl, "Start");
35 fStartButton->Resize(80, 25);
36 animCtrl->AddFrame(fStartButton, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
37 fStartButton->Connect("Clicked()", fParent->ClassName(), fParent, fFunctionName);
38 fStartButton->SetEnabled(kFALSE); // Enabled only if TS number set to at least 1
39 // -------------------------------------------------------------------------------------------------------------------
40
41 // -------------------------------- Animation type -------------------------------------------------------------------
42 TGCompositeFrame* frAnimType = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
43 TGLabel* gAnimType = new TGLabel(frAnimType, "Animation type:");
44 frAnimType->AddFrame(gAnimType, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 1, 1));
45 fTypeOpt = new TGComboBox(frAnimType);
46 fTypeOpt->AddEntry("Evts in sel. TS", kEventsInTs);
47 fTypeOpt->AddEntry("Timeslices", kTimeSlices);
48 fTypeOpt->Select(kTimeSlices);
49 fTypeOpt->Resize(100, 20);
50 frAnimType->AddFrame(fTypeOpt, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
51 animCtrl->AddFrame(frAnimType, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
52 fTypeOpt->Connect("Selected (Int_t,Int_t)", this->ClassName(), this, "UpdateEnaDisButtons()");
53
54 TGCompositeFrame* frSelAnimFrameSec = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
55 TGLabel* gLabelFrameSec = new TGLabel(frSelAnimFrameSec, "Frame length (s):");
56 frSelAnimFrameSec->AddFrame(gLabelFrameSec, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
57 fAnimFrameSec = new TGNumberEntry(frSelAnimFrameSec, 5.0, 6, -1, TGNumberFormat::kNESReal,
58 TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMin, 0);
59 fAnimFrameSec->SetNumber(5.0);
60 frSelAnimFrameSec->AddFrame(fAnimFrameSec, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
61 animCtrl->AddFrame(frSelAnimFrameSec, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
62 // -------------------------------------------------------------------------------------------------------------------
63
64 // -------------------------------- Event stepping buttons -----------------------------------------------------------
65 TGCompositeFrame* frSelEvtMin = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
66 TGLabel* gLabelEvtMin = new TGLabel(frSelEvtMin, "Min Evt:");
67 frSelEvtMin->AddFrame(gLabelEvtMin, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
68 fEvtMin = new TGNumberEntry(frSelEvtMin, 0, 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
69 TGNumberFormat::kNELLimitMinMax, 0, (fNbEvt ? fNbEvt - 1 : 0));
70 fEvtMin->SetNumber(0);
71 frSelEvtMin->AddFrame(fEvtMin, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
72 animCtrl->AddFrame(frSelEvtMin, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
73
74 TGCompositeFrame* frSelEvtMax = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
75 TGLabel* gLabelEvtMax = new TGLabel(frSelEvtMax, "Max Evt:");
76 frSelEvtMax->AddFrame(gLabelEvtMax, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
77 fEvtMax = new TGNumberEntry(frSelEvtMax, 10, 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
78 TGNumberFormat::kNELLimitMinMax, 0, (fNbEvt ? fNbEvt - 1 : 0));
79 fEvtMax->SetNumber((fNbEvt ? fNbEvt - 1 : 0));
80 frSelEvtMax->AddFrame(fEvtMax, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
81 animCtrl->AddFrame(frSelEvtMax, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
82
83 TGCompositeFrame* frSelEvtStep = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
84 TGLabel* gLabelEvtStep = new TGLabel(frSelEvtStep, "Step Evt:");
85 frSelEvtStep->AddFrame(gLabelEvtStep, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
86 fEvtStep = new TGNumberEntry(frSelEvtStep, 0, 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive,
87 TGNumberFormat::kNELLimitMinMax, 1, (fNbEvt ? fNbEvt - 1 : 1));
88 fEvtStep->SetNumber(1);
89 frSelEvtStep->AddFrame(fEvtStep, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
90 animCtrl->AddFrame(frSelEvtStep, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
91
94 fEvtMin->SetState(kFALSE);
95 fEvtMax->SetState(kFALSE);
96 fEvtStep->SetState(kFALSE);
97 // -------------------------------------------------------------------------------------------------------------------
98
99 // -------------------------------- TS stepping buttons --------------------------------------------------------------
100 TGCompositeFrame* frSelTsMin = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
101 TGLabel* gLabelTsMin = new TGLabel(frSelTsMin, "Min Ts:");
102 frSelTsMin->AddFrame(gLabelTsMin, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
103 fTsMin = new TGNumberEntry(frSelTsMin, 0, 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
104 TGNumberFormat::kNELLimitMinMax, 0, (fNbTs ? fNbTs - 1 : 0));
105 fTsMin->SetNumber(0);
106 frSelTsMin->AddFrame(fTsMin, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
107 animCtrl->AddFrame(frSelTsMin, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
108
109 TGCompositeFrame* frSelTsMax = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
110 TGLabel* gLabelTsMax = new TGLabel(frSelTsMax, "Max Ts:");
111 frSelTsMax->AddFrame(gLabelTsMax, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
112 fTsMax = new TGNumberEntry(frSelTsMax, 10, 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
113 TGNumberFormat::kNELLimitMinMax, 0, (fNbTs ? fNbTs - 1 : 0));
114 fTsMax->SetNumber((fNbTs ? fNbTs - 1 : 0));
115 frSelTsMax->AddFrame(fTsMax, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
116 animCtrl->AddFrame(frSelTsMax, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
117
118 TGCompositeFrame* frSelTsStep = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
119 TGLabel* gLabelTsStep = new TGLabel(frSelTsStep, "Step Ts:");
120 frSelTsStep->AddFrame(gLabelTsStep, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
121 fTsStep = new TGNumberEntry(frSelTsStep, 0, 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive,
122 TGNumberFormat::kNELLimitMinMax, 1, (fNbTs ? fNbTs - 1 : 1));
123 fTsStep->SetNumber(1);
124 frSelTsStep->AddFrame(fTsStep, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
125 animCtrl->AddFrame(frSelTsStep, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
126
127 Bool_t bAtLeastOneTs = (0 < fNbTs);
128 fTsMin->SetState(bAtLeastOneTs);
129 fTsMax->SetState(bAtLeastOneTs);
130 fTsStep->SetState(bAtLeastOneTs);
131 fEvtStep->SetState(bAtLeastOneTs);
132 fStartButton->SetEnabled(bAtLeastOneTs);
133 // -------------------------------------------------------------------------------------------------------------------
134
135 // -------------------------------- Screenshot Ena & type ------------------------------------------------------------
136 fBtnScreenshotEna = new TGCheckButton(animCtrl, "Screenshot each event");
137 fBtnScreenshotEna->SetOn();
138 animCtrl->AddFrame(fBtnScreenshotEna, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
139 fBtnScreenshotEna->Connect("Clicked()", this->ClassName(), this, "UpdateEnaScreenshots()");
140
141 TGCompositeFrame* frSceneType = new TGCompositeFrame(animCtrl, fWidth, 30, kHorizontalFrame | kFixedWidth);
142 TGLabel* gLabelType = new TGLabel(frSceneType, "Scene type:");
143 frSceneType->AddFrame(gLabelType, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
144 fSceneOpt = new TGComboBox(frSceneType);
145 fSceneOpt->AddEntry("3D", k3D);
146 if (fbMcbmViewersEna) {
147 fSceneOpt->AddEntry("ZX", kZX);
148 fSceneOpt->AddEntry("ZY", kZY);
149 }
150 else {
151 fSceneOpt->AddEntry("RPhi", kXY);
152 fSceneOpt->AddEntry("RhoZ", kZ);
153 }
154 fSceneOpt->AddEntry("All", kAll);
155 fSceneOpt->Select(k3D);
156 fSceneOpt->Resize(100, 20);
157 frSceneType->AddFrame(fSceneOpt, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
158 animCtrl->AddFrame(frSceneType, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
159 // -------------------------------------------------------------------------------------------------------------------
160
161 // -------------------------------- Display clear ctrl ---------------------------------------------------------------
162 fBtnClearBuffer = new TGCheckButton(animCtrl, "Clear Buffer at Start");
163 fBtnClearBuffer->SetOn();
164 animCtrl->AddFrame(fBtnClearBuffer, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
165
166 fBtnRunContinuous = new TGCheckButton(animCtrl, "Run Continuous (stack events)");
167 fBtnRunContinuous->SetOn(kFALSE);
168 animCtrl->AddFrame(fBtnRunContinuous, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
169 // -------------------------------------------------------------------------------------------------------------------
170
171 fTab->AddFrame(animCtrl, new TGLayoutHints(kLHintsRight | kLHintsExpandX, 1, 1, 2, 1));
172
174
175 fbInitDone = true;
176}
177
182
184
186
191
192Int_t CbmTsEveAnimationControl::GetEventMin() { return fEvtMin->GetNumber(); }
193
194Int_t CbmTsEveAnimationControl::GetEventMax() { return fEvtMax->GetNumber(); }
195
196Int_t CbmTsEveAnimationControl::GetEventStep() { return fEvtStep->GetNumber(); }
197
198Int_t CbmTsEveAnimationControl::GetTsMin() { return fTsMin->GetNumber(); }
199
200Int_t CbmTsEveAnimationControl::GetTsMax() { return fTsMax->GetNumber(); }
201
202Int_t CbmTsEveAnimationControl::GetTsStep() { return fTsStep->GetNumber(); }
203
205
207
209
211{
213 Bool_t bAtLeastOneTs = (0 < fNbTs);
214 if (bAtLeastOneTs) {
215 fStartButton->SetEnabled(kTRUE);
216
217 Bool_t bTsScanMode = (kTimeSlices == GetAnimationType());
218
220 fEvtMin->SetState(!bTsScanMode);
221 fEvtMax->SetState(!bTsScanMode);
222 fEvtStep->SetState(kTRUE);
223
225 fTsMin->SetState(bTsScanMode);
226 fTsMax->SetState(bTsScanMode);
227 fTsStep->SetState(bTsScanMode);
228 }
229 else {
230 fStartButton->SetEnabled(kFALSE);
231 fEvtMin->SetState(kFALSE);
232 fEvtMax->SetState(kFALSE);
233 fEvtStep->SetState(kFALSE);
234 fTsMin->SetState(kFALSE);
235 fTsMax->SetState(kFALSE);
236 fTsStep->SetState(kFALSE);
237 }
238}
239
241{
242 fEvtMin->SetLimitValues(0, fNbEvt - 1);
243 fEvtMax->SetLimitValues(0, fNbEvt - 1);
244 fEvtStep->SetLimitValues(1, fNbEvt - 1);
245
246 fEvtMin->SetNumber(0);
247 fEvtMax->SetNumber(fNbEvt - 1);
248 fEvtStep->SetNumber(1);
249
251}
252
254{
255 fTsMin->SetLimitValues(0, fNbTs - 1);
256 fTsMax->SetLimitValues(0, fNbTs - 1);
257 fTsStep->SetLimitValues(1, fNbTs - 1);
258
259 fTsMin->SetNumber(0);
260 fTsMax->SetNumber(fNbTs - 1);
261 fTsStep->SetNumber(1);
262
264}
eScreenshotType GetScreenshotType() const
CbmTsEveAnimationControl(TGedFrame *frame, TGCompositeFrame *tab, TString functionName, TString name="", Int_t width=170)
PAL 01/06/2023: heavily based on FairEveAnimationControl from FairRoot v18.6.7, for usage with CbmTim...
void UpdateEnaDisButtons()
Update GUI elements to enforce options/limits. RESERVED FOR GUI CALLS!
eAnimationType GetAnimationType() const
void UpdateEventLimits()
Update GUI elements to enforce options/limits. RESERVED FOR GUI CALLS!
void UpdateEnaScreenshots()
Update GUI elements to enforce options/limits. RESERVED FOR GUI CALLS!
void UpdateTsLimits()
Update GUI elements to enforce options/limits. RESERVED FOR GUI CALLS!