Move contents of EVE/Alieve to EVE/EveDet as most code will remain there.
[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 // AliEveTPCSector3DEditor
28 //
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   MakeTitle("AliEveTPCSector3D");
40
41   Int_t labelW = 60;
42
43   fRnrFrame = new TGCheckButton(this, "ShowFrame");
44   AddFrame(fRnrFrame, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
45   fRnrFrame->Connect
46     ("Toggled(Bool_t)","AliEveTPCSector3DEditor", this, "DoRnrFrame()");
47
48   fDriftVel = new TEveGValuator(this, "Vdrift fac", 110, 0);
49   fDriftVel->SetLabelWidth(labelW);
50   fDriftVel->SetShowSlider(kFALSE);
51   fDriftVel->SetNELength(6);
52   fDriftVel->Build();
53   fDriftVel->SetLimits(0.1, 10, 1, TGNumberFormat::kNESRealThree);
54   fDriftVel->SetToolTip("Drift velocity factor");
55   fDriftVel->Connect("ValueSet(Double_t)",
56                      "AliEveTPCSector3DEditor", this, "DoDriftVel()");
57   AddFrame(fDriftVel, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
58
59   fPointFrac = new TEveGValuator(this,"Point frac", 200, 0);
60   fPointFrac->SetLabelWidth(labelW);
61   fPointFrac->SetNELength(4);
62   fPointFrac->Build();
63   fPointFrac->GetSlider()->SetWidth(101 + 16);
64   fPointFrac->SetLimits(0.0, 1.0, 101);
65   fPointFrac->SetToolTip("Fraction of signal range displayed as points");
66   fPointFrac->Connect("ValueSet(Double_t)",
67                       "AliEveTPCSector3DEditor", this, "DoPointFrac()");
68   AddFrame(fPointFrac, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
69
70   fPointSize = new TEveGValuator(this,"Point size", 200, 0);
71   fPointSize->SetLabelWidth(labelW);
72   fPointSize->SetShowSlider(kFALSE);
73   fPointSize->SetNELength(4);
74   fPointSize->Build();
75   //fPointSize->GetSlider()->SetWidth(101 + 16);
76   fPointSize->SetLimits(0.1, 32.0, 1, TGNumberFormat::kNESRealOne);
77   fPointSize->SetToolTip("Size of displayed points");
78   fPointSize->Connect("ValueSet(Double_t)",
79                       "AliEveTPCSector3DEditor", this, "DoPointSize()");
80   AddFrame(fPointSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
81 }
82
83 AliEveTPCSector3DEditor::~AliEveTPCSector3DEditor()
84 {}
85
86 /******************************************************************************/
87
88 void AliEveTPCSector3DEditor::SetModel(TObject* obj)
89 {
90   fM = dynamic_cast<AliEveTPCSector3D*>(obj);
91
92   fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp);
93   fDriftVel->SetValue(fM->fDriftVel);
94
95   fPointFrac->SetValue(fM->fPointFrac);
96   fPointSize->SetValue(fM->fPointSize);
97 }
98
99 /******************************************************************************/
100
101 void AliEveTPCSector3DEditor::DoRnrFrame()
102 {
103   fM->SetRnrFrame(fRnrFrame->IsOn());
104   Update();
105 }
106
107 void AliEveTPCSector3DEditor::DoDriftVel()
108 {
109   fM->SetDriftVel(fDriftVel->GetValue());
110   Update();
111 }
112
113 void AliEveTPCSector3DEditor::DoPointFrac()
114 {
115   fM->SetPointFrac(fPointFrac->GetValue());
116   Update();
117 }
118
119 void AliEveTPCSector3DEditor::DoPointSize()
120 {
121   fM->SetPointSize(fPointSize->GetValue());
122   Update();
123 }
124