Logo ROOT   6.12/07
Reference Guide
TEveTrackPropagatorEditor.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
13 #include "TEveTrackPropagator.h"
14 // #include <TEveTrack.h>
15 
16 #include "TEveGValuators.h"
17 #include "TEveManager.h"
18 
19 #include "TVirtualPad.h"
20 #include "TColor.h"
21 
22 #include "TGLabel.h"
23 #include "TG3DLine.h"
24 #include "TGButton.h"
25 #include "TGNumberEntry.h"
26 #include "TGColorSelect.h"
27 #include "TGComboBox.h"
28 #include "TGDoubleSlider.h"
29 #include "TGComboBox.h"
30 #include "TAttMarkerEditor.h"
31 
32 /** \class TEveTrackPropagatorSubEditor
33 \ingroup TEve
34 Sub-editor for TEveTrackPropagator class.
35 */
36 
38 
39 ////////////////////////////////////////////////////////////////////////////////
40 /// Constructor.
41 
43  TGVerticalFrame(p),
44  fM (0),
45 
46  fMaxR(0), fMaxZ(0), fMaxOrbits(0), fMaxAng(0), fDelta(0),
47 
48  fRefsCont(0), fPMFrame(0),
49  fFitDaughters(0), fFitReferences(0),
50  fFitDecay(0),
51  fFitCluster2Ds(0), fFitLineSegments(0),
52  fRnrDaughters(0), fRnrReferences(0),
53  fRnrDecay(0), fRnrCluster2Ds(0),
54  fRnrFV(0),
55  fPMAtt(0), fFVAtt(0),
56  fProjTrackBreaking(0), fRnrPTBMarkers(0), fPTBAtt(0)
57 {
58  Int_t labelW = 51;
59 
60  // --- Limits
61  fMaxR = new TEveGValuator(this, "Max R:", 90, 0);
62  fMaxR->SetLabelWidth(labelW);
63  fMaxR->SetNELength(6);
64  fMaxR->Build();
66  fMaxR->SetToolTip("Maximum radius to which the tracks will be drawn.");
67  fMaxR->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxR()");
68  AddFrame(fMaxR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
69 
70  fMaxZ = new TEveGValuator(this, "Max Z:", 90, 0);
71  fMaxZ->SetLabelWidth(labelW);
72  fMaxZ->SetNELength(6);
73  fMaxZ->Build();
75  fMaxZ->SetToolTip("Maximum z-coordinate to which the tracks will be drawn.");
76  fMaxZ->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxZ()");
77  AddFrame(fMaxZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
78 
79  fMaxOrbits = new TEveGValuator(this, "Orbits:", 90, 0);
80  fMaxOrbits->SetLabelWidth(labelW);
82  fMaxOrbits->Build();
84  fMaxOrbits->SetToolTip("Maximal angular path of tracks' orbits (1 ~ 2Pi).");
85  fMaxOrbits->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxOrbits()");
86  AddFrame(fMaxOrbits, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
87 
88  fMaxAng = new TEveGValuator(this, "Angle:", 90, 0);
89  fMaxAng->SetLabelWidth(labelW);
90  fMaxAng->SetNELength(6);
91  fMaxAng->Build();
93  fMaxAng->SetToolTip("Maximal angular step between two helix points.");
94  fMaxAng->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxAng()");
95  AddFrame(fMaxAng, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
96 
97  fDelta = new TEveGValuator(this, "Delta:", 90, 0);
98  fDelta->SetLabelWidth(labelW);
99  fDelta->SetNELength(6);
100  fDelta->Build();
102  fDelta->SetToolTip("Maximal error at the mid-point of the line connecting to helix points.");
103  fDelta->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoDelta()");
104  AddFrame(fDelta, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
105 }
106 
107 ////////////////////////////////////////////////////////////////////////////////
108 /// Create a frame containing track-reference controls under parent frame p.
109 
111 {
112  fRefsCont = new TGCompositeFrame(p, 80, 20, kVerticalFrame);
114  // Rendering control.
115  {
116  TGGroupFrame* fitPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
119 
120  TGMatrixLayout *ml = new TGMatrixLayout(fitPM, 0,1,6);
121  fitPM->SetLayoutManager(ml);
122 
123  fFitDaughters = new TGCheckButton(fitPM, "Fit Daughters", TEvePathMark::kDaughter);
124  fFitReferences = new TGCheckButton(fitPM, "Fit Refs", TEvePathMark::kReference);
125  fFitDecay = new TGCheckButton(fitPM, "Fit Decay", TEvePathMark::kDecay);
126  fFitCluster2Ds = new TGCheckButton(fitPM, "Fit 2D Clusters", TEvePathMark::kCluster2D);
127  fFitLineSegments = new TGCheckButton(fitPM, "Fit Line Segments", TEvePathMark::kLineSegment);
128 
129  fitPM->AddFrame(fFitDaughters);
130  fitPM->AddFrame(fFitReferences);
131  fitPM->AddFrame(fFitDecay);
132  fitPM->AddFrame(fFitCluster2Ds);
133  fitPM->AddFrame(fFitLineSegments);
134 
135  fFitDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
136  fFitReferences ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
137  fFitDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
138  fFitCluster2Ds ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
139  fFitLineSegments->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
140  }
141  // Kinematics fitting.
142  {
143  TGGroupFrame* rnrPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
146 
147  TGMatrixLayout *ml = new TGMatrixLayout(rnrPM, 0, 1, 6);
148  rnrPM->SetLayoutManager(ml);
149 
150  fRnrDaughters = new TGCheckButton(rnrPM, "Rnr Daughters", TEvePathMark::kDaughter);
151  fRnrReferences = new TGCheckButton(rnrPM, "Rnr Refs", TEvePathMark::kReference);
152  fRnrDecay = new TGCheckButton(rnrPM, "Rnr Decay", TEvePathMark::kDecay);
153  fRnrCluster2Ds = new TGCheckButton(rnrPM, "Rnr 2D Clusters", TEvePathMark::kCluster2D);
154 
155  rnrPM->AddFrame(fRnrDaughters);
156  rnrPM->AddFrame(fRnrReferences);
157  rnrPM->AddFrame(fRnrDecay);
158  rnrPM->AddFrame(fRnrCluster2Ds);
159 
160  fRnrDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
161  fRnrReferences->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
162  fRnrDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
163  fRnrCluster2Ds->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
164 
165  fRefsCont->AddFrame(fPMFrame, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
166  }
167  // Marker attributes.
168  {
171  TGFrame *f = el->fFrame; fPMAtt->RemoveFrame(f);
172  f->DestroyWindow(); delete f;
173  fRefsCont->AddFrame(fPMAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
174  }
175  // First vertex.
176  {
179  vf->AddFrame(new TGLabel(vf, "FirstVertex"),
180  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
181  vf->AddFrame(new TGHorizontal3DLine(vf),
182  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
183  fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
184 
185  fRnrFV = new TGCheckButton(fRefsCont, "Rnr");
186  fRnrFV->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrFV()");
187  fRefsCont->AddFrame(fRnrFV, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
188  {
191  TGFrame *f = el->fFrame; fFVAtt->RemoveFrame(f);
192  f->DestroyWindow(); delete f;
193  fRefsCont->AddFrame(fFVAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
194  }
195  }
196  // Break-points of projected tracks
197  {
200  vf->AddFrame(new TGLabel(vf, "BreakPoints"),
201  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
202  vf->AddFrame(new TGHorizontal3DLine(vf),
203  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
204  fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
205 
206  {
207  UInt_t labelW = 40;
208  UInt_t labelH = 20;
210  // label
211  TGCompositeFrame *labfr = new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
212  TGLabel* label = new TGLabel(labfr, "Mode:");
213  labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
214  hf->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
215  // combo
216  fProjTrackBreaking = new TGComboBox(hf);
220  fProjTrackBreaking->Connect("Selected(Int_t)", "TEveTrackPropagatorSubEditor", this, "DoModePTB(UChar_t)");
221  fProjTrackBreaking->Resize(140, labelH);
223  fRefsCont->AddFrame(hf, new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
224  }
225 
226  fRnrPTBMarkers = new TGCheckButton(fRefsCont, "Rnr");
227  fRnrPTBMarkers->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPTB()");
229  {
232  TGFrame *f = el->fFrame; fPTBAtt->RemoveFrame(f);
233  f->DestroyWindow(); delete f;
234  fRefsCont->AddFrame(fPTBAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
235  }
236  }
237 
239 }
240 
241 ////////////////////////////////////////////////////////////////////////////////
242 /// Set model object.
243 
245 {
246  fM = m;
247 
248  fMaxR->SetValue(fM->fMaxR);
249  fMaxZ->SetValue(fM->fMaxZ);
252  fDelta->SetValue(fM->GetDelta());
253 
254  if(fM->fEditPathMarks)
255  {
259  fRnrDecay->SetState(fM->fRnrDecay ? kButtonDown : kButtonUp);
261 
264  fFitDecay->SetState(fM->fFitDecay ? kButtonDown : kButtonUp);
267 
268  fPMAtt->SetModel(&fM->fPMAtt);
269  }
270  else
271  {
273  }
274 
276  fFVAtt->SetModel(&fM->fFVAtt);
277 
281 }
282 
283 ////////////////////////////////////////////////////////////////////////////////
284 /// Emit "Changed()" signal.
285 
287 {
288  Emit("Changed()");
289 }
290 
291 ////////////////////////////////////////////////////////////////////////////////
292 /// Slot for MaxR.
293 
295 {
296  fM->SetMaxR(fMaxR->GetValue());
297  Changed();
298 }
299 
300 ////////////////////////////////////////////////////////////////////////////////
301 /// Slot for MaxZ.
302 
304 {
305  fM->SetMaxZ(fMaxZ->GetValue());
306  Changed();
307 }
308 
309 ////////////////////////////////////////////////////////////////////////////////
310 /// Slot for MaxOrbits.
311 
313 {
315  Changed();
316 }
317 
318 ////////////////////////////////////////////////////////////////////////////////
319 /// Slot for MaxAng.
320 
322 {
324  Changed();
325 }
326 
327 ////////////////////////////////////////////////////////////////////////////////
328 /// Slot for Delta.
329 
331 {
332  fM->SetDelta(fDelta->GetValue());
333  Changed();
334 }
335 
336 ////////////////////////////////////////////////////////////////////////////////
337 /// Slot for FitPM.
338 
340 {
341  TGButton* b = (TGButton *) gTQSender;
343  Bool_t on = b->IsOn();
344 
345  switch(type)
346  {
348  fM->SetFitDaughters(on);
349  break;
351  fM->SetFitReferences(on);
352  break;
354  fM->SetFitDecay(on);
355  break;
357  fM->SetFitCluster2Ds(on);
358  break;
360  fM->SetFitLineSegments(on);
361  break;
362 
363  default:
364  break;
365  }
366  Changed();
367 }
368 
369 ////////////////////////////////////////////////////////////////////////////////
370 /// Slot for RnrPM.
371 
373 {
374  TGButton * b = (TGButton *) gTQSender;
376  Bool_t on = b->IsOn();
377  switch(type){
379  fM->SetRnrDaughters(on);
380  break;
382  fM->SetRnrReferences(on);
383  break;
385  fM->SetRnrDecay(on);
386  break;
388  fM->SetRnrCluster2Ds(on);
389  break;
390  default:
391  break;
392  }
393  Changed();
394 }
395 
396 ////////////////////////////////////////////////////////////////////////////////
397 /// Slot for RnrFV.
398 
400 {
401  fM->SetRnrFV(fRnrFV->IsOn());
402  Changed();
403 }
404 
405 ////////////////////////////////////////////////////////////////////////////////
406 /// Slot for PTBMode.
407 
409 {
410  fM->SetProjTrackBreaking(mode);
411  Changed();
412 }
413 
414 ////////////////////////////////////////////////////////////////////////////////
415 /// Slot for RnrPTBMarkers.
416 
418 {
420  Changed();
421 }
422 
423 /** \class TEveTrackPropagatorEditor
424 \ingroup TEve
425 GUI editor for TEveTrackPropagator.
426 It's only a wrapper around a TEveTrackPropagatorSubEditor that holds actual
427 widgets.
428 */
429 
431 
432 ////////////////////////////////////////////////////////////////////////////////
433 /// Constructor.
434 
436  Int_t width, Int_t height,
437  UInt_t options, Pixel_t back) :
438  TGedFrame(p, width, height, options | kVerticalFrame, back),
439  fM(0),
440  fRSSubEditor(0)
441 {
442  MakeTitle("RenderStyle");
443 
445  fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
447 
448  TGVerticalFrame* refsFrame = CreateEditorTabSubFrame("Refs");
449  {
451  (refsFrame, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground);
452  cf->AddFrame(new TGLabel(cf, "PathMarks"),
453  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
454  cf->AddFrame(new TGHorizontal3DLine(cf),
455  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
456  refsFrame->AddFrame(cf, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
457  }
458 
459  // path marks
460  fRSSubEditor->CreateRefsContainer(refsFrame);
463 
464  fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
465 }
466 
467 ////////////////////////////////////////////////////////////////////////////////
468 /// Set model object.
469 
471 {
472  fM = dynamic_cast<TEveTrackPropagator*>(obj);
474 }
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
void SetRnrCluster2Ds(Bool_t x)
Set rendering of 2D-clusters and rebuild tracks.
auto * m
Definition: textangle.C:8
virtual Bool_t IsOn() const
Definition: TGButton.h:119
void CreateRefsContainer(TGVerticalFrame *p)
Create a frame containing track-reference controls under parent frame p.
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
static Double_t fgEditorMaxR
R__EXTERN void * gTQSender
Definition: TQObject.h:45
void SetDelta(Double_t x)
Set maximum error and rebuild tracks.
Int_t WidgetId() const
Definition: TGWidget.h:80
Double_t GetDelta() const
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:982
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1186
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void SetToolTip(const char *tip)
Set the tooltip of the number-entry.
void SetFitLineSegments(Bool_t x)
Set line segment fitting and rebuild tracks.
void SetMaxAng(Double_t x)
Set maximum step angle and rebuild tracks.
virtual void SetModel(TObject *obj)
Set model object.
TEveTrackPropagatorSubEditor * fRSSubEditor
Composite GUI element for single value selection (supports label, number-entry and slider)...
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition: TGFrame.cxx:1131
TEveTrackPropagatorSubEditor(const TEveTrackPropagatorSubEditor &)
void SetMaxR(Double_t x)
Set maximum radius and rebuild tracks.
void SetRnrReferences(Bool_t x)
Set track-reference rendering and rebuild tracks.
void SetProjTrackBreaking(UChar_t x)
Set projection break-point mode and rebuild tracks.
void DoMaxOrbits()
Slot for MaxOrbits.
void DoModePTB(UChar_t mode)
Slot for PTBMode.
virtual void SetTitlePos(ETitlePos pos=kLeft)
Definition: TGFrame.h:651
ULong_t Pixel_t
Definition: GuiTypes.h:39
TEveTrackPropagatorEditor(const TEveTrackPropagatorEditor &)
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
TGCompositeFrame(const TGCompositeFrame &)
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by &#39;owner&#39; in extra tab &#39;name&#39;.
Definition: TGedFrame.cxx:123
void SetFitDaughters(Bool_t x)
Set daughter creation point fitting and rebuild tracks.
virtual TList * GetList() const
Definition: TGFrame.h:369
GUI editor for TEveTrackPropagator.
Double_t GetMaxAng() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:867
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
static Double_t fgEditorMaxZ
void SetRnrFV(Bool_t x)
Set first-vertex rendering and rebuild tracks.
void SetModel(TEveTrackPropagator *m)
Set model object.
void SetNELength(Int_t l)
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
void SetRnrDaughters(Bool_t x)
Set daughter rendering and rebuild tracks.
TEveGedEditor * GetEditor() const
Returns main object editor.
unsigned int UInt_t
Definition: RtypesCore.h:42
void SetMaxOrbs(Double_t x)
Set maximum number of orbits and rebuild tracks.
TGFrame * fFrame
Definition: TGLayout.h:119
TGVerticalFrame(const TGWindow *p=0, UInt_t w=1, UInt_t h=1, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Definition: TGFrame.h:436
Holding structure for a number of track rendering parameters.
void SetMaxZ(Double_t x)
Set maximum z and rebuild tracks.
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entry, slider).
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
int type
Definition: TGX11.cxx:120
virtual void SetModel(TObject *obj)
Pick up the values of used marker attributes.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
Mother of all ROOT objects.
Definition: TObject.h:37
void DoRnrPTB()
Slot for RnrPTBMarkers.
Sub-editor for TEveTrackPropagator class.
void SetRnrDecay(Bool_t x)
Set decay rendering and rebuild tracks.
void SetFitReferences(Bool_t x)
Set track-reference fitting and rebuild tracks.
void SetFitDecay(Bool_t x)
Set decay fitting and rebuild tracks.
void SetLabelWidth(Int_t w)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
void SetFitCluster2Ds(Bool_t x)
Set 2D-cluster fitting and rebuild tracks.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
unsigned char UChar_t
Definition: RtypesCore.h:34
void SetLimits(Int_t min, Int_t max)
Set limits of the represented value for integer values.
void SetRnrPTBMarkers(Bool_t x)
Set projection break-point rendering and rebuild tracks.
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
void Changed()
Emit "Changed()" signal.
Float_t GetValue() const
virtual void DestroyWindow()
Definition: TGWindow.h:92
virtual void SetGedEditor(TGedEditor *ed)
Definition: TGedFrame.h:86
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185