56 const Eigen::Matrix2d& vtxCov) {
66 Eigen::Vector2d vtxJacobian(-std::sin(
phi), std::cos(
phi));
67 double vertexComponent = vtxJacobian.transpose()*vtxCov*vtxJacobian;
69 return std::sqrt(trackComponent + vertexComponent);
77 Eigen::Matrix2d vtxCov = vtx.covariancePosition().block<2,2>(0,0);
84 Eigen::Matrix2d bsCov;
92 bsCov(0, 0) = std::pow(evt.beamPosSigmaX(),2);
93 bsCov(0, 1) = evt.beamPosSigmaXY();
94 bsCov(1, 0) = evt.beamPosSigmaXY();
95 bsCov(1, 1) = std::pow(evt.beamPosSigmaY(),2);
105 Eigen::Matrix2d trkCov;
111 Eigen::Vector2d trkJacobian(
114 double trackComponent = trkJacobian.transpose()*trkCov*trkJacobian;
117 double vertexComponent = std::sin(
theta)*vxZCov*std::sin(
theta);
119 return std::sqrt(trackComponent + vertexComponent);
124 double vxZCov = vtx.covariancePosition()(
Pmt::z,
Pmt::z);
133 const std::string& name, ISvcLocator* loc )
174 "Accessors for beamspot:" <<
186 return StatusCode::SUCCESS;
201 if ( primary ==
nullptr ) {
203 return StatusCode::FAILURE;
210 ATH_MSG_DEBUG(
"Retrieved " << tracks->size() <<
" input tracks..." );
237 float d0_sigma2 = trk->definingParametersCovMatrixDiagVec().at(
Pmt::d0);
243 float full_d0_sigma = std::sqrt(d0_sigma2 + bs_d0_sigma2);
244 ATH_MSG_DEBUG(
"track d0Uncertainty: " << std::sqrt(d0_sigma2));
245 ATH_MSG_DEBUG(
"beamspot d0Uncertainty: " << std::sqrt(bs_d0_sigma2));
248 decor_d0_sigma(*trk) = full_d0_sigma;
254 double vxZCov = std::pow(beam_sigma_z(evt), 2);
264 primary ? primary->position().z() - trk->vz() : 0);
268 auto trkp4 = trk->p4();
269 const Amg::Vector3D momentum(trkp4.Px(), trkp4.Py(), trkp4.Pz());
272 "track_displacement (x,y,z)= ("
273 << position.x() <<
", " << position.y() <<
", " << position.z()
276 "track_momentum (x,y,z)= ("
277 << momentum.x() <<
", " << momentum.y() <<
", " << momentum.z()
280 std::vector<float> out_vec_pos(
281 position.data(), position.data() + position.size());
282 std::vector<float> out_vec_mom(
283 momentum.data(), momentum.data() + momentum.size());
285 decor_track_pos (*trk) = out_vec_pos;
286 decor_track_mom (*trk) = out_vec_mom;
290 decor_invalid(*trk) = 0;
293 return StatusCode::SUCCESS;
297 return StatusCode::SUCCESS;
302 if ( vertexCollection.
size() == 0 ) {
315 return vertexCollection.
front();
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
const T * front() const
Access the first element in the collection as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::ReadDecorHandleKey< xAOD::EventInfo > m_beam_cov_xy
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackContainerKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_dec_track_pos
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_dec_z0_sigma
const xAOD::Vertex * getPrimaryVertex(const xAOD::VertexContainer &) const
virtual StatusCode finalize() override
Gaudi::Property< std::string > m_prefix
SG::ReadDecorHandleKey< xAOD::EventInfo > m_beam_sigma_x
virtual StatusCode initialize() override
SG::ReadHandleKey< xAOD::VertexContainer > m_VertexContainerKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_dec_track_mom
SG::ReadDecorHandleKey< xAOD::EventInfo > m_beam_sigma_z
virtual StatusCode execute(const EventContext &) const override
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_beam_sigma_y
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_dec_invalid
PoorMansIpAugmenterAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_dec_d0_sigma
Handle class for reading a decoration on an object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Handle class for adding a decoration to an object.
float z0() const
Returns the parameter.
const std::vector< float > & definingParametersCovMatrixDiagVec() const
Returns the diagonal elements of the defining parameters covariance matrix.
float theta() const
Returns the parameter, which has range 0 to .
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float d0() const
Returns the parameter.
Eigen::Matrix< double, 3, 1 > Vector3D
double getSigmaD0(const xAOD::TrackParticle &trk, const Eigen::Matrix2d &vtxCov)
double getSigmaD0WithRespectToBeamspot(const xAOD::TrackParticle &trk, const xAOD::EventInfo &evt)
double getSigmaZ0SinTheta(const xAOD::TrackParticle &trk, double vxZCov)
Eigen::Vector3d getPosition(const xAOD::TrackParticle &trk)
double d0UncertaintyBeamSpot2(double track_phi0, double beam_sigma_x, double beam_sigma_y, double beam_sigma_xy)
calculate the squared d0 uncertainty component due to the size of the beam spot.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".