Skip to content
Snippets Groups Projects
Commit 9dd24685 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'const.TrkTrack-20210923' into 'master'

TrkTrack+TRT_SegmentToTrackTool+TrkMaterialProvider: Remove non-const trackStateOnSurfaces.

See merge request !46700
parents 6e741cab 6b1b7718
7 merge requests!69091Fix correlated smearing bug in JER in JetUncertainties in 22.0,!58791DataQualityConfigurations: Modify L1Calo config for web display,!51674Fixing hotSpotInHIST for Run3 HIST,!50012RecExConfig: Adjust log message levels from GetRunNumber and GetLBNumber,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!46700TrkTrack+TRT_SegmentToTrackTool+TrkMaterialProvider: Remove non-const trackStateOnSurfaces.
......@@ -335,11 +335,8 @@ namespace InDet {
info.setPatternRecognitionInfo(Trk::TrackInfo::TRTStandalone);
// create new track candidate
Trk::Track* newTrack = new Trk::Track(info, std::move(ntsos), fq);
// We need to keep the tsos added. As later on we modify them
auto newTrackTSOS = newTrack->trackStateOnSurfaces();
if (!m_doRefit) {
return newTrack;
return new Trk::Track(info, std::move(ntsos), fq);
} else {
//
// ----------------------------- this is a horrible hack to make the
......@@ -369,8 +366,6 @@ namespace InDet {
m_extrapolator->extrapolateDirectly(*segPar, perigeeSurface));
if (!tempper) {
ATH_MSG_DEBUG("Could not produce perigee");
delete newTrack;
newTrack = nullptr;
delete segPar;
segPar = nullptr;
return nullptr;
......@@ -481,7 +476,7 @@ namespace InDet {
// ME: wow this is hacking the vector ...
const Trk::MeasurementBase* firstmeas =
(**newTrackTSOS->begin()).measurementOnTrack();
(**ntsos.begin()).measurementOnTrack();
Amg::MatrixX newcov(2, 2);
newcov.setZero();
newcov(0, 0) = (firstmeas->localCovariance())(0, 0);
......@@ -492,8 +487,8 @@ namespace InDet {
new Trk::PseudoMeasurementOnTrack(
newpar, newcov, firstmeas->associatedSurface());
// hack replace first measurement with pseudomeasurement
newTrackTSOS->erase(newTrackTSOS->begin());
newTrackTSOS->insert(newTrackTSOS->begin(),
ntsos.erase(ntsos.begin());
ntsos.insert(ntsos.begin(),
new Trk::TrackStateOnSurface(newpseudo, nullptr));
}
......@@ -596,7 +591,7 @@ namespace InDet {
typePattern.set(Trk::TrackStateOnSurface::Perigee);
Trk::TrackStateOnSurface* seg_tsos = new Trk::TrackStateOnSurface(
nullptr, per, nullptr, nullptr, typePattern);
newTrackTSOS->insert(newTrackTSOS->begin(), seg_tsos);
ntsos.insert(ntsos.begin(), seg_tsos);
ATH_MSG_VERBOSE("Constructed perigee at input to fit : " << (*per));
......@@ -605,12 +600,11 @@ namespace InDet {
// track
//
Trk::Track newTrack (info, std::move(ntsos), fq);
Trk::Track* fitTrack =
m_fitterTool->fit(*newTrack, true, Trk::nonInteracting);
m_fitterTool->fit(newTrack, true, Trk::nonInteracting);
// cleanup
delete newTrack;
newTrack = nullptr;
if (segPar) {
delete segPar;
segPar = nullptr;
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRKTRACK_H
......@@ -206,14 +206,6 @@ namespace Trk
*/
const DataVector<const TrackStateOnSurface>* trackStateOnSurfaces() const;
/**
* return a pointer to the non-const DataVector of const TrackStateOnSurfaces
* owned by a non-const track
* The pointer will be nullptr if the track was created without
* TrackStateOnSurfaces.
*/
DataVector<const TrackStateOnSurface>* trackStateOnSurfaces();
/**
* Set the TrackStateOnSurfaces. The Trk::Track takes ownership
*/
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
namespace Trk {
......@@ -22,12 +22,6 @@ Track::trackStateOnSurfaces() const
return &m_trackStateVector;
}
inline DataVector<const TrackStateOnSurface>*
Track::trackStateOnSurfaces()
{
return &m_trackStateVector;
}
inline const TrackInfo&
Track::info() const
{
......
......@@ -156,7 +156,12 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(Trk::Track& track, const Trk::
// back extrapolate to perigee, get pAtCaloEntry from list of TSOSs
// and update/add calo+ID material to mstrack to be refitted.
Trk::TrackStates* inputTSOS = track.trackStateOnSurfaces();
const Trk::TrackStates* inputTSOS_orig = track.trackStateOnSurfaces();
auto inputTSOS = std::make_unique<Trk::TrackStates>();
for (const Trk::TrackStateOnSurface* tsos : *inputTSOS_orig) {
inputTSOS->push_back (tsos->clone());
}
// Iterators
Trk::TrackStates::iterator lastIDwP = inputTSOS->end();
......@@ -248,9 +253,10 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(Trk::Track& track, const Trk::
#endif
// apply X0 and Eloss scale to MuonSpectrometer
this->updateVectorMS(inputTSOS,firstMS,X0ScaleMS,ElossScaleMS);
this->updateVectorMS(inputTSOS.get(),firstMS,X0ScaleMS,ElossScaleMS);
// update the original vector
Trk::TrkMaterialProviderTool::updateVector(inputTSOS, firstCALO, firstMS, caloTSOS);
Trk::TrkMaterialProviderTool::updateVector(inputTSOS.get(), firstCALO, firstMS, caloTSOS);
track.setTrackStateOnSurfaces (std::move (*inputTSOS));
myLocal_resetTrack(track);
}
......@@ -261,7 +267,12 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(const Trk::Track& idTrack, Trk
ATH_MSG_VERBOSE("updateCaloTSOS(Trk::Track& idTrack, Trk::Track& extrapolatedTrack)");
const Trk::TrackStates* inputTSOS_ID = idTrack.trackStateOnSurfaces();
Trk::TrackStates* inputTSOS_MS = extrapolatedTrack.trackStateOnSurfaces();
const Trk::TrackStates* inputTSOS_MS_orig = extrapolatedTrack.trackStateOnSurfaces();
auto inputTSOS_MS = std::make_unique<Trk::TrackStates>();
for (const Trk::TrackStateOnSurface* tsos : *inputTSOS_MS_orig) {
inputTSOS_MS->push_back (tsos->clone());
}
// find last ID TSOS
......@@ -338,14 +349,14 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(const Trk::Track& idTrack, Trk
double ElossScaleMS = 0.;
// get calorimeter TSOS from TG
Trk::TrackStates* caloTSOS = this->getCaloTSOS (*(*lastIDwP)->trackParameters(),
extrapolatedTrack,
(*firstMSnotPerigee)->surface(),
Trk::alongMomentum,
Trk::muon,
Eloss, X0ScaleMS, ElossScaleMS,
(firstMSwP == inputTSOS_MS->end()) ? nullptr : (*firstMSwP)->trackParameters(),
false,
true);
extrapolatedTrack,
(*firstMSnotPerigee)->surface(),
Trk::alongMomentum,
Trk::muon,
Eloss, X0ScaleMS, ElossScaleMS,
(firstMSwP == inputTSOS_MS->end()) ? nullptr : (*firstMSwP)->trackParameters(),
false,
true);
if(!caloTSOS || caloTSOS->size()!=3) {
......@@ -362,10 +373,11 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(const Trk::Track& idTrack, Trk
#endif
// apply X0 and Eloss scale to MuonSpectrometer
this->updateVectorMS(inputTSOS_MS,firstMS,X0ScaleMS,ElossScaleMS);
this->updateVectorMS(inputTSOS_MS.get(),firstMS,X0ScaleMS,ElossScaleMS);
// update the original vector
Trk::TrkMaterialProviderTool::updateVector(inputTSOS_MS, firstCALO, firstMS, caloTSOS);
Trk::TrkMaterialProviderTool::updateVector(inputTSOS_MS.get(), firstCALO, firstMS, caloTSOS);
extrapolatedTrack.setTrackStateOnSurfaces (std::move (*inputTSOS_MS));
myLocal_resetTrack(extrapolatedTrack);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment