Commit 2f2843db authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch '22.0-cppcheck-InDetTrackSelectionTool' into 'master'

22.0-cppcheck-InDetTrackSelectionTool

See merge request !46361
parents 3394ec72 b8b2eb86
......@@ -114,10 +114,10 @@ namespace InDetAccessor {
// summary accessor
template <typename T_TrkHelper>
uint8_t getSummary(const T_TrkHelper helper, asg::AsgMessaging &msgHelper, xAOD::SummaryType sumType);
uint8_t getSummary(const T_TrkHelper & helper, asg::AsgMessaging &msgHelper, xAOD::SummaryType sumType);
template <>
inline uint8_t getSummary(const TrackParticleHelper helper, asg::AsgMessaging &msgHelper, xAOD::SummaryType summaryType) {
inline uint8_t getSummary(const TrackParticleHelper & helper, asg::AsgMessaging &msgHelper, xAOD::SummaryType summaryType) {
uint8_t summaryValue = 0;
if (!helper.track().summaryValue(summaryValue, summaryType)) {
IDTRKSEL_MSG_DEBUG( "Failed to get SummaryType " << std::to_string(summaryType) << " from xAOD::TrackParticle summary. A value of zero will be used instead." );
......@@ -128,7 +128,7 @@ namespace InDetAccessor {
#ifndef XAOD_ANALYSIS
template <>
inline uint8_t getSummary(const TrkTrackHelper helper, asg::AsgMessaging &msgHelper, xAOD::SummaryType summaryType) {
inline uint8_t getSummary(const TrkTrackHelper & helper, asg::AsgMessaging &msgHelper, xAOD::SummaryType summaryType) {
Int_t summaryTypeInt = static_cast<Int_t>(summaryType);
Int_t checkSummaryValue = helper.summary().get( static_cast<Trk::SummaryType>(summaryTypeInt) );
if (checkSummaryValue < 0) {
......@@ -152,16 +152,16 @@ namespace InDetAccessor {
// fit quality accessor
template <typename Trk_Helper>
double getFitChiSquare(const Trk_Helper helper, asg::AsgMessaging &msgHelper);
double getFitChiSquare(const Trk_Helper & helper, asg::AsgMessaging &msgHelper);
template <>
inline double getFitChiSquare(const TrackParticleHelper helper, asg::AsgMessaging &) {
inline double getFitChiSquare(const TrackParticleHelper & helper, asg::AsgMessaging &) {
return helper.track().chiSquared();
}
#ifndef XAOD_ANALYSIS
template <>
inline double getFitChiSquare(const TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
inline double getFitChiSquare(const TrkTrackHelper & helper, asg::AsgMessaging &msgHelper) {
if (!helper.track().fitQuality()) {
IDTRKSEL_MSG_WARNING( "Zero pointer to fit quality received." );
return std::nan("");
......@@ -171,16 +171,16 @@ namespace InDetAccessor {
#endif
template <typename TrkHelper>
double getFitNDoF(const TrkHelper helper, asg::AsgMessaging &msgHelper);
double getFitNDoF(const TrkHelper & helper, asg::AsgMessaging &msgHelper);
template <>
inline double getFitNDoF(const TrackParticleHelper helper, asg::AsgMessaging &) {
inline double getFitNDoF(const TrackParticleHelper & helper, asg::AsgMessaging &) {
return helper.track().numberDoF();
}
#ifndef XAOD_ANALYSIS
template <>
inline double getFitNDoF(const TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
inline double getFitNDoF(const TrkTrackHelper & helper, asg::AsgMessaging &msgHelper) {
if (!helper.track().fitQuality()) {
IDTRKSEL_MSG_WARNING( "Zero pointer to fit quality received." );
return std::nan("");
......@@ -192,10 +192,10 @@ namespace InDetAccessor {
// eProbabilityHT accessor
template <typename Trk_Helper>
float getEProbabilityHT(const Trk_Helper helper, asg::AsgMessaging &msgHelper);
float getEProbabilityHT(const Trk_Helper & helper, asg::AsgMessaging &msgHelper);
template <>
inline float getEProbabilityHT(const TrackParticleHelper helper, asg::AsgMessaging &msgHelper) {
inline float getEProbabilityHT(const TrackParticleHelper & helper, asg::AsgMessaging &msgHelper) {
float eProbHT =0.f;
if (!helper.track().summaryValue(eProbHT, xAOD::SummaryType::eProbabilityHT)) {
IDTRKSEL_MSG_DEBUG( "Failed to get eProbabilityHT from xAOD::TrackParticle summary. A value of zero will be used instead." );
......@@ -206,7 +206,7 @@ namespace InDetAccessor {
#ifndef XAOD_ANALYSIS
template <>
inline float getEProbabilityHT(const TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
inline float getEProbabilityHT(const TrkTrackHelper & helper, asg::AsgMessaging &msgHelper) {
float eProbHT;
if (!helper.hasSummaryOrError(msgHelper)) {
eProbHT = 0.f;
......@@ -225,7 +225,7 @@ namespace InDetAccessor {
//defining parameters accessor
template <short index>
inline double getDefiningParameters(TrackParticleHelper helper, asg::AsgMessaging &) {
inline double getDefiningParameters(TrackParticleHelper helper, asg::AsgMessaging &) {
static_assert(index<5);
double param = helper.track().definingParameters()[index];
if (index==1) {
......@@ -238,7 +238,8 @@ namespace InDetAccessor {
#ifndef XAOD_ANALYSIS
template <short index>
inline double getDefiningParameters(TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
//cppcheck-suppress passedByValue
inline double getDefiningParameters(TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
assert(index<5);
return helper.hasPerigeeOrError(msgHelper) ? helper.perigee()->parameters()[index] : std::nan("");
}
......@@ -246,33 +247,33 @@ namespace InDetAccessor {
// defining parameters covariance accessor
template <typename Trk_Helper>
inline double getDefiningParametersCov(Trk_Helper helper, [[maybe_unused]] asg::AsgMessaging &msgHelper, unsigned int index_i, unsigned int index_j);
inline double getDefiningParametersCov(Trk_Helper & helper, [[maybe_unused]] asg::AsgMessaging &msgHelper, unsigned int index_i, unsigned int index_j);
template <>
inline double getDefiningParametersCov(TrackParticleHelper helper, [[maybe_unused]] asg::AsgMessaging &msgHelper, unsigned int index_i, unsigned int index_j) {
inline double getDefiningParametersCov(TrackParticleHelper & helper, [[maybe_unused]] asg::AsgMessaging &msgHelper, unsigned int index_i, unsigned int index_j) {
assert( index_i<5 && index_j<5);
return helper.track().definingParametersCovMatrix()(index_i, index_j);
}
#ifndef XAOD_ANALYSIS
template <>
inline double getDefiningParametersCov(TrkTrackHelper helper, asg::AsgMessaging &msgHelper, unsigned int index_i, unsigned int index_j) {
inline double getDefiningParametersCov(TrkTrackHelper & helper, asg::AsgMessaging &msgHelper, unsigned int index_i, unsigned int index_j) {
assert( index_i<5 && index_j<5);
return helper.hasPerigeeOrError(msgHelper) ? (*helper.perigee()->covariance())(index_i, index_j) : std::nan("");
}
#endif
template <typename Trk_Helper>
inline Int_t getNumberOfUsedHitsdEdx(Trk_Helper helper, asg::AsgMessaging &msgHelper);
inline Int_t getNumberOfUsedHitsdEdx(Trk_Helper & helper, asg::AsgMessaging &msgHelper);
template <>
inline Int_t getNumberOfUsedHitsdEdx(TrackParticleHelper helper, [[maybe_unused]] asg::AsgMessaging &msgHelper) {
inline Int_t getNumberOfUsedHitsdEdx(TrackParticleHelper & helper, [[maybe_unused]] asg::AsgMessaging &msgHelper) {
return helper.track().numberOfUsedHitsdEdx();
}
#ifndef XAOD_ANALYSIS
template <>
inline Int_t getNumberOfUsedHitsdEdx(TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
inline Int_t getNumberOfUsedHitsdEdx(TrkTrackHelper & helper, asg::AsgMessaging &msgHelper) {
int n_used_hits;
if (!helper.hasSummaryOrError(msgHelper)) {
n_used_hits=0;
......@@ -290,16 +291,16 @@ namespace InDetAccessor {
#endif
template <typename Trk_Helper>
inline Int_t getNumberOfIBLOverflowsdEdx(Trk_Helper helper, asg::AsgMessaging &msgHelper);
inline Int_t getNumberOfIBLOverflowsdEdx(Trk_Helper & helper, asg::AsgMessaging &msgHelper);
template <>
inline Int_t getNumberOfIBLOverflowsdEdx(TrackParticleHelper helper, [[maybe_unused]] asg::AsgMessaging &msgHelper) {
inline Int_t getNumberOfIBLOverflowsdEdx(TrackParticleHelper & helper, [[maybe_unused]] asg::AsgMessaging &msgHelper) {
return helper.track().numberOfUsedHitsdEdx();
}
#ifndef XAOD_ANALYSIS
template <>
inline Int_t getNumberOfIBLOverflowsdEdx(TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
inline Int_t getNumberOfIBLOverflowsdEdx(TrkTrackHelper & helper, asg::AsgMessaging &msgHelper) {
int n_overflow_hits;
if (!helper.hasSummaryOrError(msgHelper)) {
n_overflow_hits=0;
......@@ -320,10 +321,10 @@ namespace InDetAccessor {
std::tuple<uint8_t,uint8_t> getSiHitsTopBottom( const Trk::Track& track, asg::AsgMessaging &msgHelper);
template <typename Trk_Helper>
inline std::tuple<uint8_t,uint8_t> getSiHitsTopBottom(Trk_Helper helper, asg::AsgMessaging &msgHelper);
inline std::tuple<uint8_t,uint8_t> getSiHitsTopBottom(Trk_Helper & helper, asg::AsgMessaging &msgHelper);
template <>
inline std::tuple<uint8_t,uint8_t> getSiHitsTopBottom(TrackParticleHelper helper, asg::AsgMessaging &msgHelper) {
inline std::tuple<uint8_t,uint8_t> getSiHitsTopBottom(TrackParticleHelper & helper, asg::AsgMessaging &msgHelper) {
const Trk::Track* trkTrack = helper.track().track();
if (!trkTrack) {
IDTRKSEL_MSG_WARNING( "xAOD::TrackParticle has a null pointer to a Trk::Track." );
......@@ -336,7 +337,7 @@ namespace InDetAccessor {
}
template <>
inline std::tuple<uint8_t,uint8_t> getSiHitsTopBottom(TrkTrackHelper helper, asg::AsgMessaging &msgHelper) {
inline std::tuple<uint8_t,uint8_t> getSiHitsTopBottom(TrkTrackHelper & helper, asg::AsgMessaging &msgHelper) {
return getSiHitsTopBottom(helper.track(),msgHelper);
}
#endif
......
......@@ -32,6 +32,8 @@ struct HistFamily
public:
HistFamily(const string&);
void fill(const xAOD::TrackParticle&, const xAOD::Vertex*);
HistFamily(const HistFamily &) = delete;
HistFamily & operator =(const HistFamily &) = delete;
private:
TH2* h_pt = nullptr; // these show eta dependence
TH2* h_si_hits_phys = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment