AliPhysics  ff1d528 (ff1d528)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliPicoTrack.cxx
Go to the documentation of this file.
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 #include "AliAODTrack.h"
11 
12 //_________________________________________________________________________________________________
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), fFlag(0), fGeneratorIndex(-1), 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), fFlag(0), fGeneratorIndex(-1), fClusId(-1), fOrig(0)
27 {
28  // Constructor.
29 }
30 
31 //_________________________________________________________________________________________________
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), fFlag(pc.fFlag), fGeneratorIndex(pc.fGeneratorIndex),
37  fClusId(pc.fClusId), fOrig(pc.fOrig)
38 {
39  // Constructor.
40 }
41 
42 //_________________________________________________________________________________________________
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;
56  fEtaEmc = pc.fEtaEmc;
57  fPhiEmc = pc.fPhiEmc;
58  fPtEmc = pc.fPtEmc;
59  fEmcal = pc.fEmcal;
60  fFlag = pc.fFlag;
62  fClusId = pc.fClusId;
63  fOrig = pc.fOrig;
64  }
65 
66  return *this;
67 }
68 
69 //_________________________________________________________________________________________________
71 {
72  // Compare this class with an other instance of this class used in a
73  // TCollection::Sort()/TClonesArray::Sort() which is descending.
74  // Returns 0 when equal, 1 when this is smaller and -1 when bigger.
75 
76  const AliPicoTrack *t = dynamic_cast<const AliPicoTrack*>(obj);
77  if (!t)
78  return -1;
79  if (t->Pt()>Pt())
80  return 1;
81  if (t->Pt()<Pt())
82  return -1;
83  return 0;
84 }
85 
86 //_________________________________________________________________________________________________
87 void AliPicoTrack::GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
88 {
89  // Calculate phi and eta difference between track and cluster.
90 
91  phidiff = 999;
92  etadiff = 999;
93 
94  if (!t||!v)
95  return;
96 
97  if (!t->IsEMCAL())
98  return;
99 
100  Double_t veta = t->GetTrackEtaOnEMCal();
101  Double_t vphi = t->GetTrackPhiOnEMCal();
102 
103  Float_t pos[3] = {0};
104  v->GetPosition(pos);
105  TVector3 cpos(pos);
106  Double_t ceta = cpos.Eta();
107  Double_t cphi = cpos.Phi();
108  etadiff=veta-ceta;
109  phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
110 }
111 
112 //_________________________________________________________________________________________________
113 Byte_t AliPicoTrack::GetTrackType(const AliVTrack *t)
114 {
115  // Get track type encoded from bits 20 and 21.
116 
117  Byte_t ret = 0;
118  if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
119  ret = 1;
120  else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
121  ret = 2;
122  else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
123  ret = 3;
124  return ret;
125 }
126 
127 //________________________________________________________________________
128 Byte_t AliPicoTrack::GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2)
129 {
130  // Return track type: 0 = filterBit1, 1 = filterBit2 && ITS, 2 = filterBit2 && !ITS.
131  // Returns 3 if filterBit1 and filterBit2 do not test.
132  // WARNING: only works with AOD tracks and AOD filter bits must be provided. Otherwise will always return 0.
133 
134  Int_t res = 0;
135 
136  if (aodTrack->TestFilterBit(filterBit1)) {
137  res = 0;
138  }
139  else if (aodTrack->TestFilterBit(filterBit2)) {
140  if ((aodTrack->GetStatus()&AliVTrack::kITSrefit)!=0) {
141  res = 1;
142  }
143  else {
144  res = 2;
145  }
146  }
147  else {
148  res = 3;
149  }
150 
151  return res;
152 }
double Double_t
Definition: External.C:58
AliPicoTrack & operator=(const AliPicoTrack &pc)
AliVTrack * fOrig
cluster id of matched cluster; -1 if not set
Definition: AliPicoTrack.h:119
Double32_t fPt
Definition: AliPicoTrack.h:105
Double_t mass
Short_t fClusId
Index of generator in cocktail.
Definition: AliPicoTrack.h:118
Byte_t fTrackType
Definition: AliPicoTrack.h:111
Int_t Compare(const TObject *obj) const
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
Double32_t fM
Definition: AliPicoTrack.h:108
Byte_t GetTrackType() const
Definition: AliPicoTrack.h:43
Double_t Pt() const
Definition: AliPicoTrack.h:23
Double32_t fPhi
Definition: AliPicoTrack.h:107
Double32_t fPtEmc
Definition: AliPicoTrack.h:114
Double32_t fEtaEmc
Definition: AliPicoTrack.h:112
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
bool Bool_t
Definition: External.C:53
Short_t fGeneratorIndex
Flag for indication of primary etc (MC)
Definition: AliPicoTrack.h:117
Double32_t fPhiEmc
Definition: AliPicoTrack.h:113
Double32_t fEta
Definition: AliPicoTrack.h:106