ATLAS Offline Software
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>
21 using Gaudi::Units::GeV;
22 using std::accumulate;
23 
24 
25 namespace 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 
64  struct TrkTrackPt2
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 }
covarianceTool.ndf
ndf
Definition: covarianceTool.py:678
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
PESA::vertexSumPt
double vertexSumPt(const TrackCollection &tracks)
Definition: T2Vertex.cxx:71
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
T2Vertex.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
PESA::T2Vertex
Definition: T2Vertex.h:100
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
PESA::operator<<
std::ostream & operator<<(std::ostream &os, const T2BeamSpot &beamSpot)
Definition: T2BeamSpot.cxx:15
PESA::TrkTrackPt2
Definition: T2Vertex.cxx:65
PESA::tiltedBeamPositionAtZPoint
double tiltedBeamPositionAtZPoint(double Zref, double nominalZPosition, double nominalTransversePosition, double tilt)
Definition: T2Vertex.cxx:41
x
#define x
PESA::TrkTrackPt2::operator()
double operator()(const Trk::Track *track)
Definition: T2Vertex.cxx:66
Track.h
PESA
Local tools.
Definition: T2BeamSpot.cxx:13
PESA::vertexSumPt2
double vertexSumPt2(const TrackCollection &tracks)
Definition: T2Vertex.cxx:77
PESA::TrkTrackPt
Definition: T2Vertex.cxx:56
Trk::theta
@ theta
Definition: ParamDefs.h:66
TrackCollection.h
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk::ParametersBase
Definition: ParametersBase.h:55
DataVector< Trk::Track >
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
PESA::vertexChi2Prob
double vertexChi2Prob(const T2Vertex &vertex)
Definition: T2Vertex.cxx:27
PESA::TrkSumOf
Definition: T2Vertex.cxx:50
PESA::TrkSumOf::operator()
double operator()(double x, const Trk::Track *track)
Definition: T2Vertex.cxx:51
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
PESA::TrkTrackPt::operator()
double operator()(const Trk::Track *track)
Definition: T2Vertex.cxx:57
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.