29 return StatusCode::SUCCESS;
38 if (!importedTruthEvents.
isValid()) {
40 return StatusCode::FAILURE;
45 ATH_CHECK(writeHandleVtx.
record(std::make_unique<xAOD::TruthVertexContainer>(),
46 std::make_unique<xAOD::TruthVertexAuxContainer>()));
51 for (
const auto * event : *importedTruthEvents){
57 if (!old_vert && event->nTruthVertices()>0){
58 old_vert =
event->truthVertex(0);
64 newVertexCollection->
push_back( xTruthVertex );
68 xTruthVertex->
setX(old_vert->
x());
69 xTruthVertex->
setY(old_vert->
y());
70 xTruthVertex->
setZ(old_vert->
z());
71 xTruthVertex->
setT(old_vert->
t());
73 ATH_MSG_WARNING(
"No signal vertex or vertices associated to an input event!");
76 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
ATLAS-specific HepMC functions.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::WriteHandleKey< xAOD::TruthVertexContainer > m_outVtxKey
Output collection name.
virtual StatusCode initialize() override final
SG::ReadHandleKey< xAOD::TruthEventContainer > m_eventsKey
Input event collection (navigates to the vertices)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
float z() const
Vertex longitudinal distance along the beam line form the origin.
void setStatus(int value)
Set the vertex status.
void setZ(float value)
Set the vertex's longitudinal distance from the origin.
float y() const
Vertex y displacement.
void setUid(int value)
Set the vertex unique ID.
float t() const
Vertex time.
void setT(float value)
Set the vertex time.
float x() const
Vertex x displacement.
void setX(float value)
Set the x displacement of the vertex.
void setY(float value)
Set the y displacement of the vertex.
TruthVertex_v1 TruthVertex
Typedef to implementation.
TruthVertexContainer_v1 TruthVertexContainer
Declare the latest version of the truth vertex container.