Commit 70d156e8 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'TrackSummary_try_to_simplify_clean' into 'master'

Trk Track Summary. Use unique_ptr, default move ctors , tidy up the code

See merge request !44474
parents 0d2afd3d ad2b0557
...@@ -559,7 +559,7 @@ InDet::InDetTrackSummaryHelperTool::addDetailedTrackSummary( ...@@ -559,7 +559,7 @@ InDet::InDetTrackSummaryHelperTool::addDetailedTrackSummary(
return; return;
} }
ATH_MSG_DEBUG("Adding detailed indet track summary"); ATH_MSG_DEBUG("Adding detailed indet track summary");
delete summary.m_indetTrackSummary; summary.m_indetTrackSummary.reset();
Trk::InDetTrackSummary* indetTrackSummary = new Trk::InDetTrackSummary(); Trk::InDetTrackSummary* indetTrackSummary = new Trk::InDetTrackSummary();
Trk::InDetTrackSummary& trackSummary = *indetTrackSummary; Trk::InDetTrackSummary& trackSummary = *indetTrackSummary;
if (m_usePixel and not m_pixeldedxtool.empty() and if (m_usePixel and not m_pixeldedxtool.empty() and
...@@ -582,7 +582,7 @@ InDet::InDetTrackSummaryHelperTool::addDetailedTrackSummary( ...@@ -582,7 +582,7 @@ InDet::InDetTrackSummaryHelperTool::addDetailedTrackSummary(
m_pixeldedxtool->getMass(ctx, dedx, p, ngoodhits); m_pixeldedxtool->getMass(ctx, dedx, p, ngoodhits);
} }
} }
summary.m_indetTrackSummary = indetTrackSummary; summary.m_indetTrackSummary.reset(indetTrackSummary);
} }
StatusCode StatusCode
......
...@@ -368,7 +368,7 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary(const Trk::Track& ...@@ -368,7 +368,7 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary(const Trk::Track&
// given that we cannot separate eta/phi holes, redo the assignment before moving to the next chamber // given that we cannot separate eta/phi holes, redo the assignment before moving to the next chamber
if (currentChamberSummary && !currentChamberSummary->isMdt()) { updateHoleContent(*currentChamberSummary); } if (currentChamberSummary && !currentChamberSummary->isMdt()) { updateHoleContent(*currentChamberSummary); }
summary.m_muonTrackSummary = muonTrackSummary; summary.m_muonTrackSummary.reset(muonTrackSummary);
} }
void Muon::MuonTrackSummaryHelperTool::updateHoleContent(Trk::MuonTrackSummary::ChamberHitSummary& chamberHitSummary) const { void Muon::MuonTrackSummaryHelperTool::updateHoleContent(Trk::MuonTrackSummary::ChamberHitSummary& chamberHitSummary) const {
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef TRK_INDETTRACKSUMMARY_H #ifndef TRK_INDETTRACKSUMMARY_H
...@@ -11,45 +11,52 @@ class MsgStream; ...@@ -11,45 +11,52 @@ class MsgStream;
class InDetTrackSummaryCnv_p1; class InDetTrackSummaryCnv_p1;
class TrackSummaryCnv_p2; class TrackSummaryCnv_p2;
namespace InDet { namespace InDet {
class InDetTrackSummaryHelperTool; class InDetTrackSummaryHelperTool;
} }
namespace Trk { namespace Trk {
/** /**
Detailed track summary for the indet system Detailed track summary for the indet system
*/ */
class InDetTrackSummary { class InDetTrackSummary
public: {
friend class InDet::InDetTrackSummaryHelperTool; public:
friend class ::InDetTrackSummaryCnv_p1; friend class InDet::InDetTrackSummaryHelperTool;
friend class ::TrackSummaryCnv_p2; friend class ::InDetTrackSummaryCnv_p1;
friend class ::TrackSummaryCnv_p2;
/** default constructor */
InDetTrackSummary(); /** default constructor */
InDetTrackSummary();
/** destructor */ InDetTrackSummary(const InDetTrackSummary&) = default;
~InDetTrackSummary(); InDetTrackSummary(InDetTrackSummary&&) = default;
InDetTrackSummary& operator=(const InDetTrackSummary&) = default;
/** access to the vector of likelihoods (pion/kaon/proton) */ InDetTrackSummary& operator=(InDetTrackSummary&&) = default;
const std::vector<float>& likelihoodsPixeldEdx() const { return m_likelihoodspixeldedx; } /** destructor */
~InDetTrackSummary() = default;
/** access to mass calculated using pixel dEdx */
float massPixeldEdx() const { return m_massdedx; } /** access to the vector of likelihoods (pion/kaon/proton) */
const std::vector<float>& likelihoodsPixeldEdx() const
private: {
return m_likelihoodspixeldedx;
std::vector<float> m_likelihoodspixeldedx; //<! vector with likelihoods }
float m_massdedx; //<! mass calculated using pixel dEdx
}; /** access to mass calculated using pixel dEdx */
float massPixeldEdx() const { return m_massdedx; }
private:
std::vector<float> m_likelihoodspixeldedx; //<! vector with likelihoods
float m_massdedx; //<! mass calculated using pixel dEdx
};
/**output. This dumps the values of each of the possible summary enums*/ /**output. This dumps the values of each of the possible summary enums*/
MsgStream& operator<<(MsgStream& out, const InDetTrackSummary& trackSum); MsgStream&
operator<<(MsgStream& out, const InDetTrackSummary& trackSum);
/**output. This dumps the values of each of the possible summary enums*/ /**output. This dumps the values of each of the possible summary enums*/
std::ostream& operator<<(std::ostream& out, const InDetTrackSummary& trackSum); std::ostream&
operator<<(std::ostream& out, const InDetTrackSummary& trackSum);
} }
#endif #endif
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef TRK_MUONTRACKSUMMARY_H #ifndef TRK_MUONTRACKSUMMARY_H
...@@ -12,155 +12,158 @@ class MuonTrackSummaryCnv_p1; ...@@ -12,155 +12,158 @@ class MuonTrackSummaryCnv_p1;
class MuonTrackSummaryCnv_p2; class MuonTrackSummaryCnv_p2;
class TrackSummaryCnv_p2; class TrackSummaryCnv_p2;
namespace Muon { namespace Muon {
class MuonTrackSummaryHelperTool; class MuonTrackSummaryHelperTool;
} }
namespace Trk { namespace Trk {
/** /**
Detailed track summary for the muon system Detailed track summary for the muon system
Give access to hit counts per chamber. Give access to hit counts per chamber.
*/ */
class MuonTrackSummary { class MuonTrackSummary
public: {
public:
friend class Muon::MuonTrackSummaryHelperTool;
/** structure to hold information per chamber in the muon system */
struct ChamberHitSummary
{
friend class Muon::MuonTrackSummaryHelperTool; friend class Muon::MuonTrackSummaryHelperTool;
/** structure to hold information per chamber in the muon system */ /** structure to hold the information for the eta/phi projection of RPC, TGC and CSC
struct ChamberHitSummary { chambers and per multilayer for MDT chambers */
friend class Muon::MuonTrackSummaryHelperTool; struct Projection
{
/** structure to hold the information for the eta/phi projection of RPC, TGC and CSC
chambers and per multilayer for MDT chambers */
struct Projection {
Projection() {} Projection() {}
int nhits{0}; //<! number of hits on track in the projection int nhits{ 0 }; //<! number of hits on track in the projection
int nholes{0}; //<! number of holes in the projection int nholes{ 0 }; //<! number of holes in the projection
int noutliers{0}; //<! number of outliers in the projection int noutliers{ 0 }; //<! number of outliers in the projection
int ndeltas{0}; //<! number of delta electrons in the projection (only filled for MDT chambers) int ndeltas{ 0 }; //<! number of delta electrons in the projection (only filled for MDT chambers)
int ncloseHits{0}; //<! number of hits within a road around the track in the projection int ncloseHits{ 0 }; //<! number of hits within a road around the track in the projection
int ngoodHits{0}; //<! number of hits that matter for the track int ngoodHits{ 0 }; //<! number of hits that matter for the track
int noutBounds{0}; //<! number of out-of-bounds hits int noutBounds{ 0 }; //<! number of out-of-bounds hits
}; };
/** constructor taking the Identifier of the chamber and a boolean whether we are dealing with a MDT chamber or not
/** constructor taking the Identifier of the chamber and a boolean whether we are dealing with a MDT chamber or not (the boolean is passed as the ChamberHitSummary cannot unpack the identifier and it needs to know whether it is
(the boolean is passed as the ChamberHitSummary cannot unpack the identifier and it needs to know whether it is dealing dealing with a MDT chamber) */
with a MDT chamber) */ ChamberHitSummary(Identifier chID, bool isMdtTube)
ChamberHitSummary( Identifier chID, bool isMdtTube ) : m_chId(chID),m_isMdt(isMdtTube) {} : m_chId(chID)
, m_isMdt(isMdtTube)
{}
/** returns the chamber identifier */ /** returns the chamber identifier */
const Identifier& chamberId() const { return m_chId; } const Identifier& chamberId() const { return m_chId; }
/** returns whether this is a MDT chamber */ /** returns whether this is a MDT chamber */
bool isMdt() const { return m_isMdt; } bool isMdt() const { return m_isMdt; }
/** returns the total number of hits on track in the chamber */ /** returns the total number of hits on track in the chamber */
int nhits() const { return m_first.nhits + m_second.nhits; } int nhits() const { return m_first.nhits + m_second.nhits; }
/** returns the total number of holes in the chamber */ /** returns the total number of holes in the chamber */
int nholes() const { return m_first.nholes + m_second.nholes; } int nholes() const { return m_first.nholes + m_second.nholes; }
/** returns the total number of outliers in the chamber */ /** returns the total number of outliers in the chamber */
int noutliers() const { return m_first.noutliers + m_second.noutliers; } int noutliers() const { return m_first.noutliers + m_second.noutliers; }
/** returns the total number of delta electrons in the chamber */ /** returns the total number of delta electrons in the chamber */
int ndeltas() const { return m_first.ndeltas + m_second.ndeltas; } int ndeltas() const { return m_first.ndeltas + m_second.ndeltas; }
/** returns the total number of close hits in the chamber */ /** returns the total number of close hits in the chamber */
int ncloseHits() const { return m_first.ncloseHits + m_second.ncloseHits; } int ncloseHits() const { return m_first.ncloseHits + m_second.ncloseHits; }
/** returns the number of non-deweighted hits in the chamber */ /** returns the number of non-deweighted hits in the chamber */
int ngoodHits() const { return m_first.ngoodHits + m_second.ngoodHits; } int ngoodHits() const { return m_first.ngoodHits + m_second.ngoodHits; }
//returns the number of out of bounds hits // returns the number of out of bounds hits
int noutBoundsHits() const { return m_first.noutBounds + m_second.noutBounds; } int noutBoundsHits() const { return m_first.noutBounds + m_second.noutBounds; }
/** returns the total number of eta hits on track in the chamber */ /** returns the total number of eta hits on track in the chamber */
int netaHits() const { return isMdt() ? nhits() : m_first.nhits; } int netaHits() const { return isMdt() ? nhits() : m_first.nhits; }
/** returns the total number of phi hits on track in the chamber */ /** returns the total number of phi hits on track in the chamber */
int nphiHits() const { return isMdt() ? 0 : m_second.nhits; } int nphiHits() const { return isMdt() ? 0 : m_second.nhits; }
/** returns the total number of MDT hits on track in the first multi layer */ /** returns the total number of MDT hits on track in the first multi layer */
int nMdtHitsMl1() const { return isMdt() ? m_first.nhits : 0; } int nMdtHitsMl1() const { return isMdt() ? m_first.nhits : 0; }
/** returns the total number of MDT hits on track in the second multi layer */ /** returns the total number of MDT hits on track in the second multi layer */
int nMdtHitsMl2() const { return isMdt() ? m_second.nhits : 0; } int nMdtHitsMl2() const { return isMdt() ? m_second.nhits : 0; }
/** access to the data of the first MDT multi layer, users have to check whether this is a MDT chamber first!! */ /** access to the data of the first MDT multi layer, users have to check whether this is a MDT chamber first!! */
const Projection& mdtMl1() const { return m_first; } const Projection& mdtMl1() const { return m_first; }
/** access to the data of the second MDT multi layer, users have to check whether this is a MDT chamber first!! */ /** access to the data of the second MDT multi layer, users have to check whether this is a MDT chamber first!! */
const Projection& mdtMl2() const { return m_second; } const Projection& mdtMl2() const { return m_second; }
/** access to the data of the eta projection, users have to check whether this is NOT a MDT chamber first!! */ /** access to the data of the eta projection, users have to check whether this is NOT a MDT chamber first!! */
const Projection& etaProjection() const { return m_first; } const Projection& etaProjection() const { return m_first; }
/** access to the data of the phi projection, users have to check whether this is NOT a MDT chamber first!! */ /** access to the data of the phi projection, users have to check whether this is NOT a MDT chamber first!! */
const Projection& phiProjection() const { return m_second; } const Projection& phiProjection() const { return m_second; }
private:
friend class ::MuonTrackSummaryCnv_p1;
friend class ::MuonTrackSummaryCnv_p2;
friend class ::TrackSummaryCnv_p2;
private: Identifier m_chId{ 0 }; //<! chamber identifier
friend class ::MuonTrackSummaryCnv_p1; bool m_isMdt{ false }; //<! is this a MDT chamber
friend class ::MuonTrackSummaryCnv_p2;
friend class ::TrackSummaryCnv_p2;
Identifier m_chId{0}; //<! chamber identifier Projection m_first; //<! eta projections for cluster chambers, first multi layer for mdt chambers
bool m_isMdt{false}; //<! is this a MDT chamber Projection m_second; //<! phi projections for cluster chambers, first multi layer for mdt chambers
};
Projection m_first; //<! eta projections for cluster chambers, first multi layer for mdt chambers
Projection m_second; //<! phi projections for cluster chambers, first multi layer for mdt chambers
};
/** default constructor */ /** default constructor */
MuonTrackSummary(); MuonTrackSummary();
/** destructor */ /** destructor */
~MuonTrackSummary(); ~MuonTrackSummary();
/** number of eta hits on the track */
unsigned int netaHits() const;
/** number of phi hits on the track */ /** number of eta hits on the track */
unsigned int nphiHits() const; unsigned int netaHits() const;
/** number of eta trigger hits on the track */ /** number of phi hits on the track */
unsigned int noutliers() const; unsigned int nphiHits() const;
/** number of holes on the track */ /** number of eta trigger hits on the track */
unsigned int nholes() const; unsigned int noutliers() const;
/** number of holes on the track */ /** number of holes on the track */
unsigned int ncloseHits() const; unsigned int nholes() const;
/** number of scattering centres on the track */ /** number of holes on the track */
unsigned int nscatterers() const { return m_nscatterers; } unsigned int ncloseHits() const;
/** number of pseudo measurements on the track */ /** number of scattering centres on the track */
unsigned int npseudoMeasurements() const { return m_npseudoMeasurements; } unsigned int nscatterers() const { return m_nscatterers; }
/** access to the vector of chamber hit summaries on the track */ /** number of pseudo measurements on the track */
const std::vector<ChamberHitSummary>& chamberHitSummary() const { return m_chamberHitSummary; } unsigned int npseudoMeasurements() const { return m_npseudoMeasurements; }
private: /** access to the vector of chamber hit summaries on the track */
friend class ::MuonTrackSummaryCnv_p1; const std::vector<ChamberHitSummary>& chamberHitSummary() const { return m_chamberHitSummary; }
friend class ::MuonTrackSummaryCnv_p2;
friend class ::TrackSummaryCnv_p2;
unsigned int m_nscatterers; //<! number of scattering centres on the track private:
unsigned int m_npseudoMeasurements; //<! number of pseudomeasurements on the track friend class ::MuonTrackSummaryCnv_p1;
std::vector<ChamberHitSummary> m_chamberHitSummary; //<! vector with chamber hit summaries friend class ::MuonTrackSummaryCnv_p2;
friend class ::TrackSummaryCnv_p2;
}; unsigned int m_nscatterers; //<! number of scattering centres on the track
unsigned int m_npseudoMeasurements; //<! number of pseudomeasurements on the track
std::vector<ChamberHitSummary> m_chamberHitSummary; //<! vector with chamber hit summaries
};
/**output. This dumps the values of each of the possible summary enums*/ /**output. This dumps the values of each of the possible summary enums*/
MsgStream& operator<<(MsgStream& out, const MuonTrackSummary& trackSum); MsgStream&
operator<<(MsgStream& out, const MuonTrackSummary& trackSum);
/**output. This dumps the values of each of the possible summary enums*/ /**output. This dumps the values of each of the possible summary enums*/
std::ostream& operator<<(std::ostream& out, const MuonTrackSummary& trackSum); std::ostream&
operator<<(std::ostream& out, const MuonTrackSummary& trackSum);
} }
#endif #endif
/* /*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
/*************************************************************************** /***************************************************************************
Summary.h - description Summary.h - description
...@@ -8,331 +8,436 @@ begin : Tue Feb 17 2004 ...@@ -8,331 +8,436 @@ begin : Tue Feb 17 2004
email : edward.moyse@cern.ch email : edward.moyse@cern.ch
***************************************************************************/ ***************************************************************************/
#ifndef TRKTRACKSUMMARY_H #ifndef TRKTRACKSUMMARY_H
#define TRKTRACKSUMMARY_H #define TRKTRACKSUMMARY_H
#include <vector> #include "TrkTrackSummary/InDetTrackSummary.h"
#include <iostream> #include "TrkTrackSummary/MuonTrackSummary.h"
#include <bitset>
#include <atomic> #include <atomic>
#include <bitset>
#include <iostream>
#include <memory>
#include <vector>
class MsgStream; class MsgStream;
class TrackSummaryCnv_p1; class TrackSummaryCnv_p1;
class TrackSummaryCnv_p2; class TrackSummaryCnv_p2;
namespace InDet { namespace InDet {
class InDetTrackSummaryHelperTool; class InDetTrackSummaryHelperTool;
} }
namespace Muon { namespace Muon {
class MuonTrackSummaryHelperTool; class MuonTrackSummaryHelperTool;
} }
namespace Trk { namespace Trk {
// forward declarations
class Track;
class TrackSummaryTool;
//forward declarations /** enumerates the different types of information stored in Summary. Use in
class Track; get(const SummaryType type), for for example, summary.get(numOfPixelHits) When
class InDetTrackSummary; adding a new transient information type, please make sure to increase
class MuonTrackSummary; numberOfTrackSummaryTypes.*/
class TrackSummaryTool; enum SummaryType
{
/** enumerates the different types of information stored in Summary. Use in get(const SummaryType type), for for example, summary.get(numOfPixelHits) // --- Inner Detector
When adding a new transient information type, please make sure to increase numberOfTrackSummaryTypes.*/ //!< number of contributing layers of the pixel detector
enum SummaryType {
// --- Inner Detector numberOfContribPixelLayers = 29,
numberOfContribPixelLayers =29, //!< number of contributing layers of the pixel detector //!< these are the hits in the first pixel layer, i.e. b-layer
numberOfBLayerHits = 0, //!< these are the hits in the first pixel layer, i.e. b-layer numberOfBLayerHits = 0,
numberOfBLayerOutliers =31, //!< number of blayer outliers //!< number of blayer outliers
numberOfBLayerSharedHits =16, //!< number of Pixel b-layer hits shared by several tracks. numberOfBLayerOutliers = 31,
numberOfBLayerSplitHits =43, //!< number of Pixel b-layer hits split by cluster splitting //!< number of Pixel b-layer hits shared by several tracks.
expectBLayerHit =42, //!< Do we expect a b-layer hit for this track? numberOfBLayerSharedHits = 16,
expectInnermostPixelLayerHit =52, //!< Do we expect a 0th-layer hit for this track? //!< number of Pixel b-layer hits split by cluster splitting
numberOfInnermostPixelLayerHits =53, //!< these are the hits in the 0th pixel layer? numberOfBLayerSplitHits = 43,
numberOfInnermostPixelLayerOutliers =54, //!< number of 0th layer outliers //!< Do we expect a b-layer hit for this track?
numberOfInnermostPixelLayerSharedHits =55, //!< number of Pixel 0th layer hits shared by several tracks. expectBLayerHit = 42,
numberOfInnermostLayerSplitHits =56, //!< number of Pixel 0th layer hits split by cluster splitting //!< Do we expect a 0th-layer hit for this track?
expectNextToInnermostPixelLayerHit =57, //!< Do we expect a 1st-layer hit for this track? expectInnermostPixelLayerHit = 52,
numberOfNextToInnermostPixelLayerHits = 58, //!< these are the hits in the 1st pixel layer //!< these are the hits in the 0th pixel layer?
numberOfNextToInnermostPixelLayerOutliers =59, //!< number of 1st pixel layer outliers numberOfInnermostPixelLayerHits = 53,
numberOfNextToInnermostPixelLayerSharedHits =60, //!< number of Pixel 1st layer hits shared by several tracks. //!< number of 0th layer outliers
numberOfNextToInnermostLayerSplitHits =61, //!< number of Pixel 1st layer hits split by cluster splitting numberOfInnermostPixelLayerOutliers = 54,
numberOfPixelHits = 2, //!< these are the pixel hits, including the b-layer //!< number of Pixel 0th layer hits shared by several tracks.
numberOfPixelOutliers =41, //!< these are the pixel outliers, including the b-layer numberOfInnermostPixelLayerSharedHits = 55,
numberOfPixelHoles = 1, //!< number of pixel layers on track with absence of hits //!< number of Pixel 0th layer hits split by cluster splitting
numberOfPixelSharedHits =17, //!< number of Pixel all-layer hits shared by several tracks. numberOfInnermostLayerSplitHits = 56,
numberOfPixelSplitHits =44, //!< number of Pixel all-layer hits split by cluster splitting //!< Do we expect a 1st-layer hit for this track?
numberOfGangedPixels =14, //!< number of pixels which have a ganged ambiguity. expectNextToInnermostPixelLayerHit = 57,
numberOfGangedFlaggedFakes =32, //!< number of Ganged Pixels flagged as fakes //!< these are the hits in the 1st pixel layer
numberOfPixelDeadSensors =33, //!< number of dead pixel sensors crossed numberOfNextToInnermostPixelLayerHits = 58,
numberOfPixelSpoiltHits =35, //!< number of pixel hits with broad errors (width/sqrt(12)) //!< number of 1st pixel layer outliers
numberOfDBMHits =63, //!< number of DBM Hits numberOfNextToInnermostPixelLayerOutliers = 59,
numberOfSCTHits = 3, //!< number of hits in SCT //!< number of Pixel 1st layer hits shared by several tracks.
numberOfSCTOutliers =39, //!< number of SCT outliers numberOfNextToInnermostPixelLayerSharedHits = 60,
numberOfSCTHoles = 4, //!< number of SCT holes //!< number of Pixel 1st layer hits split by cluster splitting
numberOfSCTDoubleHoles =28, //!< number of Holes in both sides of a SCT module numberOfNextToInnermostLayerSplitHits = 61,
numberOfSCTSharedHits =18, //!< number of SCT hits shared by several tracks. //!< these are the pixel hits, including the b-layer
numberOfSCTDeadSensors =34, //!< number of dead SCT sensors crossed numberOfPixelHits = 2,
numberOfSCTSpoiltHits =36, //!< number of SCT hits with broad errors (width/sqrt(12)) //!< these are the pixel outliers, including the b-layer
numberOfTRTHits = 5, //!< number of TRT hits numberOfPixelOutliers = 41,