ATLAS Offline Software
T2Track.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  * @project: HLT, PESA algorithms
6  * @package: TrigT2BeamSpot
7  * @class : T2Track
8  *
9  * @brief Helper class that provides an interface to Trk::Track
10  * with some additional functionality used by the beam spot algorithm
11  *
12  * @author Rainer Bartoldus, SLAC, <bartoldu@slac.stanford.edu>
13  * @author David W. Miller, SLAC/Stanford University, <David.W.Miller@cern.ch>
14  *
15  **********************************************************************************/
16 #ifndef TRIGT2BEAMSPOT_T2TRACK_H
17 #define TRIGT2BEAMSPOT_T2TRACK_H
18 #include "TrkTrack/Track.h"
21 #include "GaudiKernel/SystemOfUnits.h"
22 // Amg::error
24 #include <string>
25 #include <vector>
26 #include <cmath>
27 #include <iostream>
28 #include "TMath.h"
29 
30 namespace PESA {
31 
32  class T2Track
33  {
34  public:
35 
36  // Constructor
37  T2Track( const Trk::Track& track )
38  {
39 
40  const Trk::TrackParameters* trackPars = track.perigeeParameters();
41  if (trackPars) {
42  m_D0 = trackPars->parameters()[Trk::d0];
43  m_Z0 = trackPars->parameters()[Trk::z0];
44  if (trackPars->covariance()) {
45  m_D0err = Amg::error(*(trackPars->covariance()),Trk::d0);
46  m_Z0err = Amg::error(*(trackPars->covariance()),Trk::z0);
47  }
48  m_Phi = trackPars->parameters()[Trk::phi0];
49  float theta = trackPars->parameters()[Trk::theta];
50  m_Eta = -log(tan(0.5*theta));
51  float qOverP = trackPars->parameters()[Trk::qOverP];
52  m_Pt = std::abs(std::sin(theta)/qOverP)/Gaudi::Units::GeV;
53 
54  const Trk::FitQuality* fq = track.fitQuality();
55  m_Qual = 1e8;
56  if (fq) {
57  if(fq->numberDoF()!=0) {
58  m_Qual = fq->chiSquared()/fq->numberDoF();
59  }
60  }
61  int nPix=0;
62  int nSct=0;
63  if( track.trackSummary() != nullptr){
64  nPix = track.trackSummary()->get(Trk::numberOfPixelHits);
65  nSct = track.trackSummary()->get(Trk::numberOfSCTHits);
66  } else {
67  for(auto tSOS = track.trackStateOnSurfaces()->begin();
68  tSOS!=track.trackStateOnSurfaces()->end(); ++tSOS) {
69  if ((*tSOS)->type(Trk::TrackStateOnSurface::Perigee) == false) {
70  const Trk::FitQualityOnSurface& fq = (*tSOS)->fitQualityOnSurface();
71  if(!fq) continue;
72  int nd = fq.numberDoF();
73  if(nd==2) nPix++;
74  if(nd==1) nSct++;
75  }
76  }
77  }
78  m_PIXHits = nPix;
79  m_SCTHits = nSct/2;
81  m_NDF = (m_PIXHits + m_SCTHits)*2 - 5;
82  m_TRTHits = 0; //for now: FTF tracks have no TRT extension in any case
83  }
84  m_Chi2Prob = -1;
85  const double chi2 = m_Qual * m_NDF;
86  if ( m_NDF > 0 && chi2 > 0. && ! std::isinf( chi2 ) )
87  {
88  m_Chi2Prob = TMath::Prob(chi2,m_NDF);
89  }
90  }
91 
92  T2Track(const T2Track& track) = default;
93 
94 
95  // Accessors
96  double Pt () const { return m_Pt ; }
97  double Eta () const { return m_Eta ; }
98  double Phi () const { return m_Phi ; }
99  double Z0 () const { return m_Z0 ; }
100  double D0 () const { return m_D0 ; }
101  double Z0err () const { return m_Z0err ; }
102  double D0err () const { return m_D0err ; }
103  double NDF () const { return m_NDF ; }
104  double Qual () const { return m_Qual ; }
105  double Chi2Prob() const { return m_Chi2Prob; }
106  int SiHits () const { return m_SiHits ; }
107  int PIXHits () const { return m_PIXHits ; }
108  int SCTHits () const { return m_SCTHits ; }
109  int TRTHits () const { return m_TRTHits ; }
110 
111  private:
112 
113  static double trackChi2Prob(int ndf, double chi2);
114 
115  // Data members
116  double m_Pt;
117  double m_Eta;
118  double m_Phi;
119  double m_Z0;
120  double m_D0;
121  double m_Z0err;
122  double m_D0err;
123  double m_NDF;
124  double m_Qual;
125  double m_Chi2Prob;
126  int m_SiHits;
130  };
131 
132  std::ostream& operator<<( std::ostream& os, const T2Track& track );
133 
134 } // end namespace
135 
136 #endif
covarianceTool.ndf
ndf
Definition: covarianceTool.py:678
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
PESA::T2Track::m_Chi2Prob
double m_Chi2Prob
Definition: T2Track.h:147
Trk::TrackStateOnSurface::Perigee
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
Definition: TrackStateOnSurface.h:117
PESA::T2Track::TRTHits
int TRTHits() const
Definition: T2Track.h:131
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
PESA::T2Track::m_Qual
double m_Qual
Definition: T2Track.h:146
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
PESA::T2Track::SiHits
int SiHits() const
Definition: T2Track.h:128
PESA::T2Track::m_Phi
double m_Phi
Definition: T2Track.h:140
EventPrimitivesHelpers.h
PESA::T2Track::SCTHits
int SCTHits() const
Definition: T2Track.h:130
PESA::T2Track::m_Z0
double m_Z0
Definition: T2Track.h:141
PESA::T2Track::D0err
double D0err() const
Definition: T2Track.h:124
PESA::operator<<
std::ostream & operator<<(std::ostream &os, const T2BeamSpot &beamSpot)
Definition: T2BeamSpot.cxx:15
Trk::z0
@ z0
Definition: ParamDefs.h:64
PESA::T2Track::m_SCTHits
int m_SCTHits
Definition: T2Track.h:150
PESA::T2Track::PIXHits
int PIXHits() const
Definition: T2Track.h:129
PESA::T2Track::m_Eta
double m_Eta
Definition: T2Track.h:139
InDetAccessor::qOverP
@ qOverP
perigee
Definition: InDetAccessor.h:35
PESA::T2Track::Eta
double Eta() const
Definition: T2Track.h:119
Track.h
PESA
Local tools.
Definition: T2BeamSpot.cxx:13
Trk::FitQualityOnSurface
Definition: FitQualityOnSurface.h:19
PESA::T2Track::m_Z0err
double m_Z0err
Definition: T2Track.h:143
PESA::T2Track::m_Pt
double m_Pt
Definition: T2Track.h:138
Trk::theta
@ theta
Definition: ParamDefs.h:66
PESA::T2Track::NDF
double NDF() const
Definition: T2Track.h:125
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
PESA::T2Track::m_PIXHits
int m_PIXHits
Definition: T2Track.h:149
PESA::T2Track::D0
double D0() const
Definition: T2Track.h:122
PESA::T2Track::Z0
double Z0() const
Definition: T2Track.h:121
PESA::T2Track::m_SiHits
int m_SiHits
Definition: T2Track.h:148
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::FitQualityOnSurface::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
PESA::T2Track::m_NDF
double m_NDF
Definition: T2Track.h:145
PESA::T2Track::m_D0err
double m_D0err
Definition: T2Track.h:144
Trk::d0
@ d0
Definition: ParamDefs.h:63
Amg::error
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Definition: EventPrimitivesHelpers.h:40
PESA::T2Track::Qual
double Qual() const
Definition: T2Track.h:126
PESA::T2Track::Phi
double Phi() const
Definition: T2Track.h:120
PESA::T2Track::m_D0
double m_D0
Definition: T2Track.h:142
PESA::T2Track
Definition: T2Track.h:44
PESA::T2Track::Pt
double Pt() const
Definition: T2Track.h:118
PESA::T2Track::trackChi2Prob
static double trackChi2Prob(int ndf, double chi2)
PESA::T2Track::m_TRTHits
int m_TRTHits
Definition: T2Track.h:151
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
PESA::T2Track::Z0err
double Z0err() const
Definition: T2Track.h:123
Trk::FitQuality::chiSquared
double chiSquared() const
returns the of the overall track fit
Definition: FitQuality.h:56
Trk::FitQuality::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
PESA::T2Track::T2Track
T2Track(const Trk::Track &track)
Definition: T2Track.h:59
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
PESA::T2Track::Chi2Prob
double Chi2Prob() const
Definition: T2Track.h:127
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Trk::phi0
@ phi0
Definition: ParamDefs.h:65