18static 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;
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(
202 trk_state->fitQualityOnSurface().chiSquared() /
203 trk_state->fitQualityOnSurface().doubleNumberDoF());
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);
269 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Trk::PrepRawDataContainer< HGTD_ClusterCollection > HGTD_ClusterContainer
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterTruthClassKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerExtensionChi2Key
ToolHandle< IHGTD_TrackTimeExtensionTool > m_extension_tool
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_extrapXKey
ToolHandle< IHGTD_ClusterTruthTool > m_truth_tool
virtual StatusCode initialize() override final
TrackTimeExtensionAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trk_ptkl_rh_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterRawTimeKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerHasExtensionKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterTimeKey
SG::ReadHandleKey< InDetSimDataCollection > m_sdo_coll_rh_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterShadowedKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_extrapYKey
SG::ReadHandleKey< McEventCollection > m_mc_coll_rh_key
SG::ReadHandleKey< HGTD_ClusterContainer > m_clustercont_rh_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerPrimaryExpectedKey
StatusCode decorateTrackParticle(DecorHandles &dh, const xAOD::TrackParticle *track_ptkl, const HGTD::ExtensionObject &extension, const InDetSimDataCollection *sdo_collection, const HepMC::GenEvent *hs_event, bool skip_deco=false) const
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterMergedKey
virtual StatusCode execute(const EventContext &ctx) const override final
virtual const HGTD_Cluster * prepRawData() const override final
returns the PrepRawData - is a SiCluster in this scope
virtual float time() const
virtual float time() const
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
SG::Accessor< T, ALLOC > Accessor
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
const_pointer_type cptr()
Dereference the pointer.
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
std::array< std::unique_ptr< const Trk::TrackStateOnSurface >, 4 > m_hits
std::array< const HGTD_Cluster *, 4 > m_truth_primary_hits
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< bool > > layerPrimaryExpectedHandle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< bool > > layerClusterMergedHandle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< bool > > layerClusterShadowedHandle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, float > extrapXHandle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< float > > layerClusterTimeHandle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< float > > layerClusterRawTimeHandle
DecorHandles(const TrackTimeExtensionAlg &tool, const EventContext &ctx)
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< int > > layerClusterTruthClassHandle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< bool > > layerHasExtensionHandle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, std::vector< float > > layerExtensionChi2Handle
SG::WriteDecorHandle< xAOD::TrackParticleContainer, float > extrapYHandle