ATLAS Offline Software
Loading...
Searching...
No Matches
T2Vertex.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5/**********************************************************************************
6 *
7 *
8 * @project: HLT, PESA algorithms
9 * @package: TrigT2BeamSpot
10 * @class : T2Vertex
11 *
12 * @brief Helper class that provides an interface to TrigVertex
13 * with some additional functionality used by the beam spot algorithm
14 *
15 * @author Rainer Bartoldus, SLAC, <bartoldu@slac.stanford.edu>
16 * @author David W. Miller, SLAC/Stanford University, <David.W.Miller@cern.ch>
17 *
18 **********************************************************************************/
19
20#ifndef TRIGT2BEAMSPOT_T2VERTEX_H
21#define TRIGT2BEAMSPOT_T2VERTEX_H
22
24#include "T2BeamSpot.h"
25
29#include "TMath.h"
30
31#include <string>
32#include <vector>
33#include <cmath>
34#include <iostream>
35
36namespace PESA
37{
38 class T2Vertex;
39
40 // Helpers
41 double vertexChi2Prob( const T2Vertex& vertex );
42
43 double vertexSumPt ( const TrackCollection& tracks );
44 double vertexSumPt2( const TrackCollection& tracks );
45
46 double tiltedBeamPositionAtZPoint( double Zref, double nominalZPosition,
47 double nominalTransversePosition, double tilt );
48
50 {
51 public:
52 // Constructor
53 T2SimpleVertex( const TrigVertex& vertex )
54 : m_NTrks ( ( vertex.ndof() + 3 ) / 2 )
55 , m_X ( vertex.x() )
56 , m_Y ( vertex.y() )
57 , m_Z ( vertex.z() )
58 // FIXME: TrigVertex::cov() is not const-correct
59 , m_Xerr ( sqrt( const_cast< TrigVertex& >(vertex).cov()[0] ) )
60 , m_Yerr ( sqrt( const_cast< TrigVertex& >(vertex).cov()[2] ) )
61 , m_Zerr ( sqrt( const_cast< TrigVertex& >(vertex).cov()[5] ) )
62 {
63 }
64
65 // Accessors
66 unsigned NTrks () const { return m_NTrks; }
67 double X () const { return m_X ; }
68 double Y () const { return m_Y ; }
69 double Z () const { return m_Z ; }
70 double Xerr () const { return m_Xerr ; }
71 double Yerr () const { return m_Yerr ; }
72 double Zerr () const { return m_Zerr ; }
73
74 private:
75 // Data members
76 unsigned m_NTrks;
77 double m_X ;
78 double m_Y ;
79 double m_Z ;
80 double m_Xerr ;
81 double m_Yerr ;
82 double m_Zerr ;
83 };
84
85
86 class T2Vertex : public T2SimpleVertex
87 {
88 public:
89 // Constructor
90
91 T2Vertex( const TrigVertex& vertex, const TrackCollection& tracks, const T2BeamSpot& beamSpot, double seedZ )
92 : T2SimpleVertex( vertex )
93 , m_SumPt ( -1. ) // lazy evaluation
94 , m_SumPt2 ( -1. )
95 , m_Mass ( vertex.mass() )
96 , m_NDF ( vertex.ndof() )
97 , m_Qual ( vertex.chi2() / vertex.ndof() ) // FIXME: ndof==0 ?
98 , m_Chi2Prob( -1. ) // lazy evaluation
99 , m_XY ( 0. )
100 , m_Pull ( vertex.z() - seedZ ) // FIXME: that's not a pull
101 , m_tracks (tracks)
102 {
103 const double beamXatVtx =
104 tiltedBeamPositionAtZPoint( Z(), beamSpot.posZ(), beamSpot.posX(), beamSpot.tiltX() );
105 const double beamYatVtx =
106 tiltedBeamPositionAtZPoint( Z(), beamSpot.posZ(), beamSpot.posY(), beamSpot.tiltY() );
107
108 m_XZoom = X() - beamXatVtx;
109 m_YZoom = Y() - beamYatVtx;
110 m_ZZoom = Z() - beamSpot.posZ();
111 }
112
113 // Accessors
114 double SumPt () const {
115 if ( m_SumPt < 0. ) {
116 return vertexSumPt ( m_tracks );
117 }
118 else {
119 return m_SumPt;
120 }
121 }
122
123 double SumPt2 () const {
124 if ( m_SumPt2 < 0. ) {
125 return vertexSumPt2 ( m_tracks );
126 }
127 else {
128 return m_SumPt2;
129 }
130 }
131
132 double Mass () const { return m_Mass ; }
133 double NDF () const { return m_NDF ; }
134 double Qual () const { return m_Qual ; }
135 double Chi2Prob() const { if ( m_Chi2Prob < 0. ) m_Chi2Prob = vertexChi2Prob( *this ); return m_Chi2Prob; }
136 double XZoom () const { return m_XZoom ; }
137 double YZoom () const { return m_YZoom ; }
138 double ZZoom () const { return m_ZZoom ; }
139 double XY () const { return m_XY ; }
140 double Pull () const { return m_Pull ; }
141
142 unsigned NTrksInVtx() const { return m_tracks.size(); }
143
144
145 private:
146 // Data members
147 double m_SumPt ;
148 double m_SumPt2 ;
149 double m_Mass ;
150 double m_NDF ;
151 double m_Qual ;
152 mutable std::atomic<double> m_Chi2Prob;
153 double m_XZoom ;
154 double m_YZoom ;
155 double m_ZZoom ;
156 double m_XY ;
157 double m_Pull ;
158
160 };
161
162
163 std::ostream& operator<<( std::ostream& os, const T2Vertex& vertex );
164
165} // end namespace
166
167#endif
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
#define y
#define x
#define z
double Yerr() const
Definition T2Vertex.h:71
double X() const
Definition T2Vertex.h:67
double Z() const
Definition T2Vertex.h:69
double Xerr() const
Definition T2Vertex.h:70
double Zerr() const
Definition T2Vertex.h:72
unsigned NTrks() const
Definition T2Vertex.h:66
double Y() const
Definition T2Vertex.h:68
T2SimpleVertex(const TrigVertex &vertex)
Definition T2Vertex.h:53
double m_Qual
Definition T2Vertex.h:151
double XY() const
Definition T2Vertex.h:139
double m_XZoom
Definition T2Vertex.h:153
double SumPt2() const
Definition T2Vertex.h:123
unsigned NTrksInVtx() const
Definition T2Vertex.h:142
TrackCollection m_tracks
Definition T2Vertex.h:159
double m_Pull
Definition T2Vertex.h:157
double Mass() const
Definition T2Vertex.h:132
double m_Mass
Definition T2Vertex.h:149
double Qual() const
Definition T2Vertex.h:134
T2Vertex(const TrigVertex &vertex, const TrackCollection &tracks, const T2BeamSpot &beamSpot, double seedZ)
Definition T2Vertex.h:91
double ZZoom() const
Definition T2Vertex.h:138
double YZoom() const
Definition T2Vertex.h:137
double m_SumPt2
Definition T2Vertex.h:148
double XZoom() const
Definition T2Vertex.h:136
double NDF() const
Definition T2Vertex.h:133
double m_ZZoom
Definition T2Vertex.h:155
double m_YZoom
Definition T2Vertex.h:154
double Chi2Prob() const
Definition T2Vertex.h:135
std::atomic< double > m_Chi2Prob
Definition T2Vertex.h:152
double SumPt() const
Definition T2Vertex.h:114
double m_SumPt
Definition T2Vertex.h:147
double Pull() const
Definition T2Vertex.h:140
encapsulates LVL2 vertex parameters (in the global reference frame), covariance matrix,...
Definition TrigVertex.h:28
double chi2(TH1 *h0, TH1 *h1)
Local tools.
Definition idx.h:9
double tiltedBeamPositionAtZPoint(double Zref, double nominalZPosition, double nominalTransversePosition, double tilt)
Definition T2Vertex.cxx:41
double vertexChi2Prob(const T2Vertex &vertex)
Definition T2Vertex.cxx:27
double vertexSumPt2(const TrackCollection &tracks)
Definition T2Vertex.cxx:77
double vertexSumPt(const TrackCollection &tracks)
Definition T2Vertex.cxx:71
std::ostream & operator<<(std::ostream &os, const T2BeamSpot &beamSpot)