Coverity
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveTrackFitterEditor.cxx
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
5a1436d6 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 "AliEveTrackFitterEditor.h"
707b281a 11#include "AliEveTrackFitter.h"
5a1436d6 12
13#include <TGButton.h>
d810d0de 14
a15e6d7d 15//==============================================================================
16//==============================================================================
17// AliEveTrackFitterEditor
18//==============================================================================
5a1436d6 19
57ffa5fb 20//______________________________________________________________________________
5a1436d6 21//
a15e6d7d 22// GUI editor for class AliEveTrackFitter
5a1436d6 23
d810d0de 24ClassImp(AliEveTrackFitterEditor)
5a1436d6 25
d810d0de 26AliEveTrackFitterEditor::AliEveTrackFitterEditor(const TGWindow *p, Int_t width, Int_t height,
40790e5b 27 UInt_t options, Pixel_t back) :
5a1436d6 28 TGedFrame(p, width, height, options | kVerticalFrame, back),
29 fM(0),
30 fFit(0),
31 fReset(0),
32 fStart(0),
33 fStop(0),
34 fGraph(0)
35{
36 // Constructor.
37
d810d0de 38 MakeTitle("AliEveTrackFitter");
5a1436d6 39
40 fStart = new TGTextButton(this, "Start");
40790e5b 41 AddFrame(fStart, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 3, 1));
5a1436d6 42 fStart->Connect("Clicked()",
d810d0de 43 "AliEveTrackFitterEditor", this, "DoStart()");
5a1436d6 44
45 fFit = new TGTextButton(this, "Fit");
46 AddFrame(fFit, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
47 fFit->Connect("Clicked()",
d810d0de 48 "AliEveTrackFitterEditor", this, "DoFit()");
5a1436d6 49
50 fReset = new TGTextButton(this, "Reset");
51 AddFrame(fReset, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
52 fReset->Connect("Clicked()",
d810d0de 53 "AliEveTrackFitterEditor", this, "DoReset()");
5a1436d6 54
55 fStop = new TGTextButton(this, "Stop");
40790e5b 56 AddFrame(fStop, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 4));
5a1436d6 57 fStop->Connect("Clicked()",
d810d0de 58 "AliEveTrackFitterEditor", this, "DoStop()");
5a1436d6 59
40790e5b 60 fGraph = new TGTextButton(this, "DebugGraph");
61 AddFrame(fGraph, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 2, 4, 1));
5a1436d6 62 fGraph->Connect("Clicked()",
d810d0de 63 "AliEveTrackFitterEditor", this, "DoGraph()");
5a1436d6 64 }
65
57ffa5fb 66/******************************************************************************/
5a1436d6 67
d810d0de 68void AliEveTrackFitterEditor::SetModel(TObject* obj)
51346b82 69{
5a1436d6 70 // Set model object.
71
469ca156 72 fM = static_cast<AliEveTrackFitter*>(obj);
5a1436d6 73
74 if(fM->GetConnected())
75 {
76 fStart->SetState(kButtonDisabled);
77 fStop->SetState(kButtonUp);
78 }
79 else
51346b82 80 {
5a1436d6 81 fStop->SetState(kButtonDisabled);
82 fStart->SetState(kButtonEngaged);
83 fStart->SetState(kButtonUp);
84 }
85}
86
40790e5b 87/**************************************************************************/
88
d810d0de 89void AliEveTrackFitterEditor::DoFit()
5a1436d6 90{
91 // Fit slot.
92
93 fM->FitTrack();
94 Update();
95}
96
d810d0de 97void AliEveTrackFitterEditor::DoReset()
5a1436d6 98{
99 // Reset slot.
100
101 fM->Reset();
102 Update();
103}
104
d810d0de 105void AliEveTrackFitterEditor::DoStart()
5a1436d6 106{
107 // Start selection slot.
108
109 fM->Start();
110 fStart->SetState(kButtonDisabled);
111 fStop->SetState(kButtonUp);
112}
113
d810d0de 114void AliEveTrackFitterEditor::DoStop()
5a1436d6 115{
116 // Stop selection slot.
117
118 fM->Stop();
119 fStop->SetState(kButtonDisabled);
120 fStart->SetState(kButtonUp);
121}
122
d810d0de 123void AliEveTrackFitterEditor::DoGraph()
5a1436d6 124{
125 // Draw graph slot.
126
40790e5b 127 fM->DrawDebugGraph();
5a1436d6 128 Update();
129}