 |
ATLAS Offline Software
|
Go to the documentation of this file.
29 return StatusCode::SUCCESS;
38 if (!importedTruthEvents.isValid()) {
39 ATH_MSG_ERROR(
"No TruthEvent collection with name " << m_eventsKey.fullKey() <<
" found in StoreGate!");
40 return StatusCode::FAILURE;
45 ATH_CHECK(writeHandleVtx.record(std::make_unique<xAOD::TruthVertexContainer>(),
46 std::make_unique<xAOD::TruthVertexAuxContainer>()));
48 ATH_MSG_DEBUG(
"Recorded new TruthVertexContainer with key: " << m_outVtxKey.fullKey());
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;
void setT(float value)
Set the vertex time.
virtual StatusCode addBranches(const EventContext &ctx) const override final
#define ATH_MSG_VERBOSE(x)
void setY(float value)
Set the y displacement of the vertex.
float y() const
Vertex y displacement.
float t() const
Vertex time.
Handle class for recording to StoreGate.
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual StatusCode initialize() override final
TruthVertex_v1 TruthVertex
Typedef to implementation.
Class describing a truth vertex in the MC record.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
float x() const
Vertex x displacement.
void setZ(float value)
Set the vertex's longitudinal distance from the origin.
void setUid(int value)
Set the vertex unique ID.
#define ATH_MSG_WARNING(x)
float z() const
Vertex longitudinal distance along the beam line form the origin.
SG::WriteHandleKey< xAOD::TruthVertexContainer > m_outVtxKey
Output collection name.
Handle class for reading from StoreGate.
void setStatus(int value)
Set the vertex status.
void setX(float value)
Set the x displacement of the vertex.
SG::ReadHandleKey< xAOD::TruthEventContainer > m_eventsKey
Input event collection (navigates to the vertices)