ATLAS Offline Software
Loading...
Searching...
No Matches
TrackParticleTraits.h
Go to the documentation of this file.
1// emacs: this is -*- c++ -*-
13
14#ifndef TRACKPARTICLETRAITS_H
15#define TRACKPARTICLETRAITS_H
16
17#include "TrackTraits.h"
18
20
21
22template<>
23struct TrackTraits<xAOD::TrackParticle> : public TrackTraitsBase<xAOD::TrackParticle> {
24
25public:
26
28 uint8_t n(0); t.summaryValue(n, type); return n;
29 }
30
31 static float theta(const xAOD::TrackParticle& t) { return t.theta(); }
32 static float qOverP(const xAOD::TrackParticle& t) { return t.qOverP(); }
33
34 static float z0(const xAOD::TrackParticle& t) { return t.z0()+t.vz(); }
35 static float d0(const xAOD::TrackParticle& t) { return t.d0(); }
36
37 static float E(const xAOD::TrackParticle& t) { return t.e(); }
38 static float ET(const xAOD::TrackParticle& t) { return t.e()*t.theta(); }
39
40 static float p(const xAOD::TrackParticle& t) {
41 if ( t.qOverP()==0 ) throw std::runtime_error( "divide by 0 - track qOverP() is 0" );
42 return 1/t.qOverP();
43 }
44
45
48 static float dphi(const xAOD::TrackParticle& t) { return std::sqrt(t.definingParametersCovMatrix()(Trk::phi0,Trk::phi0)); }
49 static float dtheta(const xAOD::TrackParticle& t) { return std::sqrt(t.definingParametersCovMatrix()(Trk::theta,Trk::theta)); }
50 static float dqOverP(const xAOD::TrackParticle& t) { return std::sqrt(t.definingParametersCovMatrix()(Trk::qOverP,Trk::qOverP)); }
51
52 static float deta(const xAOD::TrackParticle& t) { return 0.5*dtheta(t)/(std::cos(0.5*theta(t))*std::cos(0.5*theta(t))*std::tan(0.5*theta(t))); } // ???? CHECK THIS <<--
53
54 static float dz0(const xAOD::TrackParticle& t) { return std::sqrt(t.definingParametersCovMatrix()(Trk::z0,Trk::z0)); }
55 static float dd0(const xAOD::TrackParticle& t) { return std::sqrt(t.definingParametersCovMatrix()(Trk::d0,Trk::d0)); }
56
57 static float dpt(const xAOD::TrackParticle& t) {
58 double th = theta(t);
59 double dth = dtheta(t);
60 double sintheta = std::sin(th);
61 double costheta = std::cos(th);
62 double p_ = p(t);
63 double dqovp = dqOverP(t);
64 double dpt2 = (p_*p_*sintheta)*(p_*p_*sintheta)*dqovp*dqovp + (p_*costheta)*(p_*costheta)*dth*dth - 2*(p_*p_*sintheta)*(p_*costheta)*covthetaOvP(t);
65 if ( dpt2>0 ) return std::sqrt( dpt2 );
66 return 0;
67 }
68
69 static float covthetaOvP(const xAOD::TrackParticle& t) { return t.definingParametersCovMatrix()(Trk::qOverP,Trk::theta); };
70
71 static float chi2(const xAOD::TrackParticle& t) { return t.chiSquared(); }
72 static float ndof(const xAOD::TrackParticle& t) { return t.numberDoF(); }
73
74 static uint8_t hasValidTime(const xAOD::TrackParticle& t) { return t.hasValidTime(); }
75 static float time(const xAOD::TrackParticle& t) { return t.time(); }
76
78 // static float pTsig(const xAOD::TrackParticle& t) { return t.charge() ? std::copysign( t.pt(), t.charge() ) : 0.; }
79 // static float z0SinTheta(const xAOD::TrackParticle& t) { return z0( p ) * std::sin( theta( p ) ); }
80
84
88
98
99 static int nPixels( const xAOD::TrackParticle& t ) { return summary_value( t, xAOD::numberOfPixelHits ); }
102
105
108
111
114
115 static int nSCT( const xAOD::TrackParticle& t ) { return summary_value( t, xAOD::numberOfSCTHits ); }
117 static int nSCTHoles( const xAOD::TrackParticle& t ) { return summary_value( t, xAOD::numberOfSCTHoles ); }
118
119 static int nSi( const xAOD::TrackParticle& t ) { return nPixels(t)+nSCT(t); }
120 static int nSiHoles( const xAOD::TrackParticle& t ) { return nPixelHoles(t)+nSCTHoles(t); }
121
122 static int nTRT( const xAOD::TrackParticle& t ) { return summary_value( t, xAOD::numberOfTRTHits ); }
124
125};
126
127
128
129
130#endif // TRACKPARTICLETRAITS_H
131
132
133
134
135
136
137
Scalar theta() const
theta method
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
SummaryType
Enumerates the different types of information stored in Summary.
@ numberOfInnermostPixelLayerSharedEndcapHits
number of Pixel 0th layer endcap hits shared by several tracks.
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
@ numberOfInnermostPixelLayerEndcapHits
these are the hits in the 0th pixel layer endcap [unit8_t].
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
@ numberOfTRTHighThresholdHitsTotal
total number of TRT hits which pass the high threshold [unit8_t].
@ numberOfNextToInnermostPixelLayerEndcapHits
these are the hits in the 0.5th and 1st pixel layer endcap rings [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].
raw track traits - use for the TrackParticle by default, specialise for anything else,...
Definition TrackTraits.h:47
static int nPixels(const T &)
Definition TrackTraits.h:89
static int nPixelHoles(const T &)
Definition TrackTraits.h:91
static int nSCT(const T &)
static float dqOverP(const T &)
Definition TrackTraits.h:66
static int nSCTHoles(const T &)
static float p(const T &)
Definition TrackTraits.h:56
static float dtheta(const T &)
Definition TrackTraits.h:65
static float covthetaOvP(const T &)
Definition TrackTraits.h:75
static int nPixelsBlayer(const xAOD::TrackParticle &t)
static uint8_t summary_value(const xAOD::TrackParticle &t, xAOD::SummaryType type)
static int nSCTShared(const xAOD::TrackParticle &t)
static int nPixelsInnerShared(const xAOD::TrackParticle &t)
static int nTRT(const xAOD::TrackParticle &t)
static int nSi(const xAOD::TrackParticle &t)
static int nPixelsInnerSharedEndcap(const xAOD::TrackParticle &t)
static int nPixelsInnerEndcap(const xAOD::TrackParticle &t)
static float ET(const xAOD::TrackParticle &t)
static int nTRTHi(const xAOD::TrackParticle &t)
static int nSCT(const xAOD::TrackParticle &t)
as mentoned, do we actually need so many ?
static float deta(const xAOD::TrackParticle &t)
static float E(const xAOD::TrackParticle &t)
static float dz0(const xAOD::TrackParticle &t)
static float z0(const xAOD::TrackParticle &t)
static float ndof(const xAOD::TrackParticle &t)
static int nSCTHoles(const xAOD::TrackParticle &t)
static int nPixelsShared(const xAOD::TrackParticle &t)
static int nSiHoles(const xAOD::TrackParticle &t)
static float time(const xAOD::TrackParticle &t)
static float dtheta(const xAOD::TrackParticle &t)
static float qOverP(const xAOD::TrackParticle &t)
static float dqOverP(const xAOD::TrackParticle &t)
static float p(const xAOD::TrackParticle &t)
static int nPixelsBlayerEndcap(const xAOD::TrackParticle &t)
static float dd0(const xAOD::TrackParticle &t)
static float covthetaOvP(const xAOD::TrackParticle &t)
static float d0(const xAOD::TrackParticle &t)
static int nPixelHoles(const xAOD::TrackParticle &t)
static float chi2(const xAOD::TrackParticle &t)
a covariance not an error
static int nPixels(const xAOD::TrackParticle &t)
again, will we need these in the future, leave here lest we forget ...
static int nPixelsInner(const xAOD::TrackParticle &t)
static float dpt(const xAOD::TrackParticle &t)
static float dphi(const xAOD::TrackParticle &t)
given the complexity of these, perhaps the TruthParticle should be the default template implementatio...
static float theta(const xAOD::TrackParticle &t)
static uint8_t hasValidTime(const xAOD::TrackParticle &t)
not an integer ???