]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
8616d353 | 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 "AliEveTOFSectorEditor.h" | |
cb4245bb | 11 | #include <EveDet/AliEveTOFSector.h> |
8616d353 | 12 | |
13 | #include <TVirtualPad.h> | |
14 | #include <TColor.h> | |
84aff7a4 | 15 | #include <TEveGValuators.h> |
8616d353 | 16 | |
17 | #include <TGLabel.h> | |
18 | #include <TGButton.h> | |
19 | #include <TGNumberEntry.h> | |
20 | #include <TGColorSelect.h> | |
21 | #include <TGSlider.h> | |
22 | #include <TGDoubleSlider.h> | |
d810d0de | 23 | |
8616d353 | 24 | |
57ffa5fb | 25 | //______________________________________________________________________________ |
d810d0de | 26 | // AliEveTOFSectorEditor |
8616d353 | 27 | // |
28 | ||
d810d0de | 29 | ClassImp(AliEveTOFSectorEditor) |
51346b82 | 30 | |
c76ea574 | 31 | AliEveTOFSectorEditor::AliEveTOFSectorEditor(const TGWindow *p, Int_t width, Int_t height, |
32 | UInt_t options, Pixel_t back) : | |
33 | TGedFrame(p, width, height, options | kVerticalFrame, back), | |
ee9d8eca | 34 | fM(0) , |
35 | fSectorID (0), fAutoTrans (0), | |
36 | fPlate (0), | |
37 | fPlate0(0), fPlate1(0), fPlate2(0), fPlate3(0), fPlate4(0), | |
38 | fThreshold (0), fMaxVal(0) | |
8616d353 | 39 | { |
51346b82 | 40 | |
8616d353 | 41 | fPlate = new TGCheckButton*[5]; |
42 | for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton; | |
51346b82 | 43 | |
8616d353 | 44 | //fPriority = 40; |
51346b82 | 45 | MakeTitle("AliEveTOFSector"); |
8616d353 | 46 | |
84aff7a4 | 47 | fSectorID = new TEveGValuator(this, "SectorID", 110, 0); |
8616d353 | 48 | fSectorID->SetLabelWidth(60); |
49 | fSectorID->SetShowSlider(kFALSE); | |
50 | fSectorID->SetNELength(4); | |
51 | fSectorID->Build(); | |
52 | fSectorID->SetLimits(0, 17); | |
53 | fSectorID->SetToolTip("The 18 Tof Sector's"); | |
54 | fSectorID->Connect("ValueSet(Double_t)", | |
d810d0de | 55 | "AliEveTOFSectorEditor", this, "DoSectorID()"); |
8616d353 | 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)); | |
d810d0de | 60 | fAutoTrans->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoAutoTrans()"); |
8616d353 | 61 | AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); |
51346b82 | 62 | |
8616d353 | 63 | // Create widgets |
64 | // fXYZZ = new TGSomeWidget(this, ...); | |
65 | // AddFrame(fXYZZ, new TGLayoutHints(...)); | |
d810d0de | 66 | // fXYZZ->Connect("SignalName()", "AliEveTOFSectorEditor", this, "DoXYZZ()"); { |
c76ea574 | 67 | TGHorizontalFrame* f = new TGHorizontalFrame(this); |
68 | ||
69 | Int_t nPlate = 0; | |
70 | fPlate0 = new TGCheckButton(f, "Plate0"); | |
71 | f->AddFrame(fPlate0, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
72 | fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate0()"); | |
73 | //fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)"); | |
74 | ||
75 | nPlate = 1; | |
76 | fPlate1 = new TGCheckButton(f, "Plate 1"); | |
77 | f->AddFrame(fPlate1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
78 | fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate1()"); | |
79 | //fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)"); | |
80 | ||
81 | nPlate = 2; | |
82 | fPlate2 = new TGCheckButton(f, "Plate 2"); | |
83 | f->AddFrame(fPlate2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
84 | fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate2()"); | |
85 | //fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)"); | |
86 | ||
87 | nPlate = 3; | |
88 | fPlate3 = new TGCheckButton(f, "Plate 3"); | |
89 | f->AddFrame(fPlate3, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
90 | fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate3()"); | |
91 | //fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)"); | |
92 | ||
93 | nPlate = 4; | |
94 | fPlate4 = new TGCheckButton(f, "Plate 4"); | |
95 | f->AddFrame(fPlate4, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
96 | fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate4()"); | |
97 | //fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)"); | |
98 | ||
99 | fPlate[0] = fPlate0; | |
100 | fPlate[1] = fPlate1; | |
101 | fPlate[2] = fPlate2; | |
102 | fPlate[3] = fPlate3; | |
103 | fPlate[4] = fPlate4; | |
104 | ||
105 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
106 | ||
107 | fThreshold = new TEveGValuator(this, "Threshold", 200, 0); | |
108 | fThreshold->SetNELength(4); | |
109 | fThreshold->SetLabelWidth(60); | |
110 | fThreshold->Build(); | |
111 | fThreshold->GetSlider()->SetWidth(120); | |
112 | fThreshold->SetLimits(0,250); | |
113 | fThreshold->Connect("ValueSet(Double_t)", | |
114 | "AliEveTOFSectorEditor", this, "DoThreshold()"); | |
115 | AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
116 | ||
117 | fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0); | |
118 | fMaxVal->SetNELength(4); | |
119 | fMaxVal->SetLabelWidth(60); | |
120 | fMaxVal->Build(); | |
121 | fMaxVal->GetSlider()->SetWidth(60); | |
122 | fMaxVal->SetLimits(0, 500); | |
123 | fMaxVal->Connect("ValueSet(Double_t)", | |
124 | "AliEveTOFSectorEditor", this, "DoMaxVal()"); | |
125 | AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
51346b82 | 126 | |
8616d353 | 127 | } |
128 | ||
ee9d8eca | 129 | /******************************************************************************/ |
130 | ||
d810d0de | 131 | AliEveTOFSectorEditor::~AliEveTOFSectorEditor() |
c76ea574 | 132 | { |
133 | delete [] fPlate; | |
134 | } | |
8616d353 | 135 | |
57ffa5fb | 136 | /******************************************************************************/ |
8616d353 | 137 | |
d810d0de | 138 | void AliEveTOFSectorEditor::SetModel(TObject* obj) |
8616d353 | 139 | { |
d810d0de | 140 | fM = dynamic_cast<AliEveTOFSector*>(obj); |
8616d353 | 141 | |
142 | fSectorID->SetValue(fM->GetSectorID()); | |
143 | fAutoTrans->SetState(fM->GetAutoTrans() ? kButtonDown : kButtonUp); | |
144 | ||
145 | fPlate0->SetState(fM->GetPlate(0) ? kButtonDown : kButtonUp); | |
146 | fPlate1->SetState(fM->GetPlate(1) ? kButtonDown : kButtonUp); | |
147 | fPlate2->SetState(fM->GetPlate(2) ? kButtonDown : kButtonUp); | |
148 | fPlate3->SetState(fM->GetPlate(3) ? kButtonDown : kButtonUp); | |
149 | fPlate4->SetState(fM->GetPlate(4) ? kButtonDown : kButtonUp); | |
8616d353 | 150 | } |
151 | ||
57ffa5fb | 152 | /******************************************************************************/ |
d810d0de | 153 | void AliEveTOFSectorEditor::DoSectorID() |
8616d353 | 154 | { |
155 | fM->SetSectorID((Int_t) fSectorID->GetValue()); | |
156 | Update(); | |
157 | } | |
158 | ||
d810d0de | 159 | void AliEveTOFSectorEditor::DoAutoTrans() |
8616d353 | 160 | { |
161 | fM->SetAutoTrans(fAutoTrans->IsOn()); | |
162 | Update(); | |
163 | } | |
164 | ||
57ffa5fb | 165 | /******************************************************************************/ |
8616d353 | 166 | |
d810d0de | 167 | void AliEveTOFSectorEditor::DoPlate(Int_t nPlate) |
8616d353 | 168 | { |
169 | fM->SetPlate(nPlate, fPlate[nPlate]->IsOn()); | |
170 | Update(); | |
171 | } | |
172 | ||
d810d0de | 173 | void AliEveTOFSectorEditor::DoPlate0() |
8616d353 | 174 | { |
175 | fM->SetPlate(0, fPlate0->IsOn()); | |
176 | Update(); | |
177 | } | |
178 | ||
d810d0de | 179 | void AliEveTOFSectorEditor::DoPlate1() |
8616d353 | 180 | { |
181 | fM->SetPlate(1, fPlate1->IsOn()); | |
182 | Update(); | |
183 | } | |
184 | ||
d810d0de | 185 | void AliEveTOFSectorEditor::DoPlate2() |
8616d353 | 186 | { |
187 | fM->SetPlate(2, fPlate2->IsOn()); | |
188 | Update(); | |
189 | } | |
d810d0de | 190 | void AliEveTOFSectorEditor::DoPlate3() |
8616d353 | 191 | { |
192 | fM->SetPlate(3, fPlate3->IsOn()); | |
193 | Update(); | |
194 | } | |
195 | ||
d810d0de | 196 | void AliEveTOFSectorEditor::DoPlate4() |
8616d353 | 197 | { |
198 | fM->SetPlate(4, fPlate4->IsOn()); | |
199 | Update(); | |
200 | } | |
201 | ||
202 | ||
d810d0de | 203 | void AliEveTOFSectorEditor::DoThreshold() |
8616d353 | 204 | { |
205 | fM->SetThreshold((Short_t) fThreshold->GetValue()); | |
206 | fThreshold->SetValue(fM->GetThreshold()); | |
207 | Update(); | |
208 | } | |
209 | ||
d810d0de | 210 | void AliEveTOFSectorEditor::DoMaxVal() |
8616d353 | 211 | { |
212 | fM->SetMaxVal((Int_t) fMaxVal->GetValue()); | |
213 | fMaxVal->SetValue(fM->GetMaxVal()); | |
214 | Update(); | |
215 | } | |
ee9d8eca | 216 | |
217 | /* | |
218 | void AliEveTOFSectorEditor::DoTime() | |
219 | { | |
220 | fM->SetMinTime((Int_t) fTime->GetMin()); | |
221 | fM->SetMaxTime((Int_t) fTime->GetMax()); | |
222 | Update(); | |
223 | } | |
224 | */ |