Commit ed9dbd69 authored by Stephen Nicholas Swatman's avatar Stephen Nicholas Swatman Committed by Walter Lampl
Browse files

Make TrackSummaryTool a friend of TrackSummary

We're going to need to access some private members of Trk::TrackSummary
in Trk::TrackSummaryTool, and as such we mark them as friends.
parent f9ca3bd6
......@@ -36,6 +36,7 @@ namespace Trk {
class Track;
class InDetTrackSummary;
class MuonTrackSummary;
class TrackSummaryTool;
/** enumerates the different types of information stored in Summary. Use in get(const SummaryType type), for for example, summary.get(numOfPixelHits)
When adding a new transient information type, please make sure to increase numberOfTrackSummaryTypes.*/
......@@ -197,6 +198,7 @@ class TrackSummary
public:
friend class InDet::InDetTrackSummaryHelperTool;
friend class Muon::MuonTrackSummaryHelperTool;
friend class Trk::TrackSummaryTool;
/** Value set in the cxx file to -1. If any of the values returned by get(const SummaryType& type)==SummaryTypeNotSet then this means that
the information has not been filled. i.e. ID information cannot be filled if the TrackSummaryTool does not have access to the InDetTrackSummaryHelperTool*/
......
......@@ -160,15 +160,18 @@ Trk::TrackSummaryTool::createSummary( const Track& track,
bool doHolesInDet,
bool doHolesMuon) const
{
// first check if track has summary already and then return a clone
std::unique_ptr<Trk::TrackSummary> ts;
// first check if track has summary already and then clone it.
if (track.trackSummary()!=nullptr) {
ATH_MSG_DEBUG ("Return cached summary for author : "<<track.info().dumpInfo());
return std::make_unique<Trk::TrackSummary>(*(track.trackSummary()));
ts = std::make_unique<Trk::TrackSummary>(*(track.trackSummary()));
} else {
ts = std::make_unique<Trk::TrackSummary>();
}
// Create and initialize information vector and bit pattern
unsigned int numberOfTrackSummaryTypes = Trk::numberOfTrackSummaryTypes+1;
// put values to -1 of they are not evaluated
std::vector<int> information(numberOfTrackSummaryTypes,-1);
std::vector<int> & information = ts->m_information;
information.resize(std::min(information.size(), static_cast<size_t>(numberOfTrackSummaryTypes)));
// Troels.Petersen@cern.ch:
unsigned int numberOfeProbabilityTypes = Trk::numberOfeProbabilityTypes+1;
......@@ -294,12 +297,12 @@ Trk::TrackSummaryTool::createSummary( const Track& track,
eProbability.push_back(0.0);
}
std::unique_ptr<TrackSummary> ts=std::make_unique<TrackSummary>(information,
eProbability,
hitPattern,
dedx,
nhitsuseddedx,
noverflowhitsdedx);
ts->m_eProbability = eProbability;
ts->m_idHitPattern = hitPattern.to_ulong();
ts->m_dedx = dedx;
ts->m_nhitsdedx = nhitsuseddedx;
ts->m_nhitsoverflowdedx = noverflowhitsdedx;
// add detailed summary for indet
if( m_addInDetDetailedSummary && !m_idTool.empty() ){
m_idTool->addDetailedTrackSummary(track,*ts);
......
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