ATLAS Offline Software
Loading...
Searching...
No Matches
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
10MSVertex::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
13MSVertex::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
24MSVertex::~MSVertex() = default;
25
26void MSVertex::setPosition(const Amg::Vector3D& position) { m_position = position; }
27
29
30const std::vector<const xAOD::TrackParticle*>* MSVertex::getTracks(void) const { return &m_tracks; }
31
32void MSVertex::setAuthor(const int author) { m_author = author; }
33
34int MSVertex::getAuthor() const { return m_author; }
35double MSVertex::getChi2Probability() const { return m_chi2prob; }
36double MSVertex::getChi2() const { return m_chi2; }
37
39 if (getTracks())
40 return getTracks()->size();
41 else
42 return 0;
43}
44
45void 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
54void 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
63void 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
73int MSVertex::getNMDT() const { return m_nMDT; }
74int MSVertex::getNRPC() const { return m_nRPC; }
75int MSVertex::getNTGC() const { return m_nTGC; }
76
77const 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}; }
78const 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}; }
79const 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
82std::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
93MsgStream& operator<<(MsgStream& m, const MSVertex& a) { return (m << str(a)); }
94
95bool 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}
static const double DELTA
static Double_t a
static Double_t ss
MsgStream & operator<<(MsgStream &m, const MSVertex &a)
Definition MSVertex.cxx:93
bool operator==(const MSVertex &a, const MSVertex &b)
Definition MSVertex.cxx:95
const Amg::Vector3D & getPosition() const
Definition MSVertex.cxx:28
int m_nMDT_M
Definition MSVertex.h:60
int m_nTGC_M
Definition MSVertex.h:62
std::vector< const xAOD::TrackParticle * > m_tracks
Definition MSVertex.h:55
const std::vector< int > getNMDT_all() const
Definition MSVertex.cxx:77
int getNRPC() const
Definition MSVertex.cxx:74
unsigned int m_author
Definition MSVertex.h:51
const std::vector< const xAOD::TrackParticle * > * getTracks() const
Definition MSVertex.cxx:30
virtual ~MSVertex()
int m_nTGC_inwards
Definition MSVertex.h:62
int m_nRPC
Definition MSVertex.h:61
int m_nRPC_O
Definition MSVertex.h:61
const std::vector< int > getNTGC_all() const
Definition MSVertex.cxx:79
int getAuthor() const
Definition MSVertex.cxx:34
void setNRPC(const int, const int, const int, const int, const int, const int)
Definition MSVertex.cxx:54
int m_nRPC_I
Definition MSVertex.h:61
int m_nRPC_M
Definition MSVertex.h:61
void setAuthor(const int)
Definition MSVertex.cxx:32
const std::vector< int > getNRPC_all() const
Definition MSVertex.cxx:78
int m_nTGC
Definition MSVertex.h:62
void setPosition(const Amg::Vector3D &)
Definition MSVertex.cxx:26
double getChi2() const
Definition MSVertex.cxx:36
void setNMDT(const int, const int, const int, const int, const int, const int)
Definition MSVertex.cxx:45
int getNTGC() const
Definition MSVertex.cxx:75
MSVertex()=default
double m_chi2prob
Definition MSVertex.h:57
int m_nRPC_inwards
Definition MSVertex.h:61
Amg::Vector3D m_position
Definition MSVertex.h:53
int m_nMDT_O
Definition MSVertex.h:60
int m_nTGC_E
Definition MSVertex.h:62
int getNTracks() const
Definition MSVertex.cxx:38
int m_nTGC_O
Definition MSVertex.h:62
int getNMDT() const
Definition MSVertex.cxx:73
double m_chi2
Definition MSVertex.h:58
int m_nMDT
Definition MSVertex.h:60
int m_nRPC_E
Definition MSVertex.h:61
void setNTGC(const int, const int, const int, const int, const int, const int)
Definition MSVertex.cxx:63
int m_nMDT_E
Definition MSVertex.h:60
int m_nMDT_I
Definition MSVertex.h:60
int m_nTGC_I
Definition MSVertex.h:62
double getChi2Probability() const
Definition MSVertex.cxx:35
int m_nMDT_inwards
Definition MSVertex.h:60
double chi2(TH1 *h0, TH1 *h1)
Eigen::Matrix< double, 3, 1 > Vector3D