16#include "GaudiKernel/TypeNameString.h"
80 return StatusCode::FAILURE;
87 return StatusCode::FAILURE;
95 return StatusCode::FAILURE;
101 return StatusCode::FAILURE;
107 return StatusCode::FAILURE;
120 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;
139 std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map(
m_assoTool->createPRDtoTrackMap());
144 <<
" not found, exit ReFitTrack." <<
endmsg;
145 return StatusCode::SUCCESS;
153 std::unique_ptr<const Trk::PerigeeSurface> constrainSf;
154 std::unique_ptr<const Trk::RecVertex> constrainVx;
162 constrainSf = std::make_unique<Trk::PerigeeSurface>( constrainVx->position());
169 std::vector<std::unique_ptr<Trk::Track> > new_tracks;
177 std::unique_ptr<Trk::Track> newtrack;
180 bool passedSelection =
true;
190 unsigned int n_trt_hits;
191 if ((*itr)->trackSummary()) {
195 std::unique_ptr<const Trk::TrackSummary> summary(
m_trkSummaryTool->summaryNoHoleSearch(ctx, **itr) );
198 if ( (**itr).measurementsOnTrack()->size() - n_trt_hits<3 )
202 if (passedSelection) {
205 const Trk::Perigee* origPerigee = (*itr)->perigeeParameters();
207 double od0 = origPerigee->parameters()[
Trk::d0];
208 double oz0 = origPerigee->parameters()[
Trk::z0];
209 double ophi0 = origPerigee->parameters()[
Trk::phi0];
210 double otheta = origPerigee->parameters()[
Trk::theta];
211 double oqOverP = origPerigee->parameters()[
Trk::qOverP];
212 ATH_MSG_DEBUG (
"Original parameters " << od0 <<
" " << oz0 <<
" " << ophi0 <<
" " << otheta <<
" " << oqOverP);
216 if (constrainVx && origPerigee){
220 std::unique_ptr<const Trk::TrackParameters> tp(
m_extrapolator->extrapolateTrack(ctx,
226 std::unique_ptr<Trk::VertexOnTrack> bsvxOnTrack( tpConstrainedSf ?
new Trk::VertexOnTrack(*constrainVx,*tpConstrainedSf) :
nullptr );
227 std::vector<const MeasurementBase*>
vec;
228 if (tpConstrainedSf)
vec.push_back(bsvxOnTrack.get() );
236 for ( ; measIter != measIterEnd; ++measIter)
237 vec.push_back((*measIter));
265 dynamic_cast<const Trk::Perigee*
>(newtrack->perigeeParameters () );
266 if (aMeasPer==
nullptr){
267 msg(MSG::ERROR) <<
"Could not get Trk::MeasuredPerigee" <<
endmsg;
270 double d0 = aMeasPer->parameters()[
Trk::d0];
271 double z0 = aMeasPer->parameters()[
Trk::z0];
280 new_tracks.push_back(std::move(newtrack));
288 for(
const std::unique_ptr<Trk::Track> &new_track : new_tracks ) {
294 std::unique_ptr<TrackCollection> new_track_collection = std::make_unique<TrackCollection>();
295 new_track_collection->reserve(new_tracks.size());
296 for(std::unique_ptr<Trk::Track> &new_track : new_tracks ) {
298 new_track_collection->push_back(std::move(new_track));
304 return StatusCode::SUCCESS;
310 msg(MSG::INFO) <<
"ReFitTrack::finalize()" <<
endmsg;
311 return StatusCode::SUCCESS;
323 ATH_MSG_DEBUG(
"Track fit with BeamSpot constraint (x/y/z) = "
324 << constrainVx->
position().x() <<
", "
325 << constrainVx->
position().y() <<
", "
333 else if (vxContainer->size() == 1 ) {
337 constrainVx =
new Trk::RecVertex( (*vxContainer)[0]->recVertex() );
339 << constrainVx->
position().x() <<
", "
340 << constrainVx->
position().y() <<
", "
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
std::vector< size_t > vec
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
the track summary tool
const TrackCollection * m_tracks
job option for main track collection
ToolHandle< Trk::ITrackSelectorTool > m_trkSelectorTool
the track selector tool
Trk::RunOutlierRemoval m_runOutlier
switch whether to run outlier logics or not
const Trk::RecVertex * setupConstrainedFit()
virtual StatusCode finalize()
ToolHandle< Trk::IPRDtoTrackMapTool > m_assoTool
Tool to create and populate PRD to track association maps e.g.
Trk::ParticleHypothesis m_ParticleHypothesis
nomen est omen
SG::ReadHandleKey< TrackCollection > m_trackName
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
virtual StatusCode initialize()
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
SG::ReadHandleKey< VxContainer > m_vxContainerName
ToolHandle< Trk::ITrackFitter > m_ITrackFitter
the refit tool
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
int m_matEffects
type of material interaction in extrapolation
unsigned int m_constrainFitMode
0 - not constrained, 1 - vertex, 2 - beamspot
SG::WriteHandleKey< TrackCollection > m_newTrackName
bool m_usetrackhypo
Fit using particle hypothesis from input track.
virtual StatusCode execute(const EventContext &ctx)
Execute method.
ToolHandle< Trk::IExtrapolator > m_extrapolator
the extrapolator for the consistent measurement frame
ToolHandle< Trk::ITrackFitter > m_ITrackFitterTRT
the TRT refit tool
Trk::RecVertex inherits from Trk::Vertex.
Class to handle Vertex On Tracks, it inherits from the common MeasurementBase.
const Amg::Vector3D & position() const
return position of vertex
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
@ numberOfTRTHits
number of TRT outliers