]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AOD/AliAODTrack.h
* add tuned on data functionality for TOF (non-gaussian tails)
[u/mrichter/AliRoot.git] / STEER / AOD / AliAODTrack.h
index ce536a147c5dc6ba0ec3c2b9e578080d2414a206..98d7d40d2b0bf08e7ed23742fe673de1d54845a9 100644 (file)
@@ -20,6 +20,9 @@
  
 
 class AliVVertex;
+class AliDetectorPID;
+class AliTPCdEdxInfo;
+class AliAODEvent;
 
 class AliAODTrack : public AliVTrack {
 
@@ -124,12 +127,20 @@ class AliAODTrack : public AliVTrack {
   virtual Bool_t   XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
 
   Double_t Chi2perNDF()  const { return fChi2perNDF; }
-  UShort_t GetTPCNcls()  const { 
-    UShort_t cl = fTPCFitMap.CountBits();
-    if(cl==0)return fTPCClusterMap.CountBits();// backward compatibility
+
+  UShort_t GetTPCnclsS(Int_t i0=0,Int_t i1=159)  const { 
+    UShort_t cl = fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1);
+    return cl;
+  }
+  
+  UShort_t GetTPCncls(Int_t i0=0,Int_t i1=159)  const { 
+    UShort_t cl = fTPCFitMap.CountBits(i0)-fTPCFitMap.CountBits(i1);
+    if(cl==0)cl = fTPCClusterMap.CountBits(i0)-fTPCClusterMap.CountBits(i1);// backward compatibility
     return cl;
   }
   
+  UShort_t GetTPCNcls()  const { return GetTPCncls(); }
+
   virtual Double_t M() const { return M(GetMostProbablePID()); }
   Double_t M(AODTrkPID_t pid) const;
   virtual Double_t E() const { return E(GetMostProbablePID()); }
@@ -152,12 +163,12 @@ class AliAODTrack : public AliVTrack {
   void ConvertAliPIDtoAODPID();
   void SetDetPID(AliAODPid *aodpid) {fDetPid = aodpid;}
 
-  template <class T> void GetPID(T *pid) const {
+  template <typename T> void GetPID(T *pid) const {
     for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
  
-  template <class T> void SetPID(const T *pid) {
+  template <typename T> void SetPID(const T *pid) {
     if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
-    else {for(Int_t i=0; i<10; fPID[i++]=0.) ; fPID[AliAODTrack::kUnknown]=1.;}}
+    else {  for(Int_t i=0; i<10; i++) fPID[i]=0.; fPID[AliAODTrack::kUnknown]=1.;}}
 
   Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;}
   ULong_t GetStatus() const { return GetFlags(); }
@@ -165,6 +176,9 @@ class AliAODTrack : public AliVTrack {
 
   Int_t   GetID() const { return (Int_t)fID; }
   Int_t   GetLabel() const { return fLabel; } 
+  void    GetTOFLabel(Int_t *p) const;
+
+
   Char_t  GetType() const { return fType;}
   Bool_t  IsPrimaryCandidate() const;
   Bool_t  GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); }
@@ -176,30 +190,32 @@ class AliAODTrack : public AliVTrack {
   Bool_t  IsTPCConstrained() const { return TestBit(kIsTPCConstrained); }
   Bool_t  IsGlobalConstrained() const { return TestBit(kIsGlobalConstrained); }
   //
-  Int_t   GetTOFBunchCrossing(Double_t b=0) const;
+  Int_t   GetTOFBunchCrossing(Double_t b=0, Bool_t tpcPIDonly=kFALSE) const;
   //
-  template <class T> void GetP(T *p) const {
+  template <typename T> void GetP(T *p) const {
     p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
 
-//  template <class T> void GetPxPyPz(T *p) const {
+//  template <typename T> void GetPxPyPz(T *p) const {
 //    p[0] = Px(); p[1] = Py(); p[2] = Pz();}
   Bool_t GetPxPyPz(Double_t *p) const;
 
-  template <class T> Bool_t GetPosition(T *x) const {
+  template <typename T> Bool_t GetPosition(T *x) const {
     x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
     return TestBit(kIsDCA);}
 
-  template <class T> void SetCovMatrix(const T *covMatrix) {
+  template <typename T> void SetCovMatrix(const T *covMatrix) {
     if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
     fCovMatrix->SetCovMatrix(covMatrix);}
 
-  template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
+  template <typename T> Bool_t GetCovMatrix(T *covMatrix) const {
     if(!fCovMatrix) return kFALSE;
     fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
 
   Bool_t GetXYZ(Double_t *p) const {
     return GetPosition(p); }
-
+  
+  Bool_t GetXYZAt(Double_t x, Double_t b, Double_t *r) const;
+  
   Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const {
     return GetCovMatrix(cv);}
 
@@ -239,42 +255,72 @@ class AliAODTrack : public AliVTrack {
   UInt_t  GetFilterMap() const {return fFilterMap;}
 
   const TBits& GetTPCClusterMap() const {return fTPCClusterMap;}
+  const TBits* GetTPCClusterMapPtr() const {return &fTPCClusterMap;}
   const TBits& GetTPCFitMap() const {return fTPCFitMap;}
+  const TBits* GetTPCFitMapPtr() const {return &fTPCFitMap;}
   Float_t GetTPCClusterInfo(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t /*type*/=0) const;
   
   const TBits& GetTPCSharedMap() const {return fTPCSharedMap;}
+  const TBits* GetTPCSharedMapPtr() const {return &fTPCSharedMap;}
   void    SetTPCClusterMap(const TBits amap) {fTPCClusterMap = amap;}
   void    SetTPCSharedMap(const TBits amap) {fTPCSharedMap = amap;}
   void    SetTPCFitMap(const TBits amap) {fTPCFitMap = amap;}
   void    SetTPCPointsF(UShort_t  findable){fTPCnclsF = findable;}
+  void    SetTPCNCrossedRows(UInt_t n)     {fTPCNCrossedRows = n;}
 
   UShort_t GetTPCNclsF() const { return fTPCnclsF;}
+  UShort_t GetTPCNCrossedRows()  const { return fTPCNCrossedRows;}
+  Float_t  GetTPCFoundFraction() const { return fTPCNCrossedRows>0 ? float(GetTPCNcls())/fTPCNCrossedRows : 0;}
 
   // Calorimeter Cluster
   Int_t GetEMCALcluster() const {return fCaloIndex;}
   void SetEMCALcluster(Int_t index) {fCaloIndex=index;}
   Bool_t IsEMCAL() const {return fFlags&kEMCALmatch;}
 
+  Double_t GetTrackPhiOnEMCal() const {return fTrackPhiOnEMCal;}
+  Double_t GetTrackEtaOnEMCal() const {return fTrackEtaOnEMCal;}
+  void SetTrackPhiEtaOnEMCal(Double_t phi,Double_t eta) {fTrackPhiOnEMCal=phi;fTrackEtaOnEMCal=eta;}
+
   Int_t GetPHOScluster() const {return fCaloIndex;}
   void SetPHOScluster(Int_t index) {fCaloIndex=index;}
   Bool_t IsPHOS() const {return fFlags&kPHOSmatch;}
 
   //pid signal interface
   Double_t  GetITSsignal()       const { return fDetPid?fDetPid->GetITSsignal():0.;    }
+  void      GetITSdEdxSamples(Double_t s[4]) const;
   Double_t  GetTPCsignal()       const { return fDetPid?fDetPid->GetTPCsignal():0.;    }
+  Double_t  GetTPCsignalTunedOnData() const { return fTPCsignalTuned;}
+  void      SetTPCsignalTunedOnData(Double_t signal) {fTPCsignalTuned = signal;}
   UShort_t  GetTPCsignalN()      const { return fDetPid?fDetPid->GetTPCsignalN():0;    }
+  virtual AliTPCdEdxInfo* GetTPCdEdxInfo() const {return fDetPid?fDetPid->GetTPCdEdxInfo():0;}
   Double_t  GetTPCmomentum()     const { return fDetPid?fDetPid->GetTPCmomentum():0.;  }
   Double_t  GetTOFsignal()       const { return fDetPid?fDetPid->GetTOFsignal():0.;    }
-  Double_t  GetHMPIDsignal()     const { return fDetPid?fDetPid->GetHMPIDsignal():0.;  }
+  Double_t  GetTOFsignalTunedOnData() const { return fTOFsignalTuned;}
+  void      SetTOFsignalTunedOnData(Double_t signal) {fTOFsignalTuned = signal;}
+  Double_t  GetHMPIDsignal()     const; 
+  Double_t  GetHMPIDoccupancy()  const;
+
+  Int_t     GetHMPIDcluIdx()     const;
+    
+  void GetHMPIDtrk(Float_t &x, Float_t &y, Float_t &th, Float_t &ph) const;  
+  void GetHMPIDmip(Float_t &x,Float_t &y,Int_t &q,Int_t &nph) const;
+  
+  Bool_t GetOuterHmpPxPyPz(Double_t *p) const;
   
   void      GetIntegratedTimes(Double_t *times) const {if (fDetPid) fDetPid->GetIntegratedTimes(times); }
   Double_t  GetTRDslice(Int_t plane, Int_t slice) const;
+  Double_t  GetTRDsignal()                        const {return fDetPid ? fDetPid->GetTRDsignal() : 0;}
   Double_t  GetTRDmomentum(Int_t plane, Double_t */*sp*/=0x0) const;
-  UChar_t   GetTRDncls(Int_t layer = -1) const;
+  Double_t  GetTRDchi2()                 const {return fDetPid ? fDetPid->GetTRDChi2() : -1;}
+  UChar_t   GetTRDncls(Int_t layer)      const;
+  UChar_t   GetTRDncls()                 const {return GetTRDncls(-1);}
   UChar_t   GetTRDntrackletsPID() const;
-  void      GetHMPIDpid(Double_t *p) const { if (fDetPid) fDetPid->GetHMPIDprobs(p); }
+  Int_t     GetNumberOfTRDslices() const { return fDetPid?fDetPid->GetTRDnSlices():0; }
+  void      GetHMPIDpid(Double_t */*p*/) const { return; } // TODO: To be implemented properly with the new HMPID object
+
+  const AliAODEvent* GetAODEvent() const {return fAODEvent;}
+  void SetAODEvent(const AliAODEvent* ptr){fAODEvent = ptr;}
 
-  
   AliAODPid    *GetDetPid() const { return fDetPid; }
   AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
   
@@ -288,8 +334,8 @@ class AliAODTrack : public AliVTrack {
 
   void SetID(Short_t id) { fID = id; }
   void SetLabel(Int_t label) { fLabel = label; }
-
-  template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
+  void SetTOFLabel(const Int_t* p);
+  template <typename T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
   void SetDCA(Double_t d, Double_t z);
   void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); }
   void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
@@ -308,7 +354,7 @@ class AliAODTrack : public AliVTrack {
   void SetPt(Double_t pt) { fMomentum[0] = pt; };
   void SetPhi(Double_t phi) { fMomentum[1] = phi; }
   void SetTheta(Double_t theta) { fMomentum[2] = theta; }
-  template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
+  template <typename T> void SetP(const T *p, Bool_t cartesian = kTRUE);
   void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
 
   void SetXYAtDCA(Double_t x, Double_t y) {fPositionAtDCA[0] = x; fPositionAtDCA[1] = y;}
@@ -323,6 +369,10 @@ class AliAODTrack : public AliVTrack {
   void SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffff00ff)|((((UInt_t)hitsPatternInTrigCh)&0xff)<<8); }
   void SetMuonClusterMap(UInt_t muonClusMap)                { fITSMuonClusterMap = (fITSMuonClusterMap&0xfc00ffff)|((muonClusMap&0x3ff)<<16); }
   void SetITSMuonClusterMap(UInt_t itsMuonClusMap)          { fITSMuonClusterMap = itsMuonClusMap; }
+  void SetMUONtrigHitsMapTrg(UInt_t muonTrigHitsMap) { fMUONtrigHitsMapTrg = muonTrigHitsMap; }
+  UInt_t GetMUONTrigHitsMapTrg() { return fMUONtrigHitsMapTrg; }
+  void SetMUONtrigHitsMapTrk(UInt_t muonTrigHitsMap) { fMUONtrigHitsMapTrk = muonTrigHitsMap; }
+  UInt_t GetMUONTrigHitsMapTrk() { return fMUONtrigHitsMapTrk; }
 
   Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;}
                                        //  0 Muon track does not match trigger
@@ -345,7 +395,9 @@ class AliAODTrack : public AliVTrack {
   void     SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
   void     SetType(AODTrk_t ttype) { fType=ttype; }
 
-
+  // Trasient PID object, is owned by the track
+  virtual void  SetDetectorPID(const AliDetectorPID *pid);
+  virtual const AliDetectorPID* GetDetectorPID() const { return fDetectorPID; }
 
   // Dummy
   Int_t    PdgCode() const {return 0;}
@@ -367,9 +419,11 @@ class AliAODTrack : public AliVTrack {
 
   ULong_t       fFlags;             // reconstruction status flags 
   Int_t         fLabel;             // track label, points back to MC track
-  
+  Int_t         fTOFLabel[3];       // TOF label   
   UInt_t        fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer
                                     // (ITS: bit 1-8, muon trigger: bit 9-16, muon tracker: bit 17-26, muon match trigger: bit 31-32) 
+  UInt_t        fMUONtrigHitsMapTrg; // Muon trigger hits map from trigger
+  UInt_t        fMUONtrigHitsMapTrk; // Muon trigger hits map from tracker track extrapolation
   UInt_t        fFilterMap;         // filter information, one bit per set of cuts
 
   TBits         fTPCFitMap;      // Map of clusters, one bit per padrow; if has a cluster on given padrow which is used in the fit   
@@ -377,6 +431,7 @@ class AliAODTrack : public AliVTrack {
   TBits         fTPCSharedMap;      // Map of clusters, one bit per padrow; 1 if has a shared cluster on given padrow
 
   UShort_t      fTPCnclsF;          // findable clusters
+  UShort_t      fTPCNCrossedRows;   // n crossed rows
 
   Short_t       fID;                // unique track ID, points back to the ESD track
 
@@ -387,10 +442,19 @@ class AliAODTrack : public AliVTrack {
 
   
   AliAODRedCov<6> *fCovMatrix;      // covariance matrix (x, y, z, px, py, pz)
-  AliAODPid    *fDetPid;            // more detailed or detector specific pid information
+  AliAODPid    *fDetPid;            // more detailed or detector specific raw pid information
+  mutable const AliDetectorPID* fDetectorPID; //! transient object to cache calibrated PID information
   TRef          fProdVertex;        // vertex of origin
 
-  ClassDef(AliAODTrack, 15);
+  Double_t      fTrackPhiOnEMCal;   // phi of track after being propagated to 430cm
+  Double_t      fTrackEtaOnEMCal;   // eta of track after being propagated to 430cm
+
+  Double_t      fTPCsignalTuned;    //! TPC signal tuned on data when using MC
+  Double_t      fTOFsignalTuned;    //! TOF signal tuned on data when using MC
+
+  const AliAODEvent* fAODEvent;     //! 
+
+  ClassDef(AliAODTrack, 20);
 };
 
 inline Bool_t  AliAODTrack::IsPrimaryCandidate() const
@@ -412,4 +476,35 @@ inline Int_t AliAODTrack::GetITSNcls() const
   return n;
 }
 
+//______________________________________________________________________________
+template <typename T> 
+void AliAODTrack::SetPosition(const T *x, const Bool_t dca) 
+{
+  // set the position
+
+  if (x) {
+    if (!dca) {
+      ResetBit(kIsDCA);
+
+      fPosition[0] = x[0];
+      fPosition[1] = x[1];
+      fPosition[2] = x[2];
+    } else {
+      SetBit(kIsDCA);
+      // don't know any better yet
+      fPosition[0] = -999.;
+      fPosition[1] = -999.;
+      fPosition[2] = -999.;
+    }
+  } else {
+    ResetBit(kIsDCA);
+
+    fPosition[0] = -999.;
+    fPosition[1] = -999.;
+    fPosition[2] = -999.;
+  }
+}
+
+//template<> void AliAODTrack::SetPosition(const double *, Bool_t);
+
 #endif