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 <Alieve/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 //______________________________________________________________________
28 // AliEveTPCSectorVizEditor
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),
48 MakeTitle("Transformation matrix");
50 fHMTrans = new TEveTransSubEditor(this);
51 fHMTrans->Connect("UseTrans()", "AliEveTPCSectorVizEditor", this, "Update()");
52 fHMTrans->Connect("TransChanged()", "AliEveTPCSectorVizEditor", this, "Update()");
53 AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
55 MakeTitle("AliEveTPCSectorViz");
57 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
58 fSectorID->SetLabelWidth(labelW);
59 fSectorID->SetShowSlider(kFALSE);
60 fSectorID->SetNELength(4);
62 fSectorID->SetLimits(0, 35);
63 fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
64 fSectorID->Connect("ValueSet(Double_t)",
65 "AliEveTPCSectorVizEditor", this, "DoSectorID()");
66 // Reuse sectorID for auto-transformation button
67 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
68 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
69 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
70 fAutoTrans->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoAutoTrans()");
71 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
74 TGHorizontalFrame* f = new TGHorizontalFrame(this);
76 fRnrInn = new TGCheckButton(f, "Inner");
77 f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
78 fRnrInn->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrInn()");
80 fRnrOut1 = new TGCheckButton(f, "Outer 1");
81 f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
82 fRnrOut1->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut1()");
84 fRnrOut2 = new TGCheckButton(f, "Outer 2");
85 f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
86 fRnrOut2->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut2()");
88 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
91 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
92 fThreshold->SetNELength(4);
93 fThreshold->SetLabelWidth(labelW);
95 fThreshold->GetSlider()->SetWidth(120);
96 fThreshold->SetLimits(0,250);
97 fThreshold->Connect("ValueSet(Double_t)",
98 "AliEveTPCSectorVizEditor", this, "DoThreshold()");
99 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
101 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
102 fMaxVal->SetNELength(4);
103 fMaxVal->SetLabelWidth(labelW);
105 fMaxVal->GetSlider()->SetWidth(120);
106 fMaxVal->SetLimits(0, 500);
107 fMaxVal->Connect("ValueSet(Double_t)",
108 "AliEveTPCSectorVizEditor", this, "DoMaxVal()");
109 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
111 fTime = new TEveGDoubleValuator(this,"Time", 200, 0);
112 fTime->SetNELength(4);
113 fTime->SetLabelWidth(labelW);
115 fTime->GetSlider()->SetWidth(224);
116 fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
117 fTime->Connect("ValueSet()",
118 "AliEveTPCSectorVizEditor", this, "DoTime()");
119 AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
122 AliEveTPCSectorVizEditor::~AliEveTPCSectorVizEditor()
125 /**************************************************************************/
127 void AliEveTPCSectorVizEditor::SetModel(TObject* obj)
129 fM = dynamic_cast<AliEveTPCSectorViz*>(obj);
131 fHMTrans->SetModel(&fM->fHMTrans);
133 fSectorID->SetValue(fM->fSectorID);
134 fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
136 fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
137 fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
138 fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
140 fThreshold->SetValue(fM->fThreshold);
141 fMaxVal->SetValue(fM->fMaxVal);
143 fTime->SetValues(fM->fMinTime, fM->fMaxTime);
146 /**************************************************************************/
148 void AliEveTPCSectorVizEditor::DoSectorID()
150 fM->SetSectorID((Int_t) fSectorID->GetValue());
154 void AliEveTPCSectorVizEditor::DoAutoTrans()
156 fM->SetAutoTrans(fAutoTrans->IsOn());
160 /**************************************************************************/
162 void AliEveTPCSectorVizEditor::DoRnrInn()
164 fM->SetRnrInn(fRnrInn->IsOn());
168 void AliEveTPCSectorVizEditor::DoRnrOut1()
170 fM->SetRnrOut1(fRnrOut1->IsOn());
174 void AliEveTPCSectorVizEditor::DoRnrOut2()
176 fM->SetRnrOut2(fRnrOut2->IsOn());
180 /**************************************************************************/
182 void AliEveTPCSectorVizEditor::DoThreshold()
184 fM->SetThreshold((Short_t) fThreshold->GetValue());
185 fThreshold->SetValue(fM->fThreshold);
189 void AliEveTPCSectorVizEditor::DoMaxVal()
191 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
192 fMaxVal->SetValue(fM->fMaxVal);
196 /**************************************************************************/
198 void AliEveTPCSectorVizEditor::DoTime()
200 fM->SetMinTime((Int_t) fTime->GetMin());
201 fM->SetMaxTime((Int_t) fTime->GetMax());