Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MSVertex.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <sstream>
8 
9 
10 MSVertex::MSVertex(int author, const Amg::Vector3D& position, double chi2prob, double chi2, int nMDT, int nRPC, int nTGC) :
11  m_author(author), m_position(position), m_tracks(0), m_chi2prob(chi2prob), m_chi2(chi2), m_nMDT(nMDT), m_nRPC(nRPC), m_nTGC(nTGC) {}
12 
13 MSVertex::MSVertex(int author, const Amg::Vector3D& position, const std::vector<const xAOD::TrackParticle*>& tracks, double chi2prob, double chi2,
14  int nMDT, int nRPC, int nTGC) :
15  m_author(author),
16  m_position(position),
17  m_tracks(tracks),
18  m_chi2prob(chi2prob),
19  m_chi2(chi2),
20  m_nMDT(nMDT),
21  m_nRPC(nRPC),
22  m_nTGC(nTGC) {}
23 
24 MSVertex::~MSVertex() = default;
25 
26 void MSVertex::setPosition(const Amg::Vector3D& position) { m_position = position; }
27 
29 
30 const std::vector<const xAOD::TrackParticle*>* MSVertex::getTracks(void) const { return &m_tracks; }
31 
32 void MSVertex::setAuthor(const int author) { m_author = author; }
33 
34 int MSVertex::getAuthor() const { return m_author; }
35 double MSVertex::getChi2Probability() const { return m_chi2prob; }
36 double MSVertex::getChi2() const { return m_chi2; }
37 
38 int MSVertex::getNTracks() const {
39  if (getTracks())
40  return getTracks()->size();
41  else
42  return 0;
43 }
44 
45 void MSVertex::setNMDT(const int nMDT, const int nMDT_inwards, const int nMDT_I, const int nMDT_E, const int nMDT_M, const int nMDT_O) {
46  m_nMDT = nMDT; // total number of MDT hits around the vertex
47  m_nMDT_inwards = nMDT_inwards; // number of MDT hits around the vertex inwards of the vertex position
48  m_nMDT_I = nMDT_I; // number of MDT hits around the vertex in the inner layer
49  m_nMDT_E = nMDT_E; // number of MDT hits around the vertex in the extended layer
50  m_nMDT_M = nMDT_M; // number of MDT hits around the vertex in the middle layer
51  m_nMDT_O = nMDT_O; // number of MDT hits around the vertex in the outer layer
52 }
53 
54 void MSVertex::setNRPC(const int nRPC, const int nRPC_inwards, const int nRPC_I, const int nRPC_E, const int nRPC_M, const int nRPC_O) {
55  m_nRPC = nRPC;
56  m_nRPC_inwards = nRPC_inwards;
57  m_nRPC_I = nRPC_I;
58  m_nRPC_E = nRPC_E;
59  m_nRPC_M = nRPC_M;
60  m_nRPC_O = nRPC_O;
61 }
62 
63 void MSVertex::setNTGC(const int nTGC, const int nTGC_inwards, const int nTGC_I, const int nTGC_E, const int nTGC_M, const int nTGC_O) {
64  m_nTGC = nTGC;
65  m_nTGC_inwards = nTGC_inwards;
66  m_nTGC_I = nTGC_I;
67  m_nTGC_E = nTGC_E;
68  m_nTGC_M = nTGC_M;
69  m_nTGC_O = nTGC_O;
70 }
71 
72 
73 int MSVertex::getNMDT() const { return m_nMDT; }
74 int MSVertex::getNRPC() const { return m_nRPC; }
75 int MSVertex::getNTGC() const { return m_nTGC; }
76 
77 const std::vector<int> MSVertex::getNMDT_all() const { return std::vector<int> {m_nMDT, m_nMDT_inwards, m_nMDT_I, m_nMDT_E, m_nMDT_M, m_nMDT_O}; }
78 const std::vector<int> MSVertex::getNRPC_all() const { return std::vector<int> {m_nRPC, m_nRPC_inwards, m_nRPC_I, m_nRPC_E, m_nRPC_M, m_nRPC_O}; }
79 const std::vector<int> MSVertex::getNTGC_all() const { return std::vector<int> {m_nTGC, m_nTGC_inwards, m_nTGC_I, m_nTGC_E, m_nTGC_M, m_nTGC_O}; }
80 
81 
82 std::string str(const MSVertex& a) {
83  std::stringstream ss;
84 
85  ss << "author = " << a.getAuthor() << "; x = " << a.getPosition().x() << "; y = " << a.getPosition().y()
86  << "; z = " << a.getPosition().z() << "; phi = " << a.getPosition().phi() << "; eta = " << a.getPosition().eta()
87  << "; chi2 prob. = " << a.getChi2Probability() << "; # tracks = " << a.getNTracks() << "; # MDT hits = " << a.getNMDT()
88  << "; # RPC hits = " << a.getNRPC() << "; # TGC hits = " << a.getNTGC();
89 
90  return ss.str();
91 }
92 
93 MsgStream& operator<<(MsgStream& m, const MSVertex& a) { return (m << str(a)); }
94 
95 bool operator==(const MSVertex& a, const MSVertex& b) {
96  //* distance used to compare floats *//
97  const double DELTA = 1e-3;
98 
99  if (std::abs(a.getPosition().x() - b.getPosition().x()) > DELTA) return false;
100  if (std::abs(a.getPosition().y() - b.getPosition().y()) > DELTA) return false;
101  if (std::abs(a.getPosition().z() - b.getPosition().z()) > DELTA) return false;
102  if (std::abs(a.getPosition().eta() - b.getPosition().eta()) > DELTA) return false;
103  if (std::abs(a.getPosition().phi() - b.getPosition().phi()) > DELTA) return false;
104  if (std::abs(a.getChi2Probability() - b.getChi2Probability()) > DELTA) return false;
105 
106  if (a.getAuthor() - b.getAuthor() != 0) return false;
107  if (a.getNTracks() - b.getNTracks() != 0) return false;
108  if (a.getNMDT() - b.getNMDT() != 0) return false;
109  if (a.getNRPC() - b.getNRPC() != 0) return false;
110  if (a.getNTGC() - b.getNTGC() != 0) return false;
111 
112  return true;
113 }
MSVertex::m_nMDT
int m_nMDT
Definition: MSVertex.h:60
MSVertex::setPosition
void setPosition(const Amg::Vector3D &)
Definition: MSVertex.cxx:26
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
MSVertex::getNTracks
int getNTracks() const
Definition: MSVertex.cxx:38
MSVertex::m_position
Amg::Vector3D m_position
Definition: MSVertex.h:53
MSVertex::m_nMDT_I
int m_nMDT_I
Definition: MSVertex.h:60
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MSVertex::m_nRPC_E
int m_nRPC_E
Definition: MSVertex.h:61
MSVertex::m_chi2
double m_chi2
Definition: MSVertex.h:58
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
MSVertex::m_nTGC
int m_nTGC
Definition: MSVertex.h:62
MSVertex::setNTGC
void setNTGC(const int, const int, const int, const int, const int, const int)
Definition: MSVertex.cxx:63
MSVertex::m_nTGC_I
int m_nTGC_I
Definition: MSVertex.h:62
MSVertex.h
MSVertex::getChi2
double getChi2() const
Definition: MSVertex.cxx:36
MSVertex::getChi2Probability
double getChi2Probability() const
Definition: MSVertex.cxx:35
MSVertex::getNTGC_all
const std::vector< int > getNTGC_all() const
Definition: MSVertex.cxx:79
MSVertex::setNMDT
void setNMDT(const int, const int, const int, const int, const int, const int)
Definition: MSVertex.cxx:45
operator<<
MsgStream & operator<<(MsgStream &m, const MSVertex &a)
Definition: MSVertex.cxx:93
MSVertex::m_nRPC_M
int m_nRPC_M
Definition: MSVertex.h:61
MSVertex
Definition: MSVertex.h:13
MSVertex::m_nTGC_E
int m_nTGC_E
Definition: MSVertex.h:62
MSVertex::m_tracks
std::vector< const xAOD::TrackParticle * > m_tracks
Definition: MSVertex.h:55
MSVertex::getNRPC_all
const std::vector< int > getNRPC_all() const
Definition: MSVertex.cxx:78
MSVertex::m_nMDT_E
int m_nMDT_E
Definition: MSVertex.h:60
MSVertex::m_chi2prob
double m_chi2prob
Definition: MSVertex.h:57
MSVertex::getNRPC
int getNRPC() const
Definition: MSVertex.cxx:74
str
std::string str(const MSVertex &a)
Definition: MSVertex.cxx:82
MSVertex::~MSVertex
virtual ~MSVertex()
MSVertex::getNMDT
int getNMDT() const
Definition: MSVertex.cxx:73
MSVertex::getTracks
const std::vector< const xAOD::TrackParticle * > * getTracks() const
Definition: MSVertex.cxx:30
MSVertex::setNRPC
void setNRPC(const int, const int, const int, const int, const int, const int)
Definition: MSVertex.cxx:54
MSVertex::getNMDT_all
const std::vector< int > getNMDT_all() const
Definition: MSVertex.cxx:77
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:525
MSVertex::m_nRPC_I
int m_nRPC_I
Definition: MSVertex.h:61
MSVertex::setAuthor
void setAuthor(const int)
Definition: MSVertex.cxx:32
MSVertex::m_author
unsigned int m_author
Definition: MSVertex.h:51
MSVertex::getNTGC
int getNTGC() const
Definition: MSVertex.cxx:75
MSVertex::m_nTGC_inwards
int m_nTGC_inwards
Definition: MSVertex.h:62
MSVertex::m_nRPC
int m_nRPC
Definition: MSVertex.h:61
MSVertex::m_nTGC_M
int m_nTGC_M
Definition: MSVertex.h:62
MSVertex::m_nRPC_O
int m_nRPC_O
Definition: MSVertex.h:61
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
MSVertex::m_nMDT_inwards
int m_nMDT_inwards
Definition: MSVertex.h:60
MSVertex::m_nTGC_O
int m_nTGC_O
Definition: MSVertex.h:62
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
a
TList * a
Definition: liststreamerinfos.cxx:10
MSVertex::MSVertex
MSVertex()=default
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
MSVertex::m_nRPC_inwards
int m_nRPC_inwards
Definition: MSVertex.h:61
MSVertex::m_nMDT_M
int m_nMDT_M
Definition: MSVertex.h:60
operator==
bool operator==(const MSVertex &a, const MSVertex &b)
Definition: MSVertex.cxx:95
MSVertex::m_nMDT_O
int m_nMDT_O
Definition: MSVertex.h:60
MSVertex::getAuthor
int getAuthor() const
Definition: MSVertex.cxx:34
MSVertex::getPosition
const Amg::Vector3D & getPosition() const
Definition: MSVertex.cxx:28