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)
19 if (fNLayers>0) fLayerSeeds = new TObjArray[fNLayers];
22 //__________________________________________________________________
23 AliITSUTrackHyp::~AliITSUTrackHyp()
29 //__________________________________________________________________
30 AliITSUTrackHyp::AliITSUTrackHyp(const AliITSUTrackHyp &src)
32 , fNLayers(src.fNLayers)
33 , fITSLabel(src.fITSLabel)
34 , fESDTrack(src.fESDTrack)
38 // copy c-tor. Note: it is shallow
40 fLayerSeeds = new TObjArray[fNLayers];
41 for (int ilr=fNLayers;ilr--;) {
42 int ns = src.GetNSeeds(ilr);
43 for (int isd=0;isd<ns;isd++) {
44 AliITSUSeed* sd = src.GetSeed(ilr,isd);
45 if (sd->IsKilled()) continue;
49 fWinner = src.fWinner;
54 //__________________________________________________________________
55 AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
58 if (this == &src) return *this;
59 this->~AliITSUTrackHyp();
60 new(this) AliITSUTrackHyp(src);
65 //__________________________________________________________________
66 void AliITSUTrackHyp::Print(Option_t* ) const
68 printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
69 for (int i=0;i<fNLayers;i++) printf(" (%d) %3d",i,GetNSeeds(i)); printf("\n");
72 //__________________________________________________________________
73 AliITSUSeed* AliITSUTrackHyp::GetWinner() const
75 // Get best candidate. TODO
79 //__________________________________________________________________
80 AliITSUSeed* AliITSUTrackHyp::DefineWinner(int lr, int id)
82 // assign best candidate
83 if (GetNSeeds(lr)<=id) return 0;
84 fWinner = GetSeed(lr,id);
85 this->AliExternalTrackParam::operator=(*fWinner);
86 SetChi2(fWinner->GetChi2GloNrm());
87 SetNumberOfClusters(fWinner->GetNLayersHit());
91 //__________________________________________________________________
92 Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
94 // calculate chi2 to cluster
95 Double_t p[2]={cl->GetY(), cl->GetZ()};
96 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
97 return AliExternalTrackParam::GetPredictedChi2(p,cov);
100 //__________________________________________________________________
101 Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
104 AliFatal("Not to be used");
108 //__________________________________________________________________
109 Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
112 AliFatal("Not to be used");
116 //__________________________________________________________________
117 Double_t AliITSUTrackHyp::Update(const AliCluster* cl)
119 // update with cluster
120 Double_t p[2]={cl->GetY(), cl->GetZ()};
121 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
122 double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
123 if (!AliExternalTrackParam::Update(p,cov)) return -1;
124 SetChi2(GetChi2()+chi2);
128 //__________________________________________________________________
129 Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
131 // fill cl.id's in the array. The clusters of layer L will be set at slots
132 // clID[2L] (and clID[2L+1] if there is an extra cluster).
133 for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
135 AliITSUSeed* seed = GetWinner();
137 AliFatal("The winner is not set");
141 int clID = seed->GetLrCluster(lr);
144 clIDarr[ clIDarr[slotLr]<0 ? slotLr : slotLr+1 ] = clID;
147 seed = (AliITSUSeed*)seed->GetParent();
152 //__________________________________________________________________
153 Int_t AliITSUTrackHyp::GetNumberOfClusters() const
155 // This is a temporary (slow) way of accessing number of clusters
156 // TODO: add dedicated data members filled by winner
157 AliITSUSeed* seed = GetWinner();
160 AliFatal("The winner is not set");
163 return seed->GetNClusters();
167 //__________________________________________________________________
168 Int_t AliITSUTrackHyp::GetClusterIndex(Int_t ind) const
170 // This is a temporary (slow) way of accessing cluster index
171 // TODO: add dedicated data members filled by winner
172 AliITSUSeed* seed = GetWinner();
175 AliFatal("The winner is not set");
178 return seed->GetClusterIndex(ind);