X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=STEER%2FAliAODVertex.cxx;h=33b3ad81194ba16d9cda1ade5f297dd40e96618c;hb=8f7b1226e6156cef90cac09edaf8b085c8e6f503;hp=bc615d13c4d88bc354b6e89a1d1c1a7798f45988;hpb=b1a9edc81cbb4051c802cd02336d829c6e3f30da;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliAODVertex.cxx b/STEER/AliAODVertex.cxx index bc615d13c4d..33b3ad81194 100644 --- a/STEER/AliAODVertex.cxx +++ b/STEER/AliAODVertex.cxx @@ -20,23 +20,27 @@ // Base class for Analysis Object Data // Generic version // Author: Markus Oldenburg, CERN +// Inheritance from AliVVertex: A. Dainese //------------------------------------------------------------------------- #include "AliAODVertex.h" - #include "AliAODTrack.h" ClassImp(AliAODVertex) //______________________________________________________________________________ AliAODVertex::AliAODVertex() : - TObject(), + AliVVertex(), fChi2perNDF(-999.), fID(-1), fType(kUndef), + fNprong(0), + fIprong(0), + fNContributors(0), fCovMatrix(NULL), - fParent(0x0), - fDaughters() + fParent(), + fDaughters(), + fProngs(NULL) { // default constructor @@ -49,19 +53,25 @@ AliAODVertex::AliAODVertex(const Double_t position[3], Double_t chi2perNDF, TObject *parent, Short_t id, - Char_t vtype) : - TObject(), + Char_t vtype, + Int_t nprong) : + AliVVertex(), fChi2perNDF(chi2perNDF), fID(id), fType(vtype), + fNprong(nprong), + fIprong(0), + fNContributors(0), fCovMatrix(NULL), fParent(parent), - fDaughters() + fDaughters(), + fProngs(0) { // constructor SetPosition(position); if (covMatrix) SetCovMatrix(covMatrix); + MakeProngs(); } //______________________________________________________________________________ @@ -70,54 +80,71 @@ AliAODVertex::AliAODVertex(const Float_t position[3], Double_t chi2perNDF, TObject *parent, Short_t id, - Char_t vtype) : + Char_t vtype, + Int_t nprong) : - TObject(), + AliVVertex(), fChi2perNDF(chi2perNDF), fID(id), fType(vtype), + fNprong(nprong), + fIprong(0), + fNContributors(0), fCovMatrix(NULL), fParent(parent), - fDaughters() + fDaughters(), + fProngs(0) { // constructor SetPosition(position); if (covMatrix) SetCovMatrix(covMatrix); + MakeProngs(); } //______________________________________________________________________________ AliAODVertex::AliAODVertex(const Double_t position[3], Double_t chi2perNDF, - Char_t vtype) : - TObject(), + Char_t vtype, + Int_t nprong) : + AliVVertex(), fChi2perNDF(chi2perNDF), fID(-1), fType(vtype), + fNprong(nprong), + fIprong(0), + fNContributors(0), fCovMatrix(NULL), - fParent(0x0), - fDaughters() + fParent(), + fDaughters(), + fProngs(0) { // constructor without covariance matrix SetPosition(position); + MakeProngs(); } //______________________________________________________________________________ AliAODVertex::AliAODVertex(const Float_t position[3], Double_t chi2perNDF, - Char_t vtype) : - TObject(), + Char_t vtype, Int_t nprong) : + AliVVertex(), fChi2perNDF(chi2perNDF), fID(-1), fType(vtype), + fNprong(nprong), + fIprong(0), + fNContributors(0), fCovMatrix(NULL), - fParent(0x0), - fDaughters() + fParent(), + fDaughters(), + fProngs(0) { // constructor without covariance matrix SetPosition(position); + MakeProngs(); } //______________________________________________________________________________ @@ -126,17 +153,22 @@ AliAODVertex::~AliAODVertex() // Destructor delete fCovMatrix; + if (fNprong > 0) delete[] fProngs; } //______________________________________________________________________________ AliAODVertex::AliAODVertex(const AliAODVertex& vtx) : - TObject(vtx), + AliVVertex(vtx), fChi2perNDF(vtx.fChi2perNDF), fID(vtx.fID), fType(vtx.fType), + fNprong(vtx.fNprong), + fIprong(vtx.fIprong), + fNContributors(vtx.fNContributors), fCovMatrix(NULL), fParent(vtx.fParent), - fDaughters(vtx.fDaughters) + fDaughters(vtx.fDaughters), + fProngs(0) { // Copy constructor. @@ -144,6 +176,10 @@ AliAODVertex::AliAODVertex(const AliAODVertex& vtx) : fPosition[i] = vtx.fPosition[i]; if (vtx.fCovMatrix) fCovMatrix=new AliAODRedCov<3>(*vtx.fCovMatrix); + MakeProngs(); + for (int i = 0; i < fNprong; i++) { + fProngs[i] = vtx.fProngs[i]; + } } //______________________________________________________________________________ @@ -153,7 +189,7 @@ AliAODVertex& AliAODVertex::operator=(const AliAODVertex& vtx) if (this != &vtx) { // name and type - TObject::operator=(vtx); + AliVVertex::operator=(vtx); //momentum for (int i = 0; i < 3; i++) @@ -171,11 +207,39 @@ AliAODVertex& AliAODVertex::operator=(const AliAODVertex& vtx) //other stuff fParent = vtx.fParent; fDaughters = vtx.fDaughters; + fNprong = vtx.fNprong; + fIprong = vtx.fIprong; + + MakeProngs(); + for (int i = 0; i < fNprong; i++) { + fProngs[i] = vtx.fProngs[i]; + } } return *this; } +//______________________________________________________________________________ +void AliAODVertex::AddDaughter(TObject *daughter) +{ + // Add reference to daughter track + if (!fProngs) { + if (fDaughters.GetEntries()==0) { + TRefArray* arr = &fDaughters; + new(arr)TRefArray(TProcessID::GetProcessWithUID(daughter)); + } + fDaughters.Add(daughter); + } else { + if (fIprong < fNprong) { + fProngs[fIprong++] = daughter; + } else { + AliWarning("Number of daughters out of range !\n"); + } + } + return; +} + + //______________________________________________________________________________ template void AliAODVertex::GetSigmaXYZ(T sigma[3]) const { @@ -200,13 +264,18 @@ template void AliAODVertex::GetSigmaXYZ(T sigma[3]) const 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++; - } - + Int_t cont = 0; + + TString vtitle = GetTitle(); + if (!vtitle.Contains("VertexerTracks")) { + cont = fNContributors; + } else { + for (Int_t iDaug = 0; iDaug < GetNDaughters(); iDaug++) { + AliAODTrack* aodT = dynamic_cast(fDaughters.At(iDaug)); + if (!aodT) continue; + if (aodT->GetUsedForPrimVtxFit()) cont++; + } + } return cont; } @@ -214,12 +283,19 @@ Int_t AliAODVertex::GetNContributors() const Bool_t AliAODVertex::HasDaughter(TObject *daughter) const { // Checks if the given daughter (particle) is part of this vertex. - - TRefArrayIter iter(&fDaughters); - while (TObject *daugh = iter.Next()) { - if (daugh == daughter) return kTRUE; - } - return kFALSE; + if (!fProngs) { + TRefArrayIter iter(&fDaughters); + while (TObject *daugh = iter.Next()) { + if (daugh == daughter) return kTRUE; + } + return kFALSE; + } else { + Bool_t has = kFALSE; + for (int i = 0; i < fNprong; i++) { + if (fProngs[i].GetObject() == daughter) has = kTRUE; + } + return has; + } } //______________________________________________________________________________ @@ -456,7 +532,7 @@ void AliAODVertex::PrintIndices() const TRefArrayIter iter(&fDaughters); while (TObject *daugh = iter.Next()) { - printf("Particle %p originates from this vertex.\n", daugh); + printf("Particle %p originates from this vertex.\n", static_cast(daugh)); } } @@ -469,7 +545,7 @@ void AliAODVertex::Print(Option_t* /*option*/) const printf(" x = %f\n", fPosition[0]); printf(" y = %f\n", fPosition[1]); printf(" z = %f\n", fPosition[2]); - printf(" parent particle: %p\n", fParent.GetObject()); + printf(" parent particle: %p\n", static_cast(fParent.GetObject())); printf(" origin of %d particles\n", fDaughters.GetEntriesFast()); printf(" vertex type %d\n", fType);