1 #include "AliITSUTrackHyp.h"
2 #include "AliESDtrack.h"
3 #include "AliCluster.h"
4 #include "AliITSUAux.h"
6 ClassImp(AliITSUTrackHyp)
10 //__________________________________________________________________
11 AliITSUTrackHyp::AliITSUTrackHyp(Int_t nlr)
18 if (fNLayers>0) fLayerSeeds = new TObjArray[fNLayers];
21 //__________________________________________________________________
22 AliITSUTrackHyp::~AliITSUTrackHyp()
28 //__________________________________________________________________
29 AliITSUTrackHyp::AliITSUTrackHyp(const AliITSUTrackHyp &src)
31 , fNLayers(src.fNLayers)
32 , fITSLabel(src.fITSLabel)
33 , fESDTrack(src.fESDTrack)
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;
51 //__________________________________________________________________
52 AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
55 if (this == &src) return *this;
56 this->~AliITSUTrackHyp();
57 new(this) AliITSUTrackHyp(src);
62 //__________________________________________________________________
63 void AliITSUTrackHyp::Print(Option_t* ) const
65 printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
66 for (int i=0;i<fNLayers;i++) printf(" (%d) %3d",i,GetNSeeds(i)); printf("\n");
69 //__________________________________________________________________
70 AliITSUSeed* AliITSUTrackHyp::GetWinner() const
72 // Get best candidate. TODO
73 return fLayerSeeds[0].GetEntriesFast()>0 ? GetSeed(0,0) : 0;
76 //__________________________________________________________________
77 AliITSUSeed* AliITSUTrackHyp::DefineWinner(int lr, int id)
79 // assign best candidate
80 if (GetNSeeds(lr)<=id) return 0;
81 AliITSUSeed* winner = GetSeed(lr,id);
82 this->AliExternalTrackParam::operator=(*winner);
83 SetChi2(winner->GetChi2GloNrm());
84 SetNumberOfClusters(winner->GetNLayersHit());
88 //__________________________________________________________________
89 Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
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);
97 //__________________________________________________________________
98 Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
101 AliFatal("Not to be used");
105 //__________________________________________________________________
106 Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
109 AliFatal("Not to be used");
113 //__________________________________________________________________
114 Bool_t AliITSUTrackHyp::Update(const AliCluster* cl)
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);
125 //__________________________________________________________________
126 Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
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;
132 AliITSUSeed* seed = GetWinner();
134 AliFatal("The winner is not set");
138 int clID = seed->GetLrCluster(lr);
141 clIDarr[ clIDarr[slotLr]<0 ? slotLr : slotLr+1 ] = clID;
144 seed = (AliITSUSeed*)seed->GetParent();
149 //__________________________________________________________________
150 Int_t AliITSUTrackHyp::GetNumberOfClusters() const
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();
157 AliFatal("The winner is not set");
160 return seed->GetNClusters();
164 //__________________________________________________________________
165 Int_t AliITSUTrackHyp::GetClusterIndex(Int_t ind) const
167 // This is a temporary (slow) way of accessing cluster index
168 // TODO: add dedicated data members filled by winner
169 AliITSUSeed* seed = GetWinner();
172 AliFatal("The winner is not set");
175 return seed->GetClusterIndex(ind);