]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALTasks/AliPicoTrack.cxx
changes in AddAnalysisTaskPIDFluctuation.C for only one output file in analysis train...
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliPicoTrack.cxx
1 // $Id$
2 //
3 // Track class with minimal number of information 
4 // (targets at selection of primary tracks)
5 //
6
7 #include "AliPicoTrack.h"
8 #include "AliExternalTrackParam.h"
9 #include "AliVCluster.h"
10
11 //_________________________________________________________________________________________________
12 AliPicoTrack::AliPicoTrack() :
13   AliVTrack(),
14   fPt(0), fEta(0), fPhi(0), fQ(0), fLabel(-1), fEtaEmc(0), fPhiEmc(0), fEmcal(0), fClusId(-1)
15 {
16   // Default constructor.
17 }
18
19 //_________________________________________________________________________________________________
20 AliPicoTrack::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), 
24   fEtaEmc(etaemc), fPhiEmc(phiemc), fEmcal(ise), fClusId(-1)
25 {
26   // Constructor.
27 }
28   
29 //_________________________________________________________________________________________________
30 AliPicoTrack::AliPicoTrack(const AliPicoTrack &pc) :
31   AliVTrack(pc),
32   fPt(pc.fPt), fEta(pc.fEta), fPhi(pc.fPhi), 
33   fQ(pc.fQ), fLabel(pc.fLabel), 
34   fEtaEmc(pc.fEtaEmc), fPhiEmc(pc.fPhiEmc), fEmcal(pc.fEmcal),
35   fClusId(pc.fClusId)
36 {
37   // Constructor.
38 }
39
40 //_________________________________________________________________________________________________
41 AliPicoTrack &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;
55     fClusId = pc.fClusId;
56   }
57
58   return *this;
59 }
60
61 //_________________________________________________________________________________________________
62 Int_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
78 //_________________________________________________________________________________________________
79 void 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;
91
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
110   if (0) {
111     if (TMath::Abs(veta)>0.75 || (vphi<70*TMath::DegToRad()) || (vphi>190*TMath::DegToRad()))
112       return;
113   }
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 }