Improved quitting Event Display with close button.
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackerV1.h
index e95da9b..882b805 100644 (file)
@@ -50,7 +50,7 @@ class AliTRDchamberTimeBin;
 class AliTRDtrackerFitter;
 class AliTRDtrackV1;
 class AliTRDReconstructor;
-
+class AliTRDrecoParam;
 class AliTRDtrackerV1 : public AliTracker
 {
 public:
@@ -58,7 +58,7 @@ public:
     kOwner            = BIT(14) // owner of clusters
    ,kRemoveContainers = BIT(15) // delete containers after usage
   };
-  enum{
+  enum ETRDtrackerV1const {
     kMaxLayersPerSector   = 1000
     , kMaxTimeBinIndex    = 216
     , kTrackingSectors    = 18
@@ -68,13 +68,20 @@ public:
     , kMaxTracksStack     = 100
     , kNConfigs           = 15
   };
-  AliTRDtrackerV1(AliTRDReconstructor *rec = NULL);
+  enum ETRDtrackerV1BetheBloch {
+     kGeant = 0
+    ,kSolid
+    ,kGas
+  };
+  AliTRDtrackerV1(const AliTRDReconstructor *rec = NULL);
   virtual ~AliTRDtrackerV1();
   
   //temporary
   AliTRDtrackingSector* GetTrackingSector(Int_t sec) {return &fTrSec[sec];}
   
   Int_t           Clusters2Tracks(AliESDEvent *esd);
+  static ETRDtrackerV1BetheBloch
+                  GetBetheBloch()            { return fgBB;}
   AliCluster*     GetCluster(Int_t index) const;
   AliTRDseedV1*   GetTracklet(Int_t index) const;
   AliKalmanTrack* GetTrack(Int_t index) const;
@@ -84,6 +91,7 @@ public:
   static Int_t    GetNTimeBins()             { return fgNTimeBins;}
   static void     GetExtrapolationConfig(Int_t iconfig, Int_t planes[2]);
   static void     GetSeedingConfig(Int_t iconfig, Int_t planes[4]);
+
   static TLinearFitter*  GetTiltedRiemanFitter();
   static TLinearFitter*  GetTiltedRiemanFitterConstraint();
   static AliRieman*      GetRiemanFitter();
@@ -99,6 +107,8 @@ public:
 
   Bool_t          IsClustersOwner() const    { return TestBit(kOwner);}
   Bool_t          HasRemoveContainers() const    { return TestBit(kRemoveContainers);}
+
+  static void     SetBetheBloch(ETRDtrackerV1BetheBloch bb) {fgBB = bb;}
   void            SetClustersOwner(Bool_t own=kTRUE) {SetBit(kOwner, own); if(!own) fClusters = NULL;}
   void            SetRemoveContainers(Bool_t rm=kTRUE) {SetBit(kRemoveContainers, rm);}
 
@@ -108,10 +118,10 @@ public:
   Int_t           LoadClusters(TClonesArray *const clusters);
   Int_t           PropagateBack(AliESDEvent *event);
   static Int_t    PropagateToX(AliTRDtrackV1 &t, Double_t xToGo, Double_t maxStep);
-  Int_t           ReadClusters(TClonesArray* &array, TTree *in) const;
+  Bool_t          ReadClusters(TTree *in);
   Int_t           RefitInward(AliESDEvent *event);
   static void     SetNTimeBins(Int_t nTimeBins){fgNTimeBins = nTimeBins; }
-  void            SetReconstructor(const AliTRDReconstructor *rec){ fkReconstructor = rec; }
+  void            SetReconstructor(const AliTRDReconstructor *rec) {fkReconstructor = rec;}
   void            UnloadClusters();
 
   class AliTRDLeastSquare{
@@ -119,20 +129,20 @@ public:
     AliTRDLeastSquare();
     ~AliTRDLeastSquare(){};
     
-    void               AddPoint(const Double_t * const x, Double_t y, Double_t sigmaY);
-    void               RemovePoint(const Double_t * const x, Double_t y, Double_t sigmaY);
-    void               Eval();
-    void    Reset();
+    void          AddPoint(const Double_t * const x, Double_t y, Double_t sigmaY);
+    void          RemovePoint(const Double_t * const x, Double_t y, Double_t sigmaY);
+    Bool_t        Eval();
+    void          Reset();
     
-    Double_t   GetFunctionParameter(Int_t ParNumber) const {return fParams[ParNumber];}
-    Double_t   GetFunctionValue(const Double_t * const xpos) const;
-    void               GetCovarianceMatrix(Double_t *storage) const;
+    Double_t      GetFunctionParameter(Int_t ParNumber) const {return fParams[ParNumber];}
+    Double_t      GetFunctionValue(const Double_t * const xpos) const;
+    void          GetCovarianceMatrix(Double_t *storage) const;
   private:
-          AliTRDLeastSquare(const AliTRDLeastSquare &);
+    AliTRDLeastSquare(const AliTRDLeastSquare &);
     AliTRDLeastSquare& operator=(const AliTRDLeastSquare &);
-    Double_t   fParams[2];                                             // Fitparameter 
-    Double_t   fCovarianceMatrix[3];                   // Covariance Matrix
-    Double_t   fSums[6];                                               // Sums
+    Double_t      fParams[2];           // Fitparameter        
+    Double_t      fCovarianceMatrix[3]; // Covariance Matrix
+    Double_t      fSums[6];             // Sums
   };
 
   class AliTRDtrackFitterRieman{
@@ -156,7 +166,7 @@ public:
     private:
       AliTRDtrackFitterRieman(const AliTRDtrackFitterRieman &);
       AliTRDtrackFitterRieman &operator=(const AliTRDtrackFitterRieman &);
-      void UpdateFitters(AliTRDseedV1 * const tracklet);
+      void UpdateFitters(const AliTRDseedV1 * const tracklet);
       Bool_t CheckAcceptable(Double_t offset, Double_t slope);
       Double_t CalculateReferenceX();
 
@@ -176,58 +186,56 @@ protected:
   static Bool_t  AdjustSector(AliTRDtrackV1 *const track); 
   Double_t       BuildSeedingConfigs(AliTRDtrackingChamber **stack, Int_t *configs);
   Int_t          BuildTrackingContainers();
-  static Float_t CalculateChi2Z(AliTRDseedV1 *tracklets, Double_t offset, Double_t slope, Double_t xref);
+  static Float_t CalculateChi2Z(const AliTRDseedV1 *tracklets, Double_t offset, Double_t slope, Double_t xref);
   Int_t          Clusters2TracksSM(Int_t sector, AliESDEvent *esd);
   Int_t          Clusters2TracksStack(AliTRDtrackingChamber **stack, TClonesArray * const esdTrackList);
-  AliTRDseedV1*  GetTracklet(AliTRDtrackV1 *const trk, Int_t plane, Int_t &idx);
+  AliTRDseedV1*  GetTracklet(const AliTRDtrackV1 *const trk, Int_t plane, Int_t &idx);
   Bool_t         GetTrackPoint(Int_t index, AliTrackPoint &p) const;   
   Float_t        GetR4Layer(Int_t ly) const { return fR[ly];}
   Int_t          MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 * const sseed, const Int_t * const ipar);
-  AliTRDtrackV1* MakeTrack(AliTRDseedV1 * const seeds, Double_t *params);
+  AliTRDtrackV1* MakeTrack(AliTRDseedV1 * const tracklet);
   AliTRDtrackV1* SetTrack(const AliTRDtrackV1 * const track);
   AliTRDseedV1*  SetTracklet(const AliTRDseedV1 * const tracklet);
+  void           UnsetTrackletsTrack(const AliTRDtrackV1 * const track);
 
 private:
   AliTRDtrackerV1(const AliTRDtrackerV1 &tracker);
   AliTRDtrackerV1 &operator=(const AliTRDtrackerV1 &tracker);
-  Double_t             CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]);
-  Double_t             CalculateTrackLikelihood(const AliTRDseedV1 *const tracklets, Double_t *chi2);
-  Int_t                ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRDseedV1 *tracklet);
+  Double_t       CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]);
+  Double_t       CalculateTrackLikelihood(Double_t *chi2);
+  Bool_t         ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRDseedV1 *tracklet, Double_t &chi2);
   static Float_t       CalculateReferenceX(const AliTRDseedV1 *const tracklets);
   void        ResetSeedTB();
   Float_t     GetChi2Y(const AliTRDseedV1 *const tracklets) const;
   Float_t     GetChi2Z(const AliTRDseedV1 *const tracklets) const;
