A new function returning the unconstrained primary vertex (A. Dainese)
authorbelikov <belikov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Jul 2009 08:58:11 +0000 (08:58 +0000)
committerbelikov <belikov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Jul 2009 08:58:11 +0000 (08:58 +0000)
STEER/AliESDEvent.cxx
STEER/AliESDEvent.h

index 7c9996e..962e1ae 100644 (file)
@@ -49,6 +49,7 @@
 #include "AliESDPmdTrack.h"
 #include "AliESDTrdTrack.h"
 #include "AliESDVertex.h"
+#include "AliVertexerTracks.h"
 #include "AliESDcascade.h"
 #include "AliESDkink.h"
 #include "AliESDtrack.h"
@@ -993,6 +994,31 @@ const AliESDVertex * AliESDEvent::GetPrimaryVertex() const
   return fSPDVertex;
 }
 
+AliESDVertex * AliESDEvent::PrimaryVertexTracksUnconstrained() const 
+{
+  //
+  // Removes diamond constraint from fPrimaryVertex (reconstructed with tracks)
+  // Returns a AliESDVertex which has to be deleted by the user
+  //
+  if(!fPrimaryVertex) {
+    AliWarning("No primary vertex from tracks available.");
+    return 0;
+  }
+  if(!fPrimaryVertex->GetStatus()) {
+    AliWarning("No primary vertex from tracks available.");
+    return 0;
+  }
+
+  AliVertexerTracks vertexer(GetMagneticField());
+  Float_t diamondxyz[3]={(Float_t)GetDiamondX(),(Float_t)GetDiamondY(),0.};
+  Float_t diamondcovxy[3]; GetDiamondCovXY(diamondcovxy);
+  Float_t diamondcov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,7.};
+  AliESDVertex *vertex = 
+    (AliESDVertex*)vertexer.RemoveConstraintFromVertex(fPrimaryVertex,diamondxyz,diamondcov);
+
+  return vertex;
+}
+
 void AliESDEvent::SetMultiplicity(const AliMultiplicity *mul) 
 {
   // Set the SPD Multiplicity
index 144acc3..c15f9dd 100644 (file)
@@ -201,6 +201,7 @@ public:
 
   void SetPrimaryVertexTracks(const AliESDVertex *vertex);
   const AliESDVertex *GetPrimaryVertexTracks() const {return fPrimaryVertex;}
+  AliESDVertex *PrimaryVertexTracksUnconstrained() const;
 
   const AliESDVertex *GetPrimaryVertex() const;