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