ATLAS Offline Software
Loading...
Searching...
No Matches
T2Vertex.cxx
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// $Id: T2Vertex.cxx 793162 2017-01-20 03:48:25Z ssnyder $
7//
8
9// This class
10#include "T2Vertex.h"
11
12// Externals
14#include "TrkTrack/Track.h"
15#include "GaudiKernel/SystemOfUnits.h"
16#include "TMath.h"
17
18#include <functional>
19#include <numeric>
20#include <cmath>
21using Gaudi::Units::GeV;
22using std::accumulate;
23
24
25namespace PESA
26{
27 double vertexChi2Prob( const T2Vertex& vertex )
28 {
29 // FIXME: unify with trackChi2Prob()
30 double chi2Prob = 0.;
31 const int ndf = vertex.NDF();
32 const double chi2 = vertex.Qual() * vertex.NDF();
33 if ( ndf > 0 && chi2 > 0. && ! std::isinf( chi2 ) )
34 {
35 chi2Prob = TMath::Prob(chi2,ndf);
36 }
37 return chi2Prob;
38 }
39
40
41 double tiltedBeamPositionAtZPoint( double Zref, double nominalZPosition,
42 double nominalTransversePosition, double tilt )
43 {
45 return nominalTransversePosition + tan(tilt) * (Zref-nominalZPosition);
46 }
47
48 template <class T>
49 struct TrkSumOf
50 {
51 double operator()( double x, const Trk::Track* track ) { return x + T()( track ); }
52 };
53
54
55 struct TrkTrackPt
56 {
57 double operator()( const Trk::Track* track ) {
58 const Trk::TrackParameters* params = track->perigeeParameters();
59 return std::abs(sin(params->parameters()[Trk::theta])/params->parameters()[Trk::qOverP])/GeV;
60 }
61 };
62
63
65 {
66 double operator()( const Trk::Track* track ) { const double pT = TrkTrackPt()( track ); return pT*pT; }
67 };
68
69
70
71 double vertexSumPt( const TrackCollection& tracks )
72 {
73 return accumulate( tracks.begin(), tracks.end(), 0., TrkSumOf< TrkTrackPt >() );
74 }
75
76
77 double vertexSumPt2( const TrackCollection& tracks )
78 {
79 return sqrt( accumulate( tracks.begin(), tracks.end(), 0., TrkSumOf< TrkTrackPt2 >() ) );
80 }
81
82 std::ostream& operator<<( std::ostream& os, const T2Vertex& vertex )
83 {
84 os
85 << "Vertex x +/- dx = " << vertex.X() << " +/- " << vertex.Xerr() << '\n'
86 << "Vertex y +/- dy = " << vertex.Y() << " +/- " << vertex.Yerr() << '\n'
87 << "Vertex z +/- dz = " << vertex.Z() << " +/- " << vertex.Zerr() << '\n'
88 << "Vertex N tracks = " << vertex.NTrks() << '\n'
89 << "Vertex fit mass = " << vertex.Mass() << '\n'
90 << "Vertex fit qual = " << vertex.Qual() << '\n'
91 << "Vertex fit prob = " << vertex.Chi2Prob() << '\n'
92 ;
93 return os;
94 }
95
96}
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
#define x
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
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)
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
ParametersBase< TrackParametersDim, Charged > TrackParameters
double operator()(double x, const Trk::Track *track)
Definition T2Vertex.cxx:51
double operator()(const Trk::Track *track)
Definition T2Vertex.cxx:66
double operator()(const Trk::Track *track)
Definition T2Vertex.cxx:57