]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliJet.cxx
Change default EMC calibration parameters (Yu.Kharlov)
[u/mrichter/AliRoot.git] / RALICE / AliJet.cxx
index c2141b43e885f9a21515c8b10277448daa0bd2e4..0c3a103988ebed6a77238ce789ef788aaf538f75 100644 (file)
@@ -111,6 +111,7 @@ void AliJet::Init()
  fTracks=0;
  fNtinit=0;
  fTrackCopy=0;
+ fRef=0;
  fSelected=0;
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -142,6 +143,11 @@ AliJet::~AliJet()
   delete fTracks;
   fTracks=0;
  }
+ if (fRef)
+ {
+  delete fRef;
+  fRef=0;
+ }
  if (fSelected)
  {
   delete fSelected;
@@ -185,6 +191,7 @@ AliJet::AliJet(const AliJet& j) : TNamed(j),Ali4Vector(j)
  fNtrk=j.fNtrk;
  fTrackCopy=j.fTrackCopy;
  fUserId=j.fUserId;
+ if (j.fRef) fRef=new AliPositionObj(*(j.fRef));
 
  fSelected=0;
 
@@ -220,6 +227,11 @@ void AliJet::SetNtinit(Int_t n)
   delete fTracks;
   fTracks=0;
  }
+ if (fRef)
+ {
+  delete fRef;
+  fRef=0;
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliJet::Reset()
@@ -355,6 +367,7 @@ void AliJet::List(TString f,TString u)
 // The defaults are f="car" and u="rad".
 
  Data(f,u); // Information of the current jet
+ if (fRef)   { cout << " Ref-point   :"; fRef->Data(f,u); }
 
  // The tracks of this jet
  AliTrack* t; 
@@ -386,6 +399,7 @@ void AliJet::ListAll(TString f,TString u)
 // The defaults are f="car" and u="rad".
 
  Data(f,u); // Information of the current jet
+ if (fRef)   { cout << " Ref-point   :"; fRef->Data(f,u); }
 
  // The tracks of this jet
  AliTrack* t; 
@@ -550,6 +564,11 @@ TObjArray* AliJet::GetTracks(Int_t idmode,Int_t chmode,Int_t pcode)
 // 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)
  {
@@ -590,6 +609,108 @@ TObjArray* AliJet::GetTracks(Int_t idmode,Int_t chmode,Int_t pcode)
  return fSelected;
 }
 ///////////////////////////////////////////////////////////////////////////
+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.
@@ -774,6 +895,35 @@ Int_t AliJet::GetId() const
  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"
@@ -852,7 +1002,10 @@ TObjArray* AliJet::SortTracks(Int_t mode,TObjArray* tracks)
     fSelected->AddAt(tx,j); // add track at the end
     break; // go for next track
    }
-   
+
+   val1=0;
+   val2=0;
+
    switch (abs(mode))
    {
     case 1:
@@ -901,8 +1054,8 @@ TObjArray* AliJet::SortTracks(Int_t mode,TObjArray* tracks)
      break;
    }
 
-   if (mode<0 && val1 < val2) continue;
-   if (mode>0 && val1 > val2) continue;
+   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