]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODVertex.h
Using fNContrubutors in AliAODVertex for SPD vertices.
[u/mrichter/AliRoot.git] / STEER / AliAODVertex.h
index 819017240c72df0eae46cb2d4ad2ac9570bd364c..cfb4ceb8ecdf38be73bbcd11fe99c1c07a68cf31 100644 (file)
@@ -8,15 +8,18 @@
 //-------------------------------------------------------------------------
 //     AOD vertex base class
 //     Author: Markus Oldenburg, CERN
+//     Inheritance from AliVVertex: A. Dainese
 //-------------------------------------------------------------------------
 
 #include <TRef.h>
 #include <TRefArray.h>
 #include <TMath.h>
 
+#include "AliVVertex.h"
 #include "AliAODRedCov.h"
+#include "AliLog.h"
 
-class AliAODVertex : public TObject {
+class AliAODVertex : public AliVVertex {
 
  public :
 
@@ -28,19 +31,23 @@ class AliAODVertex : public TObject {
               Double_t chi2perNDF = -999.,
               TObject *parent = 0x0,
               Short_t id=-1,
-              Char_t vtype=kUndef);
+              Char_t vtype=kUndef,
+              Int_t nprong = 0);
   AliAODVertex(const Float_t *position, 
               const Float_t *covMatrix=0x0,
               Double_t chi2perNDF = -999.,
               TObject *parent = 0x0,
               Short_t id=-1,
-              Char_t vtype=kUndef);
+              Char_t vtype=kUndef,
+              Int_t nprong = 0);
     AliAODVertex(const Double_t *position, 
                 Double_t chi2perNDF,
-                Char_t vtype=kUndef);
+                Char_t vtype=kUndef,
+                Int_t nprong = 0);
     AliAODVertex(const Float_t *position, 
                 Double_t chi2perNDF,
-                Char_t vtype=kUndef);
+                Char_t vtype=kUndef,
+                Int_t nprong = 0);
 
   virtual ~AliAODVertex();
   AliAODVertex(const AliAODVertex& vtx); 
@@ -60,6 +67,8 @@ class AliAODVertex : public TObject {
   Double_t GetX() const { return fPosition[0]; }
   Double_t GetY() const { return fPosition[1]; }
   Double_t GetZ() const { return fPosition[2]; }
+  void     GetXYZ(Double_t position[3]) const 
+    {position[0]=fPosition[0]; position[1]=fPosition[1]; position[2]=fPosition[2];}
   template <class T> void GetPosition(T *pos) const
     {pos[0]=fPosition[0]; pos[1]=fPosition[1]; pos[2]=fPosition[2];}
 
@@ -71,6 +80,8 @@ class AliAODVertex : public TObject {
     if(!fCovMatrix) return kFALSE;
     fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
 
+  void GetCovarianceMatrix(Double_t covmatrix[6]) const 
+                    {GetCovMatrix(covmatrix);}
   void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
 
   template <class T> void     GetSigmaXYZ(T *sigma) const;
@@ -88,13 +99,14 @@ class AliAODVertex : public TObject {
   TObject* GetParent() const   { return fParent.GetObject(); }
   Bool_t   HasParent(TObject *parent) const { return (fParent.GetObject() == parent) ? kTRUE : kFALSE; }
 
-  void     AddDaughter(TObject *daughter) { fDaughters.Add(daughter);}
+  void     AddDaughter(TObject *daughter);
   void     RemoveDaughter(TObject *daughter) { fDaughters.Remove(daughter); }
-  TObject* GetDaughter(Int_t i) { return fDaughters.At(i); }
+  void     RemoveDaughters() { fDaughters.Clear(); if(fProngs) {delete [] fProngs; fProngs=0; MakeProngs(); fIprong=0;} }
+  TObject* GetDaughter(Int_t i); 
   Bool_t   HasDaughter(TObject *daughter) const;
-  Int_t    GetNDaughters() const { return fDaughters.GetEntriesFast(); }
+  Int_t    GetNDaughters() const;
   Int_t    GetNContributors() const;
-
+  void     SetNContributors(Int_t nc) {fNContributors = nc;}
   // covariance matrix elements after rotation by phi around z-axis 
   // and, then, by theta around new y-axis
   Double_t  RotatedCovMatrixXX(Double_t phi = 0., Double_t theta = 0.) const;
@@ -109,22 +121,50 @@ class AliAODVertex : public TObject {
   Double_t  ErrorDistanceToVertex(AliAODVertex *vtx) const;
   Double_t  DistanceXYToVertex(AliAODVertex *vtx) const;
   Double_t  ErrorDistanceXYToVertex(AliAODVertex *vtx) const;
-
+  
   void     PrintIndices() const;
   void     Print(Option_t* option = "") const;
-
- private :
-
-  Double32_t      fPosition[3]; // vertex position
-  Double32_t      fChi2perNDF;  // chi2/NDF of vertex fit
-  Short_t         fID;          // vertex ID; corresponds to the array index of the appropriate ESD container
-  Char_t          fType;        // vertex type
-
-  AliAODRedCov<3> *fCovMatrix;  // vertex covariance matrix; values of and below the diagonal
-  TRef            fParent;      // reference to the parent particle
-  TRefArray       fDaughters;   // references to the daughter particles
-
-  ClassDef(AliAODVertex,3);
+  private:
+  void     MakeProngs() {if (fNprong > 0) {fProngs = new TRef[fNprong]; fIprong=0;}}
+         
+ private:
+
+  Double32_t      fPosition[3];   // vertex position
+  Double32_t      fChi2perNDF;    // chi2/NDF of vertex fit
+  Short_t         fID;            // vertex ID; corresponds to the array index of the appropriate ESD container
+  Char_t          fType;          // vertex type
+  Int_t           fNprong;        // number of prongs
+  Int_t           fIprong;        //!index  of prong
+  Int_t           fNContributors; // Number of contributors for SPD vertex
+  AliAODRedCov<3> *fCovMatrix;    // vertex covariance matrix; values of and below the diagonal
+  TRef            fParent;        // reference to the parent particle
+  TRefArray       fDaughters;     // references to the daughter particles
+  TRef            *fProngs;       //[fNprong] alternative daughters for n-prong vertex
+  
+  ClassDef(AliAODVertex, 6);
 };
 
+inline  Int_t AliAODVertex::GetNDaughters() const
+{
+    if (!fProngs) {
+       return fDaughters.GetEntriesFast();
+    } else {
+       return fNprong;
+    }
+}
+
+inline TObject* AliAODVertex::GetDaughter(Int_t i)
+{
+    if (!fProngs) {
+       return fDaughters.At(i);
+    } else {
+       if (i < fNprong) {
+           return fProngs[i].GetObject();
+       } else {
+           AliWarning("Daughter index out of range !\n");
+           return 0;
+       }
+    }
+}
+
 #endif