]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fix to GetVertex
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Jan 2009 15:10:32 +0000 (15:10 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Jan 2009 15:10:32 +0000 (15:10 +0000)
FMD/AliFMDReconstructor.cxx
FMD/AliFMDReconstructor.h

index 5e9cab6d9ea9d9c52129cb2a2db084df79abd7ec..327cde400318e0dcd3da2e01b6c0a0a1535f4457 100644 (file)
@@ -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));
index a04989d0c16086ea7816d6bfab3dc4c07fed568e..5837faeedcc7c20f5a2f2fa5a32602f6e3d9a4d3 100644 (file)
@@ -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$,