27 const IInterface*
p) :
29 declareInterface<DerivationFramework::IAugmentationTool>(
this);
35 ATH_CHECK(m_mcTruthClassifier.retrieve());
39 ATH_CHECK(m_truthPileupSGKey.initialize());
43 m_Truth_dR_Key = m_containerKey.key() +
".MCTFallback_dR";
44 m_Truth_type_Key = m_containerKey.key() +
".MCTFallback_truthType";
45 m_Truth_origin_Key = m_containerKey.key() +
".MCTFallback_truthOrigin";
48 ATH_CHECK(m_Truth_origin_Key.initialize());
50 m_Truth_PU_dR_Key = m_containerKey.key() +
".MCTFallbackPU_dR";
51 m_Truth_PU_type_Key = m_containerKey.key() +
".MCTFallbackPU_truthType";
52 m_Truth_PU_origin_Key = m_containerKey.key() +
".MCTFallbackPU_truthOrigin";
53 ATH_CHECK(m_Truth_PU_dR_Key.initialize());
54 ATH_CHECK(m_Truth_PU_type_Key.initialize());
55 ATH_CHECK(m_Truth_PU_origin_Key.initialize());
57 return StatusCode::SUCCESS;
62 const EventContext& ctx = Gaudi::Hive::currentContext();
65 if (!
parts.isValid()) {
66 ATH_MSG_ERROR(
"No Muon collection with name " << m_containerKey.fullKey() <<
" found in StoreGate!");
67 return StatusCode::FAILURE;
71 ATH_MSG_ERROR(
"No truth collection with name " << m_truthSGKey.fullKey() <<
" found in StoreGate!");
72 return StatusCode::FAILURE;
75 if (!tpec.isValid()) {
76 ATH_MSG_DEBUG(
"No truth pileup collection with name " << m_truthPileupSGKey.fullKey() <<
" found in StoreGate. Pile-up information will not be filled");
80 if (!truthMuons.isValid()) {
81 ATH_MSG_ERROR(
"No truth muon collection with name " << m_truthMuonSGKey.fullKey() <<
" found in StoreGate!");
82 return StatusCode::FAILURE;
92 if (dR > minDR)
continue;
98 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
101 tpart->
pt() < m_minPt)
104 if (dR > minDR)
continue;
110 decorator_dR(*
part) = closest ? std::sqrt(minDR) : -1;
112 int newType{-1}, newOrigin{-1};
113 if (closest && closest->
isMuon()) {
114 newType = acc_tT(*closest);
115 newOrigin = acc_tO(*closest);
116 }
else if (closest) {
117 auto res = m_mcTruthClassifier->particleTruthClassifier(closest);
119 newOrigin =
res.second;
121 decorator_type(*
part) = newType;
122 decorator_origin(*
part) = newOrigin;
124 decorator_pu_dR(*
part) = -1;
125 decorator_pu_type(*
part) = -1;
126 decorator_pu_origin(*
part) = -1;
130 if (tpec.isValid()) {
132 for (
auto event : *tpec) {
133 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
136 tpart->
pt() < m_minPt)
139 if (dR > minDR)
continue;
140 closestPileup = tpart;
144 decorator_pu_dR(*
part) = (closestPileup ? std::sqrt(minDR) : -1);
145 int newPileupType{-1}, newPileupOrigin{-1};
147 auto res = m_mcTruthClassifier->particleTruthClassifier(closestPileup);
148 newPileupType =
res.first;
149 newPileupOrigin =
res.second;
151 decorator_pu_type(*
part) = newPileupType;
152 decorator_pu_origin(*
part) = newPileupOrigin;
156 return StatusCode::SUCCESS;