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