]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveDet/AliEveTOFSectorEditor.cxx
Added ITSUModule (Stefan R.)
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTOFSectorEditor.cxx
CommitLineData
d810d0de 1/**************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
3 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 4 * full copyright notice. *
d810d0de 5 **************************************************************************/
6
fd54c9e3 7// $Id$
8// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
9
d810d0de 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 29ClassImp(AliEveTOFSectorEditor)
51346b82 30
c76ea574 31AliEveTOFSectorEditor::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{
fd54c9e3 40 //ctr
51346b82 41
8616d353 42 fPlate = new TGCheckButton*[5];
43 for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
51346b82 44
8616d353 45 //fPriority = 40;
51346b82 46 MakeTitle("AliEveTOFSector");
8616d353 47
84aff7a4 48 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
8616d353 49 fSectorID->SetLabelWidth(60);
50 fSectorID->SetShowSlider(kFALSE);
51 fSectorID->SetNELength(4);
52 fSectorID->Build();
53 fSectorID->SetLimits(0, 17);
54 fSectorID->SetToolTip("The 18 Tof Sector's");
55 fSectorID->Connect("ValueSet(Double_t)",
d810d0de 56 "AliEveTOFSectorEditor", this, "DoSectorID()");
8616d353 57 // Reuse sectorID for auto-transformation button
58 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
59 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
60 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
d810d0de 61 fAutoTrans->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoAutoTrans()");
8616d353 62 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
51346b82 63
8616d353 64 // Create widgets
65 // fXYZZ = new TGSomeWidget(this, ...);
66 // AddFrame(fXYZZ, new TGLayoutHints(...));
d810d0de 67 // fXYZZ->Connect("SignalName()", "AliEveTOFSectorEditor", this, "DoXYZZ()"); {
c76ea574 68 TGHorizontalFrame* f = new TGHorizontalFrame(this);
69
70 Int_t nPlate = 0;
71 fPlate0 = new TGCheckButton(f, "Plate0");
72 f->AddFrame(fPlate0, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
73 fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate0()");
74 //fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
75
76 nPlate = 1;
77 fPlate1 = new TGCheckButton(f, "Plate 1");
78 f->AddFrame(fPlate1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
79 fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate1()");
80 //fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
81
82 nPlate = 2;
83 fPlate2 = new TGCheckButton(f, "Plate 2");
84 f->AddFrame(fPlate2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
85 fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate2()");
86 //fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
87
88 nPlate = 3;
89 fPlate3 = new TGCheckButton(f, "Plate 3");
90 f->AddFrame(fPlate3, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
91 fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate3()");
92 //fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
93
94 nPlate = 4;
95 fPlate4 = new TGCheckButton(f, "Plate 4");
96 f->AddFrame(fPlate4, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
97 fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate4()");
98 //fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
99
100 fPlate[0] = fPlate0;
101 fPlate[1] = fPlate1;
102 fPlate[2] = fPlate2;
103 fPlate[3] = fPlate3;
104 fPlate[4] = fPlate4;
105
106 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
107
108 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
109 fThreshold->SetNELength(4);
110 fThreshold->SetLabelWidth(60);
111 fThreshold->Build();
112 fThreshold->GetSlider()->SetWidth(120);
113 fThreshold->SetLimits(0,250);
114 fThreshold->Connect("ValueSet(Double_t)",
115 "AliEveTOFSectorEditor", this, "DoThreshold()");
116 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
117
118 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
119 fMaxVal->SetNELength(4);
120 fMaxVal->SetLabelWidth(60);
121 fMaxVal->Build();
122 fMaxVal->GetSlider()->SetWidth(60);
123 fMaxVal->SetLimits(0, 500);
124 fMaxVal->Connect("ValueSet(Double_t)",
125 "AliEveTOFSectorEditor", this, "DoMaxVal()");
126 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
51346b82 127
8616d353 128}
129
ee9d8eca 130/******************************************************************************/
131
d810d0de 132AliEveTOFSectorEditor::~AliEveTOFSectorEditor()
c76ea574 133{
fd54c9e3 134 //dtr
135
c76ea574 136 delete [] fPlate;
137}
8616d353 138
57ffa5fb 139/******************************************************************************/
8616d353 140
d810d0de 141void AliEveTOFSectorEditor::SetModel(TObject* obj)
8616d353 142{
fd54c9e3 143 // Set object to monitor at visualization level
144
48bc5c25 145 fM = static_cast<AliEveTOFSector*>(obj);
8616d353 146
147 fSectorID->SetValue(fM->GetSectorID());
148 fAutoTrans->SetState(fM->GetAutoTrans() ? kButtonDown : kButtonUp);
149
150 fPlate0->SetState(fM->GetPlate(0) ? kButtonDown : kButtonUp);
151 fPlate1->SetState(fM->GetPlate(1) ? kButtonDown : kButtonUp);
152 fPlate2->SetState(fM->GetPlate(2) ? kButtonDown : kButtonUp);
153 fPlate3->SetState(fM->GetPlate(3) ? kButtonDown : kButtonUp);
154 fPlate4->SetState(fM->GetPlate(4) ? kButtonDown : kButtonUp);
8616d353 155}
156
57ffa5fb 157/******************************************************************************/
d810d0de 158void AliEveTOFSectorEditor::DoSectorID()
8616d353 159{
160 fM->SetSectorID((Int_t) fSectorID->GetValue());
161 Update();
162}
163
d810d0de 164void AliEveTOFSectorEditor::DoAutoTrans()
8616d353 165{
166 fM->SetAutoTrans(fAutoTrans->IsOn());
167 Update();
168}
169
57ffa5fb 170/******************************************************************************/
8616d353 171
d810d0de 172void AliEveTOFSectorEditor::DoPlate(Int_t nPlate)
8616d353 173{
174 fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
175 Update();
176}
177
d810d0de 178void AliEveTOFSectorEditor::DoPlate0()
8616d353 179{
180 fM->SetPlate(0, fPlate0->IsOn());
181 Update();
182}
183
d810d0de 184void AliEveTOFSectorEditor::DoPlate1()
8616d353 185{
186 fM->SetPlate(1, fPlate1->IsOn());
187 Update();
188}
189
d810d0de 190void AliEveTOFSectorEditor::DoPlate2()
8616d353 191{
192 fM->SetPlate(2, fPlate2->IsOn());
193 Update();
194}
d810d0de 195void AliEveTOFSectorEditor::DoPlate3()
8616d353 196{
197 fM->SetPlate(3, fPlate3->IsOn());
198 Update();
199}
200
d810d0de 201void AliEveTOFSectorEditor::DoPlate4()
8616d353 202{
203 fM->SetPlate(4, fPlate4->IsOn());
204 Update();
205}
206
207
d810d0de 208void AliEveTOFSectorEditor::DoThreshold()
8616d353 209{
210 fM->SetThreshold((Short_t) fThreshold->GetValue());
211 fThreshold->SetValue(fM->GetThreshold());
212 Update();
213}
214
d810d0de 215void AliEveTOFSectorEditor::DoMaxVal()
8616d353 216{
217 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
218 fMaxVal->SetValue(fM->GetMaxVal());
219 Update();
220}
ee9d8eca 221
222/*
223void AliEveTOFSectorEditor::DoTime()
224{
225 fM->SetMinTime((Int_t) fTime->GetMin());
226 fM->SetMaxTime((Int_t) fTime->GetMax());
227 Update();
228}
229*/