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>
14 #include <TEveTransEditor.h>
16 #include <TVirtualPad.h>
21 #include <TGNumberEntry.h>
22 #include <TGColorSelect.h>
24 #include <TGDoubleSlider.h>
27 //______________________________________________________________________________
29 // Editor for AliEveTPCSectorViz.
31 ClassImp(AliEveTPCSectorVizEditor)
33 AliEveTPCSectorVizEditor::AliEveTPCSectorVizEditor(const TGWindow *p,
34 Int_t width, Int_t height,
35 UInt_t options, Pixel_t back) :
36 TGedFrame(p, width, height, options | kVerticalFrame, back),
39 fSectorID (0), fAutoTrans (0),
40 fRnrInn (0), fRnrOut1 (0), fRnrOut2(0),
41 fThreshold (0), fMaxVal (0),
50 MakeTitle("Transformation matrix");
52 fHMTrans = new TEveTransSubEditor(this);
53 fHMTrans->Connect("UseTrans()", "AliEveTPCSectorVizEditor", this, "Update()");
54 fHMTrans->Connect("TransChanged()", "AliEveTPCSectorVizEditor", this, "Update()");
55 AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
57 MakeTitle("AliEveTPCSectorViz");
59 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
60 fSectorID->SetLabelWidth(labelW);
61 fSectorID->SetShowSlider(kFALSE);
62 fSectorID->SetNELength(4);
64 fSectorID->SetLimits(0, 35);
65 fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
66 fSectorID->Connect("ValueSet(Double_t)",
67 "AliEveTPCSectorVizEditor", this, "DoSectorID()");
68 // Reuse sectorID for auto-transformation button
69 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
70 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
71 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
72 fAutoTrans->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoAutoTrans()");
73 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
76 TGHorizontalFrame* f = new TGHorizontalFrame(this);
78 fRnrInn = new TGCheckButton(f, "Inner");
79 f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
80 fRnrInn->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrInn()");
82 fRnrOut1 = new TGCheckButton(f, "Outer 1");
83 f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
84 fRnrOut1->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut1()");
86 fRnrOut2 = new TGCheckButton(f, "Outer 2");
87 f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
88 fRnrOut2->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut2()");
90 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
93 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
94 fThreshold->SetNELength(4);
95 fThreshold->SetLabelWidth(labelW);
97 fThreshold->GetSlider()->SetWidth(120);
98 fThreshold->SetLimits(0,250);
99 fThreshold->Connect("ValueSet(Double_t)",
100 "AliEveTPCSectorVizEditor", this, "DoThreshold()");
101 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
103 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
104 fMaxVal->SetNELength(4);
105 fMaxVal->SetLabelWidth(labelW);
107 fMaxVal->GetSlider()->SetWidth(120);
108 fMaxVal->SetLimits(0, 500);
109 fMaxVal->Connect("ValueSet(Double_t)",
110 "AliEveTPCSectorVizEditor", this, "DoMaxVal()");
111 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
113 fTime = new TEveGDoubleValuator(this,"Time", 200, 0);
114 fTime->SetNELength(4);
115 fTime->SetLabelWidth(labelW);
117 fTime->GetSlider()->SetWidth(224);
118 fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
119 fTime->Connect("ValueSet()",
120 "AliEveTPCSectorVizEditor", this, "DoTime()");
121 AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
124 /******************************************************************************/
126 void AliEveTPCSectorVizEditor::SetModel(TObject* obj)
130 fM = dynamic_cast<AliEveTPCSectorViz*>(obj);
132 fHMTrans->SetModel(&fM->fHMTrans);
134 fSectorID->SetValue(fM->fSectorID);
135 fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
137 fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
138 fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
139 fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
141 fThreshold->SetValue(fM->fThreshold);
142 fMaxVal->SetValue(fM->fMaxVal);
144 fTime->SetValues(fM->fMinTime, fM->fMaxTime);
147 /******************************************************************************/
149 void AliEveTPCSectorVizEditor::DoSectorID()
151 // Slot for SectorID.
153 fM->SetSectorID((Int_t) fSectorID->GetValue());
157 void AliEveTPCSectorVizEditor::DoAutoTrans()
159 // Slot for AutoTrans.
161 fM->SetAutoTrans(fAutoTrans->IsOn());
165 /******************************************************************************/
167 void AliEveTPCSectorVizEditor::DoRnrInn()
171 fM->SetRnrInn(fRnrInn->IsOn());
175 void AliEveTPCSectorVizEditor::DoRnrOut1()
179 fM->SetRnrOut1(fRnrOut1->IsOn());
183 void AliEveTPCSectorVizEditor::DoRnrOut2()
187 fM->SetRnrOut2(fRnrOut2->IsOn());
191 /******************************************************************************/
193 void AliEveTPCSectorVizEditor::DoThreshold()
195 // Slot for Threshold.
197 fM->SetThreshold((Short_t) fThreshold->GetValue());
198 fThreshold->SetValue(fM->fThreshold);
202 void AliEveTPCSectorVizEditor::DoMaxVal()
206 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
207 fMaxVal->SetValue(fM->fMaxVal);
211 /******************************************************************************/
213 void AliEveTPCSectorVizEditor::DoTime()
215 // Slot for time-range.
217 fM->SetMinTime((Int_t) fTime->GetMin());
218 fM->SetMaxTime((Int_t) fTime->GetMax());