Move core classes from EveDet to EveBase.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveTrackFitterEditor.cxx
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include "AliEveTrackFitterEditor.h"
11 #include "AliEveTrackFitter.h"
12
13 #include <TGButton.h>
14
15
16 //______________________________________________________________________________
17 // AliEveTrackFitterEditor
18 //
19
20 ClassImp(AliEveTrackFitterEditor)
21
22 AliEveTrackFitterEditor::AliEveTrackFitterEditor(const TGWindow *p, Int_t width, Int_t height,
23              UInt_t options, Pixel_t back) :
24   TGedFrame(p, width, height, options | kVerticalFrame, back),
25   fM(0),
26   fFit(0),
27   fReset(0),
28   fStart(0),
29   fStop(0),
30   fGraph(0)
31 {
32   // Constructor.
33
34   MakeTitle("AliEveTrackFitter");
35
36   fStart = new TGTextButton(this, "Start");
37   AddFrame(fStart, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
38   fStart->Connect("Clicked()",
39                   "AliEveTrackFitterEditor", this, "DoStart()");
40
41   fFit = new TGTextButton(this, "Fit");
42   AddFrame(fFit, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
43   fFit->Connect("Clicked()",
44                 "AliEveTrackFitterEditor", this, "DoFit()");
45
46   fReset = new TGTextButton(this, "Reset");
47   AddFrame(fReset, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
48   fReset->Connect("Clicked()",
49                   "AliEveTrackFitterEditor", this, "DoReset()");
50
51   fStop = new TGTextButton(this, "Stop");
52   AddFrame(fStop, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
53   fStop->Connect("Clicked()",
54                  "AliEveTrackFitterEditor", this, "DoStop()");
55
56   fGraph = new TGTextButton(this, " RiemanGraph ");
57   AddFrame(fGraph, new TGLayoutHints(kLHintsLeft, 4, 2, 4, 1));
58   fGraph->Connect("Clicked()",
59                  "AliEveTrackFitterEditor", this, "DoGraph()");
60  }
61
62 /******************************************************************************/
63
64 void AliEveTrackFitterEditor::SetModel(TObject* obj)
65 {
66   // Set model object.
67
68   fM = dynamic_cast<AliEveTrackFitter*>(obj);
69
70   if(fM->GetConnected())
71   {
72     fStart->SetState(kButtonDisabled);
73     fStop->SetState(kButtonUp);
74   }
75   else
76   {
77     fStop->SetState(kButtonDisabled);
78     fStart->SetState(kButtonEngaged);
79     fStart->SetState(kButtonUp);
80   }
81 }
82
83 void AliEveTrackFitterEditor::DoFit()
84 {
85   // Fit slot.
86
87   fM->FitTrack();
88   Update();
89 }
90
91 void AliEveTrackFitterEditor::DoReset()
92 {
93   // Reset slot.
94
95   fM->Reset();
96   Update();
97 }
98
99 void AliEveTrackFitterEditor::DoStart()
100 {
101   // Start selection slot.
102
103   fM->Start();
104   fStart->SetState(kButtonDisabled);
105   fStop->SetState(kButtonUp);
106 }
107
108 void AliEveTrackFitterEditor::DoStop()
109 {
110   // Stop selection slot.
111
112   fM->Stop();
113   fStop->SetState(kButtonDisabled);
114   fStart->SetState(kButtonUp);
115 }
116
117 /******************************************************************************/
118
119 void AliEveTrackFitterEditor::DoGraph()
120 {
121   // Draw graph slot.
122
123   fM->DrawRiemanGraph();
124   Update();
125 }