18 static constexpr
unsigned short n_hgtd_layers = 4;
24 ISvcLocator* pSvcLocator)
49 return StatusCode::SUCCESS;
61 cluster_container_handle.
cptr();
62 if (not cluster_container) {
63 ATH_MSG_ERROR(
"[TrackTimeExtensionAlg] HGTD_ClusterContainer not found, "
65 return StatusCode::FAILURE;
71 if (not sdo_collection) {
73 "truth info available!");
79 ATH_MSG_ERROR(
"[TrackTimeExtensionAlg] McEventCollection not found, "
81 return StatusCode::FAILURE;
84 const HepMC::GenEvent* hs_event =
nullptr;
85 if (mc_coll->size() > 0) {
86 hs_event = mc_coll->at(0);
95 trk_ptkl_container_handle.
cptr();
96 if (not track_particles) {
97 ATH_MSG_ERROR(
"[TrackTimeExtensionAlg] TrackParticleContainer not found, "
99 return StatusCode::FAILURE;
104 for (
const auto* track_ptkl : *track_particles) {
107 <<
" pt: " << track_ptkl->pt());
111 if (std::abs(track_ptkl->eta()) <
m_eta_cut) {
121 if (track_ptkl->track() ==
nullptr) {
145 return StatusCode::SUCCESS;
153 : layerHasExtensionHandle (
tool.m_layerHasExtensionKey, ctx),
154 layerExtensionChi2Handle (
tool.m_layerExtensionChi2Key, ctx),
155 layerClusterRawTimeHandle (
tool.m_layerClusterRawTimeKey, ctx),
156 layerClusterTimeHandle (
tool.m_layerClusterTimeKey, ctx),
157 layerClusterTruthClassHandle (
tool.m_layerClusterTruthClassKey, ctx),
158 layerClusterShadowedHandle (
tool.m_layerClusterShadowedKey, ctx),
159 layerClusterMergedHandle (
tool.m_layerClusterMergedKey, ctx),
160 layerPrimaryExpectedHandle (
tool.m_layerPrimaryExpectedKey, ctx),
161 extrapXHandle (
tool.m_extrapXKey, ctx),
162 extrapYHandle (
tool.m_extrapYKey, ctx)
170 const HepMC::GenEvent* hs_event,
bool skip_deco)
const {
172 std::vector<bool> has_cluster_vec;
173 has_cluster_vec.reserve(n_hgtd_layers);
174 std::vector<float> chi2_vec;
175 chi2_vec.reserve(n_hgtd_layers);
176 std::vector<float> raw_time_vec;
177 raw_time_vec.reserve(n_hgtd_layers);
178 std::vector<float> time_vec;
179 time_vec.reserve(n_hgtd_layers);
180 std::vector<int> truth_vec;
181 truth_vec.reserve(n_hgtd_layers);
182 std::vector<bool> is_shadowed_vec;
183 is_shadowed_vec.reserve(n_hgtd_layers);
184 std::vector<bool> is_merged_vec;
185 is_merged_vec.reserve(n_hgtd_layers);
186 std::vector<bool> primary_exists_vec;
187 primary_exists_vec.reserve(n_hgtd_layers);
189 for (
unsigned short i = 0;
i < n_hgtd_layers;
i++) {
191 const std::unique_ptr<const Trk::TrackStateOnSurface>& trk_state =
195 primary_exists_vec.push_back(primary_cluster !=
nullptr);
199 has_cluster_vec.emplace_back(
true);
201 chi2_vec.emplace_back(
208 time_vec.emplace_back(cot->
time());
213 raw_time_vec.emplace_back(cluster->
time());
217 acc_tpl(
"truthParticleLink");
220 const auto& truth_match_link = acc_tpl(*track_ptkl);
221 if (truth_match_link.isValid()) {
222 truth_particle = *truth_match_link;
227 bool is_shadowed =
false;
228 bool is_merged =
false;
230 if (truth_particle) {
232 cluster, truth_particle, sdo_collection, hs_event);
233 truth_origin = truth_info.origin;
234 is_shadowed = truth_info.is_shadowed;
235 is_merged = truth_info.is_merged;
240 truth_vec.emplace_back((
int)truth_origin);
241 is_shadowed_vec.emplace_back(is_shadowed);
242 is_merged_vec.emplace_back(is_merged);
245 has_cluster_vec.emplace_back(
false);
247 chi2_vec.emplace_back(-1.);
248 raw_time_vec.emplace_back(-1.);
249 time_vec.emplace_back(-1.);
250 truth_vec.emplace_back(-1);
251 is_shadowed_vec.emplace_back(
false);
252 is_merged_vec.emplace_back(
false);
258 dh.layerHasExtensionHandle(*track_ptkl) = has_cluster_vec;
259 dh.layerExtensionChi2Handle(*track_ptkl) = chi2_vec;
260 dh.layerClusterRawTimeHandle(*track_ptkl) = raw_time_vec;
261 dh.layerClusterTimeHandle(*track_ptkl) = time_vec;
262 dh.layerClusterTruthClassHandle(*track_ptkl) = truth_vec;
263 dh.layerClusterShadowedHandle(*track_ptkl) = is_shadowed_vec;
264 dh.layerClusterMergedHandle(*track_ptkl) = is_merged_vec;
265 dh.layerPrimaryExpectedHandle(*track_ptkl) = primary_exists_vec;
269 return StatusCode::SUCCESS;