#include "AliESDtrack.h"
#include "AliCluster.h"
#include "AliITSUAux.h"
+#include <TString.h>
ClassImp(AliITSUTrackHyp)
: fNLayers(nlr)
,fITSLabel(0)
,fESDTrack(0)
+ ,fWinner(0)
+ ,fTPCSeed(0)
,fLayerSeeds(0)
{
// def. c-tor
{
// d-tor
delete[] fLayerSeeds;
+ delete fTPCSeed;
}
//__________________________________________________________________
, fNLayers(src.fNLayers)
, fITSLabel(src.fITSLabel)
, fESDTrack(src.fESDTrack)
+ , fWinner(0)
+ , fTPCSeed(src.fTPCSeed)
, fLayerSeeds(0)
{
- // copy c-tor
+ // copy c-tor. Note: it is shallow
if (fNLayers>0) {
fLayerSeeds = new TObjArray[fNLayers];
for (int ilr=fNLayers;ilr--;) {
AddSeed(sd,ilr);
}
}
+ fWinner = src.fWinner;
}
//
}
+//__________________________________________________________________
+AliITSUTrackHyp::AliITSUTrackHyp(const AliKalmanTrack &src)
+ : AliKalmanTrack(src)
+ , fNLayers(0)
+ , fITSLabel(0)
+ , fESDTrack(0)
+ , fWinner(0)
+ , fTPCSeed(0)
+ , fLayerSeeds(0)
+{
+ // copy c-tor. from KalmanTrack
+ //
+}
+
+//__________________________________________________________________
+AliITSUTrackHyp::AliITSUTrackHyp(const AliESDtrack &src)
+ : AliKalmanTrack()
+ , fNLayers(0)
+ , fITSLabel(0)
+ , fESDTrack(0)
+ , fWinner(0)
+ , fTPCSeed(0)
+ , fLayerSeeds(0)
+{
+ // copy c-tor. from ESD track: take only kinematics, mass and time integral
+ AliExternalTrackParam::operator=((const AliExternalTrackParam&)src);
+ SetMass(src.GetMassForTracking());
+ if (src.IsOn(AliESDtrack::kTIME)) {
+ StartTimeIntegral();
+ SetIntegratedLength(src.GetIntegratedLength());
+ double times[AliPID::kSPECIESC];
+ src.GetIntegratedTimes(times,AliPID::kSPECIESC);
+ SetIntegratedTimes(times);
+ }
+ //
+}
+
+//__________________________________________________________________
+void AliITSUTrackHyp::InitFrom(const AliITSUTrackHyp *src)
+{
+ // copy initial params
+ fNLayers = src->fNLayers;
+ fITSLabel = src->fITSLabel;
+ fESDTrack = src->fESDTrack;
+ fWinner = src->fWinner;
+ fTPCSeed = src->fTPCSeed;
+ //
+}
+
//__________________________________________________________________
AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
{
}
//__________________________________________________________________
-void AliITSUTrackHyp::Print(Option_t* ) const
+AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliKalmanTrack &src)
+{
+ // copy kinematics only
+ if (this == &src) return *this;
+ AliKalmanTrack::operator=(src);
+ return *this;
+ //
+}
+
+//__________________________________________________________________
+AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliESDtrack &src)
+{
+ // copy oparator from ESD track: take only kinematics, mass and time integral
+ AliExternalTrackParam::operator=((const AliExternalTrackParam&)src);
+ SetMass(src.GetMassForTracking());
+ if (src.IsOn(AliESDtrack::kTIME)) {
+ StartTimeIntegral();
+ SetIntegratedLength(src.GetIntegratedLength());
+ double times[AliPID::kSPECIESC];
+ src.GetIntegratedTimes(times,AliPID::kSPECIESC);
+ SetIntegratedTimes(times);
+ }
+ //
+ return *this;
+}
+
+
+//__________________________________________________________________
+void AliITSUTrackHyp::Print(Option_t* opt) const
{
printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
- for (int i=0;i<fNLayers;i++) printf(" (%d) %3d",i,GetNSeeds(i)); printf("\n");
+ TString opts = opt;
+ opts.ToLower();
+ Bool_t prSeeds = opts.Contains("l");
+ for (int i=0;i<fNLayers;i++) {
+ printf("Lr (%d) %3d ",i,GetNSeeds(i));
+ if (prSeeds) {
+ printf("\n");
+ for (int isd=0;isd<GetNSeeds(i);isd++) ((AliITSUSeed*)GetSeed(i,isd))->Print(opt);
+ }
+ }
+ if (!prSeeds) printf("\n");
}
//__________________________________________________________________
AliITSUSeed* AliITSUTrackHyp::GetWinner() const
{
- // Get best candidate
- return fLayerSeeds[0].GetEntriesFast()>0 ? GetSeed(0,0) : 0;
+ // Get best candidate. TODO
+ return fWinner;
}
//__________________________________________________________________
-void AliITSUTrackHyp::DefineWinner(int lr, int id)
+AliITSUSeed* AliITSUTrackHyp::DefineWinner(int lr, int id)
{
// assign best candidate
- AliITSUSeed* winner = GetSeed(lr,id);
- this->AliExternalTrackParam::operator=(*winner);
- SetChi2(winner->GetChi2GloNrm());
- SetNumberOfClusters(winner->GetNLayersHit());
+ int nsd = GetNSeeds(lr);
+ while ( id<nsd && ( !(fWinner=GetSeed(lr,id)) || fWinner->IsKilled() ) ) {id++; fWinner=0;}
+ if (!fWinner) {
+ // AliInfo(Form("No winner candidates out of %d for %d",nsd,GetUniqueID()));
+ return 0;
+ }
+ UInt_t idESD = GetUniqueID(); // retain ESDtrackID
+ this->AliExternalTrackParam::operator=(*fWinner);
+ SetUniqueID(idESD);
+ SetChi2(fWinner->GetChi2GloNrm());
+ SetNumberOfClusters(fWinner->GetNLayersHit());
+ return fWinner;
}
//__________________________________________________________________
}
//__________________________________________________________________
-Bool_t AliITSUTrackHyp::Update(const AliCluster* cl)
+Double_t AliITSUTrackHyp::Update(const AliCluster* cl)
{
// update with cluster
Double_t p[2]={cl->GetY(), cl->GetZ()};
Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
double chi2 = AliExternalTrackParam::GetPredictedChi2(p,cov);
- if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
+ if (!AliExternalTrackParam::Update(p,cov)) return -1;
SetChi2(GetChi2()+chi2);
- return kTRUE;
+ return chi2;
}
//__________________________________________________________________
// fill cl.id's in the array. The clusters of layer L will be set at slots
// clID[2L] (and clID[2L+1] if there is an extra cluster).
for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
- Int_t lr,ncl=0;
- AliITSUSeed* seed = GetWinner();
- if (!seed) {
- AliFatal("The winner is not set");
- return ncl;
- }
- while(seed) {
- int clID = seed->GetLrCluster(lr);
- if (clID>=0) {
- int slotLr = lr<<1;
- clIDarr[ clIDarr[slotLr]<0 ? slotLr : slotLr+1 ] = clID;
- ncl++;
- }
- seed = (AliITSUSeed*)seed->GetParent();
- }
- return ncl;
+ return GetWinner() ? GetWinner()->FetchClusterInfo(clIDarr) : 0;
}
//__________________________________________________________________
// This is a temporary (slow) way of accessing cluster index
// TODO: add dedicated data members filled by winner
AliITSUSeed* seed = GetWinner();
- int ncl = 0;
+ // int ncl = 0;
if (!seed) {
AliFatal("The winner is not set");
return -1;