fTracks=0;
fNtinit=0;
fTrackCopy=0;
+ fRef=0;
fSelected=0;
}
///////////////////////////////////////////////////////////////////////////
delete fTracks;
fTracks=0;
}
+ if (fRef)
+ {
+ delete fRef;
+ fRef=0;
+ }
if (fSelected)
{
delete fSelected;
fNtrk=j.fNtrk;
fTrackCopy=j.fTrackCopy;
fUserId=j.fUserId;
+ if (j.fRef) fRef=new AliPositionObj(*(j.fRef));
fSelected=0;
// Set the initial maximum number of tracks for this jet
fNtinit=n;
fNtmax=n;
+
if (fTracks)
{
delete fTracks;
fTracks=0;
}
+ if (fRef)
+ {
+ delete fRef;
+ fRef=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliJet::Reset()
// was initially reserved.
// See SetTrackCopy() to tailor the functionality of the stored structures.
//
-// Note :
+// Notes :
+// -------
// In case a private copy is made, this is performed via the Clone() memberfunction.
// All AliTrack and derived classes have the default TObject::Clone() memberfunction.
// However, derived classes generally contain an internal data structure which may
// for all derived classes a specific copy constructor and override the default Clone()
// memberfunction using this copy constructor.
// An example for this may be seen from AliTrack.
+//
+// In case NO private copy is made, a check will be performed if this
+// specific track is already present in the jet.
+// If this is the case, no action is performed to prevent multiple
+// additions of the same track.
+
AddTrack(t,1);
}
// This allows a proper treatment of automatically generated connecting
// tracks between vertices.
//
+// In case NO copy of the track is made, a check will be performed if this
+// specific track is already present in the jet.
+// If this is the case, no action is performed to prevent multiple
+// additions of the same track.
+//
// Note :
// In case a private copy is made, this is performed via the Clone() memberfunction.
fTracks=new TObjArray(fNtmax);
if (fTrackCopy) fTracks->SetOwner();
}
+ else if (!fTrackCopy || !copy) // Check if this track is already present
+ {
+ for (Int_t i=0; i<fNtrk; i++)
+ {
+ AliTrack* tx=(AliTrack*)fTracks->At(i);
+ if (tx == &t) return;
+ }
+ }
+
if (fNtrk == fNtmax) // Check if maximum track number is reached
{
fNtmax+=fNtinit;
}
///////////////////////////////////////////////////////////////////////////
-void AliJet::Data(TString f)
+void AliJet::Data(TString f,TString u)
{
// Provide jet information within the coordinate frame f
+//
+// The string argument "u" allows to choose between different angular units
+// in case e.g. a spherical frame is selected.
+// u = "rad" : angles provided in radians
+// "deg" : angles provided in degrees
+//
+// The defaults are f="car" and u="rad".
+
const char* name=GetName();
const char* title=GetTitle();
ShowTracks(0);
- Ali4Vector::Data(f);
+ Ali4Vector::Data(f,u);
}
///////////////////////////////////////////////////////////////////////////
-void AliJet::List(TString f)
+void AliJet::List(TString f,TString u)
{
// Provide jet and primary track information within the coordinate frame f
+//
+// The string argument "u" allows to choose between different angular units
+// in case e.g. a spherical frame is selected.
+// u = "rad" : angles provided in radians
+// "deg" : angles provided in degrees
+//
+// The defaults are f="car" and u="rad".
- Data(f); // Information of the current jet
+ Data(f,u); // Information of the current jet
+ if (fRef) { cout << " Ref-point :"; fRef->Data(f,u); }
// The tracks of this jet
AliTrack* t;
{
cout << " ---Track no. " << it << endl;
cout << " ";
- t->Data(f);
+ t->Data(f,u);
}
else
{
}
}
///////////////////////////////////////////////////////////////////////////
-void AliJet::ListAll(TString f)
+void AliJet::ListAll(TString f,TString u)
{
// Provide jet and prim.+sec. track information within the coordinate frame f
+//
+// The string argument "u" allows to choose between different angular units
+// in case e.g. a spherical frame is selected.
+// u = "rad" : angles provided in radians
+// "deg" : angles provided in degrees
+//
+// The defaults are f="car" and u="rad".
- Data(f); // Information of the current jet
+ Data(f,u); // Information of the current jet
+ if (fRef) { cout << " Ref-point :"; fRef->Data(f,u); }
// The tracks of this jet
AliTrack* t;
{
cout << " ---Track no. " << it << endl;
cout << " ";
- t->ListAll(f);
+ t->ListAll(f,u);
}
else
{
}
}
///////////////////////////////////////////////////////////////////////////
-Int_t AliJet::GetNtracks() const
+Int_t AliJet::GetNtracks(Int_t idmode,Int_t chmode,Int_t pcode)
{
-// Return the current number of tracks of this jet
- return fNtrk;
+// Provide the number of user selected tracks in this jet based on the
+// idmode, chmode and pcode selections as specified by the user.
+// For specification of the selection parameters see GetTracks().
+// The default parameters correspond to no selection, which implies
+// that invokation of GetNtracks() just returns the total number of
+// tracks registered in this jet.
+//
+// Note : In case certain selections are specified, this function
+// invokes GetTracks(idmode,chmode,pcode) to determine the
+// number of tracks corresponding to the selections.
+// When the jet contains a large number of tracks, invokation
+// of GetTracks(idmode,chmode,pcode) and subsequently invoking
+// GetEntries() for the resulting TObjArray* might be slightly
+// faster.
+
+ Int_t n=0;
+ if (idmode==0 && chmode==2 && pcode==0)
+ {
+ return fNtrk;
+ }
+ else
+ {
+ TObjArray* arr=GetTracks(idmode,chmode,pcode);
+ n=arr->GetEntries();
+ return n;
+ }
}
///////////////////////////////////////////////////////////////////////////
Double_t AliJet::GetEnergy()
// 0 ==> Select neutral tracks
// 1 ==> Select tracks with positive charge
// 2 ==> No selection on charge
+// 3 ==> Select all charged tracks
//
// pcode = 0 ==> No selection on particle code
// X ==> Select tracks with particle code +X or -X
// 2) Subsequent invokations of this memberfunction with e.g. chmode=-1 and chmode=1
// provides a convenient way to investigate particle pairs with opposite charge
// (e.g. for invariant mass analysis).
+// 3) The selected track pointers are returned via a multi-purpose array,
+// which will be overwritten by subsequent selections.
+// In case the selected track list is to be used amongst other selections,
+// the user is advised to store the selected track pointers in a local
+// TObjArray or TRefArray.
if (fSelected)
{
if (chmode==-1 && q>=0) continue;
if (chmode==0 && fabs(q)>1e-10) continue;
if (chmode==1 && q<=0) continue;
+ if (chmode==3 && fabs(q)<1e-10) continue;
fSelected->Add(tx);
}
return fSelected;
}
///////////////////////////////////////////////////////////////////////////
-void AliJet::ShowTracks(Int_t mode) const
+TObjArray* AliJet::GetTracks(TString name)
+{
+// Provide references to all tracks with the specified name.
+//
+// Notes :
+// -------
+// 1) In case the user has labeled reconstructed tracks with the name of
+// the applied reconstruction algorithm, this memberfunction provides
+// easy access to all tracks reconstructed by a certain method.
+// 2) The selected track pointers are returned via a multi-purpose array,
+// which will be overwritten by subsequent selections.
+// In case the selected track list is to be used amongst other selections,
+// the user is advised to store the selected track pointers in a local
+// TObjArray or TRefArray.
+
+ if (fSelected)
+ {
+ fSelected->Clear();
+ }
+ else
+ {
+ fSelected=new TObjArray();
+ }
+
+ if (!fTracks) return fSelected;
+
+ AliTrack* tx=0;
+ TString s;
+ for (Int_t i=0; i<fNtrk; i++)
+ {
+ tx=(AliTrack*)fTracks->At(i);
+ if (!tx) continue;
+
+ s=tx->GetName();
+ if (s == name) fSelected->Add(tx);
+ }
+
+ return fSelected;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliJet::RemoveTracks(TString name)
+{
+// Remove all tracks with the specified name.
+// If name="*" all tracks will be removed.
+//
+// Note :
+// ------
+// In case the user has labeled reconstructed tracks with the name of
+// the applied reconstruction algorithm, this memberfunction provides
+// easy removal of all tracks reconstructed by a certain method.
+
+ if (!fTracks) return;
+
+ AliTrack* tx=0;
+ TString s;
+ TObject* obj=0;
+ for (Int_t i=0; i<fNtrk; i++)
+ {
+ tx=(AliTrack*)fTracks->At(i);
+ if (!tx) continue;
+
+ s=tx->GetName();
+ if (s==name || name=="*")
+ {
+ obj=fTracks->Remove(tx);
+ if (obj && fTracks->IsOwner()) delete tx;
+ }
+ }
+ fTracks->Compress();
+ fNtrk=fTracks->GetEntries();
+}
+///////////////////////////////////////////////////////////////////////////
+void AliJet::RemoveTracks(Int_t idmode,Int_t chmode,Int_t pcode)
+{
+// Remove user selected tracks based on the idmode, chmode and pcode
+// selections as specified by the user.
+// For defintions of these selections see the corresponding GetTracks()
+// memberfunction.
+
+ if (!fTracks) return;
+
+ TObjArray* arr=GetTracks(idmode,chmode,pcode);
+ if (!arr) return;
+
+ Int_t ntk=arr->GetEntries();
+ if (!ntk) return;
+
+ AliTrack* tx=0;
+ TObject* obj=0;
+ for (Int_t i=0; i<ntk; i++)
+ {
+ tx=(AliTrack*)arr->At(i);
+ if (!tx) continue;
+
+ obj=fTracks->Remove(tx);
+ if (obj && fTracks->IsOwner()) delete tx;
+ }
+ fTracks->Compress();
+ fNtrk=fTracks->GetEntries();
+ arr->Clear();
+}
+///////////////////////////////////////////////////////////////////////////
+void AliJet::ShowTracks(Int_t mode)
{
// Provide an overview of the available tracks.
// The argument mode determines the amount of information as follows :
return fUserId;
}
///////////////////////////////////////////////////////////////////////////
+void AliJet::SetReferencePoint(AliPosition& p)
+{
+// Store the position of the jet reference-point.
+// The reference-point of a jet provides a means to define a generic
+// space-time location for the jet as a whole.
+// This doesn't have to be necessarily the location where all the constituent
+// tracks originate (e.g. a bundle of parallel tracks doesn't have such
+// a location). As such the meaning of this reference-point is different from
+// a normal vertex position and allows to provide complimentary information.
+// This reference point is the preferable point to start e.g. extrapolations
+// and investigate coincidences in space and/or time.
+ if (fRef) delete fRef;
+ fRef=new AliPositionObj(p);
+}
+///////////////////////////////////////////////////////////////////////////
+AliPosition* AliJet::GetReferencePoint()
+{
+// Provide the position of the jet reference-point.
+// The reference-point of a jet provides a means to define a generic
+// space-time location for the jet as a whole.
+// This doesn't have to be necessarily the location where all the constituent
+// tracks originate (e.g. a bundle of parallel tracks doesn't have such
+// a location). As such the meaning of this reference-point is different from
+// a normal vertex position and allows to provide complimentary information.
+// This reference point is the preferable point to start e.g. extrapolations
+// and investigate coincidences in space and/or time.
+ return fRef;
+}
+///////////////////////////////////////////////////////////////////////////
+TObjArray* AliJet::SortTracks(Int_t mode,TObjArray* tracks)
+{
+// Order the references to an array of tracks by looping over the input array "tracks"
+// and checking the value of a certain observable.
+// The ordered array is returned as a TObjArray.
+// In case tracks=0 (default), the registered tracks of the current jet are used.
+// Note that the original track array is not modified.
+// Via the "mode" argument the user can specify the observable to be checked upon
+// and specify whether sorting should be performed in decreasing order (mode<0)
+// or in increasing order (mode>0).
+//
+// The convention for the observable selection is the following :
+// mode : 1 ==> Number of signals associated to the track
+// 2 ==> Track energy
+// 3 ==> Track momentum
+// 4 ==> Mass of the track
+// 5 ==> Transverse momentum of the track
+// 6 ==> Longitudinal momentum of the track
+// 7 ==> Transverse energy of the track
+// 8 ==> Longitudinal energy of the track
+// 9 ==> Transverse mass of the track
+// 10 ==> Track rapidity
+// 11 ==> Pseudo-rapidity of the track
+//
+// The default is mode=-1.
+//
+// Note : This sorting routine uses a common area in memory, which is used
+// by various other sorting facilities as well.
+// This means that the resulting sorted TObjArray may be overwritten
+// when another sorting is invoked.
+// To retain the sorted list of pointers, the user is advised to copy
+// the pointers contained in the returned TObjArray into a private
+// TObjArray instance.
+
+ if (fSelected)
+ {
+ delete fSelected;
+ fSelected=0;
+ }
+
+ if (!tracks) tracks=fTracks;
+
+ if (abs(mode)>11 || !tracks) return fSelected;
+
+ Int_t ntracks=tracks->GetEntries();
+ if (!ntracks)
+ {
+ return fSelected;
+ }
+ else
+ {
+ fSelected=new TObjArray(ntracks);
+ }
+
+ Double_t val1,val2; // Values of the observable to be tested upon
+
+ Int_t nord=0;
+ for (Int_t i=0; i<ntracks; i++) // Loop over all tracks of the array
+ {
+ AliTrack* tx=(AliTrack*)tracks->At(i);
+
+ if (!tx) continue;
+
+ if (nord == 0) // store the first track at the first ordered position
+ {
+ nord++;
+ fSelected->AddAt(tx,nord-1);
+ continue;
+ }
+
+ for (Int_t j=0; j<=nord; j++) // put track in the right ordered position
+ {
+ if (j == nord) // track has smallest (mode<0) or largest (mode>0) observable value seen so far
+ {
+ nord++;
+ fSelected->AddAt(tx,j); // add track at the end
+ break; // go for next track
+ }
+
+ val1=0;
+ val2=0;
+
+ switch (abs(mode))
+ {
+ case 1:
+ val1=tx->GetNsignals();
+ val2=((AliTrack*)fSelected->At(j))->GetNsignals();
+ break;
+ case 2:
+ val1=tx->GetEnergy();
+ val2=((AliTrack*)fSelected->At(j))->GetEnergy();
+ break;
+ case 3:
+ val1=tx->GetMomentum();
+ val2=((AliTrack*)fSelected->At(j))->GetMomentum();
+ break;
+ case 4:
+ val1=tx->GetMass();
+ val2=((AliTrack*)fSelected->At(j))->GetMass();
+ break;
+ case 5:
+ val1=tx->GetPt();
+ val2=((AliTrack*)fSelected->At(j))->GetPt();
+ break;
+ case 6:
+ val1=tx->GetPl();
+ val2=((AliTrack*)fSelected->At(j))->GetPl();
+ break;
+ case 7:
+ val1=tx->GetEt();
+ val2=((AliTrack*)fSelected->At(j))->GetEt();
+ break;
+ case 8:
+ val1=tx->GetEl();
+ val2=((AliTrack*)fSelected->At(j))->GetEl();
+ break;
+ case 9:
+ val1=tx->GetMt();
+ val2=((AliTrack*)fSelected->At(j))->GetMt();
+ break;
+ case 10:
+ val1=tx->GetRapidity();
+ val2=((AliTrack*)fSelected->At(j))->GetRapidity();
+ break;
+ case 11:
+ val1=tx->GetPseudoRapidity();
+ val2=((AliTrack*)fSelected->At(j))->GetPseudoRapidity();
+ break;
+ }
+
+ if (mode<0 && val1 <= val2) continue;
+ if (mode>0 && val1 >= val2) continue;
+
+ nord++;
+ for (Int_t k=nord-1; k>j; k--) // create empty position
+ {
+ fSelected->AddAt(fSelected->At(k-1),k);
+ }
+ fSelected->AddAt(tx,j); // put track at empty position
+ break; // go for next track
+ }
+ }
+ return fSelected;
+}
+///////////////////////////////////////////////////////////////////////////
TObject* AliJet::Clone(const char* name) const
{
// Make a deep copy of the current object and provide the pointer to the copy.