1 #include "AliITSUTrackHyp.h"
2 #include "AliESDtrack.h"
3 #include "AliCluster.h"
4 #include "AliITSUAux.h"
7 ClassImp(AliITSUTrackHyp)
11 //__________________________________________________________________
12 AliITSUTrackHyp::AliITSUTrackHyp(Int_t nlr)
21 if (fNLayers>0) fLayerSeeds = new TObjArray[fNLayers];
24 //__________________________________________________________________
25 AliITSUTrackHyp::~AliITSUTrackHyp()
32 //__________________________________________________________________
33 AliITSUTrackHyp::AliITSUTrackHyp(const AliITSUTrackHyp &src)
35 , fNLayers(src.fNLayers)
36 , fITSLabel(src.fITSLabel)
37 , fESDTrack(src.fESDTrack)
39 , fTPCSeed(src.fTPCSeed)
42 // copy c-tor. Note: it is shallow
44 fLayerSeeds = new TObjArray[fNLayers];
45 for (int ilr=fNLayers;ilr--;) {
46 int ns = src.GetNSeeds(ilr);
47 for (int isd=0;isd<ns;isd++) {
48 AliITSUSeed* sd = src.GetSeed(ilr,isd);
49 if (sd->IsKilled()) continue;
53 fWinner = src.fWinner;
57 //__________________________________________________________________
58 void AliITSUTrackHyp::InitFrom(const AliITSUTrackHyp *src)
60 // copy initial params
61 fNLayers = src->fNLayers;
62 fITSLabel = src->fITSLabel;
63 fESDTrack = src->fESDTrack;
64 fWinner = src->fWinner;
65 fTPCSeed = src->fTPCSeed;
69 //__________________________________________________________________
70 AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
73 if (this == &src) return *this;
74 this->~AliITSUTrackHyp();
75 new(this) AliITSUTrackHyp(src);
80 //__________________________________________________________________
81 void AliITSUTrackHyp::Print(Option_t* opt) const
83 printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
86 Bool_t prSeeds = opts.Contains("l");
87 for (int i=0;i<fNLayers;i++) {
88 printf("Lr (%d) %3d ",i,GetNSeeds(i));
91 for (int isd=0;isd<GetNSeeds(i);isd++) ((AliITSUSeed*)GetSeed(i,isd))->Print(opt);
94 if (!prSeeds) printf("\n");
97 //__________________________________________________________________
98 AliITSUSeed* AliITSUTrackHyp::GetWinner() const
100 // Get best candidate. TODO
104 //__________________________________________________________________
105 AliITSUSeed* AliITSUTrackHyp::DefineWinner(int lr, int id)
107 // assign best candidate
108 if (GetNSeeds(lr)<=id) return 0;
109 fWinner = GetSeed(lr,id);
110 this->AliExternalTrackParam::operator=(*fWinner);
111 SetChi2(fWinner->GetChi2GloNrm());
112 SetNumberOfClusters(fWinner->GetNLayersHit());
116 //__________________________________________________________________
117 Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
119 // calculate chi2 to cluster
120 Double_t p[2]={cl->GetY(), cl->GetZ()};
121 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
122 return AliExternalTrackParam::GetPredictedChi2(p,cov);
125 //__________________________________________________________________
126 Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
129 AliFatal("Not to be used");
133 //__________________________________________________________________
134 Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
137 AliFatal("Not to be used");
141 //__________________________________________________________________
142 Double_t AliITSUTrackHyp::Update(const AliCluster* cl)
144 // update with cluster
145 Double_t p[2]={cl->GetY(), cl->GetZ()};
146 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
147 double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
148 if (!AliExternalTrackParam::Update(p,cov)) return -1;
149 SetChi2(GetChi2()+chi2);
153 //__________________________________________________________________
154 Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
156 // fill cl.id's in the array. The clusters of layer L will be set at slots
157 // clID[2L] (and clID[2L+1] if there is an extra cluster).
158 for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
159 return GetWinner() ? GetWinner()->FetchClusterInfo(clIDarr) : 0;
162 //__________________________________________________________________
163 Int_t AliITSUTrackHyp::GetNumberOfClusters() const
165 // This is a temporary (slow) way of accessing number of clusters
166 // TODO: add dedicated data members filled by winner
167 AliITSUSeed* seed = GetWinner();
170 AliFatal("The winner is not set");
173 return seed->GetNClusters();
177 //__________________________________________________________________
178 Int_t AliITSUTrackHyp::GetClusterIndex(Int_t ind) const
180 // This is a temporary (slow) way of accessing cluster index
181 // TODO: add dedicated data members filled by winner
182 AliITSUSeed* seed = GetWinner();
185 AliFatal("The winner is not set");
188 return seed->GetClusterIndex(ind);