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