 |
ATLAS Offline Software
|
Go to the documentation of this file.
29 return StatusCode::SUCCESS;
38 auto outputContainer = std::make_unique<xAOD::TruthParticleContainer>();
39 auto outputAuxContainer = std::make_unique<xAOD::AuxContainerBase>();
40 outputContainer->setStore(outputAuxContainer.get());
46 bool warningPrinted =
false;
50 outputContainer->push_back(output);
55 const int barcode = barcodeAcc(*output);
61 }
else if (warningPrinted ==
false) {
64 "xAOD::TruthParticle barcode is not available. This algorithm should "
65 "not be run with the current input.");
66 warningPrinted =
true;
76 <<
"\" is not available on "
80 return StatusCode::FAILURE;
82 auto&
links = linkAcc(*output);
84 for (
auto& link :
links) {
85 link.resetWithKeyAndIndex(
98 <<
"\" is not available on "
102 return StatusCode::FAILURE;
104 auto&
links = linkAcc(*output);
106 for (
auto& link :
links) {
107 link.resetWithKeyAndIndex(
117 .record(std::move(outputContainer), std::move(outputAuxContainer)));
122 return StatusCode::SUCCESS;
Gaudi::Property< std::vector< std::string > > m_particleLinks
Names of the truth particle links to fix.
Helper class to provide type-safe access to aux data.
virtual StatusCode initialize() override
Function initialising the algorithm.
Gaudi::Property< std::string > m_linkPrefixToRemove
Prefix to remove from the link names.
const std::string & key() const
Return the StoreGate ID for the referenced object.
std::string removePrefix(std::string_view str, std::string_view prefix)
Remove a prefix from a string, if it exists.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
TruthParticle_v1 TruthParticle
Typedef to implementation.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_outputContainerKey
The keys for the output xAOD truth containers.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_inputContainerKey
The keys of the input xAOD truth containers.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
Gaudi::Property< std::vector< std::string > > m_vertexLinks
Names of the truth vertex links to fix.
int new_particle_status_from_old(const int oldStatus, const int barcode)
Get particle status in the new scheme from the barcode and status in the old scheme.