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;
58 //__________________________________________________________________
59 AliITSUTrackHyp::AliITSUTrackHyp(const AliKalmanTrack &src)
68 // copy c-tor. from KalmanTrack
72 //__________________________________________________________________
73 AliITSUTrackHyp::AliITSUTrackHyp(const AliESDtrack &src)
82 // copy c-tor. from ESD track: take only kinematics, mass and time integral
83 AliExternalTrackParam::operator=((const AliExternalTrackParam&)src);
84 SetMass(src.GetMass());
85 if (src.IsOn(AliESDtrack::kTIME)) {
87 SetIntegratedLength(src.GetIntegratedLength());
88 double times[AliPID::kSPECIES];
89 src.GetIntegratedTimes(times);
90 SetIntegratedTimes(times);
95 //__________________________________________________________________
96 void AliITSUTrackHyp::InitFrom(const AliITSUTrackHyp *src)
98 // copy initial params
99 fNLayers = src->fNLayers;
100 fITSLabel = src->fITSLabel;
101 fESDTrack = src->fESDTrack;
102 fWinner = src->fWinner;
103 fTPCSeed = src->fTPCSeed;
107 //__________________________________________________________________
108 AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
111 if (this == &src) return *this;
112 this->~AliITSUTrackHyp();
113 new(this) AliITSUTrackHyp(src);
118 //__________________________________________________________________
119 AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliKalmanTrack &src)
121 // copy kinematics only
122 if (this == &src) return *this;
123 AliKalmanTrack::operator=(src);
128 //__________________________________________________________________
129 AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliESDtrack &src)
131 // copy oparator from ESD track: take only kinematics, mass and time integral
132 AliExternalTrackParam::operator=((const AliExternalTrackParam&)src);
133 SetMass(src.GetMass());
134 if (src.IsOn(AliESDtrack::kTIME)) {
136 SetIntegratedLength(src.GetIntegratedLength());
137 double times[AliPID::kSPECIES];
138 src.GetIntegratedTimes(times);
139 SetIntegratedTimes(times);
146 //__________________________________________________________________
147 void AliITSUTrackHyp::Print(Option_t* opt) const
149 printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
152 Bool_t prSeeds = opts.Contains("l");
153 for (int i=0;i<fNLayers;i++) {
154 printf("Lr (%d) %3d ",i,GetNSeeds(i));
157 for (int isd=0;isd<GetNSeeds(i);isd++) ((AliITSUSeed*)GetSeed(i,isd))->Print(opt);
160 if (!prSeeds) printf("\n");
163 //__________________________________________________________________
164 AliITSUSeed* AliITSUTrackHyp::GetWinner() const
166 // Get best candidate. TODO
170 //__________________________________________________________________
171 AliITSUSeed* AliITSUTrackHyp::DefineWinner(int lr, int id)
173 // assign best candidate
174 int nsd = GetNSeeds(lr);
175 while ( id<nsd && ( !(fWinner=GetSeed(lr,id)) || fWinner->IsKilled() ) ) {id++; fWinner=0;}
177 // AliInfo(Form("No winner candidates out of %d for %d",nsd,GetUniqueID()));
180 UInt_t idESD = GetUniqueID(); // retain ESDtrackID
181 this->AliExternalTrackParam::operator=(*fWinner);
183 SetChi2(fWinner->GetChi2GloNrm());
184 SetNumberOfClusters(fWinner->GetNLayersHit());
188 //__________________________________________________________________
189 Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
191 // calculate chi2 to cluster
192 Double_t p[2]={cl->GetY(), cl->GetZ()};
193 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
194 return AliExternalTrackParam::GetPredictedChi2(p,cov);
197 //__________________________________________________________________
198 Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
201 AliFatal("Not to be used");
205 //__________________________________________________________________
206 Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
209 AliFatal("Not to be used");
213 //__________________________________________________________________
214 Double_t AliITSUTrackHyp::Update(const AliCluster* cl)
216 // update with cluster
217 Double_t p[2]={cl->GetY(), cl->GetZ()};
218 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
219 double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
220 if (!AliExternalTrackParam::Update(p,cov)) return -1;
221 SetChi2(GetChi2()+chi2);
225 //__________________________________________________________________
226 Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
228 // fill cl.id's in the array. The clusters of layer L will be set at slots
229 // clID[2L] (and clID[2L+1] if there is an extra cluster).
230 for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
231 return GetWinner() ? GetWinner()->FetchClusterInfo(clIDarr) : 0;
234 //__________________________________________________________________
235 Int_t AliITSUTrackHyp::GetNumberOfClusters() const
237 // This is a temporary (slow) way of accessing number of clusters
238 // TODO: add dedicated data members filled by winner
239 AliITSUSeed* seed = GetWinner();
242 AliFatal("The winner is not set");
245 return seed->GetNClusters();
249 //__________________________________________________________________
250 Int_t AliITSUTrackHyp::GetClusterIndex(Int_t ind) const
252 // This is a temporary (slow) way of accessing cluster index
253 // TODO: add dedicated data members filled by winner
254 AliITSUSeed* seed = GetWinner();
257 AliFatal("The winner is not set");
260 return seed->GetClusterIndex(ind);