]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDseedV1.h
running local for SP and LYZEP and new histograms for QC
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.h
index c1332f589f531a63728ffeb73b3ddef5582a9f06..a9fa408b3bf98f45beab259709cf2ad0ed53e346 100644 (file)
 #include "AliTRDseed.h"
 #endif
 
+#ifndef ALITRDGEOMETRY_H
+#include "AliTRDgeometry.h"
+#endif
+
 #ifndef ALIPID_H
 #include "AliPID.h"
 #endif
@@ -39,69 +43,94 @@ class AliTRDseedV1 : public AliTRDseed
   enum {
     knSlices = 10
   };
+  // bits from 0-13 are reserved by ROOT (see TObject.h)
   enum AliTRDtrackletStatus {
-    kOwner    = BIT(1)
-  , kRowCross = BIT(2
+    kOwner    = BIT(14)
+  , kRowCross = BIT(15
   };
 
-  AliTRDseedV1(Int_t plane = -1);
+  AliTRDseedV1(Int_t det = -1);
   ~AliTRDseedV1();
   AliTRDseedV1(const AliTRDseedV1 &ref);
   AliTRDseedV1& operator=(const AliTRDseedV1 &ref);
 
-  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    CookdEdx(Int_t nslices);
-  void    Draw(Option_t* o = "");
-  Bool_t  Fit();
+  Bool_t         AttachClustersIter(
+              AliTRDtrackingChamber *chamber, Float_t quality, 
+              Bool_t kZcorr = kFALSE, AliTRDcluster *c=0x0);
+  Bool_t         AttachClusters(
+              AliTRDtrackingChamber *chamber, Bool_t tilt = kFALSE);
+  void      Bootstrap(const AliTRDReconstructor *rec);
+  void      CookdEdx(Int_t nslices);
+  Bool_t    Fit(Bool_t tilt=kTRUE, Int_t errors = 2);
 
-  Bool_t  Init(AliTRDtrackV1 *track);
+  Bool_t    Init(AliTRDtrackV1 *track);
   inline void      Init(const AliRieman *fit);
+  Bool_t    IsEqual(const TObject *inTracklet) const;
   Bool_t    IsOwner() const          { return TestBit(kOwner);}
   Bool_t    IsRowCross() const       { return TestBit(kRowCross);}
 
   inline Float_t   GetChi2Z(const Float_t z = 999.) const;
   inline Float_t   GetChi2Y(const Float_t y = 999.) const;
+  static void      GetClusterXY(const AliTRDcluster *c, Double_t &x, Double_t &y);
   void      GetCovAt(Double_t x, Double_t *cov) const;
-  Double_t* GetCrossXYZ() { return &fCross[0];}
-  Double_t  GetCrossSz2() const { return fCross[3];}
-  Float_t*  GetdEdx() {return &fdEdx[0];}
+  void      GetCovXY(Double_t *cov) const { memcpy(cov, &fCov[0], 3*sizeof(Double_t));}
+  void      GetCovRef(Double_t *cov) const { memcpy(cov, &fRefCov[0], 3*sizeof(Double_t));}
+  Double_t* GetCrossXYZ()            { return &fCross[0];}
+  Double_t  GetCrossSz2() const      { return fCross[3];}
+  Float_t   GetdX() const            { return fdX;}
+  Float_t*  GetdEdx()                { return &fdEdx[0];}
   Float_t   GetdQdl(Int_t ic) const;
-  Double_t  GetMomentum() const {return fMom;}
-  Int_t     GetN() const {return fN2;}
+  Int_t     GetDetector() const      { return fDet;}
+  Float_t   GetExB() const           { return fExB;}
+  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);}
+  Float_t   GetXref() const          { return fX0 - fXref;}
+  Double_t  GetYat(Double_t x) const { return fYfit[0] - fYfit[1] * (fX0-x);}
+  Double_t  GetZat(Double_t x) const { return fZfit[0] - fZfit[1] * (fX0-x);}
   
+  inline AliTRDcluster* NextCluster();
+  inline AliTRDcluster* PrevCluster();
   void      Print(Option_t *o = "") const;
-  
-  void      SetMomentum(Double_t mom) {fMom = mom;}
+  inline void ResetClusterIter(Bool_t forward = kTRUE);
+
+  void      SetCovRef(const Double_t *cov) { memcpy(&fRefCov[0], cov, 3*sizeof(Double_t));}
+  void      SetMomentum(Double_t mom){ fMom = mom;}
   void      SetOwner();
-  void      SetPlane(Int_t p)                      { fPlane     = p;   }
-  void      SetSnp(Double_t snp) {fSnp = snp;}
-  void      SetTgl(Double_t tgl) {fTgl = tgl;}
+  void      SetDetector(Int_t d)     { fDet = d;  }
+  void      SetDX(Float_t inDX)      { fdX = inDX;}
+  void      SetSnp(Double_t snp)     { fSnp = snp;}
+  void      SetTgl(Double_t tgl)     { fTgl = tgl;}
   void      SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
-protected:
+  void      UpDate(const AliTRDtrackV1* trk);
 
+protected:
   void Copy(TObject &ref) const;
+  void SetExB();
 
 private:
-  const AliTRDReconstructor *fReconstructor;
-  Int_t            fPlane;                  //  TRD plane
+  const AliTRDReconstructor *fReconstructor;//! local reconstructor
+  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     
   Float_t          fdX;                     // length of time bin
-  Float_t          fdEdx[knSlices];         //  dE/dx measurements for tracklet
-  Double_t         fCross[4];            // spatial parameters of the pad row crossing
+  Float_t          fXref;                   // average radial position of clusters
+  Float_t          fExB;                    // tg(a_L) for the tracklet reagion
+  Float_t          fdEdx[knSlices];         // dE/dx measurements for tracklet
+  Double_t         fCross[4];               // spatial parameters of the pad row crossing
+  Double_t         fRefCov[3];              // covariance matrix of the track in the yz plane
+  Double_t         fCov[3];                 // covariance matrix of the tracklet in the xy plane
   Double_t         fProb[AliPID::kSPECIES]; //  PID probabilities
 
-  ClassDef(AliTRDseedV1, 1)                 //  New TRD seed 
+  ClassDef(AliTRDseedV1, 4)                 //  New TRD seed 
 
 };
 
@@ -128,6 +157,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