]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDseedV1.h
- coverity fixes for unused but set variables in various places
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.h
index f2cac2d9b01649801753a448905494b3e4d84894..80bc78283836233e0cd3859b06040725c2e52866 100644 (file)
@@ -3,7 +3,7 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */
 
-/* $Id$ */
+/* $Id: AliTRDseedV1.h 60233 2013-01-10 09:04:08Z abercuci $ */
 
 ////////////////////////////////////////////////////////////////////////////
 //                                                                        //
@@ -37,7 +37,7 @@
 
 class TTreeSRedirector;
 class TLinearFitter;
-
+class TGeoHMatrix;
 class AliRieman;
 
 class AliTRDReconstructor;
@@ -54,14 +54,14 @@ public:
    ,kMask      = 0x3f   // bit mask
    ,kNtb       = 31     // max clusters/pad row
    ,kNclusters = 2*kNtb // max number of clusters/tracklet
-   ,kNslices   = 10     // max dEdx slices
+   ,kNdEdxSlices= 8     // dEdx slices allocated in reconstruction
   };
 
   // bits from 0-13 are reserved by ROOT (see TObject.h)
   enum ETRDtrackletStatus {
     kOwner      = BIT(14) // owner of its clusters
    ,kRowCross   = BIT(15) // pad row cross tracklet
-   ,kPID        = BIT(16) // PID contributor
+   ,kChmbGood   = BIT(16) // status of the detector from calibration view point
    ,kCalib      = BIT(17) // calibrated tracklet
    ,kKink       = BIT(18) // kink prolongation tracklet
    ,kStandAlone = BIT(19) // tracklet build during stand alone track finding
@@ -84,21 +84,23 @@ public:
   AliTRDseedV1(const AliTRDseedV1 &ref);
   AliTRDseedV1& operator=(const AliTRDseedV1 &ref);
 
-  Bool_t    AttachClusters(AliTRDtrackingChamber *const chamber, Bool_t tilt = kFALSE);
+  Bool_t    AttachClusters(AliTRDtrackingChamber *const chamber, Bool_t tilt = kFALSE, Bool_t ChgPlus=kTRUE, Int_t ev=-1);
   void      Bootstrap(const AliTRDReconstructor *rec);
   void      Calibrate();
   void      CookdEdx(Int_t nslices);
   void      CookLabels();
   Bool_t    CookPID();
-  Bool_t    Fit(UChar_t opt=0);
-  Bool_t    Init(AliTRDtrackV1 *track);
+  Bool_t    Fit(UChar_t opt=0); // OBSOLETE
+  Bool_t    FitRobust(AliTRDpadPlane *pp, Bool_t sgn, Int_t chg, Int_t opt=0);
+  Double_t  EstimatedCrossPoint(AliTRDpadPlane *pp);
+  Bool_t    Init(const AliTRDtrackV1 *track);
   void      Init(const AliRieman *fit);
   Bool_t    IsEqual(const TObject *inTracklet) const;
   Bool_t    IsCalibrated() const     { return TestBit(kCalib);}
+  Bool_t    IsChmbGood() const       { return TestBit(kChmbGood);}
   Bool_t    IsOwner() const          { return TestBit(kOwner);}
   Bool_t    IsKink() const           { return TestBit(kKink);}
   Bool_t    IsPrimary() const        { return TestBit(kPrimary);}
-  Bool_t    HasPID() const           { return TestBit(kPID);}
   Bool_t    HasError(ETRDtrackletError err) const
                                      { return TESTBIT(fErrorMsg, err);}
   Bool_t    IsOK() const             { return GetN() > 4 && GetNUsed() < 4;}
@@ -108,7 +110,7 @@ public:
 
   Float_t   GetAnodeWireOffset(Float_t zt);
   Float_t   GetC(Int_t typ=0) const    { return fC[typ]; }
-  Float_t   GetCharge(Bool_t useOutliers=kFALSE);
+  Float_t   GetCharge(Bool_t useOutliers=kFALSE) const;
   Float_t   GetChi2() const          { return fChi2; }
   inline Float_t   GetChi2Z() const;
   inline Float_t   GetChi2Y() const;
@@ -121,23 +123,28 @@ public:
   UChar_t   GetErrorMsg() const      { return fErrorMsg;}
   Float_t   GetdX() const            { return fdX;}
   const Float_t*  GetdEdx() const    { return &fdEdx[0];}
+  Float_t   GetQperTB(Int_t tb) const;
+  Float_t   GetdQdl() const;
   Float_t   GetdQdl(Int_t ic, Float_t *dx=NULL) const;
   Float_t   GetdYdX() const          { return fYfit[1];}
   Float_t   GetdZdX() const          { return fZfit[1];}
   Int_t     GetdY() const            { return Int_t(GetY()/0.014);}
   Int_t     GetDetector() const      { return fDet;}
+  Int_t     GetChargeGaps(Float_t sz[kNtb], Float_t pos[kNtb], Int_t ntb[kNtb]) const;
   void      GetCalibParam(Float_t &exb, Float_t &vd, Float_t &t0, Float_t &s2, Float_t &dl, Float_t &dt) const    { 
               exb = fExB; vd = fVD; t0 = fT0; s2 = fS2PRF; dl = fDiffL; dt = fDiffT;}
   AliTRDcluster*  GetClusters(Int_t i) const               { return i<0 || i>=kNclusters ? NULL: fClusters[i];}
-  Bool_t    GetEstimatedCrossPoint(Float_t &x, Float_t &z) const;
   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];}  
