]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDseedV1.h
1. Adding time dependent sigma - (important for v drift)
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.h
index fc9eb4c746bbf44ee6ea6b79687ca6f3ca91b503..b7d3d127ef5c27ab610bfc37583500d3c146a055 100644 (file)
@@ -42,6 +42,7 @@ class AliRieman;
 class AliTRDtrackingChamber;
 class AliTRDtrackV1;
 class AliTRDReconstructor;
+class AliTRDpadPlane;
 class AliTRDseedV1 : public AliTRDtrackletBase
 {
 public:
@@ -55,9 +56,10 @@ public:
   enum ETRDtrackletStatus {
     kOwner      = BIT(14) // owner of its clusters
    ,kRowCross   = BIT(15) // pad row cross tracklet
-   ,kCalib      = BIT(16) // calibrated tracklet
-   ,kKink       = BIT(17) // kink prolongation tracklet
-   ,kStandAlone = BIT(18)
+   ,kPID        = BIT(16) // PID contributor
+   ,kCalib      = BIT(17) // calibrated tracklet
+   ,kKink       = BIT(18) // kink prolongation tracklet
+   ,kStandAlone = BIT(19) // stand alone build tracklet
   };
 
   AliTRDseedV1(Int_t det = -1);
@@ -75,14 +77,14 @@ public:
   void      CookdEdx(Int_t nslices);
   void      CookLabels();
   Bool_t    CookPID();
-  Bool_t    Fit(Bool_t tilt=kTRUE, Int_t errors = 2);
-//   void      FitMI();
+  Bool_t    Fit(Bool_t tilt=kFALSE, Bool_t zcorr=kFALSE);
   Bool_t    Init(AliTRDtrackV1 *track);
   inline void      Init(const AliRieman *fit);
   Bool_t    IsEqual(const TObject *inTracklet) const;
   Bool_t    IsCalibrated() const     { return TestBit(kCalib);}
   Bool_t    IsOwner() const          { return TestBit(kOwner);}
   Bool_t    IsKink() const           { return TestBit(kKink);}
+  Bool_t    HasPID() const           { return TestBit(kPID);}
   Bool_t    IsOK() const             { return GetN() > 4 && GetNUsed() < 4;}
   Bool_t    IsRowCross() const       { return TestBit(kRowCross);}
   Bool_t    IsUsable(Int_t i) const  { return fClusters[i] && !fClusters[i]->IsUsed();}
@@ -93,13 +95,14 @@ public:
   inline Float_t   GetChi2Z() const;
   inline Float_t   GetChi2Y() const;
   inline Float_t   GetChi2Phi() const;
-  static void      GetClusterXY(const AliTRDcluster *c, Double_t &x, Double_t &y);
   void      GetCovAt(Double_t x, Double_t *cov) const;
   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));}
+  void      GetCovRef(Double_t *cov) const { memcpy(cov, &fRefCov, 7*sizeof(Double_t));}
+  static Double_t GetCovSqrt(Double_t *c, Double_t *d);
+  static Double_t GetCovInv(Double_t *c, Double_t *d);
   Float_t   GetdX() const            { return fdX;}
   Float_t*  GetdEdx()                { return &fdEdx[0];}
-  Float_t   GetdQdl(Int_t ic) const;
+  Float_t   GetdQdl(Int_t ic, Float_t *dx=0x0) const;
   Float_t   GetdYdX() const          { return fYfit[1]; } 
   Float_t   GetdZdX() const          { return fZref[1]; }
   Int_t     GetdY() const            { return Int_t(GetY()/0.014);}
@@ -109,7 +112,7 @@ public:
   AliTRDcluster*  GetClusters(Int_t i) const               { return i<0 || i>=kNclusters ? 0x0 : fClusters[i];}
   Int_t     GetIndexes(Int_t i) const{ return i<0 || i>=kNclusters ? -1 : fIndexes[i];}
   Int_t     GetLabels(Int_t i) const { return fLabels[i];}  
-  Double_t  GetMomentum() const      { return fMom;}
+  Float_t   GetMomentum(Float_t *err = 0x0) const;
   Int_t     GetN() const             { return (Int_t)fN&0x1f;}
   Int_t     GetN2() const            { return GetN();}
   Int_t     GetNUsed() const         { return Int_t((fN>>5)&0x1f);}
@@ -120,6 +123,7 @@ public:
   Int_t     GetPlane() const         { return AliTRDgeometry::GetLayer(fDet);    }
 
   Float_t*  GetProbability(Bool_t force=kFALSE);
+  Float_t   GetPt() const            { return fPt; }
   inline Double_t  GetPID(Int_t is=-1) const;
   Float_t   GetS2Y() const           { return fS2Y;}
   Float_t   GetS2Z() const           { return fS2Z;}
@@ -128,6 +132,7 @@ public:
   Float_t   GetTgl() const           { return fZref[1];}
   Float_t   GetTilt() const          { return fPad[2];}
   UInt_t    GetTrackletWord() const  { return 0;}
