From 1cfd3170bbfa92c58310fe06167ab92bd1a51f50 Mon Sep 17 00:00:00 2001
From: Giacinto Piacquadio <giacinto.piacquadio@cern.ch>
Date: Thu, 24 Nov 2016 05:26:06 +0100
Subject: [PATCH] add functionality, fix endreq (VxJetVertex-00-04-09)

	* Move to branch. Tag as VxJetVertex-00-04-09

2016-11-11 Giacinto Piacquadio <giacinto.piacquadio@stonybrook.edu>
	* Bug fix in new method

2016-11-06 Giacinto Piacquadio <giacinto.piacquadio@stonybrook.edu>
	* Add functionality to VxClusteringTable
---
 .../VxJetVertex/VxClusteringTable.h           | 15 +++++-
 .../VxJetVertex/src/VxClusteringTable.cxx     | 46 +++++++++++++++++--
 2 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/Tracking/TrkEvent/VxJetVertex/VxJetVertex/VxClusteringTable.h b/Tracking/TrkEvent/VxJetVertex/VxJetVertex/VxClusteringTable.h
index cf36816cf50..ffff1e7551f 100644
--- a/Tracking/TrkEvent/VxJetVertex/VxJetVertex/VxClusteringTable.h
+++ b/Tracking/TrkEvent/VxJetVertex/VxJetVertex/VxClusteringTable.h
@@ -10,10 +10,14 @@
               Christian Weiser (University of Freiburg)
     e-mails:  giacinto.piacquadio@physik.uni-freiburg.de)
               christian.weiser@cern.ch
-    changes: new!
 
    (c) Atlas Collaboration 2007
 
+   (1) November 6, 2016
+       adding support for differentiating between pair of probabilities with PV or without      
+       Giacinto Piacquadio (Stony Brook University)
+       giacinto.piacquadio@stonybrook.edu
+
    This class stores the information about the compatiblity of the vertices fitted 
    on the Jet Axis among themselves and with the Primary Vertex.
 
@@ -33,6 +37,7 @@
 #include "VxJetVertex/PairOfVxVertexOnJetAxis.h"
 #include <map>
  
+
 namespace Trk {
 
   class VxVertexOnJetAxis;
@@ -71,7 +76,13 @@ namespace Trk {
     const std::map<float,PairOfVxVertexOnJetAxis> & 
       getCompatibilityPairOfVertices(void) const;
     
-
+  /**
+   * Get pair of vertices with highest compatibility, removing cases with primary
+   */
+ 
+    PairOfVxVertexOnJetAxis getMostCompatibleVerticesExcludingPrimary(float & probability) const;
+    
+ 
 
   /** 
    * Output Method for MsgStream, to be overloaded by child classes 
diff --git a/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx b/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx
index 969d77bb6c8..5a6421dc6e3 100644
--- a/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx
+++ b/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx
@@ -40,12 +40,12 @@ namespace Trk {
   }
   
   MsgStream& VxClusteringTable::dump(MsgStream& sl) const {
-    sl << "Trk::VxClusteringTable:" << endreq;
+    sl << "Trk::VxClusteringTable:" << endmsg;
     if (m_compatibilityPairOfVertices.size()==0) {
-      sl << "No couple of vertices contained in the table " << endreq;
+      sl << "No couple of vertices contained in the table " << endmsg;
     } else {
-      sl << "Numbers of compatibilities store: " << m_compatibilityPairOfVertices.size() << endreq;;
-      sl << "Highest probability: " << m_compatibilityPairOfVertices.rbegin()->first << endreq;;
+      sl << "Numbers of compatibilities store: " << m_compatibilityPairOfVertices.size() << endmsg;;
+      sl << "Highest probability: " << m_compatibilityPairOfVertices.rbegin()->first << endmsg;;
       
       std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompBegin=m_compatibilityPairOfVertices.begin();
       std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompEnd=m_compatibilityPairOfVertices.end();
@@ -55,7 +55,7 @@ namespace Trk {
 	
 	sl << " Compatibility between track n " << (*CompIter).second.first->getNumVertex() << 
 	  " and " << (*CompIter).second.second->getNumVertex() << " is " << (*CompIter).first << 
-	  endreq;
+	  endmsg;
 	
       }   
       
@@ -127,4 +127,40 @@ namespace Trk {
     
   }
 
+  PairOfVxVertexOnJetAxis VxClusteringTable::getMostCompatibleVerticesExcludingPrimary(float & probability) const 
+  {
+    
+    std::map<float,PairOfVxVertexOnJetAxis>::const_reverse_iterator revIteratorEnd=m_compatibilityPairOfVertices.rbegin();
+    std::map<float,PairOfVxVertexOnJetAxis>::const_reverse_iterator revIterator=revIteratorEnd;
+    std::map<float,PairOfVxVertexOnJetAxis>::const_reverse_iterator pairHighest=revIteratorEnd;
+    
+    bool found(false);
+    for ( ; revIterator!=m_compatibilityPairOfVertices.rend() ; revIterator++)
+    {
+      
+      const PairOfVxVertexOnJetAxis & myVxVertex=(*revIterator).second;
+      VxVertexOnJetAxis* firstVertex=myVxVertex.first;
+      VxVertexOnJetAxis* secondVertex=myVxVertex.second;
+      
+      if (firstVertex->getNumVertex()==-10 || secondVertex->getNumVertex()==-10)
+      {
+        continue;
+      }
+      
+      found=true;
+      pairHighest=revIterator;
+      break;
+    }
+    
+ 
+    if (!found)
+    {
+      probability=0;
+      return PairOfVxVertexOnJetAxis();
+    }
+ 
+    probability=(*pairHighest).first;
+    return (*pairHighest).second;
+  }
+ 
 }//end namespace
-- 
GitLab