]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/AliPicoTrack.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliPicoTrack.cxx
CommitLineData
dd233e4e 1//
2// Track class with minimal number of information
980821ba 3// (targets at selection of primary tracks).
dd233e4e 4//
cd231d42 5// Author: C.Loizides
dd233e4e 6
7#include "AliPicoTrack.h"
b723beb6 8#include "AliExternalTrackParam.h"
9#include "AliVCluster.h"
dd233e4e 10
11//_________________________________________________________________________________________________
12AliPicoTrack::AliPicoTrack() :
13 AliVTrack(),
fb4e4852 14 fPt(0), fEta(0), fPhi(0), fM(0.13957), fQ(0), fLabel(-1), fTrackType(0),
eb556d0c 15 fEtaEmc(0), fPhiEmc(0), fPtEmc(0), fEmcal(0), fFlag(0), fGeneratorIndex(-1), fClusId(-1), fOrig(0)
dd233e4e 16{
17 // Default constructor.
18}
19
20//_________________________________________________________________________________________________
39799f2a 21AliPicoTrack::AliPicoTrack(Double_t pt, Double_t eta, Double_t phi, Byte_t q, Int_t lab, Byte_t type,
de1c0913 22 Double_t etaemc, Double_t phiemc, Double_t ptemc, Bool_t ise, Double_t mass) :
dd233e4e 23 AliVTrack(),
de1c0913 24 fPt(pt), fEta(eta), fPhi(phi), fM(mass), fQ(q), fLabel(lab), fTrackType(type),
eb556d0c 25 fEtaEmc(etaemc), fPhiEmc(phiemc), fPtEmc(ptemc), fEmcal(ise), fFlag(0), fGeneratorIndex(-1), fClusId(-1), fOrig(0)
dd233e4e 26{
27 // Constructor.
28}
29
30//_________________________________________________________________________________________________
31AliPicoTrack::AliPicoTrack(const AliPicoTrack &pc) :
32 AliVTrack(pc),
de1c0913 33 fPt(pc.fPt), fEta(pc.fEta), fPhi(pc.fPhi), fM(pc.fM),
39799f2a 34 fQ(pc.fQ), fLabel(pc.fLabel), fTrackType(pc.fTrackType),
eb556d0c 35 fEtaEmc(pc.fEtaEmc), fPhiEmc(pc.fPhiEmc), fPtEmc(pc.fPtEmc), fEmcal(pc.fEmcal), fFlag(pc.fFlag), fGeneratorIndex(pc.fGeneratorIndex),
fb4e4852 36 fClusId(pc.fClusId), fOrig(pc.fOrig)
dd233e4e 37{
38 // Constructor.
39}
40
41//_________________________________________________________________________________________________
42AliPicoTrack &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;
de1c0913 51 fM = pc.fM;
dd233e4e 52 fQ = pc.fQ;
53 fLabel = pc.fLabel;
39799f2a 54 fTrackType = pc.fTrackType;
dd233e4e 55 fEtaEmc = pc.fEtaEmc;
56 fPhiEmc = pc.fPhiEmc;
56bd3193 57 fPtEmc = pc.fPtEmc;
dd233e4e 58 fEmcal = pc.fEmcal;
eb556d0c 59 fFlag = pc.fFlag;
60 fGeneratorIndex = pc.fGeneratorIndex;
b723beb6 61 fClusId = pc.fClusId;
fb4e4852 62 fOrig = pc.fOrig;
dd233e4e 63 }
64
65 return *this;
66}
67
68//_________________________________________________________________________________________________
69Int_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
b723beb6 85//_________________________________________________________________________________________________
59807387 86void AliPicoTrack::GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
b723beb6 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;
dd233e4e 98
4d925f52 99 Double_t veta = t->GetTrackEtaOnEMCal();
100 Double_t vphi = t->GetTrackPhiOnEMCal();
b723beb6 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}
59807387 110
111//_________________________________________________________________________________________________
112Byte_t AliPicoTrack::GetTrackType(const AliVTrack *t)
113{
114 // Get track type encoded from bits 20 and 21.
115
116 Byte_t ret = 0;
32c97abe 117 if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
59807387 118 ret = 1;
32c97abe 119 else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
59807387 120 ret = 2;
32c97abe 121 else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
59807387 122 ret = 3;
123 return ret;
124}