Adding new classes for TPC alingment - Magnus Mager
[u/mrichter/AliRoot.git] / TPC / AliTPCTracklet.h
index 4a89af7f195be9037f1a25d5a03f9e75155659e3..efaab0d32775de25a2d7f4e64c53a6fc6d1c9e59 100755 (executable)
 class TObjArray;
 class AliTPCseed;
 class AliExternalTrackParam;
+class AliTPCclusterMI;
+
+#include "TEllipse.h"
 
 class AliTPCTracklet:public TObject {
-public:
+public: 
+  enum TrackType {kKalman,kRiemann,kLinear,kQuadratic};
+
   AliTPCTracklet();
-  AliTPCTracklet(const AliTPCseed *s,Int_t sector);
+  AliTPCTracklet(const AliTPCseed *s,Int_t sector,TrackType type=kKalman,
+                Bool_t storeClusters=kFALSE);
+  AliTPCTracklet(const TObjArray &clusters,Int_t sector,TrackType type=kKalman,
+                Bool_t storeClusters=kFALSE);
   AliTPCTracklet(const AliTPCTracklet &t);
   AliTPCTracklet& operator=(const AliTPCTracklet &t);
   virtual ~AliTPCTracklet();
 
+  static TObjArray CreateTracklets(const TObjArray &clusters,
+                                  TrackType type=kKalman,
+                                  Bool_t storeClusters=kFALSE,
+                                  Int_t minClusters=0,
+                                  Int_t maxTracklets=72);
+
   static TObjArray CreateTracklets(const AliTPCseed *s,
+                                  TrackType type=kKalman,
+                                  Bool_t storeClusters=kFALSE,
                                   Int_t minClusters=0,
                                   Int_t maxTracklets=72);
 
+  static Bool_t PropagateToMeanX(const AliTPCTracklet &t1,
+                                const AliTPCTracklet &t2,
+                                AliExternalTrackParam *&t1m,
+                                AliExternalTrackParam *&t2m);
+
   // Returns the tracklet parametrisation at its outer most cluster.
   AliExternalTrackParam* GetOuter() const {return fOuter;};
   // Returns the tracklet parametrisation at its inner most cluster.
@@ -38,8 +59,33 @@ public:
   Int_t GetSector() const {return fSector;}
   // Returns the number of clusters assined to the tracklet.
   Int_t GetNClusters() const {return fNClusters;}
+  // Returns the clusters of this tracklet. In case they weren't stored it
+  // returns 0.
+  AliTPCclusterMI* GetClusters() const {return fClusters;};
+  // Test the functionality of the class. Generates some random tracks and
+  // refits them into tracklets. 
+  static void Test(const char *filename);
+  static void RandomND(Int_t ndim,const Double_t *p,const Double_t *c,
+                      Double_t *x);
+  static TEllipse ErrorEllipse(Double_t x,Double_t y,
+                              Double_t sx,Double_t sy,Double_t sxy);
 private:
+  static const Double_t kB2C; //! ugly to have the track parametrised in a way, that constand is allways needed
+  static double GetBz(Double_t *xyz);
+  void FitLinear(const AliTPCseed *track,Int_t sector,TrackType type);
+  void FitKalman(const AliTPCseed *track,Int_t sector);
+  void FitRiemann(const AliTPCseed *track,Int_t sector);
+  void Quadratic2Helix(Double_t *a,Double_t *ca,
+                      Double_t *b,Double_t *cb,
+                      Double_t x0,
+                      Double_t *p,Double_t *c);
+  Bool_t Riemann2Helix(Double_t *a,Double_t *ca,
+                      Double_t *b,Double_t *cb,
+                      Double_t x0,
+                      Double_t *p,Double_t *c);   
   Int_t fNClusters; // The number of clusters assined to the tracklet.
+  Int_t fNStoredClusters; // The number of stored clusters.
+  AliTPCclusterMI *fClusters; //[fNStoredClusters] The clusters of the track, if stored (otherwise 0)
   Int_t fSector; // The sector this tracklet lives in.
   AliExternalTrackParam *fOuter; // The tracklet parametrisation at its outer most cluster.
   AliExternalTrackParam *fInner; // The tracklet parametrisation at its inner most cluster.