]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDseedV1.h
More on char* constantness
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.h
index baf079fff546e1bd013ff1f19905d2e928b6fe03..29545b07c2bd38a96cef181aa98588d14e026137 100644 (file)
 #include "AliTRDseed.h"
 #endif
 
+#ifndef ALITRDGEOMETRY_H
+#include "AliTRDgeometry.h"
+#endif
+
 #ifndef ALIPID_H
 #include "AliPID.h"
 #endif
@@ -45,7 +49,7 @@ class AliTRDseedV1 : public AliTRDseed
   , kRowCross = BIT(15) 
   };
 
-  AliTRDseedV1(Int_t plane = -1);
+  AliTRDseedV1(Int_t det = -1);
   ~AliTRDseedV1();
   AliTRDseedV1(const AliTRDseedV1 &ref);
   AliTRDseedV1& operator=(const AliTRDseedV1 &ref);
@@ -53,9 +57,9 @@ class AliTRDseedV1 : public AliTRDseed
   Bool_t       AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t quality, Bool_t kZcorr = kFALSE
                                 , AliTRDcluster *c=0x0);
   Bool_t       AttachClusters(AliTRDtrackingChamber *chamber, Bool_t kZcorr = kFALSE);
+  void    Bootstrap(const AliTRDReconstructor *rec);
   void    CookdEdx(Int_t nslices);
-  void    Draw(Option_t* o = "");
-  Bool_t  Fit();
+  Bool_t  Fit(Bool_t tilt=kTRUE);
 
   Bool_t  Init(AliTRDtrackV1 *track);
   inline void      Init(const AliRieman *fit);
@@ -69,21 +73,26 @@ class AliTRDseedV1 : public AliTRDseed
   Double_t  GetCrossSz2() const { return fCross[3];}
   Float_t*  GetdEdx() {return &fdEdx[0];}
   Float_t   GetdQdl(Int_t ic) const;
+  Int_t     GetDetector() const {return fDet;}
   Double_t  GetMomentum() const {return fMom;}
   Int_t     GetN() const {return fN2;}
   Float_t   GetQuality(Bool_t kZcorr) const;
-  Int_t     GetPlane() const         { return fPlane;    }
+  Int_t     GetPlane() const         { return AliTRDgeometry::GetLayer(fDet);    }
+
   Double_t* GetProbability();
   Double_t  GetSnp() const           { return fSnp;}
   Double_t  GetTgl() const           { return fTgl;}
-  Double_t  GetYat(Double_t x) const { return fYfitR[0] + fYfitR[1] * (x - fX0);}
-  Double_t  GetZat(Double_t x) const { return fZfitR[0] + fZfitR[1] * (x - fX0);}
+  Double_t  GetYat(Double_t x) const { return fYfit[0] + fYfit[1] * (x-fX0);}
+  Double_t  GetZat(Double_t x) const { return fZfit[0] + fZfit[1] * (x-fX0);}
   
+  inline AliTRDcluster* NextCluster();
+  inline AliTRDcluster* PrevCluster();
   void      Print(Option_t *o = "") const;
-  
+  inline void ResetClusterIter(Bool_t forward = kTRUE);
+
   void      SetMomentum(Double_t mom) {fMom = mom;}
   void      SetOwner();
-  void      SetPlane(Int_t p)                      { fPlane     = p;   }
+  void      SetDetector(Int_t d) {fDet = d;  }
   void      SetSnp(Double_t snp) {fSnp = snp;}
   void      SetTgl(Double_t tgl) {fTgl = tgl;}
   void      SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
@@ -93,7 +102,9 @@ protected:
 
 private:
   const AliTRDReconstructor *fReconstructor;//! local reconstructor
-  Int_t            fPlane;                  //  TRD plane
+  AliTRDcluster    **fClusterIter;          //! clusters iterator
+  Char_t           fClusterIdx;             //! clusters iterator
+  Int_t            fDet;                    //  TRD detector
   Float_t          fMom;                    //  Momentum estimate for tracklet [GeV/c]
   Float_t          fSnp;                    // sin of track with respect to x direction in XY plane    
   Float_t          fTgl;                    // tg of track with respect to x direction in XZ plane     
@@ -102,7 +113,7 @@ private:
   Double_t         fCross[4];            // spatial parameters of the pad row crossing
   Double_t         fProb[AliPID::kSPECIES]; //  PID probabilities
 
-  ClassDef(AliTRDseedV1, 1)                 //  New TRD seed 
+  ClassDef(AliTRDseedV1, 2)                 //  New TRD seed 
 
 };
 
@@ -129,6 +140,60 @@ inline void AliTRDseedV1::Init(const AliRieman *rieman)
   fZref[1] = rieman->GetDZat(fX0);
   fYref[0] = rieman->GetYat(fX0);
   fYref[1] = rieman->GetDYat(fX0);
+  fC       = rieman->GetC(); 
+  fChi2    = rieman->GetChi2();
+}
+
+//____________________________________________________________
+inline AliTRDcluster* AliTRDseedV1::NextCluster()
+{
+// Mimic the usage of STL iterators.
+// Forward iterator
+
+  fClusterIdx++; fClusterIter++;
+  while(fClusterIdx < AliTRDseed::knTimebins){
+    if(!(*fClusterIter)){ 
+      fClusterIdx++; 
+      fClusterIter++;
+      continue;
+    }
+    return *fClusterIter;
+  }
+  return 0x0;
+}
+
+//____________________________________________________________
+inline AliTRDcluster* AliTRDseedV1::PrevCluster()
+{
+// Mimic the usage of STL iterators.
+// Backward iterator
+
+  fClusterIdx--; fClusterIter--;
+  while(fClusterIdx >= 0){
+    if(!(*fClusterIter)){ 
+      fClusterIdx--; 
+      fClusterIter--;
+      continue;
+    }
+    return *fClusterIter;
+  }
+  return 0x0;
+}
+
+//____________________________________________________________
+inline void AliTRDseedV1::ResetClusterIter(Bool_t forward) 
+{
+// Mimic the usage of STL iterators.
+// Facilitate the usage of NextCluster for forward like 
+// iterator (kTRUE) and PrevCluster for backward like iterator (kFALSE)
+
+  if(forward){
+    fClusterIter = &fClusters[0]; fClusterIter--; 
+    fClusterIdx=-1;
+  } else {
+    fClusterIter = &fClusters[AliTRDseed::knTimebins-1]; fClusterIter++; 
+    fClusterIdx=AliTRDseed::knTimebins;
+  }
 }
 
 #endif