12 ISvcLocator *pSvcLocator)
19 std::vector<std::string> supportedStrategies {
"BeamLine",
"Vertex"};
20 bool isAllowedStrategy =
false;
21 for (
const std::string& strategy : supportedStrategies) {
23 isAllowedStrategy =
true;
27 if (not isAllowedStrategy) {
28 ATH_MSG_ERROR(
"Wrong configuration of the Track to Track Particle Cnv algorithm: perigeeExpression is not supported");
29 return StatusCode::FAILURE;
35 else return StatusCode::FAILURE;
46 return StatusCode::SUCCESS;
52 if (wh_track_particles.
record(std::make_unique<xAOD::TrackParticleContainer>(),
53 std::make_unique<xAOD::TrackParticleAuxContainer>()).isFailure()) {
55 return StatusCode::FAILURE;
69 beamspot_data = beamSpotHandle.
cptr();
75 vertexContainer = vertexHandle.
cptr();
76 if (vertexContainer->
size() == 0) {
77 ATH_MSG_ERROR(
"Retrieved an empty vertex container. This is totally wrong!");
78 return StatusCode::FAILURE;
88 if (not primaryVertex) {
89 ATH_MSG_WARNING(
"Requested to compute track particles wrt primary vertex, but no primary vertex is found. Using dummy vertex");
90 primaryVertex = vertexContainer->front();
94 std::size_t nTracks = 0ul;
95 std::vector<const ActsTrk::TrackContainer *> trackContainers;
99 trackContainers.push_back( handle.
cptr() );
100 nTracks += trackContainers.back()->size();
104 std::vector<xAOD::TrackParticle*> toAddParticles;
105 toAddParticles.reserve(nTracks);
106 for (std::size_t i(0); i<nTracks; ++i) {
109 track_particles->
insert(track_particles->
end(),
110 toAddParticles.begin(),
111 toAddParticles.end());
113 std::shared_ptr<Acts::PerigeeSurface> perigee_surface {
nullptr};
120 std::size_t particleCounter = 0ul;
122 for (
const typename ActsTrk::TrackContainer::ConstTrackProxy track : *tracksContainer) {
125 perigee_surface.get(), beamspot_data) );
128 trackLink(*track_particle)
134 ATH_MSG_DEBUG(
"Converted " << nTracks <<
" acts tracks into " << track_particles->
size() <<
" track particles.");
136 return StatusCode::SUCCESS;
141 Acts::Vector3 beamspot(0., 0., 0.);
149 Acts::Translation3 translation(beamspot);
150 Acts::Transform3 transform( translation * Acts::RotationMatrix3::Identity() );
151 transform *= Acts::AngleAxis3(tilty, Acts::Vector3(0.,1.,0.));
152 transform *= Acts::AngleAxis3(tiltx, Acts::Vector3(1.,0.,0.));
153 return Acts::Surface::makeShared<Acts::PerigeeSurface>(transform);
157 Acts::Translation3 translation(Acts::Vector3(vertex.position()));
158 Acts::Transform3 transform( translation * Acts::RotationMatrix3::Identity() );
159 return Acts::Surface::makeShared<Acts::PerigeeSurface>(transform);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
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::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexHandle
ToolHandle< ActsTrk::ITrackToTrackParticleCnvTool > m_cnvTool
SG::ReadHandleKeyArray< ActsTrk::TrackContainer > m_tracksContainerKey
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_perigeeExpression
TrackToTrackParticleCnvAlg(const std::string &name, ISvcLocator *pSvcLocator)
An algorithm that can be simultaneously executed in multiple threads.
const T * at(size_type n) const
Access an element, as an rvalue.
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
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
const_pointer_type cptr()
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
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...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
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".