Merge changes from branches/dev/EVE. This branch was following development in ROOT...
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTPCSector3DEditor.cxx
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include "AliEveTPCSector3DEditor.h"
11 #include <EveDet/AliEveTPCSector3D.h>
12
13 #include <TEveGValuators.h>
14
15 #include <TGButton.h>
16 #include <TGNumberEntry.h>
17 #include <TGSlider.h>
18
19 //______________________________________________________________________________
20 //
21 // Editor for AliEveTPCSector3D.
22
23 ClassImp(AliEveTPCSector3DEditor)
24
25 AliEveTPCSector3DEditor::AliEveTPCSector3DEditor(const TGWindow *p,
26                                                  Int_t width, Int_t height,
27                                                  UInt_t options, Pixel_t back) :
28   TGedFrame(p, width, height, options | kVerticalFrame, back),
29   fM(0),
30   fRnrFrame(0), fDriftVel(0), fPointFrac(0), fPointSize(0)
31 {
32   // Constructor.
33
34   MakeTitle("AliEveTPCSector3D");
35
36   Int_t labelW = 60;
37
38   fRnrFrame = new TGCheckButton(this, "ShowFrame");
39   AddFrame(fRnrFrame, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
40   fRnrFrame->Connect
41     ("Toggled(Bool_t)","AliEveTPCSector3DEditor", this, "DoRnrFrame()");
42
43   fDriftVel = new TEveGValuator(this, "Vdrift fac", 110, 0);
44   fDriftVel->SetLabelWidth(labelW);
45   fDriftVel->SetShowSlider(kFALSE);
46   fDriftVel->SetNELength(6);
47   fDriftVel->Build();
48   fDriftVel->SetLimits(0.1, 10, 1, TGNumberFormat::kNESRealThree);
49   fDriftVel->SetToolTip("Drift velocity factor");
50   fDriftVel->Connect("ValueSet(Double_t)",
51                      "AliEveTPCSector3DEditor", this, "DoDriftVel()");
52   AddFrame(fDriftVel, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
53
54   fPointFrac = new TEveGValuator(this,"Point frac", 200, 0);
55   fPointFrac->SetLabelWidth(labelW);
56   fPointFrac->SetNELength(4);
57   fPointFrac->Build();
58   fPointFrac->GetSlider()->SetWidth(101 + 16);
59   fPointFrac->SetLimits(0.0, 1.0, 101);
60   fPointFrac->SetToolTip("Fraction of signal range displayed as points");
61   fPointFrac->Connect("ValueSet(Double_t)",
62                       "AliEveTPCSector3DEditor", this, "DoPointFrac()");
63   AddFrame(fPointFrac, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
64
65   fPointSize = new TEveGValuator(this,"Point size", 200, 0);
66   fPointSize->SetLabelWidth(labelW);
67   fPointSize->SetShowSlider(kFALSE);
68   fPointSize->SetNELength(4);
69   fPointSize->Build();
70   //fPointSize->GetSlider()->SetWidth(101 + 16);
71   fPointSize->SetLimits(0.1, 32.0, 1, TGNumberFormat::kNESRealOne);
72   fPointSize->SetToolTip("Size of displayed points");
73   fPointSize->Connect("ValueSet(Double_t)",
74                       "AliEveTPCSector3DEditor", this, "DoPointSize()");
75   AddFrame(fPointSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
76 }
77
78 /******************************************************************************/
79
80 void AliEveTPCSector3DEditor::SetModel(TObject* obj)
81 {
82   // Set model object.
83
84   fM = dynamic_cast<AliEveTPCSector3D*>(obj);
85
86   fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp);
87   fDriftVel->SetValue(fM->fDriftVel);
88
89   fPointFrac->SetValue(fM->fPointFrac);
90   fPointSize->SetValue(fM->fPointSize);
91 }
92
93 /******************************************************************************/
94
95 void AliEveTPCSector3DEditor::DoRnrFrame()
96 {
97   // Slot for RnrFrame.
98
99   fM->SetRnrFrame(fRnrFrame->IsOn());
100   Update();
101 }
102
103 void AliEveTPCSector3DEditor::DoDriftVel()
104 {
105   // Slot for DriftVel.
106
107   fM->SetDriftVel(fDriftVel->GetValue());
108   Update();
109 }
110
111 void AliEveTPCSector3DEditor::DoPointFrac()
112 {
113   // Slot for PointFrac.
114
115   fM->SetPointFrac(fPointFrac->GetValue());
116   Update();
117 }
118
119 void AliEveTPCSector3DEditor::DoPointSize()
120 {
121   // Slot for PointSize.
122
123   fM->SetPointSize(fPointSize->GetValue());
124   Update();
125 }
126