]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/AliPicoTrack.cxx
Add track propagation (Marta)
[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), fEtaEmc(0), fPhiEmc(0), fPtEmc(0), fEmcal(0), fClusId(-1)
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), fClusId(-1)
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),
36   fClusId(pc.fClusId)
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     fClusId = pc.fClusId;
60   }
61
62   return *this;
63 }
64
65 //_________________________________________________________________________________________________
66 Int_t AliPicoTrack::Compare(const TObject* obj) const
67 {
68   // Compare this class with an other instance of this class used in a 
69   // TCollection::Sort()/TClonesArray::Sort() which is descending.
70   // Returns 0 when equal, 1 when this is smaller and -1 when bigger.
71
72   const AliPicoTrack *t = dynamic_cast<const AliPicoTrack*>(obj);
73   if (!t) 
74     return -1;
75   if (t->Pt()>Pt())
76     return 1;
77   if (t->Pt()<Pt())
78     return -1;
79   return 0;
80 }
81
82 //_________________________________________________________________________________________________
83 void AliPicoTrack::GetEtaPhiDiff(AliVTrack *t, AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
84 {
85   // Calculate phi and eta difference between track and cluster.
86  
87   phidiff = 999;
88   etadiff = 999;
89
90   if (!t||!v)
91     return;
92
93   if (!t->IsEMCAL())
94     return;
95
96   Double_t veta = t->GetTrackEtaOnEMCal();
97   Double_t vphi = t->GetTrackPhiOnEMCal();
98
99   Float_t pos[3] = {0};
100   v->GetPosition(pos);  
101   TVector3 cpos(pos); 
102   Double_t ceta     = cpos.Eta();
103   Double_t cphi     = cpos.Phi();
104   etadiff=veta-ceta;
105   phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
106 }