]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUTrackHyp.cxx
Fix to previous commit
[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{
72 // Get best candidate
73 return fLayerSeeds[0].GetEntriesFast()>0 ? GetSeed(0,0) : 0;
74}
75
76//__________________________________________________________________
77void AliITSUTrackHyp::DefineWinner(int lr, int id)
78{
79 // assign best candidate
80 AliITSUSeed* winner = GetSeed(lr,id);
81 this->AliExternalTrackParam::operator=(*winner);
82 SetChi2(winner->GetChi2GloNrm());
83 SetNumberOfClusters(winner->GetNLayersHit());
84}
85
3e4e3c23 86//__________________________________________________________________
8b16dbae 87Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
3e4e3c23 88{
8b16dbae 89 // calculate chi2 to cluster
90 Double_t p[2]={cl->GetY(), cl->GetZ()};
91 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
92 return AliExternalTrackParam::GetPredictedChi2(p,cov);
3e4e3c23 93}
94
95//__________________________________________________________________
96Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
97{
98 // NA
99 AliFatal("Not to be used");
100 return 0;
101}
102
103//__________________________________________________________________
104Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
105{
106 // NA
107 AliFatal("Not to be used");
108 return kFALSE;
109}
8b16dbae 110
111//__________________________________________________________________
112Bool_t AliITSUTrackHyp::Update(const AliCluster* cl)
113{
114 // update with cluster
115 Double_t p[2]={cl->GetY(), cl->GetZ()};
116 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
117 double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
118 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
119 SetChi2(GetChi2()+chi2);
120 return kTRUE;
121}
122
123//__________________________________________________________________
68a0f687 124Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
8b16dbae 125{
126 // fill cl.id's in the array. The clusters of layer L will be set at slots
127 // clID[2L] (and clID[2L+1] if there is an extra cluster).
128 for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
129 AliITSUSeed* seed = GetWinner();
68a0f687 130 Int_t lr,ncl=0;
8b16dbae 131 while(seed) {
132 int clID = seed->GetLrCluster(lr);
133 if (clID>=0) {
134 int slotLr = lr<<1;
135 clIDarr[ clIDarr[slotLr]<0 ? slotLr : slotLr+1 ] = clID;
68a0f687 136 ncl++;
8b16dbae 137 }
138 seed = (AliITSUSeed*)seed->GetParent();
139 }
68a0f687 140 return ncl;
8b16dbae 141}