+  Float_t   GetLocalZ() const        { return fZfit[0] - fZfit[1] * fX;}
+  Float_t   GetLocalY() const        { return fYfit[0] - fYfit[1] * fX;}
   Float_t   GetMomentum(Float_t *err = NULL) const;
   Int_t     GetN() const             { return (Int_t)fN&kMask;}
   Int_t     GetN2() const            { return GetN();}
   Int_t     GetNUsed() const         { return Int_t((fN>>kNbits)&kMask);}
   Int_t     GetNShared() const       { return Int_t(((fN>>kNbits)>>kNbits)&kMask);}
-  Float_t   GetOccupancyTB() const;
+  Int_t     GetTBoccupancy() const;
+  Int_t     GetTBcross() const;
   Float_t   GetQuality(Bool_t kZcorr) const;
   Float_t   GetPadLength() const     { return fPad[0];}
   Float_t   GetPadWidth() const      { return fPad[1];}
@@ -146,8 +153,11 @@ public:
   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   GetS2Y() const           { return fCov[0];}
   Float_t   GetS2Z() const           { return fS2Z;}
+  Double_t  GetS2DYDX(Float_t) const { return fCov[2];}
+  inline Double_t  GetS2DZDX(Float_t) const;
+  inline Double_t  GetS2XcrossDZDX(Double_t absdzdx) const;
   Float_t   GetSigmaY() const        { return fS2Y > 0. ? TMath::Sqrt(fS2Y) : 0.2;}
   Float_t   GetSnp() const           { return fYref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);}
   Float_t   GetTgl() const           { return fZref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);}
@@ -156,14 +166,17 @@ public:
   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;}
-  Double_t  GetYat(Double_t x) const { return fYfit[0] - fYfit[1] * (fX0-x);}
+  Float_t   GetXcross() const        { return fS2Y;}
+  Float_t   GetY() const             { return TMath::Abs(fY)<1.e-15?GetLocalY():fY;/*fYfit[0] - fYfit[1] * fX;*/}
+  Double_t  GetYat(Double_t x) const { return fY/*fit[0]*/ - fYfit[1] * (fX0-x);}
   Float_t   GetYfit(Int_t id) const  { return fYfit[id];}
   Float_t   GetYref(Int_t id) const  { return fYref[id];}
-  Float_t   GetZ() const             { return fZfit[0] - fZfit[1] * fX;}
-  Double_t  GetZat(Double_t x) const { return fZfit[0] - fZfit[1] * (fX0-x);}
+  Float_t   GetYref() const          { return fYref[0] - fYref[1] *fX;}
+  Float_t   GetZ() const             { return TMath::Abs(fZ)<1.e-15?GetLocalZ():fZ;/*fZfit[0] - fZfit[1] * fX;*/}
+  Double_t  GetZat(Double_t x) const { return fZ/*fit[0]*/ - fZfit[1] * (fX0-x);}
   Float_t   GetZfit(Int_t id) const  { return fZfit[id];}
   Float_t   GetZref(Int_t id) const  { return fZref[id];}
+  Float_t   GetZref() const          { return fZref[0] - fZref[1] *fX;}
   Int_t     GetYbin() const          { return Int_t(GetY()/0.016);}
   Int_t     GetZbin() const          { return Int_t(GetZ()/fPad[0]);}
 
@@ -174,6 +187,7 @@ public:
   void      Reset(Option_t *opt="");
 
   void      SetC(Float_t c, Int_t typ=0) { fC[typ] = c;}
+  void      SetChmbGood(Bool_t k = kTRUE){ SetBit(kChmbGood, k);}
   void      SetChi2(Float_t chi2)    { fChi2 = chi2;}
   inline void SetCovRef(const Double_t *cov);
   void      SetErrorMsg(ETRDtrackletError err)  { SETBIT(fErrorMsg, err);}
