31 const IInterface*
p) :
33 declareInterface<DerivationFramework::IAugmentationTool>(
this);
39 ATH_CHECK(m_mcTruthClassifier.retrieve());
43 ATH_CHECK(m_truthPileupSGKey.initialize());
47 m_Truth_dR_Key = m_containerKey.key() +
".MCTFallback_dR";
48 m_Truth_type_Key = m_containerKey.key() +
".MCTFallback_truthType";
49 m_Truth_origin_Key = m_containerKey.key() +
".MCTFallback_truthOrigin";
52 ATH_CHECK(m_Truth_origin_Key.initialize());
54 m_Truth_PU_dR_Key = m_containerKey.key() +
".MCTFallbackPU_dR";
55 m_Truth_PU_type_Key = m_containerKey.key() +
".MCTFallbackPU_truthType";
56 m_Truth_PU_origin_Key = m_containerKey.key() +
".MCTFallbackPU_truthOrigin";
57 ATH_CHECK(m_Truth_PU_dR_Key.initialize());
58 ATH_CHECK(m_Truth_PU_type_Key.initialize());
59 ATH_CHECK(m_Truth_PU_origin_Key.initialize());
61 return StatusCode::SUCCESS;
66 const EventContext& ctx = Gaudi::Hive::currentContext();
69 if (!
parts.isValid()) {
70 ATH_MSG_ERROR(
"No Muon collection with name " << m_containerKey.fullKey() <<
" found in StoreGate!");
71 return StatusCode::FAILURE;
75 ATH_MSG_ERROR(
"No truth collection with name " << m_truthSGKey.fullKey() <<
" found in StoreGate!");
76 return StatusCode::FAILURE;
79 if (!tpec.isValid()) {
80 ATH_MSG_DEBUG(
"No truth pileup collection with name " << m_truthPileupSGKey.fullKey() <<
" found in StoreGate. Pile-up information will not be filled");
84 if (!truthMuons.isValid()) {
85 ATH_MSG_ERROR(
"No truth muon collection with name " << m_truthMuonSGKey.fullKey() <<
" found in StoreGate!");
86 return StatusCode::FAILURE;
96 if (dR > minDR)
continue;
102 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
105 tpart->
pt() < m_minPt)
108 if (dR > minDR)
continue;
114 decorator_dR(*
part) = closest ? std::sqrt(minDR) : -1;
116 int newType{-1}, newOrigin{-1};
117 if (closest && closest->
isMuon()) {
118 newType = acc_tT(*closest);
119 newOrigin = acc_tO(*closest);
120 }
else if (closest) {
121 auto res = m_mcTruthClassifier->particleTruthClassifier(closest);
123 newOrigin =
res.second;
125 decorator_type(*
part) = newType;
126 decorator_origin(*
part) = newOrigin;
128 decorator_pu_dR(*
part) = -1;
129 decorator_pu_type(*
part) = -1;
130 decorator_pu_origin(*
part) = -1;
134 if (tpec.isValid()) {
136 for (
auto event : *tpec) {
137 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
140 tpart->
pt() < m_minPt)
143 if (dR > minDR)
continue;
144 closestPileup = tpart;
148 decorator_pu_dR(*
part) = (closestPileup ? std::sqrt(minDR) : -1);
149 int newPileupType{-1}, newPileupOrigin{-1};
151 auto res = m_mcTruthClassifier->particleTruthClassifier(closestPileup);
152 newPileupType =
res.first;
153 newPileupOrigin =
res.second;
155 decorator_pu_type(*
part) = newPileupType;
156 decorator_pu_origin(*
part) = newPileupOrigin;
160 return StatusCode::SUCCESS;