+Double_t AliJet::GetDistance(AliPosition* p,Float_t scale)
+{
+// Provide distance of the current jet to the position p.
+// The error on the result can be obtained as usual by invoking
+// GetResultError() afterwards.
+//
+// By default the distance will be provided in the metric unit scale of
+// the AliPosition p.
+// However, the user can select a different metric unit scale by
+// specification of the scale parameter.
+// The convention is that scale=1 corresponds to meter, so specification
+// of scale=0.01 will provide the distance in cm.
+// As such it is possible to obtain a correctly computed distance even in case
+// the jet parameters have a different unit scale.
+// However, it is recommended to work always with one single unit scale.
+//
+// Note : In case of incomplete information, a distance value of -1 is
+// returned.
+
+ Double_t dist=-1.;
+ fDresult=0.;
+
+ if (!p) return dist;
+
+ // Obtain a defined position on this jet
+ AliPosition* rx=fRef;
+
+ if (!rx) return dist;
+
+ Ali3Vector pj=Get3Momentum();
+
+ if (pj.GetNorm() <= 0.) return dist;
+
+ AliTrack tj;
+ tj.Set3Momentum(pj);
+ tj.SetReferencePoint(*rx);
+ dist=tj.GetDistance(p,scale);
+ fDresult=tj.GetResultError();
+ return dist;
+}
+///////////////////////////////////////////////////////////////////////////
+Double_t AliJet::GetDistance(AliTrack* t,Float_t scale)
+{
+// Provide distance of the current jet to the track t.
+// The error on the result can be obtained as usual by invoking
+// GetResultError() afterwards.
+//
+// By default the distance will be provided in the metric unit scale of
+// the current jet.
+// However, the user can specify a required metric unit scale by specification
+// of the scale parameter.
+// The convention is that scale=1 corresponds to meter, so specification
+// of scale=0.01 will provide the distance in cm.
+// As such it is possible to obtain a correctly computed distance even in case
+// the jet and track parameters have a different unit scale.
+// However, it is recommended to work always with one single unit scale.
+//
+// Note : In case of incomplete information, a distance value of -1 is
+// returned.
+
+ Double_t dist=-1.;
+ fDresult=0.;
+
+ if (!t) return dist;
+
+ // Obtain a defined position on this jet
+ AliPosition* rx=fRef;
+
+ if (!rx) return dist;
+
+ Ali3Vector pj=Get3Momentum();
+
+ if (pj.GetNorm() <= 0.) return dist;
+
+ AliTrack tj;
+ tj.Set3Momentum(pj);
+ tj.SetReferencePoint(*rx);
+ dist=tj.GetDistance(t,scale);
+ fDresult=tj.GetResultError();
+ return dist;
+}
+///////////////////////////////////////////////////////////////////////////
+Double_t AliJet::GetDistance(AliJet* j,Float_t scale)
+{
+// Provide distance of the current jet to the jet j.
+// The error on the result can be obtained as usual by invoking
+// GetResultError() afterwards.
+//
+// By default the distance will be provided in the metric unit scale of
+// the current jet.
+// This implies that the results of j1.GetDistance(j2) and j2.GetDistance(j1)
+// may be numerically different in case j1 and j2 have different metric units.
+// However, the user can specify a required metric unit scale by specification
+// of the scale parameter.
+// The convention is that scale=1 corresponds to meter, so specification
+// of scale=0.01 will provide the distance in cm.
+// As such it is possible to obtain a correctly computed distance even in case
+// the jet parameters have a different unit scale.
+// However, it is recommended to work always with one single unit scale.
+//
+// Note : In case of incomplete information, a distance value of -1 is
+// returned.
+
+ Double_t dist=-1.;
+ fDresult=0.;
+
+ if (!j) return dist;
+
+ // Obtain a defined position on jet j
+ AliPosition* rx=j->GetReferencePoint();
+
+ if (!rx) return dist;
+
+ Ali3Vector pj=j->Get3Momentum();
+
+ if (pj.GetNorm() <= 0.) return dist;
+
+ AliTrack tj;
+ tj.Set3Momentum(pj);
+ tj.SetReferencePoint(*rx);
+ dist=GetDistance(tj,scale);
+ return dist;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliJet::GetNsignals() const
+{
+// Provide the number of signals associated to the jet tracks.
+// Note : Multiple occurrences of the same signal are only counted once.
+
+ if (fNtrk<1) return 0;
+
+ TObjArray arr;
+
+ Int_t n=0;
+ AliTrack* tx=0;
+ Int_t exists=0;
+ for (Int_t i=1; i<=fNtrk; i++)
+ {
+ tx=GetTrack(i);
+ for (Int_t j=1; j<=tx->GetNsignals(); j++)
+ {
+ AliSignal* sx=tx->GetSignal(j);
+ if (!sx) continue;
+ exists=0;
+ for (Int_t k=0; k<arr.GetEntries(); k++)
+ {
+ if (sx==(AliSignal*)arr.At(k))
+ {
+ exists=1;
+ break;
+ }
+ }
+ if (!exists) arr.Add(sx);
+ }
+ }
+ n=arr.GetEntries();
+ return n;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliJet::SetEscale(Float_t scale)
+{
+// Indicate the energy/momentum scale as used by the user.
+// The convention is that scale=1 indicates values in units
+// of GeV, GeV/c or GeV/c**2.
+// So, in case one decides to store values in units of MeV, MeV/c or MeV/c**2
+// the scale indicator should be set to scale=0.001.
+//
+// By default scale=1 is set in the constructor.
+
+ if (scale>0)
+ {
+ fEscale=scale;
+ }
+ else
+ {
+ cout << " *AliJet::SetEscale* Invalid scale value : " << scale << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Float_t AliJet::GetEscale() const
+{
+// Provide the energy/momentum scale as used by the user.
+// The convention is that scale=1 indicates values in units
+// of GeV, GeV/c or GeV/c**2.
+// So, a value of scale=0.001 indicates that energy/momentum values are
+// stored in units of MeV, MeV/c or MeV/c**2.
+ return fEscale;
+}
+///////////////////////////////////////////////////////////////////////////