12 const std::vector<std::string> supportedStrategies {
"BeamLine",
"Vertex",
"DontRecalculate"};
13 bool isAllowedStrategy =
false;
14 for (
const std::string& strategy : supportedStrategies) {
16 isAllowedStrategy =
true;
20 if (not isAllowedStrategy) {
21 ATH_MSG_ERROR(
"Wrong configuration of the Track to Track Particle Cnv algorithm: perigeeExpression is not supported");
22 return StatusCode::FAILURE;
40 return StatusCode::SUCCESS;
45 ATH_CHECK(wh_track_particles.
record(std::make_unique<xAOD::TrackParticleContainer>(),
46 std::make_unique<xAOD::TrackParticleAuxContainer>()));
61 if (vertexContainer->
size() == 0) {
62 ATH_MSG_ERROR(
"Retrieved an empty vertex container. This is totally wrong!");
63 return StatusCode::FAILURE;
73 if (not primaryVertex) {
74 ATH_MSG_WARNING(
"Requested to compute track particles wrt primary vertex, but no primary vertex is found. Using dummy vertex");
75 primaryVertex = vertexContainer->front();
79 std::size_t nTracks = 0ul;
80 std::vector<const ActsTrk::TrackContainer *> trackContainers;
83 nTracks += trackContainers.back()->size();
87 track_particles->
reserve(nTracks);
88 for (std::size_t i = 0; i<nTracks; ++i) {
89 track_particles->
push_back( std::make_unique<xAOD::TrackParticle>());
92 std::shared_ptr<const Acts::Surface> perigee_surface {
nullptr};
99 std::size_t particleCounter = 0ul;
101 for (
const typename ActsTrk::TrackContainer::ConstTrackProxy track : *tracksContainer) {
104 perigee_surface = track.referenceSurface().getSharedPtr();
106 ATH_CHECK(
m_cnvTool->convert(*track_particle, ctx, track, *perigee_surface, beamspot_data));
110 ATH_CHECK( trackLink(*track_particle).isValid() );
113 ATH_MSG_DEBUG(
"Converted " << nTracks <<
" acts tracks into " << track_particles->
size() <<
" track particles.");
115 return StatusCode::SUCCESS;
120 Acts::Vector3 beamspot = Amg::Vector3D::Zero();
121 float tiltx{0.f}, tilty{0.f};
130 return Acts::Surface::makeShared<Acts::PerigeeSurface>(trf);
134 return Acts::Surface::makeShared<Acts::PerigeeSurface>(
Amg::getTranslate3D(vertex.position()));
#define ATH_CHECK
Evaluate an expression and check for errors.
ElementLink()
Default constructor.
#define ATH_MSG_WARNING(x)
static std::shared_ptr< Acts::PerigeeSurface > makePerigeeSurface(const InDet::BeamSpotData *beamspotptr)
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_decorator_actsTracks
expressionStrategy m_expression_strategy
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_trackParticlesOutKey
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
ToolHandle< ActsTrk::ITrackToTrackParticleCnvTool > m_cnvTool
SG::ReadHandleKeyArray< ActsTrk::TrackContainer > m_tracksContainerKey
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_perigeeExpression
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
float beamTilt(int i) const noexcept
Returns the beam sigma for the i+3-th error matrix element (the 'tilt').
const Trk::RecVertex & beamVtx() const noexcept
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for adding a decoration to an object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
const Amg::Vector3D & position() const
return position of vertex
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Amg::Transform3D getRotateX3D(double angle)
get a rotation transformation around X-axis
Amg::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Eigen::Affine3d Transform3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
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".