46 return StatusCode::SUCCESS;
53 if (!parts.isValid()) {
55 return StatusCode::FAILURE;
60 return StatusCode::FAILURE;
64 ATH_MSG_DEBUG(
"No truth pileup collection with name " <<
m_truthPileupSGKey.fullKey() <<
" found in StoreGate. Pile-up information will not be filled");
70 return StatusCode::FAILURE;
80 if (dR > minDR)
continue;
86 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
92 if (dR > minDR)
continue;
98 decorator_dR(*part) = closest ? std::sqrt(minDR) : -1;
100 int newType{-1}, newOrigin{-1};
101 if (closest && closest->
isMuon()) {
102 newType = acc_tT(*closest);
103 newOrigin = acc_tO(*closest);
104 }
else if (closest) {
107 newOrigin =
res.second;
109 decorator_type(*part) = newType;
110 decorator_origin(*part) = newOrigin;
112 decorator_pu_dR(*part) = -1;
113 decorator_pu_type(*part) = -1;
114 decorator_pu_origin(*part) = -1;
120 for (
auto event : *tpec) {
121 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
127 if (dR > minDR)
continue;
128 closestPileup = tpart;
132 decorator_pu_dR(*part) = (closestPileup ? std::sqrt(minDR) : -1);
133 int newPileupType{-1}, newPileupOrigin{-1};
136 newPileupType =
res.first;
137 newPileupOrigin =
res.second;
139 decorator_pu_type(*part) = newPileupType;
140 decorator_pu_origin(*part) = newPileupOrigin;
144 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
ATLAS-specific HepMC functions.
std::pair< std::vector< unsigned int >, bool > res
ToolHandle< IMCTruthClassifier > m_mcTruthClassifier
Gaudi::Property< float > m_minPt
SG::ReadHandleKey< xAOD::TruthPileupEventContainer > m_truthPileupSGKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthSGKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_Truth_type_Key
virtual StatusCode initialize() override
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_Truth_origin_Key
virtual StatusCode addBranches(const EventContext &ctx) const override
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_Truth_dR_Key
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_Truth_PU_dR_Key
SG::ReadHandleKey< xAOD::IParticleContainer > m_containerKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_Truth_PU_origin_Key
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthMuonSGKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_Truth_PU_type_Key
Helper class to provide type-safe access to aux data.
Helper class to provide type-safe access to aux data.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Class providing the definition of the 4-vector interface.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
double charge() const
Physical charge.
bool isMuon() const
Whether the particle is a muon (or antimuon)
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
TruthEvent_v1 TruthEvent
Typedef to implementation.
TruthParticle_v1 TruthParticle
Typedef to implementation.