5#ifndef INDETTRACKPERFMON_TRKPARAMETERSHELPER_H
6#define INDETTRACKPERFMON_TRKPARAMETERSHELPER_H
33 inline float pT(
const U& p ) {
return p.pt(); }
37 inline float pTsig(
const U& p ) {
38 return p.charge() ? std::copysign(
pT(p), p.charge() ) : 0.;
43 inline float eta(
const U& p ) {
return p.eta(); }
49 return (thetaAcc.
isAvailable(p)) ? thetaAcc(p) : -9999.;
58 return (phiAcc.
isAvailable(p)) ? phiAcc(p) : -9999.;
61 inline float phi(
const U& p ) {
return getPhi( p ); }
72 inline float z0(
const U& p ) {
return getZ0( p ); }
84 inline float d0(
const U& p ) {
return getD0( p ); }
90 return (prodRAcc.
isAvailable(p)) ? prodRAcc(p) : -9999.;
99 return (prodZAcc.
isAvailable(p)) ? prodZAcc(p) : -9999.;
108 return (qOverPAcc.
isAvailable(p)) ? qOverPAcc(p) : -9999.;
118 inline float eTot(
const U& p ) {
return p.e(); }
122 inline float eT(
const U& p ) {
return p.p4().Et(); }
138 std::vector< unsigned int > authorVec;
139 std::bitset< xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo > patternInfo = p.patternRecoInfo();
141 if( patternInfo.test(i) ) authorVec.push_back(i);
163 return p.definingParametersCovMatrix()( par1, par2 ); }
167 return getCov( p, par1, par2 ); }
171 return (
cov(p, par, par) < 0 ) ? 0. : std::sqrt(
cov(p, par, par) ); }
178 return p.definingParametersCovMatrixVec(); }
185 float invSinTheta = 1. / std::sin(
theta(p) );
186 float cosTheta = std::cos(
theta(p) );
191 return qOverPTerr2 > 0 ? std::sqrt( qOverPTerr2 ) : 0.;
199 std::vector< float > covs =
covVec(p);
200 if( covs.size() < 15 ) {
201 throw std::runtime_error(
202 "TrackParticle without covariance matrix for defining parameters or the covariance matrix is wrong dimensionality.");
204 if(
qOverP(p) <= 0. )
return 0.;
205 float diff_qp = -
pT(p) / std::fabs(
qOverP(p) );
206 float diff_theta =
theta(p) == 0. ? 0. :
pT(p) / std::tan(
theta(p) );
207 float pTerr2 = diff_qp * (diff_qp * covs[14] + diff_theta * covs[13]) + diff_theta * diff_theta * covs[9];
208 return pTerr2 > 0. ? std::sqrt( pTerr2 ) : 0.;
218 return std::fabs( etaErr ); }
229 return z0sinErr2 > 0. ? std::sqrt( z0sinErr2 ) : 0.;
236 template<
class U1,
class U2=U1 >
237 inline float deltaPhi(
const U1& p1,
const U2& p2 ) {
238 return p1.p4().DeltaPhi( p2.p4() );
242 template<
class U1,
class U2=U1 >
243 inline float deltaEta(
const U1& p1,
const U2& p2 ) {
244 return (
eta(p1) -
eta(p2) );
248 template<
class U1,
class U2=U1 >
249 inline float deltaR(
const U1& p1,
const U2& p2 ) {
250 return p1.p4().DeltaR( p2.p4() );
270 return type.isAvailable(p) ?
type(p) : -9999;
287 uint8_t iInnerMostPixelHits(0);
289 float( iInnerMostPixelHits ) : -9999.;
297 uint8_t iInnerMostPixelEndcapHits(0);
299 float( iInnerMostPixelEndcapHits ) : -9999.;
307 uint8_t iNextToInnerMostPixelHits(0);
309 float( iNextToInnerMostPixelHits ) : -9999.;
317 uint8_t iNextToInnerMostPixelEndcapHits(0);
319 float( iNextToInnerMostPixelEndcapHits ) : -9999.;
327 uint8_t iInnerMostPixelSharedHits(0);
329 float( iInnerMostPixelSharedHits ) : -9999.;
337 uint8_t iInnerMostPixelSharedEndcapHits(0);
339 float( iInnerMostPixelSharedEndcapHits ) : -9999.;
347 uint8_t iPixelHits(0);
349 float( iPixelHits ) : -9999.;
357 uint8_t iPixHoles(0);
359 float( iPixHoles ) : -9999.;
367 uint8_t iPixelShared(0);
369 float( iPixelShared ) : -9999.;
378 return p.summaryValue( iPixeldEdx,
xAOD::pixeldEdx ) ? iPixeldEdx : -9999.;
388 float( iSctHits ) : -9999.;
396 uint8_t iSctHoles(0);
398 float( iSctHoles ) : -9999.;
406 uint8_t iSCTShared(0);
408 float( iSCTShared ) : -9999.;
419 return ( pnPixelHits + pnSCTHits );
423 return prodNSiHits.
isAvailable(p) ? prodNSiHits(p) : -9999.;
434 return ( pnPixelHoles + pnSCTHoles );
441 float( iTrtHits ) : -9999.;
449 uint8_t iTrtHitsXe(0);
451 float( iTrtHitsXe ) : -9999.;
462 return ( pnTRTHits - pnTRTHitsXe );
470 uint8_t iTrtHighThresholdHits(0);
472 float( iTrtHighThresholdHits ) : -9999.;
480 uint8_t iTrtHighThresholdHitsXe(0);
482 float( iTrtHighThresholdHitsXe ) : -9999.;
493 return ( pnTRTHighThresholdHits - pnTRTHighThresholdHitsXe );
503 uint8_t iInnerMostPixelOutliers(0);
505 float( iInnerMostPixelOutliers ) : -9999.;
515 uint8_t iInnerMostPixelEndcapOutliers(0);
517 float( iInnerMostPixelEndcapOutliers ) : -9999.;
527 uint8_t iInnerMostPixelSplitHits(0);
529 float( iInnerMostPixelSplitHits ) : -9999.;
539 uint8_t iInnerMostPixelSplitEndcapHits(0);
541 float( iInnerMostPixelSplitEndcapHits ) : -9999.;
551 uint8_t iNExpectedInnerMostPixelHits(0);
553 float( iNExpectedInnerMostPixelHits ) : -9999.;
563 uint8_t iNExpectedNextToInnerMostPixelHits(0);
565 float( iNExpectedNextToInnerMostPixelHits ) : -9999.;
575 uint8_t iNPixelOutliers(0);
577 float( iNPixelOutliers ) : -9999.;
587 uint8_t iNPixelContribLayers(0);
589 float( iNPixelContribLayers ) : -9999.;
599 uint8_t iNPixelSplitHits(0);
601 float( iNPixelSplitHits ) : -9999.;
611 uint8_t iNPixelGangedHits(0);
613 float( iNPixelGangedHits ) : -9999.;
623 uint8_t iNPixelGangedHitsFlaggedFakes(0);
625 float( iNPixelGangedHitsFlaggedFakes ) : -9999.;
635 uint8_t iNPixelDeadSensors(0);
637 float( iNPixelDeadSensors ) : -9999.;
647 uint8_t iNSCTOutliers(0);
649 float( iNSCTOutliers ) : -9999.;
659 uint8_t iNSCTDoubleHoles(0);
661 float( iNSCTDoubleHoles ) : -9999.;
671 uint8_t iNSCTDeadSensors(0);
673 float( iNSCTDeadSensors ) : -9999.;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Scalar theta() const
theta method
Utility methods to access reco/truth vertices parmeters in a consitent way across this package.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
float getD0(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of d0.
std::vector< float > getCovVec(const xAOD::TrackParticle &p)
Accessor utility function for getting the track parameters covariance vector.
float nTRTHighThresholdHits(const U &p)
float nInnerMostPixelSharedEndcapHits(const U &p)
float getNPixelContribLayers(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NPixelContribLayers.
float nInnerMostPixelSplitHits(const U &p)
float getNSCTOutliers(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NSCTOutliers.
float getNNextToInnerMostPixelHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nNextToInnerMostPixelHits.
float nSiHoles(const U &p)
Accessor utility function for getting the value of nSiHoles.
float getNInnerMostPixelEndcapOutliers(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NInnerMostPixelEndcapOutliers.
float getNInnerMostPixelHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nInnerMostPixelHits.
float getNPixelSharedHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nPixelSharedHits.
int getTruthType(const xAOD::TrackParticle &)
Accessor utility function for getting the value of truthType.
float getZ0SinThetaError(const xAOD::TrackParticle &p)
Accessor utility function for getting the z0SinTheta error.
float getNTRTHitsXe(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nTRTHitsXe.
float getQOverPTError(const xAOD::TrackParticle &p)
Accessor utility function for getting the QOverPt error.
float getNPixelSplitHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NPixelSplitHits.
float nInnerMostPixelSplitEndcapHits(const U &p)
float getTime(const xAOD::TrackParticle &p)
Accessor utility function for getting the track time.
float nExpectedInnerMostPixelHits(const U &p)
float nPixelHoles(const U &p)
float getNPixelGangedHitsFlaggedFakes(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NPixelGangedHitsFlaggedFakes.
float nPixelSharedHits(const U &p)
uint8_t getHasValidTime(const xAOD::TrackParticle &p)
Accessor utility function for getting the track hasValidTime.
float pT(const U &p)
Accessor utility function for getting the value of pT.
float z0SinTheta(const U &p)
float getNExpectedNextToInnerMostPixelHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NExpectedNextToInnerMostPixelHits.
float getNPixelOutliers(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NPixelOutliers.
float eT(const U &p)
Accessor utility function for getting the value of Tranverse energy.
float getPhi(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of phi.
float nNextToInnerMostPixelHits(const U &p)
float getNTRTHighThresholdHitsAr(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nTRTHighThresholdHitsAr.
float nPixelContribLayers(const U &p)
float getNInnerMostPixelSharedHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nInnerMostPixelSharedHits.
float getNSCTHoles(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nSCTHoles.
float getNSCTHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nSCTHits.
float getNPixelGangedHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NPixelGangedHits.
float getPixeldEdx(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of pixeldEdx.
float getNSCTDoubleHoles(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NSCTDoubleHoles.
float getPTError(const xAOD::TrackParticle &p)
Accessor utility function for getting the Pt error.
float getError(const xAOD::TrackParticle &p, Trk::ParamDefs par)
Accessor utility function for getting the track parameters error.
float nPixelGangedHits(const U &p)
float eTot(const U &p)
Accessor utility function for getting the value of Energy.
std::vector< unsigned int > getAuthor(const xAOD::TrackParticle &p)
Accessor utility function for getting the track author.
float getProdR(const xAOD::TrackParticle &)
Accessor utility function for getting the value of R.
float nInnerMostPixelEndcapOutliers(const U &p)
float getNdof(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of dof.
float nSCTSharedHits(const U &p)
float getIsHadron(const xAOD::TrackParticle &)
Accessor utility function for getting the value of isHadron.
float chiSquared(const U &p)
float qOverPT(const U &p)
float deltaPhi(const U1 &p1, const U2 &p2)
Accessor utility function for getting the DeltaPhi betwen two tracks.
float getNInnerMostPixelSplitEndcapHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NInnerMostPixelSplitEndcapHits.
float getNSCTSharedHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nSCTSharedHits.
float nPixelDeadSensors(const U &p)
float nSCTHoles(const U &p)
float nTRTHighThresholdHitsXe(const U &p)
float nNextToInnerMostPixelEndcapHits(const U &p)
float nSCTHits(const U &p)
float qOverPTError(const U &p)
float pTError(const U &p)
float nSCTDeadSensors(const U &p)
float getNSCTDeadSensors(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NSCTDeadSensors.
std::vector< float > covVec(const U &p)
float nSCTDoubleHoles(const U &p)
float nInnerMostPixelSharedHits(const U &p)
float getNPixelHoles(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nPixelHoles.
float nTRTHits(const U &p)
float nTRTHitsAr(const U &p)
float pixeldEdx(const U &p)
float getNInnerMostPixelOutliers(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NInnerMostPixelOutliers.
float nTRTHighThresholdHitsAr(const U &p)
float getTheta(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of theta.
float getNNextToInnerMostPixelEndcapHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nNextToInnerMostPixelEndcapHits.
float getChiSquared(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of chi^2.
float getNExpectedInnerMostPixelHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NExpectedInnerMostPixelHits.
float getNPixelDeadSensors(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NPixelDeadSensors.
float nTRTHitsXe(const U &p)
float getNPixelHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nPixelHits.
float pTsig(const U &p)
Accessor utility function for getting the value of signed pT.
float nInnerMostPixelHits(const U &p)
int truthOrigin(const U &p)
float getNInnerMostPixelSplitHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of NInnerMostPixelSplitHits.
float nPixelOutliers(const U &p)
float getNTRTHitsAr(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nTRTHitsAr.
float getQoverP(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of qOverP.
float getEtaError(const xAOD::TrackParticle &p)
Accessor utility function for getting the Eta error.
float getNInnerMostPixelSharedEndcapHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nInnerMostPixelSharedEndcapHits.
float deltaR(const U1 &p1, const U2 &p2)
Accessor utility function for getting the DeltaR betwen two tracks.
float nInnerMostPixelOutliers(const U &p)
float nSiHits(const U &p)
float nPixelSplitHits(const U &p)
std::vector< unsigned int > author(const U &p)
float getProdZ(const xAOD::TrackParticle &)
Accessor utility function for getting the value of Z.
float getCov(const xAOD::TrackParticle &p, Trk::ParamDefs par1, Trk::ParamDefs par2)
Accessor utility function for getting the track parameters covariance.
int getTruthOrigin(const xAOD::TrackParticle &)
Accessor utility function for getting the value of truthOrigin.
float nPixelHits(const U &p)
float getZ0(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of z0.
float etaError(const U &p)
int truthType(const U &p)
float getNSiHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nSiHits.
float nExpectedNextToInnerMostPixelHits(const U &p)
float cov(const U &p, Trk::ParamDefs par1, Trk::ParamDefs par2)
float z0SinThetaError(const U &p)
float nSCTOutliers(const U &p)
uint8_t hasValidTime(const U &p)
float getNTRTHighThresholdHitsXe(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nTRTHighThresholdHitsXe.
float getNTRTHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nTRTHits.
float getNInnerMostPixelEndcapHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nInnerMostPixelEndcapHits.
float isHadron(const U &p)
float nInnerMostPixelEndcapHits(const U &p)
float nPixelGangedHitsFlaggedFakes(const U &p)
float getIsPion(const xAOD::TrackParticle &)
Accessor utility function for getting the value of isPion.
float deltaEta(const U1 &p1, const U2 &p2)
Accessor utility function for getting the DeltaEta betwen two tracks.
float getNTRTHighThresholdHits(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of nTRTHighThresholdHits.
ParamDefs
This file defines the parameter enums in the Trk namespace.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
@ numberOfInnermostPixelLayerSharedEndcapHits
number of Pixel 0th layer endcap hits shared by several tracks.
@ numberOfGangedPixels
number of pixels which have a ganged ambiguity [unit8_t].
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ 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].
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector [unit8_t].
@ pixeldEdx
the dE/dx estimate, calculated using the pixel clusters [?
@ numberOfPixelSplitHits
number of Pixel all-layer hits split by cluster splitting [unit8_t].
@ numberOfInnermostPixelLayerEndcapOutliers
number of 0th layer endcap outliers
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
@ numberOfPixelOutliers
these are the pixel outliers, including the b-layer [unit8_t].
@ numberOfTRTXenonHits
number of TRT hits on track in straws with xenon [unit8_t].
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
@ numberOfGangedFlaggedFakes
number of Ganged Pixels flagged as fakes [unit8_t].
@ numberOfInnermostPixelLayerOutliers
number of 0th layer barrel outliers
@ 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].
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfSCTDoubleHoles
number of Holes in both sides of a SCT module [unit8_t].
@ numberOfSCTOutliers
number of SCT outliers [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].
@ numberOfInnermostPixelLayerSplitEndcapHits
number of Pixel 0th layer endcap hits shared by several tracks.
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].
@ NumberOfTrackRecoInfo
maximum number of enums