 |
ATLAS Offline Software
|
Go to the documentation of this file.
26 return StatusCode::SUCCESS;
36 ATH_CHECK(muonTruthContainer.
record(std::make_unique<xAOD::TruthParticleContainer>(),
37 std::make_unique<xAOD::TruthParticleAuxContainer>()));
47 xAOD::TruthParticle* truthParticle = muonTruthContainer->push_back(std::make_unique<xAOD::TruthParticle>());
48 truthParticle->
setPdgId(truth->pdgId());
50 truthParticle->
setStatus(truth->status());
51 truthParticle->
setPx(truth->px());
52 truthParticle->
setPy(truth->py());
53 truthParticle->
setPz(truth->pz());
54 truthParticle->
setE(truth->e());
55 truthParticle->
setM(truth->m());
56 if (truth->hasProdVtx()) truthParticle->
setProdVtxLink(truth->prodVtxLink());
58 TruthLink_t itruthLink(*truthContainer, truth->index());
60 truthLink(*truthParticle) = itruthLink;
61 ATH_MSG_DEBUG(
"Found stable muon: " << truth->pt() <<
" eta " << truth->eta() <<
" phi " << truth->phi() <<
" mass "
62 << truth->m() <<
" unique ID " <<
HepMC::uniqueID(truth) <<
" HepMC::uniqueID(truthParticle) "
65 int iType{0}, iOrigin{0};
70 std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin> truthClass =
72 iType = truthClass.first;
73 iOrigin = truthClass.second;
79 ATH_MSG_DEBUG(
"good muon with type " << iType <<
" and origin" << iOrigin);
82 ATH_MSG_DEBUG(
"Registered " << muonTruthContainer->size() <<
" truth muons ");
84 return StatusCode::SUCCESS;
void setStatus(int value)
Set status code.
Gaudi::Property< float > m_pt
void setE(float value)
Set the energy of the particle.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
void setPx(float value)
Set the x component of the particle's momentum.
#define ATH_MSG_VERBOSE(x)
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
int truthType(const U &p)
int truthOrigin(const U &p)
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_truthOriginKey
virtual StatusCode execute(const EventContext &ctx) const override
void setM(float value)
Also store the mass.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
Handle class for adding a decoration to an object.
ToolHandle< IMCTruthClassifier > m_truthClassifier
Handle class for adding a decoration to an object.
void setPy(float value)
Set the y component of the particle's momentum.
Gaudi::Property< std::set< int > > m_pdgIds
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
ElementLink implementation for ROOT usage.
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_truthTypeKey
void setPdgId(int pid)
Set PDG ID code.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_outTruthMuonKey
void setUid(int value)
Set unique ID.
virtual StatusCode initialize() override
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setPz(float value)
Set the z component of the particle's momentum.
void setProdVtxLink(const ElementLink< TruthVertexContainer > &link)
Set the production vertex of the particle.
bool toPersistent()
Dummy function provinding the offline interface.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthRecordKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_truthLinkKey