@@ -181,7 +195,6 @@ public:
   void      SetLabels(Int_t *lbls)   { memcpy(fLabels, lbls, 3*sizeof(Int_t)); }
   void      SetKink(Bool_t k = kTRUE){ SetBit(kKink, k);}
   void      SetPrimary(Bool_t k = kTRUE){ SetBit(kPrimary, k);}  
-  void      SetPID(Bool_t k = kTRUE) { SetBit(kPID, k);}
   void      SetStandAlone(Bool_t st) { SetBit(kStandAlone, st); }
   void      SetPt(Double_t pt)       { fPt = pt;}
   void      SetOwner();
@@ -193,15 +206,18 @@ public:
   void      SetDX(Float_t inDX)      { fdX = inDX;}
   void      SetReconstructor(const AliTRDReconstructor *rec) {fkReconstructor = rec;}
   void      SetX0(Float_t x0)        { fX0 = x0; }
-  void      SetYref(Int_t i, Float_t y) { fYref[i]     = y;}
-  void      SetZref(Int_t i, Float_t z) { fZref[i]     = z;}
+  void      SetXYZ(TGeoHMatrix *mDet);
+  void      SetYref(Int_t i, Float_t y) { if(i==0||i==1) fYref[i]     = y;}
+  void      SetZref(Int_t i, Float_t z) { if(i==0||i==1) fZref[i]     = z;}
 //   void      SetUsabilityMap(Long_t um)  { fUsable = um; }
   void      Update(const AliTRDtrackV1* trk);
   void      UpdateUsed();
   void      UseClusters();
 
 protected:
-  void        Copy(TObject &ref) const;
+  void      Copy(TObject &ref) const;
+  void      UnbiasDZDX(Bool_t rc);
+  Double_t  UnbiasY(Bool_t rc, Bool_t sgn, Int_t chg);
 
 private:
   inline void SetN(Int_t n);
@@ -227,25 +243,25 @@ private:
   Float_t          fPad[4];                 // local pad definition : length/width/tilt/anode wire offset 
   Float_t          fYref[2];                //  Reference y, dydx
   Float_t          fZref[2];                //  Reference z, dz/dx
-  Float_t          fYfit[2];                //  Fit y, dy/dx
-  Float_t          fZfit[2];                //  Fit z
+  Float_t          fYfit[2];                //  Fit :: chamber local y, dy/dx
+  Float_t          fZfit[2];                //  Fit :: chamber local z, dz/dx
   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
-  Float_t          fY;                      // r-phi position of the tracklet
-  Float_t          fZ;                      // z position of the tracklet
-  Float_t          fS2Y;                    // estimated resolution in the r-phi direction 
+  Float_t          fX0;                     // anode wire position in TrackingCoordinates (alignment included)
+  Float_t          fX;                      // local radial offset from anode wire where tracklet position is estimated
+  Float_t          fY;                      // r-phi position of the tracklet  in TrackingCoordinates (alignment included)
+  Float_t          fZ;                      // z position of the tracklet in TrackingCoordinates (alignment included)
+  Float_t          fS2Y;                    // estimated radial cross point (chmb. coord.) in case of RC tracklets 
   Float_t          fS2Z;                    // estimated resolution in the z direction 
   Float_t          fC[2];                   // Curvature for standalone [0] rieman [1] vertex constrained 
   Float_t          fChi2;                   // Global chi2  
-  Float_t          fdEdx[kNslices];         // dE/dx measurements for tracklet
+  Float_t          fdEdx[kNdEdxSlices];     // 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[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, 11)                 // The offline TRD tracklet 
+  ClassDef(AliTRDseedV1, 13)                 // The offline TRD tracklet 
 };
 
 //____________________________________________________________
@@ -286,6 +302,27 @@ inline Double_t AliTRDseedV1::GetPID(Int_t is) const
 }
 
 //____________________________________________________________
+Double_t AliTRDseedV1::GetS2XcrossDZDX(Double_t absdzdx) const
+{
+  // correct sigma(x_cross) for the width of the crossing area
+  if(absdzdx>0.05) return TMath::Exp(-1.58839-absdzdx*3.24116);
+  else return 0.957043-absdzdx*12.4597;
+}
+
+//____________________________________________________________
+Double_t AliTRDseedV1::GetS2DZDX(Float_t dzdx) const
+{
+//   Double_t p0[] = {0.03925, 0.03178},
+//            p1[] = {0.06316, 0.06669};
+  Double_t p0[] = {0.02835, 0.03925},
+           p1[] = {0.04746, 0.06316};
+  
+  Double_t s2(p0[IsRowCross()]+p1[IsRowCross()]*dzdx*dzdx);
+  s2*=s2;
+  return s2;
+}
+
+  //____________________________________________________________
 inline AliTRDcluster* AliTRDseedV1::NextCluster()
 {
 // Mimic the usage of STL iterators.