Coverity
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTPCSectorVizEditor.cxx
CommitLineData
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"
cb4245bb 11#include <EveDet/AliEveTPCSectorViz.h>
092578a7 12
84aff7a4 13#include <TEveGValuators.h>
5987168b 14
092578a7 15#include <TVirtualPad.h>
092578a7 16
092578a7 17#include <TGButton.h>
18#include <TGNumberEntry.h>
092578a7 19#include <TGSlider.h>
20#include <TGDoubleSlider.h>
d810d0de 21
092578a7 22
57ffa5fb 23//______________________________________________________________________________
092578a7 24//
a97abca8 25// Editor for AliEveTPCSectorViz.
092578a7 26
d810d0de 27ClassImp(AliEveTPCSectorVizEditor)
092578a7 28
d810d0de 29AliEveTPCSectorVizEditor::AliEveTPCSectorVizEditor(const TGWindow *p,
265ecb21 30 Int_t width, Int_t height,
31 UInt_t options, Pixel_t back) :
a8600b56 32 TGedFrame(p, width, height, options | kVerticalFrame, back),
265ecb21 33 fM(0),
fbb1b08d 34 fSectorID (0), fAutoTrans (0),
35 fRnrInn (0), fRnrOut1 (0), fRnrOut2(0),
36 fThreshold (0), fMaxVal (0),
265ecb21 37 fTime (0)
092578a7 38{
a97abca8 39 // Constructor.
40
a8600b56 41 fPriority = 40;
092578a7 42
5987168b 43 Int_t labelW = 60;
092578a7 44
d810d0de 45 MakeTitle("AliEveTPCSectorViz");
fbb1b08d 46
84aff7a4 47 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
5987168b 48 fSectorID->SetLabelWidth(labelW);
49 fSectorID->SetShowSlider(kFALSE);
50 fSectorID->SetNELength(4);
51 fSectorID->Build();
52 fSectorID->SetLimits(0, 35);
53 fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
54 fSectorID->Connect("ValueSet(Double_t)",
d810d0de 55 "AliEveTPCSectorVizEditor", this, "DoSectorID()");
fbb1b08d 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)","AliEveTPCSectorVizEditor", this, "DoAutoTrans()");
5987168b 61 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
092578a7 62
092578a7 63 {
64 TGHorizontalFrame* f = new TGHorizontalFrame(this);
65
66 fRnrInn = new TGCheckButton(f, "Inner");
67 f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
d810d0de 68 fRnrInn->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrInn()");
092578a7 69
70 fRnrOut1 = new TGCheckButton(f, "Outer 1");
71 f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
d810d0de 72 fRnrOut1->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut1()");
092578a7 73
74 fRnrOut2 = new TGCheckButton(f, "Outer 2");
75 f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
d810d0de 76 fRnrOut2->Connect("Toggled(Bool_t)","AliEveTPCSectorVizEditor", this, "DoRnrOut2()");
092578a7 77
78 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
79 }
5987168b 80
84aff7a4 81 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
5987168b 82 fThreshold->SetNELength(4);
83 fThreshold->SetLabelWidth(labelW);
84 fThreshold->Build();
85 fThreshold->GetSlider()->SetWidth(120);
a8600b56 86 fThreshold->SetLimits(0,250);
5987168b 87 fThreshold->Connect("ValueSet(Double_t)",
d810d0de 88 "AliEveTPCSectorVizEditor", this, "DoThreshold()");
5987168b 89 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
90
84aff7a4 91 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
5987168b 92 fMaxVal->SetNELength(4);
93 fMaxVal->SetLabelWidth(labelW);
94 fMaxVal->Build();
95 fMaxVal->GetSlider()->SetWidth(120);
a8600b56 96 fMaxVal->SetLimits(0, 500);
5987168b 97 fMaxVal->Connect("ValueSet(Double_t)",
d810d0de 98 "AliEveTPCSectorVizEditor", this, "DoMaxVal()");
5987168b 99 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
100
84aff7a4 101 fTime = new TEveGDoubleValuator(this,"Time", 200, 0);
5987168b 102 fTime->SetNELength(4);
103 fTime->SetLabelWidth(labelW);
104 fTime->Build();
105 fTime->GetSlider()->SetWidth(224);
106 fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
107 fTime->Connect("ValueSet()",
d810d0de 108 "AliEveTPCSectorVizEditor", this, "DoTime()");
5987168b 109 AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
092578a7 110}
111
57ffa5fb 112/******************************************************************************/
092578a7 113
d810d0de 114void AliEveTPCSectorVizEditor::SetModel(TObject* obj)
092578a7 115{
a97abca8 116 // Set model object.
117
a3addc10 118 fM = static_cast<AliEveTPCSectorViz*>(obj);
092578a7 119
5987168b 120 fSectorID->SetValue(fM->fSectorID);
fbb1b08d 121 fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
5987168b 122
123 fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
092578a7 124 fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
125 fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
092578a7 126
5987168b 127 fThreshold->SetValue(fM->fThreshold);
128 fMaxVal->SetValue(fM->fMaxVal);
129
130 fTime->SetValues(fM->fMinTime, fM->fMaxTime);
092578a7 131}
132
57ffa5fb 133/******************************************************************************/
092578a7 134
d810d0de 135void AliEveTPCSectorVizEditor::DoSectorID()
092578a7 136{
a97abca8 137 // Slot for SectorID.
138
5987168b 139 fM->SetSectorID((Int_t) fSectorID->GetValue());
092578a7 140 Update();
141}
142
d810d0de 143void AliEveTPCSectorVizEditor::DoAutoTrans()
02937761 144{
a97abca8 145 // Slot for AutoTrans.
146
fbb1b08d 147 fM->SetAutoTrans(fAutoTrans->IsOn());
02937761 148 Update();
149}
150
57ffa5fb 151/******************************************************************************/
092578a7 152
d810d0de 153void AliEveTPCSectorVizEditor::DoRnrInn()
092578a7 154{
a97abca8 155 // Slot for RnrInn.
156
092578a7 157 fM->SetRnrInn(fRnrInn->IsOn());
158 Update();
159}
160
d810d0de 161void AliEveTPCSectorVizEditor::DoRnrOut1()
092578a7 162{
a97abca8 163 // Slot for RnrOut1.
164
092578a7 165 fM->SetRnrOut1(fRnrOut1->IsOn());
166 Update();
167}
168
d810d0de 169void AliEveTPCSectorVizEditor::DoRnrOut2()
092578a7 170{
a97abca8 171 // Slot for RnrOut2.
172
092578a7 173 fM->SetRnrOut2(fRnrOut2->IsOn());
174 Update();
175}
176
57ffa5fb 177/******************************************************************************/
092578a7 178
d810d0de 179void AliEveTPCSectorVizEditor::DoThreshold()
092578a7 180{
a97abca8 181 // Slot for Threshold.
182
5987168b 183 fM->SetThreshold((Short_t) fThreshold->GetValue());
a89f67d8 184 fThreshold->SetValue(fM->fThreshold);
092578a7 185 Update();
186}
187
d810d0de 188void AliEveTPCSectorVizEditor::DoMaxVal()
092578a7 189{
a97abca8 190 // Slot for MaxVal.
191
5987168b 192 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
a89f67d8 193 fMaxVal->SetValue(fM->fMaxVal);
092578a7 194 Update();
195}
196
57ffa5fb 197/******************************************************************************/
092578a7 198
d810d0de 199void AliEveTPCSectorVizEditor::DoTime()
51346b82 200{
a97abca8 201 // Slot for time-range.
202
5987168b 203 fM->SetMinTime((Int_t) fTime->GetMin());
204 fM->SetMaxTime((Int_t) fTime->GetMax());
092578a7 205 Update();
206}