20 return StatusCode::SUCCESS;
33 return StatusCode::FAILURE;
39 ATH_MSG_ERROR(
"Standard jet TVA decoration is not valid for InDetTrackParticles");
40 return StatusCode::FAILURE;
44 ATH_CHECK( clustersOutputHandle.
record(std::make_unique<xAOD::CaloClusterContainer>(), std::make_unique<xAOD::CaloClusterAuxContainer>()) );
47 ATH_CHECK( tracksOutputHandle.
record(std::make_unique<xAOD::TrackParticleContainer>(), std::make_unique<xAOD::TrackParticleAuxContainer>()) );
50 ATH_CHECK( removedClustersOutputHandle.
record(std::make_unique<xAOD::CaloClusterContainer>(), std::make_unique<xAOD::CaloClusterAuxContainer>()) );
53 ATH_CHECK( removedTracksOutputHandle.
record(std::make_unique<xAOD::TrackParticleContainer>(), std::make_unique<xAOD::TrackParticleAuxContainer>()) );
55 std::vector<bool> selectElectron(electronInput->
size(),
false);
58 selectElectron.at(elec->index()) =
static_cast<bool>(
m_eleLHSelectTool->accept(elec));
63 if (
std::find(selectElectron.begin(),selectElectron.end(),
true) == selectElectron.end())
return StatusCode::SUCCESS;
66 clustersOutputContainer->
reserve(clustersInput->
size());
69 tracksOutputContainer->
reserve(tracksInput->
size());
71 std::vector<const xAOD::TrackParticle *> tracks_to_remove;
72 std::vector<const xAOD::CaloCluster *> clusters_to_remove;
76 if (selectElectron.at(elec->index()))
79 std::vector<ElementLink< xAOD::CaloClusterContainer>> elec_cluster_links = elec->caloClusterLinks();
80 for (
const auto& elec_cluster_link : elec_cluster_links){
81 if (elec_cluster_link.isValid()){
83 clusters_to_remove.insert(clusters_to_remove.end(), orig_clusters.cbegin(), orig_clusters.cend());
89 ATH_MSG_WARNING(
"DOING NOTHING... For validation only, please check your config.");
93 auto where = std::find_if(tracks_to_remove.cbegin(), tracks_to_remove.cend(),
96 if (
where == tracks_to_remove.cend())
99 tracksOutputContainer->
push_back(new_track);
100 *new_track = *old_track;
103 acc_originalObjectDecor(*new_track) = link;
106 ATH_MSG_DEBUG(
"Old tracks size = " << tracksInput->
size() <<
", new tracks size = " << tracksOutputContainer->
size() <<
", expected diff = " << tracks_to_remove.size());
109 auto where = std::find_if(clusters_to_remove.cbegin(), clusters_to_remove.cend(),
112 if (
where == clusters_to_remove.cend()){
114 clustersOutputContainer->
push_back(new_cluster);
115 *new_cluster = *old_cluster;
118 acc_originalObjectDecor(*new_cluster) = link;
121 ATH_MSG_DEBUG(
"Old cluster size = " << clustersInput->
size() <<
", new cluster size = " << clustersOutputContainer->
size() <<
", expected diff = " << clusters_to_remove.size());
124 removedClustersOutputCont->
reserve(clusters_to_remove.size());
127 *new_removed_cluster = *
cls;
128 removedClustersOutputCont->
push_back(new_removed_cluster);
132 removedTracksOutputCont->
reserve(tracks_to_remove.size());
135 *new_removed_track = *trk;
136 removedTracksOutputCont->
push_back(new_removed_track);
139 return StatusCode::SUCCESS;