]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUTrackHyp.cxx
mods. in track update
[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)
3e4e3c23 32 , fESDTrack(src.fESDTrack)
716ccba7 33 , fLayerSeeds(0)
34{
35 // copy c-tor
36 if (fNLayers>0) {
37 fLayerSeeds = new TObjArray[fNLayers];
38 for (int ilr=fNLayers;ilr--;) {
39 int ns = src.GetNSeeds(ilr);
40 for (int isd=0;isd<ns;isd++) {
41 AliITSUSeed* sd = src.GetSeed(ilr,isd);
42 if (sd->IsKilled()) continue;
43 AddSeed(sd,ilr);
44 }
45 }
46 }
47 //
48}
49
50//__________________________________________________________________
51AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
52{
53 // copy
54 if (this == &src) return *this;
55 this->~AliITSUTrackHyp();
56 new(this) AliITSUTrackHyp(src);
57 return *this;
58 //
59}
60
61//__________________________________________________________________
62void AliITSUTrackHyp::Print(Option_t* ) const
63{
64 printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
65 for (int i=0;i<fNLayers;i++) printf(" (%d) %3d",i,GetNSeeds(i)); printf("\n");
66}
3e4e3c23 67
68//__________________________________________________________________
69AliITSUSeed* AliITSUTrackHyp::GetWinner() const
70{
71 // Get best candidate
72 return fLayerSeeds[0].GetEntriesFast()>0 ? GetSeed(0,0) : 0;
73}
74
75//__________________________________________________________________
76void AliITSUTrackHyp::DefineWinner(int lr, int id)
77{
78 // assign best candidate
79 AliITSUSeed* winner = GetSeed(lr,id);
80 this->AliExternalTrackParam::operator=(*winner);
81 SetChi2(winner->GetChi2GloNrm());
82 SetNumberOfClusters(winner->GetNLayersHit());
83}
84
3e4e3c23 85//__________________________________________________________________
8b16dbae 86Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
3e4e3c23 87{
8b16dbae 88 // calculate chi2 to cluster
89 Double_t p[2]={cl->GetY(), cl->GetZ()};
90 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
91 return AliExternalTrackParam::GetPredictedChi2(p,cov);
3e4e3c23 92}
93
94//__________________________________________________________________
95Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
96{
97 // NA
98 AliFatal("Not to be used");
99 return 0;
100}
101
102//__________________________________________________________________
103Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
104{
105 // NA
106 AliFatal("Not to be used");
107 return kFALSE;
108}
8b16dbae 109
110//__________________________________________________________________
111Bool_t AliITSUTrackHyp::Update(const AliCluster* cl)
112{
113 // update with cluster
114 Double_t p[2]={cl->GetY(), cl->GetZ()};
115 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
116 double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
117 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
118 SetChi2(GetChi2()+chi2);
119 return kTRUE;
120}
121
122//__________________________________________________________________
68a0f687 123Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
8b16dbae 124{
125 // fill cl.id's in the array. The clusters of layer L will be set at slots
126 // clID[2L] (and clID[2L+1] if there is an extra cluster).
127 for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
128 AliITSUSeed* seed = GetWinner();
68a0f687 129 Int_t lr,ncl=0;
8b16dbae 130 while(seed) {
131 int clID = seed->GetLrCluster(lr);
132 if (clID>=0) {
133 int slotLr = lr<<1;
134 clIDarr[ clIDarr[slotLr]<0 ? slotLr : slotLr+1 ] = clID;
68a0f687 135 ncl++;
8b16dbae 136 }
137 seed = (AliITSUSeed*)seed->GetParent();
138 }
68a0f687 139 return ncl;
8b16dbae 140}