]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/AliPicoTrack.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliPicoTrack.cxx
1 // $Id$
2 //
3 // Track class with minimal number of information 
4 // (targets at selection of primary tracks).
5 //
6 // Author: C.Loizides
7
8 #include "AliPicoTrack.h"
9 #include "AliExternalTrackParam.h"
10 #include "AliVCluster.h"
11
12 //_________________________________________________________________________________________________
13 AliPicoTrack::AliPicoTrack() :
14   AliVTrack(),
15   fPt(0), fEta(0), fPhi(0), fM(0.13957), fQ(0), fLabel(-1), fTrackType(0), 
16   fEtaEmc(0), fPhiEmc(0), fPtEmc(0), fEmcal(0), fClusId(-1), fOrig(0)
17 {
18   // Default constructor.
19 }
20
21 //_________________________________________________________________________________________________
22 AliPicoTrack::AliPicoTrack(Double_t pt, Double_t eta, Double_t phi, Byte_t q, Int_t lab, Byte_t type,
23                            Double_t etaemc, Double_t phiemc, Double_t ptemc, Bool_t ise, Double_t mass) :
24   AliVTrack(),
25   fPt(pt), fEta(eta), fPhi(phi), fM(mass), fQ(q), fLabel(lab), fTrackType(type), 
26   fEtaEmc(etaemc), fPhiEmc(phiemc), fPtEmc(ptemc), fEmcal(ise), fClusId(-1), fOrig(0)
27 {
28   // Constructor.
29 }
30   
31 //_________________________________________________________________________________________________
32 AliPicoTrack::AliPicoTrack(const AliPicoTrack &pc) :
33   AliVTrack(pc),
34   fPt(pc.fPt), fEta(pc.fEta), fPhi(pc.fPhi), fM(pc.fM),
35   fQ(pc.fQ), fLabel(pc.fLabel), fTrackType(pc.fTrackType),  
36   fEtaEmc(pc.fEtaEmc), fPhiEmc(pc.fPhiEmc), fPtEmc(pc.fPtEmc), fEmcal(pc.fEmcal),
37   fClusId(pc.fClusId), fOrig(pc.fOrig)
38 {
39   // Constructor.
40 }
41
42 //_________________________________________________________________________________________________
43 AliPicoTrack &AliPicoTrack::operator=(const AliPicoTrack &pc)
44 {
45   // Assignment operator.
46
47   if (this!=&pc) {
48     AliVTrack::operator=(pc);
49     fPt     = pc.fPt;
50     fEta    = pc.fEta;
51     fPhi    = pc.fPhi;
52     fM      = pc.fM;
53     fQ      = pc.fQ;
54     fLabel  = pc.fLabel;
55     fTrackType = pc.fTrackType;
56     fEtaEmc = pc.fEtaEmc;
57     fPhiEmc = pc.fPhiEmc;
58     fPtEmc  = pc.fPtEmc;
59     fEmcal  = pc.fEmcal;
60     fClusId = pc.fClusId;
61     fOrig = pc.fOrig;
62   }
63
64   return *this;
65 }
66
67 //_________________________________________________________________________________________________
68 Int_t AliPicoTrack::Compare(const TObject* obj) const
69 {
70   // Compare this class with an other instance of this class used in a 
71   // TCollection::Sort()/TClonesArray::Sort() which is descending.
72   // Returns 0 when equal, 1 when this is smaller and -1 when bigger.
73
74   const AliPicoTrack *t = dynamic_cast<const AliPicoTrack*>(obj);
75   if (!t) 
76     return -1;
77   if (t->Pt()>Pt())
78     return 1;
79   if (t->Pt()<Pt())
80     return -1;
81   return 0;
82 }
83
84 //_________________________________________________________________________________________________
85 void AliPicoTrack::GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
86 {
87   // Calculate phi and eta difference between track and cluster.
88  
89   phidiff = 999;
90   etadiff = 999;
91
92   if (!t||!v)
93     return;
94
95   if (!t->IsEMCAL())
96     return;
97
98   Double_t veta = t->GetTrackEtaOnEMCal();
99   Double_t vphi = t->GetTrackPhiOnEMCal();
100
101   Float_t pos[3] = {0};
102   v->GetPosition(pos);  
103   TVector3 cpos(pos); 
104   Double_t ceta     = cpos.Eta();
105   Double_t cphi     = cpos.Phi();
106   etadiff=veta-ceta;
107   phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
108 }
109
110 //_________________________________________________________________________________________________
111 Byte_t AliPicoTrack::GetTrackType(const AliVTrack *t)
112 {
113   // Get track type encoded from bits 20 and 21.
114
115   Byte_t ret = 0;
116   if (t->TestBit(BIT(20)) && !t->TestBit(BIT(21)))
117     ret = 1;
118   else if (!t->TestBit(BIT(20)) && t->TestBit(BIT(21)))
119     ret = 2;
120   else if (t->TestBit(BIT(20)) && t->TestBit(BIT(21)))
121     ret = 3;
122   return ret;
123 }