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

Merge branch 'perigeeAtBeamline_eventContext_aware' into 'master'

Make perigeeAtBeamline EventContext aware

See merge request atlas/athena!39177
parents d16f281f 1fe04858
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!39177Make perigeeAtBeamline EventContext aware
......@@ -53,51 +53,90 @@ namespace Reco {
/** AlgTool interface methods */
static const InterfaceID& interfaceID() { return IID_ITrackToVertex; };
/** Use this for MT Coding */
virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(const InDet::BeamSpotData*) const = 0; //In C++17 make this [[nodiscard]]
virtual const InDet::BeamSpotData* GetBeamSpotData(const EventContext &ctx) const = 0; //In C++17 make this [[nodiscard]]
/** Interface method for use with TrackParticle and given vertex position - AOD */
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp, const Amg::Vector3D& gp) const = 0;
/** Interface method for use with xAOD::Trackparticle and given vertex position - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(const xAOD::TrackParticle& tp, const Amg::Vector3D& gp) const = 0;
/** Interface method for use with TrackParticle and default primary vertex from TrackParticle - AOD */
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp) const = 0;
/** Interface method for use with TrackParticle and default primary vertex from TrackParticle - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(const xAOD::TrackParticle& tp) const = 0;
/** Interface method for use with Track and given vertex position - ESD */
virtual const Trk::Perigee* perigeeAtVertex(const Trk::Track& trk, const Amg::Vector3D& gp) const = 0;
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - AOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(const Rec::TrackParticle& tp, const InDet::BeamSpotData*) const = 0;
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - xAOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(const xAOD::TrackParticle& tp, const InDet::BeamSpotData*) const = 0;
/** Interface method for use with Track and the beamspot from the BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamspot(const Trk::Track& trk, const InDet::BeamSpotData*) const = 0;
/** Interface method for use with Track and the beamline from the BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamline(const Trk::Track& trk, const InDet::BeamSpotData*) const = 0;
/** Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - AOD*/
virtual const Trk::TrackParameters* trackAtBeamline(const Rec::TrackParticle& tp) const = 0;
/** Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - xAOD*/
virtual const Trk::TrackParameters* trackAtBeamline(const xAOD::TrackParticle& tp, const InDet::BeamSpotData*) const = 0;
/** Interface method for use with Track and the beamline from the BeamSpotSvc - ESD */
virtual const Trk::TrackParameters* trackAtBeamline(const Trk::Track& trk, const Trk::StraightLineSurface*) const = 0;
/** Interface method for use with Track and the beamline from the BeamSpotSvc - TrackParameters */
virtual const Trk::TrackParameters* trackAtBeamline(const Trk::TrackParameters& tpars, const Trk::StraightLineSurface* ) const = 0;
/** Use this for MT Coding */
virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(
const InDet::BeamSpotData*)
const = 0; // In C++17 make this [[nodiscard]]
virtual const InDet::BeamSpotData* GetBeamSpotData(
const EventContext& ctx) const = 0; // In C++17 make this [[nodiscard]]
/** Interface method for use with TrackParticle and given vertex position
* - AOD */
virtual const Trk::Perigee* perigeeAtVertex(
const Rec::TrackParticle& tp,
const Amg::Vector3D& gp) const = 0;
/** Interface method for use with xAOD::Trackparticle and given vertex
* position - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(
const xAOD::TrackParticle& tp,
const Amg::Vector3D& gp) const = 0;
/** Interface method for use with TrackParticle and default primary
* vertex from TrackParticle - AOD */
virtual const Trk::Perigee* perigeeAtVertex(
const Rec::TrackParticle& tp) const = 0;
/** Interface method for use with TrackParticle and default primary
* vertex from TrackParticle - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(
const xAOD::TrackParticle& tp) const = 0;
/** Interface method for use with Track and given vertex position - ESD
*/
virtual const Trk::Perigee* perigeeAtVertex(
const Trk::Track& trk,
const Amg::Vector3D& gp) const = 0;
/** Interface method for use with TrackParticle and the beamspot from the
* BeamSpotSvc - AOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(
const Rec::TrackParticle& tp,
const InDet::BeamSpotData*) const = 0;
/** Interface method for use with TrackParticle and the beamspot from the
* BeamSpotSvc - xAOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(
const xAOD::TrackParticle& tp,
const InDet::BeamSpotData*) const = 0;
/** Interface method for use with Track and the beamspot from the
* BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamspot(
const Trk::Track& trk,
const InDet::BeamSpotData*) const = 0;
/** Interface method for use with Track and the beamline from the
* BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamline(
const EventContext& ctx,
const Trk::Track& trk,
const InDet::BeamSpotData* beamSpotData) const = 0;
/** Interface method for use with TrackParticle and the beamline from the
* BeamSpotSvc - AOD*/
virtual const Trk::TrackParameters* trackAtBeamline(
const Rec::TrackParticle& tp) const = 0;
/** Interface method for use with TrackParticle and the beamline from the
* BeamSpotSvc - xAOD*/
virtual const Trk::TrackParameters* trackAtBeamline(
const xAOD::TrackParticle& tp,
const InDet::BeamSpotData*) const = 0;
/** Interface method for use with Track and the beamline from the
* BeamSpotSvc - ESD */
virtual const Trk::TrackParameters* trackAtBeamline(
const Trk::Track& trk,
const Trk::StraightLineSurface*) const = 0;
/** Interface method for use with Track and the beamline from the
* BeamSpotSvc - TrackParameters */
virtual const Trk::TrackParameters* trackAtBeamline(
const Trk::TrackParameters& tpars,
const Trk::StraightLineSurface*) const = 0;
};
}
#endif // TRACKTOVERTEX_ITRACKTOVERTEX_H
......
......@@ -50,63 +50,108 @@ namespace Reco {
/**Virtual destructor*/
virtual ~TrackToVertex();
/** AlgTool initailize method.*/
virtual StatusCode initialize() override;
virtual StatusCode initialize() override final;
/** AlgTool finalize method */
virtual StatusCode finalize() override;
virtual StatusCode finalize() override final;
/** Use this for MT Coding */
virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(const InDet::BeamSpotData*) const override; //In C++17 make this [[nodiscard]]
virtual const InDet::BeamSpotData* GetBeamSpotData(const EventContext &ctx) const override; //In C++17 make this [[nodiscard]]
/** Interface method for use with TrackParticle and given vertex position - AOD */
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp, const Amg::Vector3D& gp) const override;
/** Interface method for use with xAOD::Trackparticle and given vertex position - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(const xAOD::TrackParticle& tp, const Amg::Vector3D& gp) const override;
/** Interface method for use with TrackParticle and default primary vertex from TrackParticle - AOD */
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp) const override;
/** Interface method for use with TrackParticle and default primary vertex from TrackParticle - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(const xAOD::TrackParticle& tp) const override;
virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(
const InDet::BeamSpotData*)
const override final; // In C++17 make this [[nodiscard]]
virtual const InDet::BeamSpotData* GetBeamSpotData(
const EventContext& ctx)
const override final; // In C++17 make this [[nodiscard]]
/** Interface method for use with TrackParticle and given vertex position
* - AOD */
virtual const Trk::Perigee* perigeeAtVertex(
const Rec::TrackParticle& tp,
const Amg::Vector3D& gp) const override final;
/** Interface method for use with xAOD::Trackparticle and given vertex
* position - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(
const xAOD::TrackParticle& tp,
const Amg::Vector3D& gp) const override final;
/** Interface method for use with TrackParticle and default primary vertex
* from TrackParticle - AOD */
virtual const Trk::Perigee* perigeeAtVertex(
const Rec::TrackParticle& tp) const override final;
/** Interface method for use with TrackParticle and default primary vertex
* from TrackParticle - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(
const xAOD::TrackParticle& tp) const override final;
/** Interface method for use with Track and given vertex position - ESD */
virtual const Trk::Perigee* perigeeAtVertex(const Trk::Track& trk, const Amg::Vector3D& gp) const override;
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - AOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(const Rec::TrackParticle& tp, const InDet::BeamSpotData*) const override;
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - xAOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(const xAOD::TrackParticle& tp, const InDet::BeamSpotData*) const override;
/** Interface method for use with Track and the beamspot from the BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamspot(const Trk::Track& trk, const InDet::BeamSpotData*) const override;
/** Interface method for use with Track and the beamline from the BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamline(const Trk::Track& trk, const InDet::BeamSpotData*) const override;
/** Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - AOD*/
virtual const Trk::TrackParameters* trackAtBeamline(const Rec::TrackParticle& tp) const override;
/** Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - xAOD*/
virtual const Trk::TrackParameters* trackAtBeamline(const xAOD::TrackParticle& tp, const InDet::BeamSpotData*) const override;
/** Interface method for use with Track and the beamline from the BeamSpotSvc - ESD */
virtual const Trk::TrackParameters* trackAtBeamline(const Trk::Track& trk, const Trk::StraightLineSurface* beamline) const override;
/** Interface method for use with Track and the beamline from the BeamSpotSvc - TrackParameters */
virtual const Trk::TrackParameters* trackAtBeamline(const Trk::TrackParameters& tpars, const Trk::StraightLineSurface* beamline) const override;
private:
ToolHandle< Trk::IExtrapolator > m_extrapolator; //!< ToolHandle for Extrapolator
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
bool m_ForceBeamSpotZero = false;
const static Amg::Vector3D s_origin; //!< static origin
virtual const Trk::Perigee* perigeeAtVertex(
const Trk::Track& trk,
const Amg::Vector3D& gp) const override final;
/** Interface method for use with TrackParticle and the beamspot from the
* BeamSpotSvc - AOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(
const Rec::TrackParticle& tp,
const InDet::BeamSpotData*) const override final;
/** Interface method for use with TrackParticle and the beamspot from the
* BeamSpotSvc - xAOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(
const xAOD::TrackParticle& tp,
const InDet::BeamSpotData*) const override final;
/** Interface method for use with Track and the beamspot from the
* BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamspot(
const Trk::Track& trk,
const InDet::BeamSpotData*) const override final;
/** Interface method for use with Track and the beamline from the
* BeamSpotSvc - ESD */
virtual const Trk::Perigee* perigeeAtBeamline(
const EventContext& ctx,
const Trk::Track& trk,
const InDet::BeamSpotData*) const override final;
/** Interface method for use with TrackParticle and the beamline from the
* BeamSpotSvc - AOD*/
virtual const Trk::TrackParameters* trackAtBeamline(
const Rec::TrackParticle& tp) const override final;
/** Interface method for use with TrackParticle and the beamline from the
* BeamSpotSvc - xAOD*/
virtual const Trk::TrackParameters* trackAtBeamline(
const xAOD::TrackParticle& tp,
const InDet::BeamSpotData*) const override final;
/** Interface method for use with Track and the beamline from the
* BeamSpotSvc - ESD */
virtual const Trk::TrackParameters* trackAtBeamline(
const Trk::Track& trk,
const Trk::StraightLineSurface* beamline) const override final;
/** Interface method for use with Track and the beamline from the
* BeamSpotSvc - TrackParameters */
virtual const Trk::TrackParameters* trackAtBeamline(
const Trk::TrackParameters& tpars,
const Trk::StraightLineSurface* beamline) const override final;
private:
ToolHandle<Trk::IExtrapolator>
m_extrapolator; //!< ToolHandle for Extrapolator
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey{
this,
"BeamSpotKey",
"BeamSpotData",
"SG key for beam spot"
};
bool m_ForceBeamSpotZero = false;
const static Amg::Vector3D s_origin; //!< static origin
};
} // end of namespace
......
......@@ -196,8 +196,11 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamspot(const Trk::Track& tra
return perigeeAtVertex(track, beamspot ? beamspot->beamVtx().position() : s_origin);
}
const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamline(const Trk::Track& track, const InDet::BeamSpotData* beamspotptr) const
const Trk::Perigee*
Reco::TrackToVertex::perigeeAtBeamline(
const EventContext& ctx,
const Trk::Track& track,
const InDet::BeamSpotData* beamspotptr) const
{
Amg::Vector3D beamspot(s_origin);
......@@ -218,7 +221,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamline(const Trk::Track& tra
const Trk::Perigee* vertexPerigee = nullptr;
const Trk::TrackParameters* extrapResult =
m_extrapolator->extrapolate(track, persf);
m_extrapolator->extrapolate(ctx,track, persf);
if (extrapResult && extrapResult->surfaceType() == Trk::Surface::Perigee) {
vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
}
......@@ -227,14 +230,13 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamline(const Trk::Track& tra
// try again using the first track parameter set, since the current extrapolator will
// use "the closest" track parameterset which is not necessarily the mostuseful one to
// start the extrapolation with.
// @TODO should try to improve the extrapolator to pick the correct start parameters.
const DataVector<const Trk::TrackParameters> *track_parameter_list= track.trackParameters();
if (track_parameter_list) {
for(const Trk::TrackParameters *trk_params: *track_parameter_list) {
if (!trk_params) {
continue;
}
extrapResult = m_extrapolator->extrapolate(*trk_params, persf);
extrapResult = m_extrapolator->extrapolate(ctx,*trk_params, persf);
if (extrapResult &&
extrapResult->surfaceType() == Trk::Surface::Perigee) {
vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
......
......@@ -346,7 +346,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t,
}
else if (m_perigeeExpression == "BeamLine"){
const Trk::Perigee* result =
m_trackToVertex->perigeeAtBeamline(*track, CacheBeamSpotData(ctx));
m_trackToVertex->perigeeAtBeamline(ctx,*track, CacheBeamSpotData(ctx));
if (!result){
ATH_MSG_WARNING("Failed to extrapolate to Beamline");
......@@ -532,7 +532,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t,
}
else if (m_perigeeExpression == "BeamLine"){
const Trk::Perigee* result =
m_trackToVertex->perigeeAtBeamline(track, CacheBeamSpotData(ctx));
m_trackToVertex->perigeeAtBeamline(ctx,track, CacheBeamSpotData(ctx));
if (!result){
ATH_MSG_WARNING("Failed to extrapolate to Beamline - No TrackParticle created.");
return nullptr;
......
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