+  Float_t     GetChi2Phi(const AliTRDseedV1 *const tracklets) const;
 
-private:
-  const AliTRDReconstructor *fkReconstructor;            // reconstructor manager
+  const AliTRDReconstructor *fkReconstructor;           // reconstructor manager
+  const AliTRDrecoParam     *fkRecoParam;               // reco param for the current event
   AliTRDgeometry      *fGeom;                           // Pointer to TRD geometry
   AliTRDtrackingSector fTrSec[kTrackingSectors];        // Array of tracking sectors;    
   TClonesArray        *fClusters;                       // List of clusters
   TClonesArray        *fTracklets;                      // List of tracklets
   TClonesArray        *fTracks;                         // List of tracks
+  TClonesArray        *fTracksESD;                      // List of ESD tracks in current SM
   Float_t              fR[kNPlanes];                    //! rough radial position of each TRD layer
 
-  // should go to the recoParam
-  static const Double_t    fgkMaxChi2;                  // Max increment in track chi2 
-  static const Float_t     fgkMinClustersInTrack;       // Min number of clusters in track
-  static const Float_t     fgkLabelFraction;            // Min fraction of same label
-  static const Double_t    fgkMaxSnp;                   // Maximal snp for tracking
-  static const Double_t    fgkMaxStep;                  // Maximal step for tracking  
-  
   // stand alone tracking
   static Double_t      fgTopologicQA[kNConfigs];        //  Topologic quality
   Double_t             fTrackQuality[kMaxTracksStack];  //  Track quality 
   Int_t                fSeedLayer[kMaxTracksStack];     //  Seed layer
   AliTRDchamberTimeBin *fSeedTB[kNSeedPlanes]; // seeding time bin planes
   Int_t                fSieveSeeding;                   //! Seeding iterator
-  
+  Int_t                fEventInFile;                    //! event in file being tracked (debug purposes)
+
+  static ETRDtrackerV1BetheBloch fgBB;                  // Bethe Bloch method
   static const Double_t fgkX0[kNPlanes];                // default values for the position of anode wire
   static Int_t         fgNTimeBins;                     // Timebins per plane in track prolongation 
   static TLinearFitter *fgTiltedRieman;                 //  Fitter for the tilted Rieman fit without vertex constriant
   static TLinearFitter *fgTiltedRiemanConstrained;      //  Fitter for the tilted Rieman fit with vertex constraint    
   static AliRieman     *fgRieman;                       //  Fitter for the untilted Rieman fit
   
-  ClassDef(AliTRDtrackerV1, 3)                          //  TRD tracker - tracklet based tracking
+  ClassDef(AliTRDtrackerV1, 7)                          //  TRD tracker - tracklet based tracking
 
 };
 #endif