New line fitter class from Annalisa. Code in development.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveCosmicRayFitter.h
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 #ifndef ALIEVE_CosmicRayFitter_H
11 #define ALIEVE_CosmicRayFitter_H
12
13 #include <TEvePointSet.h>
14 #include <map>
15
16 class TGraphErrors;
17 class TGraph;
18 class TGraph2DErrors;
19 class TGraph2D;
20 class TLinearFitter;
21 class TVirtualFitter;
22
23 class AliEveCosmicRayFitter : public TEvePointSet
24 {
25 private:
26   AliEveCosmicRayFitter(const AliEveCosmicRayFitter&);            // Not implemented
27   AliEveCosmicRayFitter& operator=(const AliEveCosmicRayFitter&); // Not implemented
28
29 protected:
30
31   struct Point_t
32   {
33     // inner structure to check duplicates
34     TEvePointSet   *fPS;   // selected pointset
35     Int_t           fIdx;  // location in the point set array
36
37     Point_t(TEvePointSet* ps=0, Int_t i=0): fPS(ps), fIdx(i){} 
38     Point_t(const Point_t& p) : fPS(p.fPS), fIdx(p.fIdx)  {}
39
40     Point_t& operator=(const Point_t& p) {
41       fPS = p.fPS; fIdx = p.fIdx; return *this;
42     }
43
44     bool operator<(const Point_t& o) const {
45       if (fPS != o.fPS) return fPS < o.fPS;
46       return fIdx < o.fIdx;
47     }
48   };
49
50   typedef std::map<Point_t, Int_t>          PointMap_t;
51
52   TVirtualFitter* fLine3DFitter; // 3D straight line fitter
53
54   Bool_t     fConnected;         // object connected to pointset Ctrl-shift signal 
55   
56   PointMap_t fSPMap;             // map of selected points from different PointSet
57
58   TGraph            *fGraphPicked1; // graph of selected points debug info
59   TGraphErrors      *fGraphLinear1; // graph of fitted points for debug info
60   TGraph            *fGraphPicked2; // graph of selected points debug info
61   TGraphErrors      *fGraphLinear2; // graph of fitted points for debug info
62   TGraph2D          *fGraphPicked3; // graph of selected points debug info
63   TGraph2DErrors    *fGraphLinear3; // graph of fitted points for debug info
64
65 public:
66   AliEveCosmicRayFitter(const Text_t* name = "CosmicRayFitter", Int_t n_points=0);
67   virtual ~AliEveCosmicRayFitter();
68   
69   void AddFitPoint(Int_t); // slot for PointCtrlClicked() signal
70
71   virtual void       Start();
72   virtual void       Stop();
73   virtual void       FitTrack();
74   virtual void  Reset(Int_t n_points=0, Int_t n_int_ids=0);
75
76   Bool_t       GetConnected() { return fConnected; }
77   TVirtualFitter* GetLine3DFitter(){ return fLine3DFitter; }
78
79   TGraph*         GetGraphSelected1() { return fGraphPicked1; }
80   TGraph*         GetGraphSelected2() { return fGraphPicked2; }
81   TGraph2D*       GetGraphSelected3() { return fGraphPicked3; }
82   TGraphErrors*   GetGraphFitted1() { return fGraphLinear1; }
83   TGraphErrors*   GetGraphFitted2() { return fGraphLinear2; }
84   TGraph2DErrors* GetGraphFitted3() { return fGraphLinear3; }
85   void          DrawDebugGraph();
86
87   virtual void  DestroyElements(); // *MENU*
88
89   ClassDef(AliEveCosmicRayFitter, 0); // Interface to TEvePointSet allowing 3D straight linear fit.
90 }; // endclass AliEveCosmicRayFitter
91
92 #endif