Added class documentation.
[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 <TVirtualPad.h>
16 #include <TColor.h>
17
18 #include <TGLabel.h>
19 #include <TGButton.h>
20 #include <TGNumberEntry.h>
21 #include <TGColorSelect.h>
22 #include <TGSlider.h>
23 #include <TGDoubleSlider.h>
24
25
26 //______________________________________________________________________________
27 //
28 // Editor for AliEveTPCSector3D.
29
30 ClassImp(AliEveTPCSector3DEditor)
31
32 AliEveTPCSector3DEditor::AliEveTPCSector3DEditor(const TGWindow *p,
33                                                  Int_t width, Int_t height,
34                                                  UInt_t options, Pixel_t back) :
35   TGedFrame(p, width, height, options | kVerticalFrame, back),
36   fM(0),
37   fRnrFrame(0), fDriftVel(0), fPointFrac(0), fPointSize(0)
38 {
39   // Constructor.
40
41   MakeTitle("AliEveTPCSector3D");
42
43   Int_t labelW = 60;
44
45   fRnrFrame = new TGCheckButton(this, "ShowFrame");
46   AddFrame(fRnrFrame, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
47   fRnrFrame->Connect
48     ("Toggled(Bool_t)","AliEveTPCSector3DEditor", this, "DoRnrFrame()");
49
50   fDriftVel = new TEveGValuator(this, "Vdrift fac", 110, 0);
51   fDriftVel->SetLabelWidth(labelW);
52   fDriftVel->SetShowSlider(kFALSE);
53   fDriftVel->SetNELength(6);
54   fDriftVel->Build();
55   fDriftVel->SetLimits(0.1, 10, 1, TGNumberFormat::kNESRealThree);
56   fDriftVel->SetToolTip("Drift velocity factor");
57   fDriftVel->Connect("ValueSet(Double_t)",
58                      "AliEveTPCSector3DEditor", this, "DoDriftVel()");
59   AddFrame(fDriftVel, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
60
61   fPointFrac = new TEveGValuator(this,"Point frac", 200, 0);
62   fPointFrac->SetLabelWidth(labelW);
63   fPointFrac->SetNELength(4);
64   fPointFrac->Build();
65   fPointFrac->GetSlider()->SetWidth(101 + 16);
66   fPointFrac->SetLimits(0.0, 1.0, 101);
67   fPointFrac->SetToolTip("Fraction of signal range displayed as points");
68   fPointFrac->Connect("ValueSet(Double_t)",
69                       "AliEveTPCSector3DEditor", this, "DoPointFrac()");
70   AddFrame(fPointFrac, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
71
72   fPointSize = new TEveGValuator(this,"Point size", 200, 0);
73   fPointSize->SetLabelWidth(labelW);
74   fPointSize->SetShowSlider(kFALSE);
75   fPointSize->SetNELength(4);
76   fPointSize->Build();
77   //fPointSize->GetSlider()->SetWidth(101 + 16);
78   fPointSize->SetLimits(0.1, 32.0, 1, TGNumberFormat::kNESRealOne);
79   fPointSize->SetToolTip("Size of displayed points");
80   fPointSize->Connect("ValueSet(Double_t)",
81                       "AliEveTPCSector3DEditor", this, "DoPointSize()");
82   AddFrame(fPointSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
83 }
84
85 /******************************************************************************/
86
87 void AliEveTPCSector3DEditor::SetModel(TObject* obj)
88 {
89   // Set model object.
90
91   fM = dynamic_cast<AliEveTPCSector3D*>(obj);
92
93   fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp);
94   fDriftVel->SetValue(fM->fDriftVel);
95
96   fPointFrac->SetValue(fM->fPointFrac);
97   fPointSize->SetValue(fM->fPointSize);
98 }
99
100 /******************************************************************************/
101
102 void AliEveTPCSector3DEditor::DoRnrFrame()
103 {
104   // Slot for RnrFrame.
105
106   fM->SetRnrFrame(fRnrFrame->IsOn());
107   Update();
108 }
109
110 void AliEveTPCSector3DEditor::DoDriftVel()
111 {
112   // Slot for DriftVel.
113
114   fM->SetDriftVel(fDriftVel->GetValue());
115   Update();
116 }
117
118 void AliEveTPCSector3DEditor::DoPointFrac()
119 {
120   // Slot for PointFrac.
121
122   fM->SetPointFrac(fPointFrac->GetValue());
123   Update();
124 }
125
126 void AliEveTPCSector3DEditor::DoPointSize()
127 {
128   // Slot for PointSize.
129
130   fM->SetPointSize(fPointSize->GetValue());
131   Update();
132 }
133