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