]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
track clust distance
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 9 Feb 2012 15:19:38 +0000 (15:19 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 9 Feb 2012 15:19:38 +0000 (15:19 +0000)
PWGGA/EMCALTasks/AliPicoTrack.cxx
PWGGA/EMCALTasks/AliPicoTrack.h

index 856d28868b2a45519df4a5f14f6d12b997dca331..c528af28c5791f5a5757a14990dfb7ce97a0ffd1 100644 (file)
@@ -5,11 +5,13 @@
 //
 
 #include "AliPicoTrack.h"
+#include "AliExternalTrackParam.h"
+#include "AliVCluster.h"
 
 //_________________________________________________________________________________________________
 AliPicoTrack::AliPicoTrack() :
   AliVTrack(),
-  fPt(0), fEta(0), fPhi(0), fQ(0), fLabel(-1), fEtaEmc(0), fPhiEmc(0), fEmcal(0)
+  fPt(0), fEta(0), fPhi(0), fQ(0), fLabel(-1), fEtaEmc(0), fPhiEmc(0), fEmcal(0), fClusId(-1)
 {
   // Default constructor.
 }
@@ -19,7 +21,7 @@ AliPicoTrack::AliPicoTrack(Double_t pt, Double_t eta, Double_t phi, Byte_t q, By
                            Double_t etaemc, Double_t phiemc, Bool_t ise) :
   AliVTrack(),
   fPt(pt), fEta(eta), fPhi(phi), fQ(q), fLabel(lab), 
-  fEtaEmc(etaemc), fPhiEmc(phiemc), fEmcal(ise)
+  fEtaEmc(etaemc), fPhiEmc(phiemc), fEmcal(ise), fClusId(-1)
 {
   // Constructor.
 }
@@ -29,7 +31,8 @@ AliPicoTrack::AliPicoTrack(const AliPicoTrack &pc) :
   AliVTrack(pc),
   fPt(pc.fPt), fEta(pc.fEta), fPhi(pc.fPhi), 
   fQ(pc.fQ), fLabel(pc.fLabel), 
-  fEtaEmc(pc.fEtaEmc), fPhiEmc(pc.fPhiEmc), fEmcal(pc.fEmcal)
+  fEtaEmc(pc.fEtaEmc), fPhiEmc(pc.fPhiEmc), fEmcal(pc.fEmcal),
+  fClusId(pc.fClusId)
 {
   // Constructor.
 }
@@ -49,6 +52,7 @@ AliPicoTrack &AliPicoTrack::operator=(const AliPicoTrack &pc)
     fEtaEmc = pc.fEtaEmc;
     fPhiEmc = pc.fPhiEmc;
     fEmcal  = pc.fEmcal;
+    fClusId = pc.fClusId;
   }
 
   return *this;
@@ -71,4 +75,46 @@ Int_t AliPicoTrack::Compare(const TObject* obj) const
   return 0;
 }
 
+//_________________________________________________________________________________________________
+void AliPicoTrack::GetEtaPhiDiff(AliVTrack *t, AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
+{
+  // Calculate phi and eta difference between track and cluster.
+  phidiff = 999;
+  etadiff = 999;
+
+  if (!t||!v)
+    return;
+
+  if (!t->IsEMCAL())
+    return;
 
+  const AliExternalTrackParam *outp = t->GetOuterParam();
+  Double_t veta = 999;
+  Double_t vphi = 999;
+  if (outp) {
+    Double_t trkPos[3] = {0.,0.,0.};
+    if (!outp->GetXYZ(trkPos)) 
+      return;
+    TVector3 vec(trkPos[0],trkPos[1],trkPos[2]);
+    veta = vec.Eta();
+    vphi = vec.Phi();
+  } else {
+    AliPicoTrack *ptrack = dynamic_cast<AliPicoTrack*>(t);
+    if (ptrack) {
+      veta = ptrack->GetEtaEmc();
+      vphi = ptrack->GetPhiEmc();
+    }
+  }
+
+  if (0&&(TMath::Abs(veta)>0.75 || (vphi<70*TMath::DegToRad()) || (vphi>190*TMath::DegToRad())))
+    return;
+
+  Float_t pos[3] = {0};
+  v->GetPosition(pos);  
+  TVector3 cpos(pos); 
+  Double_t ceta     = cpos.Eta();
+  Double_t cphi     = cpos.Phi();
+  etadiff=veta-ceta;
+  phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
+}
index fa20b83071a04d3a4181ac814a0675316fafc88c..3bc631a9255459365559f98336d619aca75b8155 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "AliVTrack.h"
 #include <TMath.h>
+class AliVCluster;
 
 class AliPicoTrack: public AliVTrack {
  public:
@@ -38,18 +39,20 @@ class AliPicoTrack: public AliVTrack {
   const Double_t *PID()                const { return 0;       }
   Int_t    GetID()                     const { return 0;       }
   UChar_t  GetITSClusterMap()          const { return 0;       }
-  Int_t    GetEMCALcluster()           const { return -1;      }
+  Int_t    GetEMCALcluster()           const { return fClusId; }
   Double_t GetEtaEmc()                 const { return fEtaEmc; }
   Double_t GetPhiEmc()                 const { return fPhiEmc; }
   Bool_t   IsEMCAL()                   const { return fEmcal;  }
-  ULong_t  GetStatus()                 const { return 0; }
+  ULong_t  GetStatus()                 const { return 0;       }
   Bool_t   GetXYZ(Double_t *v)         const { v[0]=0; v[1]=0; v[2]=0; return 0; }
-  Double_t GetBz()                     const { return 0; }
-  void     GetBxByBz(Double_t b[3])    const {b[0]=0;b[1]=0;b[2]=0;}
-  Bool_t   GetCovarianceXYZPxPyPz(Double_t /*cv*/[21]) const {return 0;}
+  Double_t GetBz()                     const { return 0;       }
+  void     GetBxByBz(Double_t b[3])    const { b[0]=0;b[1]=0;b[2]=0; }
+  Bool_t   GetCovarianceXYZPxPyPz(Double_t /*cv*/[21]) const { return 0; }
   Int_t    Compare(const TObject* obj) const;
   Bool_t   PropagateToDCA(const AliVVertex *, Double_t, Double_t, Double_t *, Double_t *) { return 0; }
-  void     SetEMCALcluster(Int_t) {;}
+  void     SetEMCALcluster(Int_t id)         { fClusId = id;   }
+
+  static void GetEtaPhiDiff(AliVTrack *t, AliVCluster *v, Double_t &phidiff, Double_t &etadiff);
 
  protected:
   Double32_t       fPt;       //[0,0,12]   pt at vertex
@@ -60,7 +63,8 @@ class AliPicoTrack: public AliVTrack {
   Double32_t       fEtaEmc;   //[-1,1,12]  eta at emcal surface
   Double32_t       fPhiEmc;   //[0,6.3,12] phi at emcal surface
   Bool_t           fEmcal;    //           is true if track propagated to emcal
+  Short_t          fClusId;   //!          cluster id of matched cluster; -1 if not set
 
-  ClassDef(AliPicoTrack, 1) // Pico track class
+  ClassDef(AliPicoTrack, 2) // Pico track class
 };
 #endif