]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
092578a7 | 3 | |
d810d0de | 4 | /************************************************************************** |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
9 | ||
10 | #include "AliEveTPCSectorVizEditor.h" | |
11 | #include <Alieve/AliEveTPCSectorViz.h> | |
092578a7 | 12 | |
84aff7a4 | 13 | #include <TEveGValuators.h> |
14 | #include <TEveTransEditor.h> | |
5987168b | 15 | |
092578a7 | 16 | #include <TVirtualPad.h> |
17 | #include <TColor.h> | |
18 | ||
19 | #include <TGLabel.h> | |
20 | #include <TGButton.h> | |
21 | #include <TGNumberEntry.h> | |
22 | #include <TGColorSelect.h> | |
23 | #include <TGSlider.h> | |
24 | #include <TGDoubleSlider.h> | |
d810d0de | 25 | |
092578a7 | 26 | |
27 | //______________________________________________________________________ | |
d810d0de | 28 | // AliEveTPCSectorVizEditor |
092578a7 | 29 | // |
30 | ||
d810d0de | 31 | ClassImp(AliEveTPCSectorVizEditor) |
092578a7 | 32 | |
d810d0de | 33 | AliEveTPCSectorVizEditor::AliEveTPCSectorVizEditor(const TGWindow *p, |
265ecb21 | 34 | Int_t width, Int_t height, |
35 | UInt_t options, Pixel_t back) : | |
a8600b56 | 36 | TGedFrame(p, width, height, options | kVerticalFrame, back), |
265ecb21 | 37 | fM(0), |
fbb1b08d | 38 | fHMTrans (0), |
39 | fSectorID (0), fAutoTrans (0), | |
40 | fRnrInn (0), fRnrOut1 (0), fRnrOut2(0), | |
41 | fThreshold (0), fMaxVal (0), | |
265ecb21 | 42 | fTime (0) |
092578a7 | 43 | { |
a8600b56 | 44 | fPriority = 40; |
092578a7 | 45 | |
5987168b | 46 | Int_t labelW = 60; |
092578a7 | 47 | |
fbb1b08d | 48 | MakeTitle("Transformation matrix"); |
49 | ||
84aff7a4 | 50 | fHMTrans = new TEveTransSubEditor(this); |
d810d0de | 51 | fHMTrans->Connect("UseTrans()", "AliEveTPCSectorVizEditor", this, "Update()"); |
52 | fHMTrans->Connect("TransChanged()", "AliEveTPCSectorVizEditor", this, "Update()"); | |
fbb1b08d | 53 | AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0)); |
54 | ||
d810d0de | 55 | MakeTitle("AliEveTPCSectorViz"); |
fbb1b08d | 56 | |
84aff7a4 | 57 | fSectorID = new TEveGValuator(this, "SectorID", 110, 0); |
5987168b | 58 | fSectorID->SetLabelWidth(labelW); |
59 | fSectorID->SetShowSlider(kFALSE); | |
60 | fSectorID->SetNELength(4); | |
61 | fSectorID->Build(); | |
62 | fSectorID->SetLimits(0, 35); | |
63 | fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate"); | |
64 | fSectorID->Connect("ValueSet(Double_t)", | |
d810d0de | 65 | "AliEveTPCSectorVizEditor", this, "DoSectorID()"); |
fbb1b08d | 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)); | |
d810d0de | 70 | fAutoTrans->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoAutoTrans()"); |
5987168b | 71 | AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); |
092578a7 | 72 | |
092578a7 | 73 | { |
74 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
75 | ||
76 | fRnrInn = new TGCheckButton(f, "Inner"); | |
77 | f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
d810d0de | 78 | fRnrInn->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrInn()"); |
092578a7 | 79 | |
80 | fRnrOut1 = new TGCheckButton(f, "Outer 1"); | |
81 | f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
d810d0de | 82 | fRnrOut1->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut1()"); |
092578a7 | 83 | |
84 | fRnrOut2 = new TGCheckButton(f, "Outer 2"); | |
85 | f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
d810d0de | 86 | fRnrOut2->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut2()"); |
092578a7 | 87 | |
88 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
89 | } | |
5987168b | 90 | |
84aff7a4 | 91 | fThreshold = new TEveGValuator(this, "Threshold", 200, 0); |
5987168b | 92 | fThreshold->SetNELength(4); |
93 | fThreshold->SetLabelWidth(labelW); | |
94 | fThreshold->Build(); | |
95 | fThreshold->GetSlider()->SetWidth(120); | |
a8600b56 | 96 | fThreshold->SetLimits(0,250); |
5987168b | 97 | fThreshold->Connect("ValueSet(Double_t)", |
d810d0de | 98 | "AliEveTPCSectorVizEditor", this, "DoThreshold()"); |
5987168b | 99 | AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); |
100 | ||
84aff7a4 | 101 | fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0); |
5987168b | 102 | fMaxVal->SetNELength(4); |
103 | fMaxVal->SetLabelWidth(labelW); | |
104 | fMaxVal->Build(); | |
105 | fMaxVal->GetSlider()->SetWidth(120); | |
a8600b56 | 106 | fMaxVal->SetLimits(0, 500); |
5987168b | 107 | fMaxVal->Connect("ValueSet(Double_t)", |
d810d0de | 108 | "AliEveTPCSectorVizEditor", this, "DoMaxVal()"); |
5987168b | 109 | AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); |
110 | ||
84aff7a4 | 111 | fTime = new TEveGDoubleValuator(this,"Time", 200, 0); |
5987168b | 112 | fTime->SetNELength(4); |
113 | fTime->SetLabelWidth(labelW); | |
114 | fTime->Build(); | |
115 | fTime->GetSlider()->SetWidth(224); | |
116 | fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger); | |
117 | fTime->Connect("ValueSet()", | |
d810d0de | 118 | "AliEveTPCSectorVizEditor", this, "DoTime()"); |
5987168b | 119 | AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); |
092578a7 | 120 | } |
121 | ||
d810d0de | 122 | AliEveTPCSectorVizEditor::~AliEveTPCSectorVizEditor() |
092578a7 | 123 | {} |
124 | ||
125 | /**************************************************************************/ | |
126 | ||
d810d0de | 127 | void AliEveTPCSectorVizEditor::SetModel(TObject* obj) |
092578a7 | 128 | { |
d810d0de | 129 | fM = dynamic_cast<AliEveTPCSectorViz*>(obj); |
092578a7 | 130 | |
84aff7a4 | 131 | fHMTrans->SetModel(&fM->fHMTrans); |
fbb1b08d | 132 | |
5987168b | 133 | fSectorID->SetValue(fM->fSectorID); |
fbb1b08d | 134 | fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp); |
5987168b | 135 | |
136 | fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp); | |
092578a7 | 137 | fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp); |
138 | fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp); | |
092578a7 | 139 | |
5987168b | 140 | fThreshold->SetValue(fM->fThreshold); |
141 | fMaxVal->SetValue(fM->fMaxVal); | |
142 | ||
143 | fTime->SetValues(fM->fMinTime, fM->fMaxTime); | |
092578a7 | 144 | } |
145 | ||
146 | /**************************************************************************/ | |
147 | ||
d810d0de | 148 | void AliEveTPCSectorVizEditor::DoSectorID() |
092578a7 | 149 | { |
5987168b | 150 | fM->SetSectorID((Int_t) fSectorID->GetValue()); |
092578a7 | 151 | Update(); |
152 | } | |
153 | ||
d810d0de | 154 | void AliEveTPCSectorVizEditor::DoAutoTrans() |
02937761 | 155 | { |
fbb1b08d | 156 | fM->SetAutoTrans(fAutoTrans->IsOn()); |
02937761 | 157 | Update(); |
158 | } | |
159 | ||
092578a7 | 160 | /**************************************************************************/ |
161 | ||
d810d0de | 162 | void AliEveTPCSectorVizEditor::DoRnrInn() |
092578a7 | 163 | { |
164 | fM->SetRnrInn(fRnrInn->IsOn()); | |
165 | Update(); | |
166 | } | |
167 | ||
d810d0de | 168 | void AliEveTPCSectorVizEditor::DoRnrOut1() |
092578a7 | 169 | { |
170 | fM->SetRnrOut1(fRnrOut1->IsOn()); | |
171 | Update(); | |
172 | } | |
173 | ||
d810d0de | 174 | void AliEveTPCSectorVizEditor::DoRnrOut2() |
092578a7 | 175 | { |
176 | fM->SetRnrOut2(fRnrOut2->IsOn()); | |
177 | Update(); | |
178 | } | |
179 | ||
180 | /**************************************************************************/ | |
181 | ||
d810d0de | 182 | void AliEveTPCSectorVizEditor::DoThreshold() |
092578a7 | 183 | { |
5987168b | 184 | fM->SetThreshold((Short_t) fThreshold->GetValue()); |
a89f67d8 | 185 | fThreshold->SetValue(fM->fThreshold); |
092578a7 | 186 | Update(); |
187 | } | |
188 | ||
d810d0de | 189 | void AliEveTPCSectorVizEditor::DoMaxVal() |
092578a7 | 190 | { |
5987168b | 191 | fM->SetMaxVal((Int_t) fMaxVal->GetValue()); |
a89f67d8 | 192 | fMaxVal->SetValue(fM->fMaxVal); |
092578a7 | 193 | Update(); |
194 | } | |
195 | ||
196 | /**************************************************************************/ | |
197 | ||
d810d0de | 198 | void AliEveTPCSectorVizEditor::DoTime() |
51346b82 | 199 | { |
5987168b | 200 | fM->SetMinTime((Int_t) fTime->GetMin()); |
201 | fM->SetMaxTime((Int_t) fTime->GetMax()); | |
092578a7 | 202 | Update(); |
203 | } |