// in an AliEvent.
// In this way the AliJet just represents a 'logical structure' for the
// physics analysis which can be embedded in e.g. an AliEvent or AliVertex.
+//
+// Note :
// Modifications made to the original tracks also affect the AliTrack objects
// which are stored in the AliJet.
+//
// b) SetTrackCopy(1).
// Of every 'added' track a private copy will be made of which the pointer
// will be stored.
// The max. number of tracks is set to the initial value again
fNtrk=0;
fQ=0;
+ fUserId=0;
Double_t a[4]={0,0,0,0};
SetVector(a,"sph");
if (fNtinit > 0) SetNtinit(fNtinit);
///////////////////////////////////////////////////////////////////////////
void AliJet::AddTrack(AliTrack& t)
{
-// Add a track to the jet
+// Add a track to the jet.
+// Note : In case TrackCopy is set, the originally entered track
+// will be automatically reset.
// In case the maximum number of tracks has been reached
// space will be extended to hold an additional amount of tracks as
-// was initially reserved
+// was initially reserved.
if (!fTracks) fTracks=new TObjArray(fNtmax);
if (fNtrk == fNtmax) // Check if maximum track number is reached
{
fNtrk++;
if (fTrackCopy)
{
- AliTrack* tx=new AliTrack(t);
- fTracks->Add(tx);
+ fTracks->Add(t.Clone());
}
else
{
fTracks->Add(&t);
}
+
(*this)+=(Ali4Vector&)t;
fQ+=t.GetCharge();
+
}
///////////////////////////////////////////////////////////////////////////
void AliJet::Info(TString f)
{
// Provide jet information within the coordinate frame f
- cout << " *AliJet::Info* Invmass : " << GetInvmass() << " Charge : " << fQ
+ cout << " *AliJet::Info* Id : " << fUserId << " Invmass : " << GetInvmass() << " Charge : " << fQ
<< " Momentum : " << GetMomentum() << " Ntracks : " << fNtrk << endl;
cout << " ";
Ali4Vector::Info(f);
}
}
///////////////////////////////////////////////////////////////////////////
+AliTrack* AliJet::GetIdTrack(Int_t id)
+{
+// Return the track with user identifier "id" of this jet
+ AliTrack* tx=0;
+ AliTrack* t=0;
+ if (!fTracks)
+ {
+ cout << " *AliJet*::GetIdTrack* No tracks present." << endl;
+ return 0;
+ }
+ else
+ {
+ for (Int_t i=0; i<fNtrk; i++)
+ {
+ tx=(AliTrack*)fTracks->At(i);
+ if (id == tx->GetId()) t=tx;
+ }
+ return t;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
Double_t AliJet::GetPt()
{
// Provide trans. momentum value w.r.t. z-axis.
return fTrackCopy;
}
///////////////////////////////////////////////////////////////////////////
+void AliJet::SetId(Int_t id)
+{
+// Set a user defined identifier for this jet.
+ fUserId=id;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliJet::GetId()
+{
+// Provide the user defined identifier of this jet.
+ return fUserId;
+}
+///////////////////////////////////////////////////////////////////////////