]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveDet/AliEveTOFSectorEditor.cxx
Possibility to sort AliTrackPointArray
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTOFSectorEditor.cxx
CommitLineData
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 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),
34 fM(0),
35 fSectorID(0), fAutoTrans(0),
36 fPlate(0), fPlate0(0), fPlate1(0), fPlate2(0), fPlate3(0), fPlate4(0),
37 fThreshold(0), fMaxVal(0)
8616d353 38{
51346b82 39
8616d353 40 fPlate = new TGCheckButton*[5];
41 for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
51346b82 42
8616d353 43 //fPriority = 40;
51346b82 44 MakeTitle("AliEveTOFSector");
8616d353 45
84aff7a4 46 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
8616d353 47 fSectorID->SetLabelWidth(60);
48 fSectorID->SetShowSlider(kFALSE);
49 fSectorID->SetNELength(4);
50 fSectorID->Build();
51 fSectorID->SetLimits(0, 17);
52 fSectorID->SetToolTip("The 18 Tof Sector's");
53 fSectorID->Connect("ValueSet(Double_t)",
d810d0de 54 "AliEveTOFSectorEditor", this, "DoSectorID()");
8616d353 55 // Reuse sectorID for auto-transformation button
56 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
57 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
58 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
d810d0de 59 fAutoTrans->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoAutoTrans()");
8616d353 60 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
51346b82 61
8616d353 62 // Create widgets
63 // fXYZZ = new TGSomeWidget(this, ...);
64 // AddFrame(fXYZZ, new TGLayoutHints(...));
d810d0de 65 // fXYZZ->Connect("SignalName()", "AliEveTOFSectorEditor", this, "DoXYZZ()"); {
c76ea574 66 TGHorizontalFrame* f = new TGHorizontalFrame(this);
67
68 Int_t nPlate = 0;
69 fPlate0 = new TGCheckButton(f, "Plate0");
70 f->AddFrame(fPlate0, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
71 fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate0()");
72 //fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
73
74 nPlate = 1;
75 fPlate1 = new TGCheckButton(f, "Plate 1");
76 f->AddFrame(fPlate1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
77 fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate1()");
78 //fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
79
80 nPlate = 2;
81 fPlate2 = new TGCheckButton(f, "Plate 2");
82 f->AddFrame(fPlate2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
83 fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate2()");
84 //fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
85
86 nPlate = 3;
87 fPlate3 = new TGCheckButton(f, "Plate 3");
88 f->AddFrame(fPlate3, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
89 fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate3()");
90 //fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
91
92 nPlate = 4;
93 fPlate4 = new TGCheckButton(f, "Plate 4");
94 f->AddFrame(fPlate4, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
95 fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate4()");
96 //fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
97
98 fPlate[0] = fPlate0;
99 fPlate[1] = fPlate1;
100 fPlate[2] = fPlate2;
101 fPlate[3] = fPlate3;
102 fPlate[4] = fPlate4;
103
104 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
105
106 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
107 fThreshold->SetNELength(4);
108 fThreshold->SetLabelWidth(60);
109 fThreshold->Build();
110 fThreshold->GetSlider()->SetWidth(120);
111 fThreshold->SetLimits(0,250);
112 fThreshold->Connect("ValueSet(Double_t)",
113 "AliEveTOFSectorEditor", this, "DoThreshold()");
114 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
115
116 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
117 fMaxVal->SetNELength(4);
118 fMaxVal->SetLabelWidth(60);
119 fMaxVal->Build();
120 fMaxVal->GetSlider()->SetWidth(60);
121 fMaxVal->SetLimits(0, 500);
122 fMaxVal->Connect("ValueSet(Double_t)",
123 "AliEveTOFSectorEditor", this, "DoMaxVal()");
124 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
51346b82 125
8616d353 126}
127
d810d0de 128AliEveTOFSectorEditor::~AliEveTOFSectorEditor()
c76ea574 129{
130 delete [] fPlate;
131}
8616d353 132
57ffa5fb 133/******************************************************************************/
8616d353 134
d810d0de 135void AliEveTOFSectorEditor::SetModel(TObject* obj)
8616d353 136{
d810d0de 137 fM = dynamic_cast<AliEveTOFSector*>(obj);
8616d353 138
139 fSectorID->SetValue(fM->GetSectorID());
140 fAutoTrans->SetState(fM->GetAutoTrans() ? kButtonDown : kButtonUp);
141
142 fPlate0->SetState(fM->GetPlate(0) ? kButtonDown : kButtonUp);
143 fPlate1->SetState(fM->GetPlate(1) ? kButtonDown : kButtonUp);
144 fPlate2->SetState(fM->GetPlate(2) ? kButtonDown : kButtonUp);
145 fPlate3->SetState(fM->GetPlate(3) ? kButtonDown : kButtonUp);
146 fPlate4->SetState(fM->GetPlate(4) ? kButtonDown : kButtonUp);
8616d353 147}
148
57ffa5fb 149/******************************************************************************/
d810d0de 150void AliEveTOFSectorEditor::DoSectorID()
8616d353 151{
152 fM->SetSectorID((Int_t) fSectorID->GetValue());
153 Update();
154}
155
d810d0de 156void AliEveTOFSectorEditor::DoAutoTrans()
8616d353 157{
158 fM->SetAutoTrans(fAutoTrans->IsOn());
159 Update();
160}
161
57ffa5fb 162/******************************************************************************/
8616d353 163
d810d0de 164void AliEveTOFSectorEditor::DoPlate(Int_t nPlate)
8616d353 165{
166 fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
167 Update();
168}
169
d810d0de 170void AliEveTOFSectorEditor::DoPlate0()
8616d353 171{
172 fM->SetPlate(0, fPlate0->IsOn());
173 Update();
174}
175
d810d0de 176void AliEveTOFSectorEditor::DoPlate1()
8616d353 177{
178 fM->SetPlate(1, fPlate1->IsOn());
179 Update();
180}
181
d810d0de 182void AliEveTOFSectorEditor::DoPlate2()
8616d353 183{
184 fM->SetPlate(2, fPlate2->IsOn());
185 Update();
186}
d810d0de 187void AliEveTOFSectorEditor::DoPlate3()
8616d353 188{
189 fM->SetPlate(3, fPlate3->IsOn());
190 Update();
191}
192
d810d0de 193void AliEveTOFSectorEditor::DoPlate4()
8616d353 194{
195 fM->SetPlate(4, fPlate4->IsOn());
196 Update();
197}
198
199
d810d0de 200void AliEveTOFSectorEditor::DoThreshold()
8616d353 201{
202 fM->SetThreshold((Short_t) fThreshold->GetValue());
203 fThreshold->SetValue(fM->GetThreshold());
204 Update();
205}
206
d810d0de 207void AliEveTOFSectorEditor::DoMaxVal()
8616d353 208{
209 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
210 fMaxVal->SetValue(fM->GetMaxVal());
211 Update();
212}