+  UShort_t  GetVolumeId() const;
   Float_t   GetX0() const            { return fX0;}
   Float_t   GetX() const             { return fX0 - fX;}
   Float_t   GetY() const             { return fYfit[0] - fYfit[1] * fX;}
@@ -149,16 +154,18 @@ public:
 
   void      SetC(Float_t c)         { fC = c;}
   void      SetChi2(Float_t chi2)   { fChi2 = chi2;}
-  void      SetCovRef(const Double_t *cov) { memcpy(&fRefCov[0], cov, 3*sizeof(Double_t));}
+  inline void SetCovRef(const Double_t *cov);
   void      SetIndexes(Int_t i, Int_t idx) { fIndexes[i]  = idx; }
   void      SetLabels(Int_t *lbls)   { memcpy(fLabels, lbls, 3*sizeof(Int_t)); }
-  void      SetKink(Bool_t k)        { SetBit(kKink, k);}
+  void      SetKink(Bool_t k = kTRUE){ SetBit(kKink, k);}
+  void      SetPID(Bool_t k = kTRUE) { SetBit(kPID, k);}
   void      SetStandAlone(Bool_t st) { SetBit(kStandAlone, st); }
-  void      SetMomentum(Double_t mom){ fMom = mom;}
+  void      SetPt(Double_t pt)       { fPt = pt;}
   void      SetOwner();
-  void      SetTilt(Float_t tilt)    { fPad[3] = tilt; }
+  void      SetPadPlane(AliTRDpadPlane *p);
   void      SetPadLength(Float_t l)  { fPad[0] = l;}
   void      SetPadWidth(Float_t w)   { fPad[1] = w;}
+  void      SetTilt(Float_t tilt)    { fPad[2] = tilt; }
   void      SetDetector(Int_t d)     { fDet = d;  }
   void      SetDX(Float_t inDX)      { fdX = inDX;}
   void      SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
@@ -166,7 +173,7 @@ public:
   void      SetYref(Int_t i, Float_t y) { fYref[i]     = y;}
   void      SetZref(Int_t i, Float_t z) { fZref[i]     = z;}
 //   void      SetUsabilityMap(Long_t um)  { fUsable = um; }
-  void      UpDate(const AliTRDtrackV1* trk);
+  void      Update(const AliTRDtrackV1* trk);
   void      UpdateUsed();
   void      UseClusters();
 
@@ -196,7 +203,7 @@ private:
   Float_t          fZref[2];                //  Reference z
   Float_t          fYfit[2];                //  Y fit position +derivation
   Float_t          fZfit[2];                //  Z fit position
-  Float_t          fMom;                    //  Momentum estimate @ tracklet [GeV/c]
+  Float_t          fPt;                     //  Pt estimate @ tracklet [GeV/c]
   Float_t          fdX;                     // length of time bin
   Float_t          fX0;                     // anode wire position
   Float_t          fX;                      // radial position of the tracklet
@@ -209,10 +216,10 @@ private:
   Float_t          fdEdx[kNslices];         // dE/dx measurements for tracklet
   Float_t          fProb[AliPID::kSPECIES]; //  PID probabilities
   Int_t            fLabels[3];              // most frequent MC labels and total number of different labels
-  Double_t         fRefCov[3];              // covariance matrix of the track in the yz plane
+  Double_t         fRefCov[7];              // covariance matrix of the track in the yz plane + the rest of the diagonal elements
   Double_t         fCov[3];                 // covariance matrix of the tracklet in the xy plane
 
-  ClassDef(AliTRDseedV1, 6)                 // The offline TRD tracklet 
+  ClassDef(AliTRDseedV1, 7)                 // The offline TRD tracklet 
 };
 
 //____________________________________________________________
@@ -242,6 +249,8 @@ inline Float_t AliTRDseedV1::GetChi2Phi() const
   return s2 > 0. ? dphi/s2 : 0.; 
 }
 
+
+
 //____________________________________________________________
 inline Double_t AliTRDseedV1::GetPID(Int_t is) const
 {
@@ -313,6 +322,24 @@ inline void AliTRDseedV1::ResetClusterIter(Bool_t forward)
   }
 }
 
+//____________________________________________________________
+inline void AliTRDseedV1::SetCovRef(const Double_t *cov)
+{ 
+// Copy some "important" covariance matrix elements
+//  var(y)
+// cov(y,z)  var(z)
+//                  var(snp)
+//                           var(tgl)
+//                        cov(tgl, 1/pt)  var(1/pt)
+
+  memcpy(&fRefCov[0], cov, 3*sizeof(Double_t)); // yz full covariance
+  fRefCov[3] = cov[ 5];  // snp variance 
+  fRefCov[4] = cov[ 9];  // tgl variance
+  fRefCov[5] = cov[13];  // cov(tgl, 1/pt)
+  fRefCov[6] = cov[14];  // 1/pt variance
+}
+
+
 //____________________________________________________________
 inline void AliTRDseedV1::SetN(Int_t n)
 {