Skip to content
Snippets Groups Projects
Commit 1fe04858 authored by Christos Anastopoulos's avatar Christos Anastopoulos Committed by Frank Winklmeier
Browse files

Make perigeeAtBeamline EventContext aware

parent f4682b7a
5 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
...@@ -53,51 +53,90 @@ namespace Reco { ...@@ -53,51 +53,90 @@ namespace Reco {
/** AlgTool interface methods */ /** AlgTool interface methods */
static const InterfaceID& interfaceID() { return IID_ITrackToVertex; }; static const InterfaceID& interfaceID() { return IID_ITrackToVertex; };
/** Use this for MT Coding */ /** Use this for MT Coding */
virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(const InDet::BeamSpotData*) const = 0; //In C++17 make this [[nodiscard]] virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(
const InDet::BeamSpotData*)
virtual const InDet::BeamSpotData* GetBeamSpotData(const EventContext &ctx) const = 0; //In C++17 make this [[nodiscard]] const = 0; // In C++17 make this [[nodiscard]]
/** Interface method for use with TrackParticle and given vertex position - AOD */ virtual const InDet::BeamSpotData* GetBeamSpotData(
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp, const Amg::Vector3D& gp) const = 0; const EventContext& ctx) const = 0; // In C++17 make this [[nodiscard]]
/** Interface method for use with xAOD::Trackparticle and given vertex position - xAOD */ /** Interface method for use with TrackParticle and given vertex position
virtual const Trk::Perigee* perigeeAtVertex(const xAOD::TrackParticle& tp, const Amg::Vector3D& gp) const = 0; * - AOD */
virtual const Trk::Perigee* perigeeAtVertex(
/** Interface method for use with TrackParticle and default primary vertex from TrackParticle - AOD */ const Rec::TrackParticle& tp,
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp) const = 0; const Amg::Vector3D& gp) const = 0;
/** Interface method for use with TrackParticle and default primary vertex from TrackParticle - xAOD */ /** Interface method for use with xAOD::Trackparticle and given vertex
virtual const Trk::Perigee* perigeeAtVertex(const xAOD::TrackParticle& tp) const = 0; * position - xAOD */
virtual const Trk::Perigee* perigeeAtVertex(
/** Interface method for use with Track and given vertex position - ESD */ const xAOD::TrackParticle& tp,
virtual const Trk::Perigee* perigeeAtVertex(const Trk::Track& trk, const Amg::Vector3D& gp) const = 0; const Amg::Vector3D& gp) const = 0;
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - AOD*/ /** Interface method for use with TrackParticle and default primary
virtual const Trk::Perigee* perigeeAtBeamspot(const Rec::TrackParticle& tp, const InDet::BeamSpotData*) const = 0; * vertex from TrackParticle - AOD */
virtual const Trk::Perigee* perigeeAtVertex(
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - xAOD*/ const Rec::TrackParticle& tp) const = 0;
virtual const Trk::Perigee* perigeeAtBeamspot(const xAOD::TrackParticle& tp, const InDet::BeamSpotData*) const = 0;
/** Interface method for use with TrackParticle and default primary
/** Interface method for use with Track and the beamspot from the BeamSpotSvc - ESD */ * vertex from TrackParticle - xAOD */
virtual const Trk::Perigee* perigeeAtBeamspot(const Trk::Track& trk, const InDet::BeamSpotData*) const = 0; virtual const Trk::Perigee* perigeeAtVertex(
const xAOD::TrackParticle& tp) 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 Track and given vertex position - ESD
*/
/** Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - AOD*/ virtual const Trk::Perigee* perigeeAtVertex(
virtual const Trk::TrackParameters* trackAtBeamline(const Rec::TrackParticle& tp) const = 0; const Trk::Track& trk,
const Amg::Vector3D& gp) 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 TrackParticle and the beamspot from the
* BeamSpotSvc - AOD*/
/** Interface method for use with Track and the beamline from the BeamSpotSvc - ESD */ virtual const Trk::Perigee* perigeeAtBeamspot(
virtual const Trk::TrackParameters* trackAtBeamline(const Trk::Track& trk, const Trk::StraightLineSurface*) const = 0; const Rec::TrackParticle& tp,
const InDet::BeamSpotData*) 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; /** 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 #endif // TRACKTOVERTEX_ITRACKTOVERTEX_H
......
...@@ -50,63 +50,108 @@ namespace Reco { ...@@ -50,63 +50,108 @@ namespace Reco {
/**Virtual destructor*/ /**Virtual destructor*/
virtual ~TrackToVertex(); virtual ~TrackToVertex();
/** AlgTool initailize method.*/ /** AlgTool initailize method.*/
virtual StatusCode initialize() override; virtual StatusCode initialize() override final;
/** AlgTool finalize method */ /** AlgTool finalize method */
virtual StatusCode finalize() override; virtual StatusCode finalize() override final;
/** Use this for MT Coding */ /** Use this for MT Coding */
virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(const InDet::BeamSpotData*) const override; //In C++17 make this [[nodiscard]] virtual std::unique_ptr<Trk::StraightLineSurface> GetBeamLine(
const InDet::BeamSpotData*)
virtual const InDet::BeamSpotData* GetBeamSpotData(const EventContext &ctx) const override; //In C++17 make this [[nodiscard]] const override final; // In C++17 make this [[nodiscard]]
/** Interface method for use with TrackParticle and given vertex position - AOD */ virtual const InDet::BeamSpotData* GetBeamSpotData(
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp, const Amg::Vector3D& gp) const override; const EventContext& ctx)
const override final; // In C++17 make this [[nodiscard]]
/** 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 given vertex position
* - AOD */
/** Interface method for use with TrackParticle and default primary vertex from TrackParticle - AOD */ virtual const Trk::Perigee* perigeeAtVertex(
virtual const Trk::Perigee* perigeeAtVertex(const Rec::TrackParticle& tp) const override; const Rec::TrackParticle& tp,
const Amg::Vector3D& gp) 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; /** 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 */ /** 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; virtual const Trk::Perigee* perigeeAtVertex(
const Trk::Track& trk,
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - AOD*/ const Amg::Vector3D& gp) const override final;
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
/** Interface method for use with TrackParticle and the beamspot from the BeamSpotSvc - xAOD*/ * BeamSpotSvc - AOD*/
virtual const Trk::Perigee* perigeeAtBeamspot(const xAOD::TrackParticle& tp, const InDet::BeamSpotData*) const override; virtual const Trk::Perigee* perigeeAtBeamspot(
const Rec::TrackParticle& tp,
/** Interface method for use with Track and the beamspot from the BeamSpotSvc - ESD */ const InDet::BeamSpotData*) const override final;
virtual const Trk::Perigee* perigeeAtBeamspot(const Trk::Track& trk, const InDet::BeamSpotData*) const override;
/** Interface method for use with TrackParticle and the beamspot from the
/** Interface method for use with Track and the beamline from the BeamSpotSvc - ESD */ * BeamSpotSvc - xAOD*/
virtual const Trk::Perigee* perigeeAtBeamline(const Trk::Track& trk, const InDet::BeamSpotData*) const override; virtual const Trk::Perigee* perigeeAtBeamspot(
const xAOD::TrackParticle& tp,
/** Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - AOD*/ const InDet::BeamSpotData*) const override final;
virtual const Trk::TrackParameters* trackAtBeamline(const Rec::TrackParticle& tp) const override;
/** Interface method for use with Track and the beamspot from the
/** Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - xAOD*/ * BeamSpotSvc - ESD */
virtual const Trk::TrackParameters* trackAtBeamline(const xAOD::TrackParticle& tp, const InDet::BeamSpotData*) const override; virtual const Trk::Perigee* perigeeAtBeamspot(
const Trk::Track& trk,
/** Interface method for use with Track and the beamline from the BeamSpotSvc - ESD */ const InDet::BeamSpotData*) const override final;
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
/** Interface method for use with Track and the beamline from the BeamSpotSvc - TrackParameters */ * BeamSpotSvc - ESD */
virtual const Trk::TrackParameters* trackAtBeamline(const Trk::TrackParameters& tpars, const Trk::StraightLineSurface* beamline) const override; virtual const Trk::Perigee* perigeeAtBeamline(
const EventContext& ctx,
const Trk::Track& trk,
private: const InDet::BeamSpotData*) const override final;
ToolHandle< Trk::IExtrapolator > m_extrapolator; //!< ToolHandle for Extrapolator
/** Interface method for use with TrackParticle and the beamline from the
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; * BeamSpotSvc - AOD*/
bool m_ForceBeamSpotZero = false; virtual const Trk::TrackParameters* trackAtBeamline(
const static Amg::Vector3D s_origin; //!< static origin 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 } // end of namespace
......
...@@ -196,8 +196,11 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamspot(const Trk::Track& tra ...@@ -196,8 +196,11 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamspot(const Trk::Track& tra
return perigeeAtVertex(track, beamspot ? beamspot->beamVtx().position() : s_origin); return perigeeAtVertex(track, beamspot ? beamspot->beamVtx().position() : s_origin);
} }
const Trk::Perigee*
const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamline(const Trk::Track& track, const InDet::BeamSpotData* beamspotptr) const Reco::TrackToVertex::perigeeAtBeamline(
const EventContext& ctx,
const Trk::Track& track,
const InDet::BeamSpotData* beamspotptr) const
{ {
Amg::Vector3D beamspot(s_origin); Amg::Vector3D beamspot(s_origin);
...@@ -218,7 +221,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamline(const Trk::Track& tra ...@@ -218,7 +221,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamline(const Trk::Track& tra
const Trk::Perigee* vertexPerigee = nullptr; const Trk::Perigee* vertexPerigee = nullptr;
const Trk::TrackParameters* extrapResult = const Trk::TrackParameters* extrapResult =
m_extrapolator->extrapolate(track, persf); m_extrapolator->extrapolate(ctx,track, persf);
if (extrapResult && extrapResult->surfaceType() == Trk::Surface::Perigee) { if (extrapResult && extrapResult->surfaceType() == Trk::Surface::Perigee) {
vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult); vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
} }
...@@ -227,14 +230,13 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtBeamline(const Trk::Track& tra ...@@ -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 // 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 // use "the closest" track parameterset which is not necessarily the mostuseful one to
// start the extrapolation with. // 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(); const DataVector<const Trk::TrackParameters> *track_parameter_list= track.trackParameters();
if (track_parameter_list) { if (track_parameter_list) {
for(const Trk::TrackParameters *trk_params: *track_parameter_list) { for(const Trk::TrackParameters *trk_params: *track_parameter_list) {
if (!trk_params) { if (!trk_params) {
continue; continue;
} }
extrapResult = m_extrapolator->extrapolate(*trk_params, persf); extrapResult = m_extrapolator->extrapolate(ctx,*trk_params, persf);
if (extrapResult && if (extrapResult &&
extrapResult->surfaceType() == Trk::Surface::Perigee) { extrapResult->surfaceType() == Trk::Surface::Perigee) {
vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult); vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
......
...@@ -346,7 +346,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t, ...@@ -346,7 +346,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t,
} }
else if (m_perigeeExpression == "BeamLine"){ else if (m_perigeeExpression == "BeamLine"){
const Trk::Perigee* result = const Trk::Perigee* result =
m_trackToVertex->perigeeAtBeamline(*track, CacheBeamSpotData(ctx)); m_trackToVertex->perigeeAtBeamline(ctx,*track, CacheBeamSpotData(ctx));
if (!result){ if (!result){
ATH_MSG_WARNING("Failed to extrapolate to Beamline"); ATH_MSG_WARNING("Failed to extrapolate to Beamline");
...@@ -532,7 +532,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t, ...@@ -532,7 +532,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t,
} }
else if (m_perigeeExpression == "BeamLine"){ else if (m_perigeeExpression == "BeamLine"){
const Trk::Perigee* result = const Trk::Perigee* result =
m_trackToVertex->perigeeAtBeamline(track, CacheBeamSpotData(ctx)); m_trackToVertex->perigeeAtBeamline(ctx,track, CacheBeamSpotData(ctx));
if (!result){ if (!result){
ATH_MSG_WARNING("Failed to extrapolate to Beamline - No TrackParticle created."); ATH_MSG_WARNING("Failed to extrapolate to Beamline - No TrackParticle created.");
return nullptr; 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