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>
19 #include <TGNumberEntry.h>
21 #include <TGDoubleSlider.h>
24 //______________________________________________________________________________
26 // Editor for AliEveTPCSectorViz.
28 ClassImp(AliEveTPCSectorVizEditor)
30 AliEveTPCSectorVizEditor::AliEveTPCSectorVizEditor(const TGWindow *p,
31 Int_t width, Int_t height,
32 UInt_t options, Pixel_t back) :
33 TGedFrame(p, width, height, options | kVerticalFrame, back),
36 fSectorID (0), fAutoTrans (0),
37 fRnrInn (0), fRnrOut1 (0), fRnrOut2(0),
38 fThreshold (0), fMaxVal (0),
47 MakeTitle("Transformation matrix");
49 fHMTrans = new TEveTransSubEditor(this);
50 fHMTrans->Connect("UseTrans()", "AliEveTPCSectorVizEditor", this, "Update()");
51 fHMTrans->Connect("TransChanged()", "AliEveTPCSectorVizEditor", this, "Update()");
52 AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
54 MakeTitle("AliEveTPCSectorViz");
56 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
57 fSectorID->SetLabelWidth(labelW);
58 fSectorID->SetShowSlider(kFALSE);
59 fSectorID->SetNELength(4);
61 fSectorID->SetLimits(0, 35);
62 fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
63 fSectorID->Connect("ValueSet(Double_t)",
64 "AliEveTPCSectorVizEditor", this, "DoSectorID()");
65 // Reuse sectorID for auto-transformation button
66 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
67 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
68 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
69 fAutoTrans->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoAutoTrans()");
70 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
73 TGHorizontalFrame* f = new TGHorizontalFrame(this);
75 fRnrInn = new TGCheckButton(f, "Inner");
76 f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
77 fRnrInn->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrInn()");
79 fRnrOut1 = new TGCheckButton(f, "Outer 1");
80 f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
81 fRnrOut1->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut1()");
83 fRnrOut2 = new TGCheckButton(f, "Outer 2");
84 f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
85 fRnrOut2->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut2()");
87 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
90 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
91 fThreshold->SetNELength(4);
92 fThreshold->SetLabelWidth(labelW);
94 fThreshold->GetSlider()->SetWidth(120);
95 fThreshold->SetLimits(0,250);
96 fThreshold->Connect("ValueSet(Double_t)",
97 "AliEveTPCSectorVizEditor", this, "DoThreshold()");
98 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
100 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
101 fMaxVal->SetNELength(4);
102 fMaxVal->SetLabelWidth(labelW);
104 fMaxVal->GetSlider()->SetWidth(120);
105 fMaxVal->SetLimits(0, 500);
106 fMaxVal->Connect("ValueSet(Double_t)",
107 "AliEveTPCSectorVizEditor", this, "DoMaxVal()");
108 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
110 fTime = new TEveGDoubleValuator(this,"Time", 200, 0);
111 fTime->SetNELength(4);
112 fTime->SetLabelWidth(labelW);
114 fTime->GetSlider()->SetWidth(224);
115 fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
116 fTime->Connect("ValueSet()",
117 "AliEveTPCSectorVizEditor", this, "DoTime()");
118 AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
121 /******************************************************************************/
123 void AliEveTPCSectorVizEditor::SetModel(TObject* obj)
127 fM = dynamic_cast<AliEveTPCSectorViz*>(obj);
129 fHMTrans->SetModel(fM->PtrMainTrans());
131 fSectorID->SetValue(fM->fSectorID);
132 fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
134 fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
135 fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
136 fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
138 fThreshold->SetValue(fM->fThreshold);
139 fMaxVal->SetValue(fM->fMaxVal);
141 fTime->SetValues(fM->fMinTime, fM->fMaxTime);
144 /******************************************************************************/
146 void AliEveTPCSectorVizEditor::DoSectorID()
148 // Slot for SectorID.
150 fM->SetSectorID((Int_t) fSectorID->GetValue());
154 void AliEveTPCSectorVizEditor::DoAutoTrans()
156 // Slot for AutoTrans.
158 fM->SetAutoTrans(fAutoTrans->IsOn());
162 /******************************************************************************/
164 void AliEveTPCSectorVizEditor::DoRnrInn()
168 fM->SetRnrInn(fRnrInn->IsOn());
172 void AliEveTPCSectorVizEditor::DoRnrOut1()
176 fM->SetRnrOut1(fRnrOut1->IsOn());
180 void AliEveTPCSectorVizEditor::DoRnrOut2()
184 fM->SetRnrOut2(fRnrOut2->IsOn());
188 /******************************************************************************/
190 void AliEveTPCSectorVizEditor::DoThreshold()
192 // Slot for Threshold.
194 fM->SetThreshold((Short_t) fThreshold->GetValue());
195 fThreshold->SetValue(fM->fThreshold);
199 void AliEveTPCSectorVizEditor::DoMaxVal()
203 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
204 fMaxVal->SetValue(fM->fMaxVal);
208 /******************************************************************************/
210 void AliEveTPCSectorVizEditor::DoTime()
212 // Slot for time-range.
214 fM->SetMinTime((Int_t) fTime->GetMin());
215 fM->SetMaxTime((Int_t) fTime->GetMax());