27 const IInterface*
p) :
34 ATH_CHECK(m_mcTruthClassifier.retrieve());
38 ATH_CHECK(m_truthPileupSGKey.initialize());
42 m_Truth_dR_Key = m_containerKey.key() +
".MCTFallback_dR";
43 m_Truth_type_Key = m_containerKey.key() +
".MCTFallback_truthType";
44 m_Truth_origin_Key = m_containerKey.key() +
".MCTFallback_truthOrigin";
47 ATH_CHECK(m_Truth_origin_Key.initialize());
49 m_Truth_PU_dR_Key = m_containerKey.key() +
".MCTFallbackPU_dR";
50 m_Truth_PU_type_Key = m_containerKey.key() +
".MCTFallbackPU_truthType";
51 m_Truth_PU_origin_Key = m_containerKey.key() +
".MCTFallbackPU_truthOrigin";
52 ATH_CHECK(m_Truth_PU_dR_Key.initialize());
53 ATH_CHECK(m_Truth_PU_type_Key.initialize());
54 ATH_CHECK(m_Truth_PU_origin_Key.initialize());
56 return StatusCode::SUCCESS;
61 const EventContext& ctx = Gaudi::Hive::currentContext();
64 if (!
parts.isValid()) {
65 ATH_MSG_ERROR(
"No Muon collection with name " << m_containerKey.fullKey() <<
" found in StoreGate!");
66 return StatusCode::FAILURE;
70 ATH_MSG_ERROR(
"No truth collection with name " << m_truthSGKey.fullKey() <<
" found in StoreGate!");
71 return StatusCode::FAILURE;
74 if (!tpec.isValid()) {
75 ATH_MSG_DEBUG(
"No truth pileup collection with name " << m_truthPileupSGKey.fullKey() <<
" found in StoreGate. Pile-up information will not be filled");
79 if (!truthMuons.isValid()) {
80 ATH_MSG_ERROR(
"No truth muon collection with name " << m_truthMuonSGKey.fullKey() <<
" found in StoreGate!");
81 return StatusCode::FAILURE;
91 if (dR > minDR)
continue;
97 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
100 tpart->
pt() < m_minPt)
103 if (dR > minDR)
continue;
109 decorator_dR(*
part) = closest ? std::sqrt(minDR) : -1;
111 int newType{-1}, newOrigin{-1};
112 if (closest && closest->
isMuon()) {
113 newType = acc_tT(*closest);
114 newOrigin = acc_tO(*closest);
115 }
else if (closest) {
116 auto res = m_mcTruthClassifier->particleTruthClassifier(closest);
118 newOrigin =
res.second;
120 decorator_type(*
part) = newType;
121 decorator_origin(*
part) = newOrigin;
123 decorator_pu_dR(*
part) = -1;
124 decorator_pu_type(*
part) = -1;
125 decorator_pu_origin(*
part) = -1;
129 if (tpec.isValid()) {
131 for (
auto event : *tpec) {
132 for (
size_t parti = 0; parti <
event->nTruthParticles(); parti++) {
135 tpart->
pt() < m_minPt)
138 if (dR > minDR)
continue;
139 closestPileup = tpart;
143 decorator_pu_dR(*
part) = (closestPileup ? std::sqrt(minDR) : -1);
144 int newPileupType{-1}, newPileupOrigin{-1};
146 auto res = m_mcTruthClassifier->particleTruthClassifier(closestPileup);
147 newPileupType =
res.first;
148 newPileupOrigin =
res.second;
150 decorator_pu_type(*
part) = newPileupType;
151 decorator_pu_origin(*
part) = newPileupOrigin;
155 return StatusCode::SUCCESS;