]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUTrackHyp.cxx
from redmer
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUTrackHyp.cxx
CommitLineData
716ccba7 1#include "AliITSUTrackHyp.h"
3e4e3c23 2#include "AliESDtrack.h"
3#include "AliCluster.h"
dd2117a2 4#include "AliITSUAux.h"
716ccba7 5
6ClassImp(AliITSUTrackHyp)
7
8
9
10//__________________________________________________________________
11AliITSUTrackHyp::AliITSUTrackHyp(Int_t nlr)
12: fNLayers(nlr)
dd2117a2 13 ,fITSLabel(0)
3e4e3c23 14 ,fESDTrack(0)
716ccba7 15 ,fLayerSeeds(0)
16{
17 // def. c-tor
18 if (fNLayers>0) fLayerSeeds = new TObjArray[fNLayers];
19}
20
21//__________________________________________________________________
22AliITSUTrackHyp::~AliITSUTrackHyp()
23{
24 // d-tor
25 delete[] fLayerSeeds;
26}
27
28//__________________________________________________________________
29AliITSUTrackHyp::AliITSUTrackHyp(const AliITSUTrackHyp &src)
3e4e3c23 30 : AliKalmanTrack(src)
716ccba7 31 , fNLayers(src.fNLayers)
a616242b 32 , fITSLabel(src.fITSLabel)
3e4e3c23 33 , fESDTrack(src.fESDTrack)
716ccba7 34 , fLayerSeeds(0)
35{
36 // copy c-tor
37 if (fNLayers>0) {
38 fLayerSeeds = new TObjArray[fNLayers];
39 for (int ilr=fNLayers;ilr--;) {
40 int ns = src.GetNSeeds(ilr);
41 for (int isd=0;isd<ns;isd++) {
42 AliITSUSeed* sd = src.GetSeed(ilr,isd);
43 if (sd->IsKilled()) continue;
44 AddSeed(sd,ilr);
45 }
46 }
47 }
48 //
49}
50
51//__________________________________________________________________
52AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
53{
54 // copy
55 if (this == &src) return *this;
56 this->~AliITSUTrackHyp();
57 new(this) AliITSUTrackHyp(src);
58 return *this;
59 //
60}
61
62//__________________________________________________________________
63void AliITSUTrackHyp::Print(Option_t* ) const
64{
65 printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
66 for (int i=0;i<fNLayers;i++) printf(" (%d) %3d",i,GetNSeeds(i)); printf("\n");
67}
3e4e3c23 68
69//__________________________________________________________________
70AliITSUSeed* AliITSUTrackHyp::GetWinner() const
71{
69e0f089 72 // Get best candidate. TODO
3e4e3c23 73 return fLayerSeeds[0].GetEntriesFast()>0 ? GetSeed(0,0) : 0;
74}
75
76//__________________________________________________________________
69e0f089 77AliITSUSeed* AliITSUTrackHyp::DefineWinner(int lr, int id)
3e4e3c23 78{
79 // assign best candidate
69e0f089 80 if (GetNSeeds(lr)<=id) return 0;
3e4e3c23 81 AliITSUSeed* winner = GetSeed(lr,id);
82 this->AliExternalTrackParam::operator=(*winner);
83 SetChi2(winner->GetChi2GloNrm());
84 SetNumberOfClusters(winner->GetNLayersHit());
69e0f089 85 return winner;
3e4e3c23 86}
87
3e4e3c23 88//__________________________________________________________________
8b16dbae 89Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
3e4e3c23 90{
8b16dbae 91 // calculate chi2 to cluster
92 Double_t p[2]={cl->GetY(), cl->GetZ()};
93 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
94 return AliExternalTrackParam::GetPredictedChi2(p,cov);
3e4e3c23 95}
96
97//__________________________________________________________________
98Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
99{
100 // NA
101 AliFatal("Not to be used");
102 return 0;
103}
104
105//__________________________________________________________________
106Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
107{
108 // NA
109 AliFatal("Not to be used");
110 return kFALSE;
111}
8b16dbae 112
113//__________________________________________________________________
114Bool_t AliITSUTrackHyp::Update(const AliCluster* cl)
115{
116 // update with cluster
117 Double_t p[2]={cl->GetY(), cl->GetZ()};
118 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
119 double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
120 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
121 SetChi2(GetChi2()+chi2);
122 return kTRUE;
123}
124
125//__________________________________________________________________
68a0f687 126Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
8b16dbae 127{
128 // fill cl.id's in the array. The clusters of layer L will be set at slots
129 // clID[2L] (and clID[2L+1] if there is an extra cluster).
130 for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
68a0f687 131 Int_t lr,ncl=0;
e7d83d38 132 AliITSUSeed* seed = GetWinner();
133 if (!seed) {
134 AliFatal("The winner is not set");
135 return ncl;
136 }
8b16dbae 137 while(seed) {
138 int clID = seed->GetLrCluster(lr);
139 if (clID>=0) {
140 int slotLr = lr<<1;
141 clIDarr[ clIDarr[slotLr]<0 ? slotLr : slotLr+1 ] = clID;
68a0f687 142 ncl++;
8b16dbae 143 }
144 seed = (AliITSUSeed*)seed->GetParent();
145 }
68a0f687 146 return ncl;
8b16dbae 147}
e7d83d38 148
149//__________________________________________________________________
150Int_t AliITSUTrackHyp::GetNumberOfClusters() const
151{
152 // This is a temporary (slow) way of accessing number of clusters
153 // TODO: add dedicated data members filled by winner
154 AliITSUSeed* seed = GetWinner();
155 int ncl = 0;
156 if (!seed) {
157 AliFatal("The winner is not set");
158 return ncl;
159 }
160 return seed->GetNClusters();
161 //
162}
163
164//__________________________________________________________________
165Int_t AliITSUTrackHyp::GetClusterIndex(Int_t ind) const
166{
167 // This is a temporary (slow) way of accessing cluster index
168 // TODO: add dedicated data members filled by winner
169 AliITSUSeed* seed = GetWinner();
80557052 170 // int ncl = 0;
e7d83d38 171 if (!seed) {
172 AliFatal("The winner is not set");
173 return -1;
174 }
175 return seed->GetClusterIndex(ind);
176 //
177}