#include "AliAODVertex.h"
+#include "AliAODTrack.h"
+
ClassImp(AliAODVertex)
//______________________________________________________________________________
AliAODVertex::AliAODVertex() :
TObject(),
- fCovMatrix(NULL),
- fChi2(-999.),
+ fChi2perNDF(-999.),
+ fID(-1),
fType(kUndef),
- fParent(0x0),
+ fCovMatrix(NULL),
+ fParent(),
fDaughters()
-{
+ {
// default constructor
fPosition[0] = fPosition[1] = fPosition[2] = -999.;
//______________________________________________________________________________
AliAODVertex::AliAODVertex(const Double_t position[3],
- const Double_t covMatrix[6],
- Double_t chi2,
+ const Double_t covMatrix[6],
+ Double_t chi2perNDF,
TObject *parent,
+ Short_t id,
Char_t vtype) :
TObject(),
- fCovMatrix(NULL),
- fChi2(chi2),
+ fChi2perNDF(chi2perNDF),
+ fID(id),
fType(vtype),
+ fCovMatrix(NULL),
fParent(parent),
fDaughters()
{
//______________________________________________________________________________
AliAODVertex::AliAODVertex(const Float_t position[3],
const Float_t covMatrix[6],
- Double_t chi2,
+ Double_t chi2perNDF,
TObject *parent,
+ Short_t id,
Char_t vtype) :
+
TObject(),
- fCovMatrix(NULL),
- fChi2(chi2),
+ fChi2perNDF(chi2perNDF),
+ fID(id),
fType(vtype),
+ fCovMatrix(NULL),
fParent(parent),
fDaughters()
{
//______________________________________________________________________________
AliAODVertex::AliAODVertex(const Double_t position[3],
- Double_t chi2,
+ Double_t chi2perNDF,
Char_t vtype) :
TObject(),
- fCovMatrix(NULL),
- fChi2(chi2),
+ fChi2perNDF(chi2perNDF),
+ fID(-1),
fType(vtype),
- fParent(0x0),
+ fCovMatrix(NULL),
+ fParent(),
fDaughters()
{
// constructor without covariance matrix
//______________________________________________________________________________
AliAODVertex::AliAODVertex(const Float_t position[3],
- Double_t chi2,
+ Double_t chi2perNDF,
Char_t vtype) :
TObject(),
- fCovMatrix(NULL),
- fChi2(chi2),
+ fChi2perNDF(chi2perNDF),
+ fID(-1),
fType(vtype),
- fParent(0x0),
+ fCovMatrix(NULL),
+ fParent(),
fDaughters()
{
// constructor without covariance matrix
//______________________________________________________________________________
AliAODVertex::AliAODVertex(const AliAODVertex& vtx) :
TObject(vtx),
- fCovMatrix(NULL),
- fChi2(vtx.fChi2),
+ fChi2perNDF(vtx.fChi2perNDF),
+ fID(vtx.fID),
fType(vtx.fType),
+ fCovMatrix(NULL),
fParent(vtx.fParent),
fDaughters(vtx.fDaughters)
{
for (int i = 0; i < 3; i++)
fPosition[i] = vtx.fPosition[i];
- if (vtx.fCovMatrix) fCovMatrix=new AliAODVtxCov(*vtx.fCovMatrix);
+ if (vtx.fCovMatrix) fCovMatrix=new AliAODRedCov<3>(*vtx.fCovMatrix);
}
//______________________________________________________________________________
for (int i = 0; i < 3; i++)
fPosition[i] = vtx.fPosition[i];
+ fChi2perNDF = vtx.fChi2perNDF;
+ fID = vtx.fID;
+ fType = vtx.fType;
+
//covariance matrix
delete fCovMatrix;
- fCovMatrix = NULL;
-
- if (vtx.fCovMatrix) fCovMatrix=new AliAODVtxCov(*vtx.fCovMatrix);
-
+ fCovMatrix = NULL;
+ if (vtx.fCovMatrix) fCovMatrix=new AliAODRedCov<3>(*vtx.fCovMatrix);
//other stuff
- fChi2 = vtx.fChi2;
fParent = vtx.fParent;
fDaughters = vtx.fDaughters;
- fType = vtx.fType;
}
return *this;
*/
}
+//______________________________________________________________________________
+Int_t AliAODVertex::GetNContributors() const
+{
+ // Returns the number of tracks used to fit this vertex.
+
+ Int_t cont = 0;
+
+ for (Int_t iDaug = 0; iDaug < GetNDaughters(); iDaug++) {
+ if (((AliAODTrack*)fDaughters.At(iDaug))->GetUsedForVtxFit()) cont++;
+ }
+
+ return cont;
+}
+
//______________________________________________________________________________
Bool_t AliAODVertex::HasDaughter(TObject *daughter) const
{
// rotation angles around z-axis (phi) and around new y-axis (theta)
// with which vtx is seen (used by RotatedCovMatrix... methods)
- phi = TMath::ATan2(vtx->GetY()-GetY(),vtx->GetX()-GetX());
+ phi = TMath::Pi()+TMath::ATan2(-vtx->GetY()+GetY(),-vtx->GetX()+GetX());
Double_t vtxxphi = vtx->GetX()*TMath::Cos(phi)+vtx->GetY()*TMath::Sin(phi);
Double_t xphi = GetX()*TMath::Cos(phi)+GetY()*TMath::Sin(phi);
theta = TMath::ATan2(vtx->GetZ()-GetZ(),vtxxphi-xphi);
fCovMatrix[4],
fCovMatrix[5]);
} */
- printf(" Chi^2 = %f\n", fChi2);
-}
-
-//-------------------------------------------------------------------------
-// AOD track cov matrix base class
-//-------------------------------------------------------------------------
-
-ClassImp(AliAODVertex::AliAODVtxCov)
-
-//______________________________________________________________________________
-template <class T> void AliAODVertex::AliAODVtxCov::GetCovMatrix(T *cmat) const
-{
- //
- // Returns the external cov matrix
- //
- cmat[ 0] = fDiag[ 0]*fDiag[ 0];
- cmat[ 2] = fDiag[ 1]*fDiag[ 1];
- cmat[ 5] = fDiag[ 2]*fDiag[ 2];
-
- //
- cmat[ 1] = fODia[ 0]*fDiag[ 0]*fDiag[ 1];
- cmat[ 3] = fODia[ 1]*fDiag[ 0]*fDiag[ 2];
- cmat[ 4] = fODia[ 2]*fDiag[ 1]*fDiag[ 2];
+ printf(" Chi^2/NDF = %f\n", fChi2perNDF);
}
-
-//______________________________________________________________________________
-template <class T> void AliAODVertex::AliAODVtxCov::SetCovMatrix(T *cmat)
-{
- //
- // Sets the external cov matrix
- //
- if(cmat) {
- fDiag[ 0] = TMath::Sqrt(cmat[ 0]);
- fDiag[ 1] = TMath::Sqrt(cmat[ 2]);
- fDiag[ 2] = TMath::Sqrt(cmat[ 5]);
- //
- fODia[ 0] = cmat[ 1]/(fDiag[ 0]*fDiag[ 1]);
- fODia[ 1] = cmat[ 3]/(fDiag[ 0]*fDiag[ 2]);
- fODia[ 2] = cmat[ 4]/(fDiag[ 1]*fDiag[ 2]);
- } else {
- for(Int_t i=0; i< 3; ++i) {
- fDiag[i]=-999.; fODia[i]=0.;}
- }
-}