ATLAS Offline Software
TIDAVertex.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
12 #ifndef TIDA_VERTEX_H
13 #define TIDA_VERTEX_H
14 
15 #include <iostream>
16 #include <vector>
17 
19 
20 
21 namespace TIDA {
22 
23 class Vertex : public TObject {
24 
25 public:
26 
27  Vertex( double x=0, double y=0, double z=0,
28  double dx=0, double dy=0, double dz=0,
29  int Ntracks=0, double c2=0, int dof=0,
30  const std::vector<TIDA::Track*>* tracks=0 );
31 
32  // copy constructor
33  Vertex(const TIDA::Vertex& v);
34 
35  // destructor
36  virtual ~Vertex() {}
37 
38  // Tracks passed to addTracks() should belong to the vertex
39  void addTracks( const std::vector<TIDA::Track*>& tracks );
40 
41  // Select tracks with specific ids from a track collection and add to vertex
42  void selectTracks( const std::vector<TIDA::Track*>& trackCollection,
43  const std::vector<unsigned long>& trackIds );
44 
45  void selectTracks( const std::vector<TIDA::Track*>& trackCollection );
46 
47  // vertex parameter accessors
48  const double* position() const { return m_x; }
49  double* position() { return m_x; }
50 
51  double x() const { return m_x[0]; }
52  double y() const { return m_x[1]; }
53  double z() const { return m_x[2]; }
54 
55  const double* error() const { return m_dx; }
56  double* error() { return m_dx; }
57 
58  double dx() const { return m_dx[0]; }
59  double dy() const { return m_dx[1]; }
60  double dz() const { return m_dx[2]; }
61 
62  int Ntracks() const { return m_Ntracks; }
63 
64  double chi2() const { return m_chi2; }
65  int ndof() const { return m_ndof; }
66 
67  const std::vector<TIDA::Track*>& tracks() const { return m_tracks; }
68 
69  const std::vector<unsigned long>& ids() const { return m_ids; }
70 
71  const TIDA::Track* operator[] ( const int i ) const {
72  if ( m_tracks.size() > 0 ) return m_tracks.at( i );
73  return nullptr; }
74 
75 private:
76 
77  // internal track addition method
78  void addTrack( TIDA::Track* trk ) { m_tracks.push_back(trk); }
79 
80  // vertex parameters
81  double m_x[3];
82  double m_dx[3];
83 
84  int m_Ntracks;
85  double m_chi2;
86  int m_ndof;
87 
88  // vertex tracks
89  std::vector<TIDA::Track*> m_tracks;
90  std::vector<unsigned long> m_ids;
91 
92  ClassDef(TIDA::Vertex,3)
93 
94 };
95 
96 }
97 
98 inline std::ostream& operator<<( std::ostream& s, const TIDA::Vertex& t ) {
99  return s << "[ x=" << t.position()[0] << " +- " << t.error()[0]
100  << "\ty=" << t.position()[1] << " +- " << t.error()[1]
101  << "\tz=" << t.position()[2] << " +- " << t.error()[2]
102  << ";\tchi2=" << t.chi2() << "/" << t.ndof()
103  << "\tNtracks=" << t.Ntracks() << "\t]";
104 }
105 
106 #endif // TIDA_VERTEX_H
Track.h
TIDA
Test for xAOD.
Definition: Filter_AcceptAll.h:22
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TIDA::Vertex::addTracks
void addTracks(const std::vector< TIDA::Track * > &tracks)
Definition: TIDAVertex.cxx:52
TIDA::Vertex::m_tracks
std::vector< TIDA::Track * > m_tracks
Definition: TIDAVertex.h:89
TIDA::Vertex::ids
const std::vector< unsigned long > & ids() const
Definition: TIDAVertex.h:69
TIDA::Vertex::y
double y() const
Definition: TIDAVertex.h:52
TIDA::Vertex::~Vertex
virtual ~Vertex()
Definition: TIDAVertex.h:36
TIDA::Vertex::ndof
int ndof() const
Definition: TIDAVertex.h:65
TIDA::Vertex::chi2
double chi2() const
Definition: TIDAVertex.h:64
TIDA::Vertex::m_chi2
double m_chi2
Definition: TIDAVertex.h:85
TIDA::Vertex::m_ids
std::vector< unsigned long > m_ids
Definition: TIDAVertex.h:90
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TIDA::Vertex::m_dx
double m_dx[3]
Definition: TIDAVertex.h:82
TIDA::Vertex::error
double * error()
Definition: TIDAVertex.h:56
lumiFormat.i
int i
Definition: lumiFormat.py:85
TIDA::Vertex::m_ndof
int m_ndof
Definition: TIDAVertex.h:86
TIDA::Vertex::dy
double dy() const
Definition: TIDAVertex.h:59
TIDA::Vertex::dz
double dz() const
Definition: TIDAVertex.h:60
TIDA::Vertex::operator[]
const TIDA::Track * operator[](const int i) const
Definition: TIDAVertex.h:71
TIDA::Vertex::position
double * position()
Definition: TIDAVertex.h:49
TIDA::Vertex::selectTracks
void selectTracks(const std::vector< TIDA::Track * > &trackCollection, const std::vector< unsigned long > &trackIds)
Definition: TIDAVertex.cxx:65
TIDA::Vertex
Definition: TIDAVertex.h:23
TIDA::Vertex::position
const double * position() const
Definition: TIDAVertex.h:48
TIDA::Vertex::m_Ntracks
int m_Ntracks
Definition: TIDAVertex.h:84
TIDA::Vertex::error
const double * error() const
Definition: TIDAVertex.h:55
TIDA::Vertex::m_x
double m_x[3]
Definition: TIDAVertex.h:81
TIDA::Vertex::z
double z() const
Definition: TIDAVertex.h:53
python.PyAthena.v
v
Definition: PyAthena.py:154
TIDA::Vertex::Ntracks
int Ntracks() const
Definition: TIDAVertex.h:62
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
TIDA::Vertex::tracks
const std::vector< TIDA::Track * > & tracks() const
Definition: TIDAVertex.h:67
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
operator<<
std::ostream & operator<<(std::ostream &s, const TIDA::Vertex &t)
Definition: TIDAVertex.h:98
TIDA::Vertex::Vertex
Vertex(double x=0, double y=0, double z=0, double dx=0, double dy=0, double dz=0, int Ntracks=0, double c2=0, int dof=0, const std::vector< TIDA::Track * > *tracks=0)
TIDA::Vertex::addTrack
void addTrack(TIDA::Track *trk)
Definition: TIDAVertex.h:78
TIDA::Vertex::x
double x() const
Definition: TIDAVertex.h:51
TIDA::Vertex::dx
double dx() const
Definition: TIDAVertex.h:58