ATLAS Offline Software
VxClusteringTable.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***************************************************************************
6  VxClusteringTable.h - Description
7  -------------------
8  begin : Februar 2007
9  authors : Giacinto Piacquadio (University of Freiburg)
10  Christian Weiser (University of Freiburg)
11  e-mails: giacinto.piacquadio@physik.uni-freiburg.de)
12  christian.weiser@cern.ch
13  changes: new!
14 
15  (c) Atlas Collaboration 2007
16 
17  For more details look into the header file.
18 
19 
20  ***************************************************************************/
21 
24 
25 namespace Trk {
26 
28 
30 
31  MsgStream& VxClusteringTable::dump(MsgStream& sl) const {
32  sl << "Trk::VxClusteringTable:" << endmsg;
33  if (m_compatibilityPairOfVertices.empty()) {
34  sl << "No couple of vertices contained in the table " << endmsg;
35  } else {
36  sl << "Numbers of compatibilities store: " << m_compatibilityPairOfVertices.size() << endmsg;
37  sl << "Highest probability: " << m_compatibilityPairOfVertices.rbegin()->first << endmsg;
38 
39  std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompBegin=m_compatibilityPairOfVertices.begin();
40  std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompEnd=m_compatibilityPairOfVertices.end();
41 
42  for (std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompIter=CompBegin;
43  CompIter!=CompEnd;++CompIter) {
44 
45  sl << " Compatibility between track n " << (*CompIter).second.first->getNumVertex() <<
46  " and " << (*CompIter).second.second->getNumVertex() << " is " << (*CompIter).first <<
47  endmsg;
48 
49  }
50 
51  }
52  return sl;
53  }
54 
55  MsgStream& operator << ( MsgStream& sl, const VxClusteringTable& sf)
56  { return sf.dump(sl); }
57 
58  std::ostream& operator << ( std::ostream& sl, const VxClusteringTable& sf)
59  { return sf.dump(sl); }
60 
61  std::ostream& VxClusteringTable::dump(std::ostream& sl) const {
62  sl << "Trk::VxClusteringTable:" << std::endl;
63  if (m_compatibilityPairOfVertices.empty()) {
64  sl << "No couple of vertices contained in the table " << std::endl;
65  } else {
66  sl << "Numbers of compatibilities store: " << m_compatibilityPairOfVertices.size() << std::endl;
67  sl << "Highest probability: " << m_compatibilityPairOfVertices.rbegin()->first << std::endl;
68 
69  std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompBegin=m_compatibilityPairOfVertices.begin();
70  std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompEnd=m_compatibilityPairOfVertices.end();
71 
72  for (std::map<float,PairOfVxVertexOnJetAxis>::const_iterator CompIter=CompBegin;
73  CompIter!=CompEnd;++CompIter) {
74 
75  sl << " Compatibility between track n " << (*CompIter).second.first->getNumVertex() <<
76  " and " << (*CompIter).second.second->getNumVertex() << " is " << (*CompIter).first <<
77  std::endl;
78 
79 
80  }
81 
82  }
83  return sl;
84  }
85 
86  const std::map<float,PairOfVxVertexOnJetAxis> & VxClusteringTable::getCompatibilityPairOfVertices(void) const {
88  }
89 
90 
91  void VxClusteringTable::setCompatibilityOfTo(const PairOfVxVertexOnJetAxis& pairOfVertices,float compatibility) {
92  if (compatibility!=0) {
93  m_compatibilityPairOfVertices[compatibility]=pairOfVertices;
94  }
95  // else {
96  // std::cout << "Warning in VxClusteringTable: assigning to a couple of track 0 probability. Should not happen (waste of time!) " << std::endl;
97  //}
98  //GP 02-04-2007 Too verbose... happens too often...
99  }
100 
101 
103 
104  if (m_compatibilityPairOfVertices.empty()) {
105  // std::cout << "Warning in VxClusteringTable: requested highest compatibility to an empty probability table" << std::endl;
106  //GP 02-04-2007 Too verbose... happens too often...
107  probability=0;
108  return {};
109  }
110 
111  std::map<float,PairOfVxVertexOnJetAxis>::const_reverse_iterator pairHighest=
113 
114  probability=(*pairHighest).first;
115  return (*pairHighest).second;
116 
117  }
118 
120  {
121 
122  std::map<float,PairOfVxVertexOnJetAxis>::const_reverse_iterator revIteratorEnd=m_compatibilityPairOfVertices.rbegin();
123  std::map<float,PairOfVxVertexOnJetAxis>::const_reverse_iterator revIterator=revIteratorEnd;
124  std::map<float,PairOfVxVertexOnJetAxis>::const_reverse_iterator pairHighest=revIteratorEnd;
125 
126  bool found(false);
127  for ( ; revIterator!=m_compatibilityPairOfVertices.rend() ; ++revIterator)
128  {
129 
130  const PairOfVxVertexOnJetAxis & myVxVertex=(*revIterator).second;
131  VxVertexOnJetAxis* firstVertex=myVxVertex.first;
132  VxVertexOnJetAxis* secondVertex=myVxVertex.second;
133 
134  if (firstVertex->getNumVertex()==-10 || secondVertex->getNumVertex()==-10)
135  {
136  continue;
137  }
138 
139  found=true;
140  pairHighest=revIterator;
141  break;
142  }
143 
144 
145  if (!found)
146  {
147  probability=0;
148  return {};
149  }
150 
151  probability=(*pairHighest).first;
152  return (*pairHighest).second;
153  }
154 
155 }//end namespace
VxVertexOnJetAxis.h
Trk::VxClusteringTable::VxClusteringTable
VxClusteringTable()
Default constructor, if called initializes a VxClusteringTable with all data members set to 0.
Trk::VxVertexOnJetAxis
VxVertexOnJetAxis inherits from Vertex.
Definition: VxVertexOnJetAxis.h:79
Trk::PairOfVxVertexOnJetAxis
Definition: PairOfVxVertexOnJetAxis.h:53
Trk::VxClusteringTable::dump
MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
Definition: VxClusteringTable.cxx:46
Trk::VxClusteringTable::~VxClusteringTable
~VxClusteringTable()
VxClusteringTable.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trk::VxClusteringTable::m_compatibilityPairOfVertices
std::map< float, PairOfVxVertexOnJetAxis > m_compatibilityPairOfVertices
Definition: VxClusteringTable.h:124
Trk::VxVertexOnJetAxis::getNumVertex
int getNumVertex(void) const
Get Method for NumVertex.
Definition: VxVertexOnJetAxis.cxx:98
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::VxClusteringTable::getCompatibilityPairOfVertices
const std::map< float, PairOfVxVertexOnJetAxis > & getCompatibilityPairOfVertices(void) const
Get back full compatibility info (only for reading)
Definition: VxClusteringTable.cxx:101
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
Trk::VxClusteringTable::setCompatibilityOfTo
void setCompatibilityOfTo(const PairOfVxVertexOnJetAxis &, float)
Set compatibility of a new pair of tracks.
Definition: VxClusteringTable.cxx:106
Trk::VxClusteringTable::getMostCompatibleVerticesExcludingPrimary
PairOfVxVertexOnJetAxis getMostCompatibleVerticesExcludingPrimary(float &probability) const
Get pair of vertices with highest compatibility, removing cases with primary.
Definition: VxClusteringTable.cxx:134
Trk::VxClusteringTable::getMostCompatibleVertices
PairOfVxVertexOnJetAxis getMostCompatibleVertices(float &probability) const
Get pair of tracks with highest compatibility.
Definition: VxClusteringTable.cxx:117