ATLAS Offline Software
VertexPositions.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  VertexPositions.cxx - Description
7  -------------------
8  begin : Autumn 2006
9  authors : Giacinto Piacquadio (Freiburg University)
10  email : Giacinto.Piacquadio@physik.uni-freiburg.de
11  comments:
12  changes :
13 
14  ***************************************************************************/
15 
17 
18 namespace Trk {
19 
21  : Trk::ObjectCounter<Trk::VertexPositions>()
22  , m_position(Amg::VectorX())
23  , m_useWeightTimesPosition(false)
24 {
25  m_position.setZero();
26 }
27 
28 VertexPositions::VertexPositions(const Amg::VectorX& p)
30  , m_position(p)
31  , m_useWeightTimesPosition(false)
32 {
33 }
34 
35 MsgStream&
36 VertexPositions::dump(MsgStream& sl) const
37 {
38  if (m_useWeightTimesPosition) {
39  sl << "Trk::VertexPositions weight times position: (";
40  } else {
41  sl << "Trk::VertexPositions position: (";
42  }
43  sl << "xv " << m_position[jet_xv] << ", "
44  << "yv " << m_position[jet_yv] << ", "
45  << "zv " << m_position[jet_zv] << ", "
46  << "phi " << m_position[jet_phi] << ", "
47  << "theta " << m_position[jet_theta] << endmsg;
48  for (int i = 5; i < m_position.rows(); i++) {
49  sl << "dist" << i << " " << m_position[i] << " ." << endmsg;
50  }
51  return sl;
52 }
53 
54 std::ostream&
55 VertexPositions::dump(std::ostream& sl) const
56 {
57  if (m_useWeightTimesPosition) {
58  sl << "Trk::VertexPositions weight times position: (";
59  } else {
60  sl << "Trk::VertexPositions position: (";
61  }
62  sl << "xv " << m_position[jet_xv] << ", "
63  << "yv " << m_position[jet_yv] << ", "
64  << "zv " << m_position[jet_zv] << ", "
65  << "phi " << m_position[jet_phi] << ", "
66  << "theta " << m_position[jet_theta] << std::endl;
67  for (int i = 5; i < m_position.rows(); i++) {
68  sl << "dist" << i << " " << m_position[i] << " ." << std::endl;
69  }
70  return sl;
71 }
72 
73 MsgStream&
74 operator<<(MsgStream& sl, const VertexPositions& sf)
75 {
76  return sf.dump(sl);
77 }
78 
79 std::ostream&
80 operator<<(std::ostream& sl, const VertexPositions& sf)
81 {
82  return sf.dump(sl);
83 }
84 
85 const Amg::VectorX&
86 VertexPositions::position() const
87 {
88  if (!m_useWeightTimesPosition) {
89  return m_position;
90  }
91  std::cout << "FATAL: VertexPositions is not able to return a valid position "
92  << " as a const object: need to go from Update to Use mode. "
93  "Unrecovered Bug!"
94  << std::endl;
95  std::abort();
96  // return m_position;
97 }
98 
99 void
100 VertexPositions::setPosition(const Amg::VectorX& newposition)
101 {
102  m_position = newposition;
103 }
104 } // end of namespace
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Trk::jet_theta
@ jet_theta
Definition: JetVtxParamDefs.h:28
Trk::jet_xv
@ jet_xv
Definition: JetVtxParamDefs.h:27
VertexPositions.h
Trk::ObjectCounter
Helper to enable counting number of instantiations in debug builds.
Definition: TrkObjectCounter.h:18
run_Egamma1_LArStrip_Fex.dump
dump
Definition: run_Egamma1_LArStrip_Fex.py:88
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trk::jet_yv
@ jet_yv
Definition: JetVtxParamDefs.h:27
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::operator<<
std::ostream & operator<<(std::ostream &sl, const VertexPositions &sf)
Definition: VertexPositions.cxx:89
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Trk::VertexPositions::VertexPositions
VertexPositions()
default constructor
Definition: VertexPositions.cxx:29
Trk::jet_zv
@ jet_zv
position x,y,z of primary vertex
Definition: JetVtxParamDefs.h:27
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
Trk::jet_phi
@ jet_phi
Definition: JetVtxParamDefs.h:28
Trk::VertexPositions
VertexPositions class to represent and store a vertex.
Definition: VertexPositions.h:36