ATLAS Offline Software
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 
36 namespace 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 
49  class T2SimpleVertex
50  {
51  public:
52  // Constructor
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 )
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
PESA::T2SimpleVertex::m_Z
double m_Z
Definition: T2Vertex.h:92
IDTPM::ndof
float ndof(const U &p)
Definition: TrackParametersHelper.h:134
PESA::vertexSumPt
double vertexSumPt(const TrackCollection &tracks)
Definition: T2Vertex.cxx:71
PESA::T2Vertex::m_tracks
TrackCollection m_tracks
Definition: T2Vertex.h:172
PESA::T2Vertex::m_Pull
double m_Pull
Definition: T2Vertex.h:170
PESA::T2Vertex::NTrksInVtx
unsigned NTrksInVtx() const
Definition: T2Vertex.h:155
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
PESA::T2Vertex
Definition: T2Vertex.h:100
PESA::T2Vertex::ZZoom
double ZZoom() const
Definition: T2Vertex.h:151
T2BeamSpot.h
PESA::T2Vertex::Mass
double Mass() const
Definition: T2Vertex.h:145
PESA::T2Vertex::m_ZZoom
double m_ZZoom
Definition: T2Vertex.h:168
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
PESA::operator<<
std::ostream & operator<<(std::ostream &os, const T2BeamSpot &beamSpot)
Definition: T2BeamSpot.cxx:15
PESA::T2Vertex::m_SumPt
double m_SumPt
Definition: T2Vertex.h:160
PESA::T2Vertex::m_Qual
double m_Qual
Definition: T2Vertex.h:164
PESA::T2Vertex::XY
double XY() const
Definition: T2Vertex.h:152
PESA::tiltedBeamPositionAtZPoint
double tiltedBeamPositionAtZPoint(double Zref, double nominalZPosition, double nominalTransversePosition, double tilt)
Definition: T2Vertex.cxx:41
PESA::T2SimpleVertex::NTrks
unsigned NTrks() const
Definition: T2Vertex.h:79
PESA::T2Vertex::m_SumPt2
double m_SumPt2
Definition: T2Vertex.h:161
PESA::T2Vertex::m_NDF
double m_NDF
Definition: T2Vertex.h:163
x
#define x
PESA::T2SimpleVertex::m_Xerr
double m_Xerr
Definition: T2Vertex.h:93
PESA::T2SimpleVertex
Definition: T2Vertex.h:63
PESA
Local tools.
Definition: T2BeamSpot.cxx:13
PESA::vertexSumPt2
double vertexSumPt2(const TrackCollection &tracks)
Definition: T2Vertex.cxx:77
PESA::T2Vertex::Qual
double Qual() const
Definition: T2Vertex.h:147
PESA::T2BeamSpot
Definition: T2BeamSpot.h:32
PESA::T2Vertex::Chi2Prob
double Chi2Prob() const
Definition: T2Vertex.h:148
z
#define z
PESA::T2SimpleVertex::Z
double Z() const
Definition: T2Vertex.h:82
PESA::T2SimpleVertex::Y
double Y() const
Definition: T2Vertex.h:81
TrackCollection.h
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:523
PESA::T2Vertex::XZoom
double XZoom() const
Definition: T2Vertex.h:149
PESA::T2Vertex::SumPt
double SumPt() const
Definition: T2Vertex.h:127
DataVector< Trk::Track >
PESA::T2Vertex::m_YZoom
double m_YZoom
Definition: T2Vertex.h:167
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
PESA::T2SimpleVertex::m_Y
double m_Y
Definition: T2Vertex.h:91
PESA::vertexChi2Prob
double vertexChi2Prob(const T2Vertex &vertex)
Definition: T2Vertex.cxx:27
PESA::T2Vertex::YZoom
double YZoom() const
Definition: T2Vertex.h:150
PESA::T2Vertex::Pull
double Pull() const
Definition: T2Vertex.h:153
PESA::T2SimpleVertex::X
double X() const
Definition: T2Vertex.h:80
PESA::T2SimpleVertex::m_Zerr
double m_Zerr
Definition: T2Vertex.h:95
PESA::T2SimpleVertex::Yerr
double Yerr() const
Definition: T2Vertex.h:84
PESA::T2SimpleVertex::m_NTrks
unsigned m_NTrks
Definition: T2Vertex.h:89
PESA::T2SimpleVertex::m_X
double m_X
Definition: T2Vertex.h:90
PESA::T2Vertex::m_Mass
double m_Mass
Definition: T2Vertex.h:162
PESA::T2SimpleVertex::m_Yerr
double m_Yerr
Definition: T2Vertex.h:94
PESA::T2Vertex::m_Chi2Prob
std::atomic< double > m_Chi2Prob
Definition: T2Vertex.h:165
TrigVertex.h
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
y
#define y
TrigVertex
Definition: TrigVertex.h:28
PESA::T2SimpleVertex::Xerr
double Xerr() const
Definition: T2Vertex.h:83
PESA::T2Vertex::m_XY
double m_XY
Definition: T2Vertex.h:169
PESA::T2Vertex::T2Vertex
T2Vertex(const TrigVertex &vertex, const TrackCollection &tracks, const T2BeamSpot &beamSpot, double seedZ)
Definition: T2Vertex.h:104
PESA::T2SimpleVertex::Zerr
double Zerr() const
Definition: T2Vertex.h:85
python.BuildSignatureFlags.beamSpot
AthConfigFlags beamSpot(AthConfigFlags flags, str instanceName, str recoMode)
Definition: BuildSignatureFlags.py:454
PESA::T2Vertex::m_XZoom
double m_XZoom
Definition: T2Vertex.h:166
PESA::T2Vertex::SumPt2
double SumPt2() const
Definition: T2Vertex.h:136
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
PESA::T2Vertex::NDF
double NDF() const
Definition: T2Vertex.h:146
PESA::T2SimpleVertex::T2SimpleVertex
T2SimpleVertex(const TrigVertex &vertex)
Definition: T2Vertex.h:66