Coverity
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTPCSector3DEditor.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 "AliEveTPCSector3DEditor.h"
cb4245bb 11#include <EveDet/AliEveTPCSector3D.h>
092578a7 12
84aff7a4 13#include <TEveGValuators.h>
e2bf98a4 14
092578a7 15#include <TGButton.h>
16#include <TGNumberEntry.h>
092578a7 17#include <TGSlider.h>
092578a7 18
57ffa5fb 19//______________________________________________________________________________
092578a7 20//
a97abca8 21// Editor for AliEveTPCSector3D.
092578a7 22
d810d0de 23ClassImp(AliEveTPCSector3DEditor)
092578a7 24
d810d0de 25AliEveTPCSector3DEditor::AliEveTPCSector3DEditor(const TGWindow *p,
a97abca8 26 Int_t width, Int_t height,
27 UInt_t options, Pixel_t back) :
a8600b56 28 TGedFrame(p, width, height, options | kVerticalFrame, back),
265ecb21 29 fM(0),
30 fRnrFrame(0), fDriftVel(0), fPointFrac(0), fPointSize(0)
092578a7 31{
a97abca8 32 // Constructor.
33
d810d0de 34 MakeTitle("AliEveTPCSector3D");
092578a7 35
e2bf98a4 36 Int_t labelW = 60;
37
092578a7 38 fRnrFrame = new TGCheckButton(this, "ShowFrame");
39 AddFrame(fRnrFrame, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
40 fRnrFrame->Connect
d810d0de 41 ("Toggled(Bool_t)","AliEveTPCSector3DEditor", this, "DoRnrFrame()");
092578a7 42
84aff7a4 43 fDriftVel = new TEveGValuator(this, "Vdrift fac", 110, 0);
e2bf98a4 44 fDriftVel->SetLabelWidth(labelW);
45 fDriftVel->SetShowSlider(kFALSE);
46 fDriftVel->SetNELength(6);
47 fDriftVel->Build();
48 fDriftVel->SetLimits(0.1, 10, 1, TGNumberFormat::kNESRealThree);
49 fDriftVel->SetToolTip("Drift velocity factor");
50 fDriftVel->Connect("ValueSet(Double_t)",
d810d0de 51 "AliEveTPCSector3DEditor", this, "DoDriftVel()");
e2bf98a4 52 AddFrame(fDriftVel, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
53
84aff7a4 54 fPointFrac = new TEveGValuator(this,"Point frac", 200, 0);
e2bf98a4 55 fPointFrac->SetLabelWidth(labelW);
56 fPointFrac->SetNELength(4);
57 fPointFrac->Build();
58 fPointFrac->GetSlider()->SetWidth(101 + 16);
59 fPointFrac->SetLimits(0.0, 1.0, 101);
60 fPointFrac->SetToolTip("Fraction of signal range displayed as points");
61 fPointFrac->Connect("ValueSet(Double_t)",
d810d0de 62 "AliEveTPCSector3DEditor", this, "DoPointFrac()");
e2bf98a4 63 AddFrame(fPointFrac, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
092578a7 64
84aff7a4 65 fPointSize = new TEveGValuator(this,"Point size", 200, 0);
8a08431f 66 fPointSize->SetLabelWidth(labelW);
67 fPointSize->SetShowSlider(kFALSE);
68 fPointSize->SetNELength(4);
69 fPointSize->Build();
70 //fPointSize->GetSlider()->SetWidth(101 + 16);
71 fPointSize->SetLimits(0.1, 32.0, 1, TGNumberFormat::kNESRealOne);
72 fPointSize->SetToolTip("Size of displayed points");
73 fPointSize->Connect("ValueSet(Double_t)",
d810d0de 74 "AliEveTPCSector3DEditor", this, "DoPointSize()");
8a08431f 75 AddFrame(fPointSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
092578a7 76}
77
57ffa5fb 78/******************************************************************************/
092578a7 79
d810d0de 80void AliEveTPCSector3DEditor::SetModel(TObject* obj)
092578a7 81{
a97abca8 82 // Set model object.
83
d810d0de 84 fM = dynamic_cast<AliEveTPCSector3D*>(obj);
092578a7 85
86 fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp);
e2bf98a4 87 fDriftVel->SetValue(fM->fDriftVel);
88
89 fPointFrac->SetValue(fM->fPointFrac);
8a08431f 90 fPointSize->SetValue(fM->fPointSize);
092578a7 91}
92
57ffa5fb 93/******************************************************************************/
092578a7 94
d810d0de 95void AliEveTPCSector3DEditor::DoRnrFrame()
092578a7 96{
a97abca8 97 // Slot for RnrFrame.
98
092578a7 99 fM->SetRnrFrame(fRnrFrame->IsOn());
100 Update();
101}
102
d810d0de 103void AliEveTPCSector3DEditor::DoDriftVel()
092578a7 104{
a97abca8 105 // Slot for DriftVel.
106
e2bf98a4 107 fM->SetDriftVel(fDriftVel->GetValue());
092578a7 108 Update();
109}
e2bf98a4 110
d810d0de 111void AliEveTPCSector3DEditor::DoPointFrac()
e2bf98a4 112{
a97abca8 113 // Slot for PointFrac.
114
e2bf98a4 115 fM->SetPointFrac(fPointFrac->GetValue());
116 Update();
117}
118
d810d0de 119void AliEveTPCSector3DEditor::DoPointSize()
8a08431f 120{
a97abca8 121 // Slot for PointSize.
122
8a08431f 123 fM->SetPointSize(fPointSize->GetValue());
124 Update();
125}
126