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
73 return fLayerSeeds[0].GetEntriesFast()>0 ? GetSeed(0,0) : 0;
76 //__________________________________________________________________
77 void AliITSUTrackHyp::DefineWinner(int lr, int id)
79 // assign best candidate
80 AliITSUSeed* winner = GetSeed(lr,id);
81 this->AliExternalTrackParam::operator=(*winner);
82 SetChi2(winner->GetChi2GloNrm());
83 SetNumberOfClusters(winner->GetNLayersHit());
86 //__________________________________________________________________
87 Double_t AliITSUTrackHyp::GetPredictedChi2(const AliCluster *cl) const
89 // calculate chi2 to cluster
90 Double_t p[2]={cl->GetY(), cl->GetZ()};
91 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
92 return AliExternalTrackParam::GetPredictedChi2(p,cov);
95 //__________________________________________________________________
96 Bool_t AliITSUTrackHyp::PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/)
99 AliFatal("Not to be used");
103 //__________________________________________________________________
104 Bool_t AliITSUTrackHyp::Update(const AliCluster* /*c*/, Double_t /*chi2*/, Int_t /*index*/)
107 AliFatal("Not to be used");
111 //__________________________________________________________________
112 Bool_t AliITSUTrackHyp::Update(const AliCluster* cl)
114 // update with cluster
115 Double_t p[2]={cl->GetY(), cl->GetZ()};
116 Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
117 double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
118 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
119 SetChi2(GetChi2()+chi2);
123 //__________________________________________________________________
124 Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
126 // fill cl.id's in the array. The clusters of layer L will be set at slots
127 // clID[2L] (and clID[2L+1] if there is an extra cluster).
128 for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
129 AliITSUSeed* seed = GetWinner();
132 int clID = seed->GetLrCluster(lr);
135 clIDarr[ clIDarr[slotLr]<0 ? slotLr : slotLr+1 ] = clID;
138 seed = (AliITSUSeed*)seed->GetParent();