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