2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 **************************************************************************/
10 #include "AliEveTPCSectorVizEditor.h"
11 #include <EveDet/AliEveTPCSectorViz.h>
13 #include <TEveGValuators.h>
15 #include <TVirtualPad.h>
18 #include <TGNumberEntry.h>
20 #include <TGDoubleSlider.h>
23 //______________________________________________________________________________
25 // Editor for AliEveTPCSectorViz.
27 ClassImp(AliEveTPCSectorVizEditor)
29 AliEveTPCSectorVizEditor::AliEveTPCSectorVizEditor(const TGWindow *p,
30 Int_t width, Int_t height,
31 UInt_t options, Pixel_t back) :
32 TGedFrame(p, width, height, options | kVerticalFrame, back),
34 fSectorID (0), fAutoTrans (0),
35 fRnrInn (0), fRnrOut1 (0), fRnrOut2(0),
36 fThreshold (0), fMaxVal (0),
45 MakeTitle("AliEveTPCSectorViz");
47 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
48 fSectorID->SetLabelWidth(labelW);
49 fSectorID->SetShowSlider(kFALSE);
50 fSectorID->SetNELength(4);
52 fSectorID->SetLimits(0, 35);
53 fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
54 fSectorID->Connect("ValueSet(Double_t)",
55 "AliEveTPCSectorVizEditor", this, "DoSectorID()");
56 // Reuse sectorID for auto-transformation button
57 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
58 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
59 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
60 fAutoTrans->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoAutoTrans()");
61 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
64 TGHorizontalFrame* f = new TGHorizontalFrame(this);
66 fRnrInn = new TGCheckButton(f, "Inner");
67 f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
68 fRnrInn->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrInn()");
70 fRnrOut1 = new TGCheckButton(f, "Outer 1");
71 f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
72 fRnrOut1->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut1()");
74 fRnrOut2 = new TGCheckButton(f, "Outer 2");
75 f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
76 fRnrOut2->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut2()");
78 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
81 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
82 fThreshold->SetNELength(4);
83 fThreshold->SetLabelWidth(labelW);
85 fThreshold->GetSlider()->SetWidth(120);
86 fThreshold->SetLimits(0,250);
87 fThreshold->Connect("ValueSet(Double_t)",
88 "AliEveTPCSectorVizEditor", this, "DoThreshold()");
89 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
91 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
92 fMaxVal->SetNELength(4);
93 fMaxVal->SetLabelWidth(labelW);
95 fMaxVal->GetSlider()->SetWidth(120);
96 fMaxVal->SetLimits(0, 500);
97 fMaxVal->Connect("ValueSet(Double_t)",
98 "AliEveTPCSectorVizEditor", this, "DoMaxVal()");
99 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
101 fTime = new TEveGDoubleValuator(this,"Time", 200, 0);
102 fTime->SetNELength(4);
103 fTime->SetLabelWidth(labelW);
105 fTime->GetSlider()->SetWidth(224);
106 fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
107 fTime->Connect("ValueSet()",
108 "AliEveTPCSectorVizEditor", this, "DoTime()");
109 AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
112 /******************************************************************************/
114 void AliEveTPCSectorVizEditor::SetModel(TObject* obj)
118 fM = dynamic_cast<AliEveTPCSectorViz*>(obj);
120 fSectorID->SetValue(fM->fSectorID);
121 fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
123 fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
124 fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
125 fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
127 fThreshold->SetValue(fM->fThreshold);
128 fMaxVal->SetValue(fM->fMaxVal);
130 fTime->SetValues(fM->fMinTime, fM->fMaxTime);
133 /******************************************************************************/
135 void AliEveTPCSectorVizEditor::DoSectorID()
137 // Slot for SectorID.
139 fM->SetSectorID((Int_t) fSectorID->GetValue());
143 void AliEveTPCSectorVizEditor::DoAutoTrans()
145 // Slot for AutoTrans.
147 fM->SetAutoTrans(fAutoTrans->IsOn());
151 /******************************************************************************/
153 void AliEveTPCSectorVizEditor::DoRnrInn()
157 fM->SetRnrInn(fRnrInn->IsOn());
161 void AliEveTPCSectorVizEditor::DoRnrOut1()
165 fM->SetRnrOut1(fRnrOut1->IsOn());
169 void AliEveTPCSectorVizEditor::DoRnrOut2()
173 fM->SetRnrOut2(fRnrOut2->IsOn());
177 /******************************************************************************/
179 void AliEveTPCSectorVizEditor::DoThreshold()
181 // Slot for Threshold.
183 fM->SetThreshold((Short_t) fThreshold->GetValue());
184 fThreshold->SetValue(fM->fThreshold);
188 void AliEveTPCSectorVizEditor::DoMaxVal()
192 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
193 fMaxVal->SetValue(fM->fMaxVal);
197 /******************************************************************************/
199 void AliEveTPCSectorVizEditor::DoTime()
201 // Slot for time-range.
203 fM->SetMinTime((Int_t) fTime->GetMin());
204 fM->SetMaxTime((Int_t) fTime->GetMax());