4#ifndef _InDetAccessor_H_
5#define _InDetAccessor_H_
22#define IDTRKSEL_MSG(msg_type,the_msg) if (msgHelper.msgLvl(msg_type)) { msgHelper.msg() << the_msg << endmsg; } do {} while (false)
23#define IDTRKSEL_MSG_DEBUG(the_msg) IDTRKSEL_MSG(MSG::DEBUG,the_msg)
24#define IDTRKSEL_MSG_WARNING(the_msg) IDTRKSEL_MSG(MSG::WARNING,the_msg)
25#define IDTRKSEL_MSG_ERROR(the_msg) IDTRKSEL_MSG(MSG::ERROR,the_msg)
40 class TrackParticleHelper;
41 template <
short index>
46 template <
short index>
117 template <
typename T_TrkHelper>
122 uint8_t summaryValue = 0;
123 if (!helper.track().summaryValue(summaryValue, summaryType)) {
124 IDTRKSEL_MSG_DEBUG(
"Failed to get SummaryType " << std::to_string(summaryType) <<
" from xAOD::TrackParticle summary. A value of zero will be used instead." );
133 Int_t summaryTypeInt =
static_cast<Int_t
>(summaryType);
134 Int_t checkSummaryValue = helper.summary().get(
static_cast<Trk::SummaryType>(summaryTypeInt) );
135 if (checkSummaryValue < 0) {
137 IDTRKSEL_MSG_DEBUG(
"Received " << checkSummaryValue <<
" for SummaryType " << std::to_string(summaryType) <<
" from Trk::TrackSummary. A value of zero will be used instead." );
138 checkSummaryValue = 0;
140 return checkSummaryValue;
144 template <std::
size_t n_summary_types,
typename T_TrkHelper>
148 sum +=
getSummary(helper, msgHelper, sum_type);
155 template <
typename Trk_Helper>
160 return helper.track().chiSquared();
166 if (!helper.track().fitQuality()) {
170 return helper.track().fitQuality()->chiSquared();
174 template <
typename TrkHelper>
179 return helper.track().numberDoF();
185 if (!helper.track().fitQuality()) {
189 return helper.track().fitQuality()->doubleNumberDoF();
195 template <
typename Trk_Helper>
202 IDTRKSEL_MSG_DEBUG(
"Failed to get eProbabilityHT from xAOD::TrackParticle summary. A value of zero will be used instead." );
211 throw std::runtime_error(
"eProbabilityHT only available in xAOD::TrackParticle not for Trk::Track.");
218 template <
short index>
220 static_assert(
index<5);
221 double param = helper.track().definingParameters()[
index];
223 if (helper.vertex()) {
224 param += helper.track().vz() - helper.vertex()->z();
231 template <
short index>
235 return helper.hasPerigeeOrError(msgHelper) ? helper.perigee()->parameters()[
index] : std::nan(
"");
240 template <
typename Trk_Helper>
245 assert( index_i<5 && index_j<5);
246 return helper.track().definingParametersCovMatrix()(index_i, index_j);
252 assert( index_i<5 && index_j<5);
253 return helper.hasPerigeeOrError(msgHelper) ? (*helper.perigee()->covariance())(index_i, index_j) : std::nan(
"");
257 template <
typename Trk_Helper>
262 return helper.track().numberOfUsedHitsdEdx();
268 throw std::runtime_error(
"umberOfUsedHitsdEdx only available in xAOD::TrackParticle not for Trk::Track.");
273 template <
typename Trk_Helper>
278 return helper.track().numberOfUsedHitsdEdx();
284 throw std::runtime_error(
"NumberOfIBLOverflowsdEdx only available in xAOD::TrackParticle not for Trk::Track.");
292 template <
typename Trk_Helper>
297 const Trk::Track* trkTrack = helper.track().track();
301 return std::tuple<uint8_t,uint8_t>{};
#define IDTRKSEL_MSG_DEBUG(the_msg)
#define IDTRKSEL_MSG_WARNING(the_msg)
#define IDTRKSEL_MSG_ERROR(the_msg)
const xAOD::TrackParticle & track() const
double d0(const asg::AsgMessaging &msgHelper) const
const xAOD::Vertex * vertex() const
double eta(const asg::AsgMessaging &) const
const xAOD::Vertex * m_vtx
double theta(const asg::AsgMessaging &msgHelper) const
double pt(const asg::AsgMessaging &) const
double qOverP(const asg::AsgMessaging &) const
const xAOD::TrackParticle * m_track
TrackParticleHelper(const xAOD::TrackParticle &a_track, const xAOD::Vertex *a_vtx)
double z0(const asg::AsgMessaging &msgHelper) const
bool hasPerigeeOrError(const asg::AsgMessaging &msgHelper) const
double d0(const asg::AsgMessaging &msgHelper) const
const Trk::TrackSummary & summary() const
const Trk::Track * m_track
double eta(const asg::AsgMessaging &msgHelper) const
double theta(const asg::AsgMessaging &msgHelper) const
double qOverP(const asg::AsgMessaging &msgHelper) const
double pt(const asg::AsgMessaging &msgHelper) const
const Trk::TrackParameters * m_perigee
double z0(const asg::AsgMessaging &msgHelper) const
const Trk::Track & track() const
const Trk::TrackSummary * m_summary
const Trk::TrackParameters * perigee() const
bool hasSummaryOrError(const asg::AsgMessaging &msgHelper) const
TrkTrackHelper(const Trk::Track &a_track, const Trk::TrackSummary &summary, const Trk::TrackParameters *a_perigee)
const Amg::Vector3D & momentum() const
Access method for the momentum.
A summary of the information contained by a track.
Class mimicking the AthMessaging class from the offline software.
float qOverP() const
Returns the parameter.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Int_t getNumberOfUsedHitsdEdx(Trk_Helper &helper, const asg::AsgMessaging &msgHelper)
std::tuple< uint8_t, uint8_t > getSiHitsTopBottom(const Trk::Track &track, const asg::AsgMessaging &msgHelper)
double getFitChiSquare(const Trk_Helper &helper, const asg::AsgMessaging &msgHelper)
double getDefiningParameters(TrackParticleHelper helper, const asg::AsgMessaging &msgHelper)
Int_t getNumberOfIBLOverflowsdEdx(Trk_Helper &helper, const asg::AsgMessaging &msgHelper)
uint8_t getSummarySum(const T_TrkHelper helper, const asg::AsgMessaging &msgHelper, std::array< xAOD::SummaryType, n_summary_types > sumTypes)
double getDefiningParametersCov(Trk_Helper &helper, const asg::AsgMessaging &msgHelper, unsigned int index_i, unsigned int index_j)
double getFitNDoF(const TrkHelper &helper, const asg::AsgMessaging &msgHelper)
float getEProbabilityHT(const Trk_Helper &helper, const asg::AsgMessaging &msgHelper)
uint8_t getSummary(const T_TrkHelper &helper, const asg::AsgMessaging &msgHelper, xAOD::SummaryType sumType)
ParametersBase< TrackParametersDim, Charged > TrackParameters
SummaryType
enumerates the different types of information stored in Summary.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
SummaryType
Enumerates the different types of information stored in Summary.
@ eProbabilityHT
Electron probability from High Threshold (HT) information [float].