26 const std::string& name, ISvcLocator* loc )
64 return StatusCode::SUCCESS;
74 ATH_MSG_DEBUG(
"Retrieved " << tracks->size() <<
" tracks..." );
77 ATH_MSG_DEBUG(
"Retrieved " << muons->size() <<
" muons..." );
97 std::vector<const xAOD::TrackParticle*> tracks_vector(tracks->begin(), tracks->end());
98 for (
const auto& track : tracks_vector ) {
109 dec_type_label(*track) = truth ? acc_type_label(*truth) : TruthDecoratorHelpers::TruthType::Label::NoTruth;
110 dec_source_label(*track) = truth ? acc_source_label(*truth) : TruthDecoratorHelpers::TruthSource::Label::NoTruth;
111 dec_vertex_index(*track) = truth ? acc_vertex_index(*truth) : -2;
112 dec_muon_origin_label(*track) = -2;
118 for (
const auto muon : *muons ) {
121 if (muon->muonType() != xAOD::Muon::MuonType::Combined) {
continue; }
124 unsigned int muTruthOrigin = 0;
129 auto track = muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
130 if ( !track ) {
continue; }
134 if ( !truth ) {
continue; }
139 if ( abs(truth->pdgId()) != 13 ) {
155 muTruthOrigin = it->second;
159 ATH_MSG_ERROR(
"Muon truth origin not found in the map: " <<
static_cast<int>(muTruthOriginType));
160 return StatusCode::FAILURE;
165 dec_muon_origin_label(*track) = muTruthOrigin;
168 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
std::unordered_map< Truth::Type, unsigned int > m_muTruthMap
virtual StatusCode initialize() override
Gaudi::Property< bool > m_use_barcode
ToolHandle< CP::IClassificationTool > m_truthLeptonTool
SG::ConstAccessor< int > m_uid
WDHK m_dec_muon_origin_label
TrackTruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &) const override
WDHK m_dec_parent_uniqueID
SG::ReadHandleKey< xAOD::MuonContainer > m_MuonContainerKey
RDHK m_acc_parent_uniqueID
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackContainerKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
ToolHandle< InDet::InDetTrackTruthOriginTool > m_trackTruthOriginTool
Helper class to provide constant type-safe access to aux data.
Handle class for reading a decoration on an object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Handle class for adding a decoration to an object.
constexpr int UNDEFINED_ID
int getExclusiveOrigin(int origin)
bool isFromDfromB(int origin)
from B-->D decay chain
Type
truth classification type enum
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".