From: cholm Date: Wed, 28 Jan 2009 15:10:32 +0000 (+0000) Subject: Fix to GetVertex X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=8983e5aee9d1b366badf25261dc9e45808dd687e;p=u%2Fmrichter%2FAliRoot.git Fix to GetVertex --- diff --git a/FMD/AliFMDReconstructor.cxx b/FMD/AliFMDReconstructor.cxx index 5e9cab6d9ea..327cde40031 100644 --- a/FMD/AliFMDReconstructor.cxx +++ b/FMD/AliFMDReconstructor.cxx @@ -219,32 +219,32 @@ AliFMDReconstructor::ConvertDigits(AliRawReader* reader, //____________________________________________________________________ void -AliFMDReconstructor::GetVertex() const +AliFMDReconstructor::GetVertex(AliESDEvent* esd) const { // Return the vertex to use. // This is obtained from the ESD object. // If not found, a warning is issued. fVertexType = kNoVertex; fCurrentVertex = 0; - if (fESD) { - const AliESDVertex* vertex = fESD->GetPrimaryVertex(); - if (!vertex) vertex = fESD->GetPrimaryVertexSPD(); - if (!vertex) vertex = fESD->GetPrimaryVertexTPC(); - if (!vertex) vertex = fESD->GetVertex(); - - if (vertex) { - AliFMDDebug(2, ("Got %s (%s) from ESD: %f", - vertex->GetName(), vertex->GetTitle(), vertex->GetZv())); - fCurrentVertex = vertex->GetZv(); - fVertexType = kESDVertex; - return; - } - else if (fESD->GetESDTZERO()) { - AliFMDDebug(2, ("Got primary vertex from T0: %f", fESD->GetT0zVertex())); - fCurrentVertex = fESD->GetT0zVertex(); - fVertexType = kESDVertex; - return; - } + if (!esd) return; + + const AliESDVertex* vertex = esd->GetPrimaryVertex(); + if (!vertex) vertex = esd->GetPrimaryVertexSPD(); + if (!vertex) vertex = esd->GetPrimaryVertexTPC(); + if (!vertex) vertex = esd->GetVertex(); + + if (vertex) { + AliFMDDebug(2, ("Got %s (%s) from ESD: %f", + vertex->GetName(), vertex->GetTitle(), vertex->GetZv())); + fCurrentVertex = vertex->GetZv(); + fVertexType = kESDVertex; + return; + } + else if (esd->GetESDTZERO()) { + AliFMDDebug(2, ("Got primary vertex from T0: %f", esd->GetT0zVertex())); + fCurrentVertex = esd->GetT0zVertex(); + fVertexType = kESDVertex; + return; } AliWarning("Didn't get any vertex from ESD or generator"); } @@ -320,7 +320,7 @@ AliFMDReconstructor::Reconstruct(TTree* digitsTree, // clusterTree Pointer to output tree // AliFMDDebug(2, ("Reconstructing from digits in a tree")); - GetVertex(); + GetVertex(fESD); TBranch *digitBranch = digitsTree->GetBranch("FMD"); if (!digitBranch) { @@ -777,7 +777,7 @@ AliFMDReconstructor::FillESD(TTree* /* digitsTree */, // fESDObj->Print(); Double_t oldVz = fCurrentVertex; - GetVertex(); + GetVertex(esd); if (fVertexType != kNoVertex) { AliFMDDebug(2, ("Revertexing the ESD data to vz=%f (was %f)", fCurrentVertex, oldVz)); diff --git a/FMD/AliFMDReconstructor.h b/FMD/AliFMDReconstructor.h index a04989d0c16..5837faeedcc 100644 --- a/FMD/AliFMDReconstructor.h +++ b/FMD/AliFMDReconstructor.h @@ -178,8 +178,10 @@ protected: * Try to get the vertex from either ESD or generator header. Sets * @c fCurrentVertex to the found Z posistion of the vertex (if * found), and sets the flag @c fVertexType accordingly + * + * @param esd ESD structure to get Vz from */ - virtual void GetVertex() const; + virtual void GetVertex(AliESDEvent* esd) const; /** * Process AliFMDDigit objects in @a digits. For each digit, find * the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,