]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveCosmicRayFitter.h
esd_tracks.C
[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 TEveTrackList;
17
18 class TGraphErrors;
19 class TGraph;
20 class TGraph2DErrors;
21 class TGraph2D;
22 class TLinearFitter;
23
24
25 class AliEveCosmicRayFitter : public TEvePointSet
26 {
27 public:
28   AliEveCosmicRayFitter(const Text_t* name = "CosmicRayFitter", Int_t n_points=0);
29   virtual ~AliEveCosmicRayFitter();
30
31   void AddFitPoint(Int_t); // slot for PointSelected() signal
32
33   virtual void       Start();
34   virtual void       Stop();
35   virtual void       FitTrack();
36   virtual void       Reset(Int_t n_points=0, Int_t n_int_ids=0);
37
38   Bool_t             GetConnected() { return fConnected; }
39
40   void               DrawDebugGraph();
41
42   virtual void    DestroyElements(); // *MENU*
43   static Double_t Distance3D(Double_t x, Double_t y, Double_t z, Double_t *p);
44   static void     SumDistance3D(Int_t &, Double_t *, Double_t & sum, Double_t * par, Int_t );
45
46 private:
47   AliEveCosmicRayFitter(const AliEveCosmicRayFitter&);            // Not implemented
48   AliEveCosmicRayFitter& operator=(const AliEveCosmicRayFitter&); // Not implemented
49
50 protected:
51   struct Point_t
52   {
53     // inner structure to check duplicates
54     TEvePointSet   *fPS;   // selected pointset
55     Int_t           fIdx;  // location in the point set array
56
57     Point_t(TEvePointSet* ps=0, Int_t i=0): fPS(ps), fIdx(i){}
58     Point_t(const Point_t& p) : fPS(p.fPS), fIdx(p.fIdx)  {}
59
60     Point_t& operator=(const Point_t& p) {
61       fPS = p.fPS; fIdx = p.fIdx; return *this;
62     }
63
64     bool operator<(const Point_t& o) const {
65       if (fPS != o.fPS) return fPS < o.fPS;
66       return fIdx < o.fIdx;
67     }
68   };
69
70   typedef std::map<Point_t, Int_t>          PointMap_t; // Map of registered points.
71
72   TLinearFitter*  fLineFitter1;  // 2D straight line fitter
73   TLinearFitter*  fLineFitter2;  // 2D straight line fitter
74
75   Bool_t          fConnected;    // object connected to pointset Ctrl-shift signal
76
77   PointMap_t fSPMap;             // map of selected points from different PointSet
78
79   TEveTrackList*   fTrackList; // list of tracks removed in the destructor
80
81   TGraph         *fGraphPicked1; // graph of selected points debug info
82   TGraphErrors   *fGraphLinear1; // graph of fitted points for debug info
83   TGraph         *fGraphPicked2; // graph of selected points debug info
84   TGraphErrors   *fGraphLinear2; // graph of fitted points for debug info
85
86   ClassDef(AliEveCosmicRayFitter, 0); // Interface to TEvePointSet allowing 3D straight linear fit.
87 };
88
89 #endif