forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEveTrackPropagatorEditor.cxx
466 lines (394 loc) · 17.3 KB
/
TEveTrackPropagatorEditor.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#include "TEveTrackPropagatorEditor.h"
#include "TEveTrackPropagator.h"
#include "TEveGValuators.h"
#include "TEveManager.h"
#include "TGLabel.h"
#include "TG3DLine.h"
#include "TGButton.h"
#include "TGComboBox.h"
#include "TAttMarkerEditor.h"
/** \class TEveTrackPropagatorSubEditor
\ingroup TEve
Sub-editor for TEveTrackPropagator class.
*/
ClassImp(TEveTrackPropagatorSubEditor);
////////////////////////////////////////////////////////////////////////////////
/// Constructor.
TEveTrackPropagatorSubEditor::TEveTrackPropagatorSubEditor(const TGWindow *p):
TGVerticalFrame(p),
fM (nullptr),
fMaxR(nullptr), fMaxZ(nullptr), fMaxOrbits(nullptr), fMaxAng(nullptr), fDelta(nullptr),
fRefsCont(nullptr), fPMFrame(nullptr),
fFitDaughters(nullptr), fFitReferences(nullptr),
fFitDecay(nullptr),
fFitCluster2Ds(nullptr), fFitLineSegments(nullptr),
fRnrDaughters(nullptr), fRnrReferences(nullptr),
fRnrDecay(nullptr), fRnrCluster2Ds(nullptr),
fRnrFV(nullptr),
fPMAtt(nullptr), fFVAtt(nullptr),
fProjTrackBreaking(nullptr), fRnrPTBMarkers(nullptr), fPTBAtt(nullptr)
{
Int_t labelW = 51;
// --- Limits
fMaxR = new TEveGValuator(this, "Max R:", 90, 0);
fMaxR->SetLabelWidth(labelW);
fMaxR->SetNELength(6);
fMaxR->Build();
fMaxR->SetLimits(0.1, TEveTrackPropagator::fgEditorMaxR, 101, TGNumberFormat::kNESRealOne);
fMaxR->SetToolTip("Maximum radius to which the tracks will be drawn.");
fMaxR->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxR()");
AddFrame(fMaxR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
fMaxZ = new TEveGValuator(this, "Max Z:", 90, 0);
fMaxZ->SetLabelWidth(labelW);
fMaxZ->SetNELength(6);
fMaxZ->Build();
fMaxZ->SetLimits(0.1, TEveTrackPropagator::fgEditorMaxZ, 101, TGNumberFormat::kNESRealOne);
fMaxZ->SetToolTip("Maximum z-coordinate to which the tracks will be drawn.");
fMaxZ->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxZ()");
AddFrame(fMaxZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
fMaxOrbits = new TEveGValuator(this, "Orbits:", 90, 0);
fMaxOrbits->SetLabelWidth(labelW);
fMaxOrbits->SetNELength(6);
fMaxOrbits->Build();
fMaxOrbits->SetLimits(0.1, 10, 101, TGNumberFormat::kNESRealOne);
fMaxOrbits->SetToolTip("Maximal angular path of tracks' orbits (1 ~ 2Pi).");
fMaxOrbits->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxOrbits()");
AddFrame(fMaxOrbits, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
fMaxAng = new TEveGValuator(this, "Angle:", 90, 0);
fMaxAng->SetLabelWidth(labelW);
fMaxAng->SetNELength(6);
fMaxAng->Build();
fMaxAng->SetLimits(1, 160, 81, TGNumberFormat::kNESRealOne);
fMaxAng->SetToolTip("Maximal angular step between two helix points.");
fMaxAng->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxAng()");
AddFrame(fMaxAng, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
fDelta = new TEveGValuator(this, "Delta:", 90, 0);
fDelta->SetLabelWidth(labelW);
fDelta->SetNELength(6);
fDelta->Build();
fDelta->SetLimits(0.001, 10, 101, TGNumberFormat::kNESRealThree);
fDelta->SetToolTip("Maximal error at the mid-point of the line connecting to helix points.");
fDelta->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoDelta()");
AddFrame(fDelta, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}
////////////////////////////////////////////////////////////////////////////////
/// Create a frame containing track-reference controls under parent frame p.
void TEveTrackPropagatorSubEditor::CreateRefsContainer(TGVerticalFrame* p)
{
fRefsCont = new TGCompositeFrame(p, 80, 20, kVerticalFrame);
fPMFrame = new TGVerticalFrame(fRefsCont);
// Rendering control.
{
TGGroupFrame* fitPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
fitPM->SetTitlePos(TGGroupFrame::kLeft);
fPMFrame->AddFrame( fitPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
TGMatrixLayout *ml = new TGMatrixLayout(fitPM, 0,1,6);
fitPM->SetLayoutManager(ml);
fFitDaughters = new TGCheckButton(fitPM, "Fit Daughters", TEvePathMark::kDaughter);
fFitReferences = new TGCheckButton(fitPM, "Fit Refs", TEvePathMark::kReference);
fFitDecay = new TGCheckButton(fitPM, "Fit Decay", TEvePathMark::kDecay);
fFitCluster2Ds = new TGCheckButton(fitPM, "Fit 2D Clusters", TEvePathMark::kCluster2D);
fFitLineSegments = new TGCheckButton(fitPM, "Fit Line Segments", TEvePathMark::kLineSegment);
fitPM->AddFrame(fFitDaughters);
fitPM->AddFrame(fFitReferences);
fitPM->AddFrame(fFitDecay);
fitPM->AddFrame(fFitCluster2Ds);
fitPM->AddFrame(fFitLineSegments);
fFitDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
fFitReferences ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
fFitDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
fFitCluster2Ds ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
fFitLineSegments->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
}
// Kinematics fitting.
{
TGGroupFrame* rnrPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
rnrPM->SetTitlePos(TGGroupFrame::kLeft);
fPMFrame->AddFrame( rnrPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
TGMatrixLayout *ml = new TGMatrixLayout(rnrPM, 0, 1, 6);
rnrPM->SetLayoutManager(ml);
fRnrDaughters = new TGCheckButton(rnrPM, "Rnr Daughters", TEvePathMark::kDaughter);
fRnrReferences = new TGCheckButton(rnrPM, "Rnr Refs", TEvePathMark::kReference);
fRnrDecay = new TGCheckButton(rnrPM, "Rnr Decay", TEvePathMark::kDecay);
fRnrCluster2Ds = new TGCheckButton(rnrPM, "Rnr 2D Clusters", TEvePathMark::kCluster2D);
rnrPM->AddFrame(fRnrDaughters);
rnrPM->AddFrame(fRnrReferences);
rnrPM->AddFrame(fRnrDecay);
rnrPM->AddFrame(fRnrCluster2Ds);
fRnrDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
fRnrReferences->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
fRnrDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
fRnrCluster2Ds->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
fRefsCont->AddFrame(fPMFrame, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}
// Marker attributes.
{
fPMAtt = new TAttMarkerEditor(fRefsCont);
TGFrameElement *el = (TGFrameElement*) fPMAtt->GetList()->First();
TGFrame *f = el->fFrame; fPMAtt->RemoveFrame(f);
f->DestroyWindow(); delete f;
fRefsCont->AddFrame(fPMAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
}
// First vertex.
{
TGCompositeFrame *vf = new TGCompositeFrame
(fRefsCont, 145, 10, kHorizontalFrame | kFitWidth | kFixedWidth | kOwnBackground);
vf->AddFrame(new TGLabel(vf, "FirstVertex"),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
vf->AddFrame(new TGHorizontal3DLine(vf),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
fRnrFV = new TGCheckButton(fRefsCont, "Rnr");
fRnrFV->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrFV()");
fRefsCont->AddFrame(fRnrFV, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
{
fFVAtt = new TAttMarkerEditor(fRefsCont);
TGFrameElement *el = (TGFrameElement*) fFVAtt->GetList()->First();
TGFrame *f = el->fFrame; fFVAtt->RemoveFrame(f);
f->DestroyWindow(); delete f;
fRefsCont->AddFrame(fFVAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
}
}
// Break-points of projected tracks
{
TGCompositeFrame *vf = new TGCompositeFrame
(fRefsCont, 145, 10, kHorizontalFrame | kFitWidth | kFixedWidth | kOwnBackground);
vf->AddFrame(new TGLabel(vf, "BreakPoints"),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
vf->AddFrame(new TGHorizontal3DLine(vf),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
{
UInt_t labelW = 40;
UInt_t labelH = 20;
TGHorizontalFrame* hf = new TGHorizontalFrame(fRefsCont);
// label
TGCompositeFrame *labfr = new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
TGLabel* label = new TGLabel(labfr, "Mode:");
labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
hf->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
// combo
fProjTrackBreaking = new TGComboBox(hf);
fProjTrackBreaking->AddEntry("Break tracks", TEveTrackPropagator::kPTB_Break);
fProjTrackBreaking->AddEntry("First point position", TEveTrackPropagator::kPTB_UseFirstPointPos);
fProjTrackBreaking->AddEntry("Last point position", TEveTrackPropagator::kPTB_UseLastPointPos);
fProjTrackBreaking->Connect("Selected(Int_t)", "TEveTrackPropagatorSubEditor", this, "DoModePTB(UChar_t)");
fProjTrackBreaking->Resize(140, labelH);
hf->AddFrame(fProjTrackBreaking, new TGLayoutHints(kLHintsLeft, 0,0,2,0));
fRefsCont->AddFrame(hf, new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
}
fRnrPTBMarkers = new TGCheckButton(fRefsCont, "Rnr");
fRnrPTBMarkers->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPTB()");
fRefsCont->AddFrame(fRnrPTBMarkers, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
{
fPTBAtt = new TAttMarkerEditor(fRefsCont);
TGFrameElement *el = (TGFrameElement*) fPTBAtt->GetList()->First();
TGFrame *f = el->fFrame; fPTBAtt->RemoveFrame(f);
f->DestroyWindow(); delete f;
fRefsCont->AddFrame(fPTBAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
}
}
p->AddFrame(fRefsCont, new TGLayoutHints(kLHintsTop| kLHintsExpandX));
}
////////////////////////////////////////////////////////////////////////////////
/// Set model object.
void TEveTrackPropagatorSubEditor::SetModel(TEveTrackPropagator* m)
{
fM = m;
fMaxR->SetValue(fM->fMaxR);
fMaxZ->SetValue(fM->fMaxZ);
fMaxOrbits->SetValue(fM->fMaxOrbs);
fMaxAng->SetValue(fM->GetMaxAng());
fDelta->SetValue(fM->GetDelta());
if(fM->fEditPathMarks)
{
ShowFrame(fPMFrame);
fRnrDaughters->SetState(fM->fRnrDaughters ? kButtonDown : kButtonUp);
fRnrReferences->SetState(fM->fRnrReferences ? kButtonDown : kButtonUp);
fRnrDecay->SetState(fM->fRnrDecay ? kButtonDown : kButtonUp);
fRnrCluster2Ds->SetState(fM->fRnrCluster2Ds ? kButtonDown : kButtonUp);
fFitDaughters->SetState(fM->fFitDaughters ? kButtonDown : kButtonUp);
fFitReferences->SetState(fM->fFitReferences ? kButtonDown : kButtonUp);
fFitDecay->SetState(fM->fFitDecay ? kButtonDown : kButtonUp);
fFitCluster2Ds->SetState(fM->fFitCluster2Ds ? kButtonDown : kButtonUp);
fFitLineSegments->SetState(fM->fFitLineSegments ? kButtonDown : kButtonUp);
fPMAtt->SetModel(&fM->fPMAtt);
}
else
{
fRefsCont->HideFrame(fPMFrame);
}
fRnrFV->SetState(fM->fRnrFV ? kButtonDown : kButtonUp);
fFVAtt->SetModel(&fM->fFVAtt);
fProjTrackBreaking->Select(fM->fProjTrackBreaking, kFALSE);
fRnrPTBMarkers->SetState(fM->fRnrPTBMarkers ? kButtonDown : kButtonUp);
fPTBAtt->SetModel(&fM->fPTBAtt);
}
////////////////////////////////////////////////////////////////////////////////
/// Emit "Changed()" signal.
void TEveTrackPropagatorSubEditor::Changed()
{
Emit("Changed()");
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for MaxR.
void TEveTrackPropagatorSubEditor::DoMaxR()
{
fM->SetMaxR(fMaxR->GetValue());
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for MaxZ.
void TEveTrackPropagatorSubEditor::DoMaxZ()
{
fM->SetMaxZ(fMaxZ->GetValue());
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for MaxOrbits.
void TEveTrackPropagatorSubEditor::DoMaxOrbits()
{
fM->SetMaxOrbs(fMaxOrbits->GetValue());
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for MaxAng.
void TEveTrackPropagatorSubEditor::DoMaxAng()
{
fM->SetMaxAng(fMaxAng->GetValue());
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for Delta.
void TEveTrackPropagatorSubEditor::DoDelta()
{
fM->SetDelta(fDelta->GetValue());
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for FitPM.
void TEveTrackPropagatorSubEditor::DoFitPM()
{
TGButton* b = (TGButton *) gTQSender;
TEvePathMark::EType_e type = TEvePathMark::EType_e(b->WidgetId());
Bool_t on = b->IsOn();
switch(type)
{
case TEvePathMark::kDaughter:
fM->SetFitDaughters(on);
break;
case TEvePathMark::kReference:
fM->SetFitReferences(on);
break;
case TEvePathMark::kDecay:
fM->SetFitDecay(on);
break;
case TEvePathMark::kCluster2D:
fM->SetFitCluster2Ds(on);
break;
case TEvePathMark::kLineSegment:
fM->SetFitLineSegments(on);
break;
default:
break;
}
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for RnrPM.
void TEveTrackPropagatorSubEditor::DoRnrPM()
{
TGButton * b = (TGButton *) gTQSender;
TEvePathMark::EType_e type = TEvePathMark::EType_e(b->WidgetId());
Bool_t on = b->IsOn();
switch(type){
case TEvePathMark::kDaughter:
fM->SetRnrDaughters(on);
break;
case TEvePathMark::kReference:
fM->SetRnrReferences(on);
break;
case TEvePathMark::kDecay:
fM->SetRnrDecay(on);
break;
case TEvePathMark::kCluster2D:
fM->SetRnrCluster2Ds(on);
break;
default:
break;
}
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for RnrFV.
void TEveTrackPropagatorSubEditor::DoRnrFV()
{
fM->SetRnrFV(fRnrFV->IsOn());
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for PTBMode.
void TEveTrackPropagatorSubEditor::DoModePTB(UChar_t mode)
{
fM->SetProjTrackBreaking(mode);
Changed();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for RnrPTBMarkers.
void TEveTrackPropagatorSubEditor::DoRnrPTB()
{
fM->SetRnrPTBMarkers(fRnrPTBMarkers->IsOn());
Changed();
}
/** \class TEveTrackPropagatorEditor
\ingroup TEve
GUI editor for TEveTrackPropagator.
It's only a wrapper around a TEveTrackPropagatorSubEditor that holds actual
widgets.
*/
ClassImp(TEveTrackPropagatorEditor);
////////////////////////////////////////////////////////////////////////////////
/// Constructor.
TEveTrackPropagatorEditor::TEveTrackPropagatorEditor(const TGWindow *p,
Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM(nullptr),
fRSSubEditor(nullptr)
{
MakeTitle("RenderStyle");
fRSSubEditor = new TEveTrackPropagatorSubEditor(this);
fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
AddFrame(fRSSubEditor, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0,0,0));
TGVerticalFrame* refsFrame = CreateEditorTabSubFrame("Refs");
{
TGCompositeFrame *cf = new TGCompositeFrame
(refsFrame, 145, 10, kHorizontalFrame | kFitWidth | kFixedWidth | kOwnBackground);
cf->AddFrame(new TGLabel(cf, "PathMarks"),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
cf->AddFrame(new TGHorizontal3DLine(cf),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
refsFrame->AddFrame(cf, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
}
// path marks
fRSSubEditor->CreateRefsContainer(refsFrame);
fRSSubEditor->fPMAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
fRSSubEditor->fFVAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
}
////////////////////////////////////////////////////////////////////////////////
/// Set model object.
void TEveTrackPropagatorEditor::SetModel(TObject* obj)
{
fM = dynamic_cast<TEveTrackPropagator*>(obj);
fRSSubEditor->SetModel(fM);
}