21 #include "TLorentzVector.h"
26 : base_class(
t,
n,
p) {}
31 const HepMC::GenEvent* hard_scatter_evnt)
const {
33 if (not sim_data or not
tp) {
37 ATH_MSG_DEBUG(
"[ClusterTruthTool] " << sim_data->size() <<
" SDO elements");
39 for (
const auto& elem : *sim_data) {
43 const std::vector<Identifier>& rdo_id_list = cluster->
rdoList();
45 std::vector<std::pair<HGTD::ClusterTruthOrigin, bool>> shadowed_origins;
47 for (
const auto& rdo_id : rdo_id_list) {
49 ATH_MSG_DEBUG(
"[ClusterTruthTool] looking for ID:" << rdo_id);
51 auto pos = sim_data->find(rdo_id);
54 if (
pos == sim_data->end()) {
56 "[HGTD::ClusterTruthTool::classifyCluster] ID not found in SDO "
57 "map, going to next ID");
61 std::map<float, HGTD::ClusterTruthOrigin> sorted_deposits;
66 <<
pos->second.getdeposits().size() <<
" deposits");
67 for (
const auto& deposit :
pos->second.getdeposits()) {
81 TLorentzVector l4(gen_part->momentum().px(), gen_part->momentum().py(),
82 gen_part->momentum().pz(), gen_part->momentum().e());
86 sorted_deposits.emplace(deposit.second,
89 }
else if (hard_scatter_evnt and
90 gen_part->parent_event() == hard_scatter_evnt) {
91 sorted_deposits.emplace(deposit.second,
97 sorted_deposits.emplace(deposit.second,
103 sorted_deposits.emplace(deposit.second,
108 sorted_deposits.emplace(deposit.second,
114 ATH_MSG_DEBUG(
"[ClusterTruthTool] " << sorted_deposits.size()
115 <<
" sorted_deposits");
120 bool is_shadowed =
false;
124 sorted_deposits.begin();
126 for (; elem != sorted_deposits.end(); ++elem) {
127 if (elem == sorted_deposits.begin()) {
128 current_origin = elem->second;
139 shadowed_origins.emplace_back(current_origin, is_shadowed);
144 if (shadowed_origins.empty()) {
147 result.is_shadowed =
false;
153 result.origin = shadowed_origins.at(0).first;
154 result.is_shadowed = shadowed_origins.at(0).second;
155 for (
size_t i = 1;
i < shadowed_origins.size(); ++
i) {
156 if (shadowed_origins.at(
i).first !=
result.origin) {
159 result.is_shadowed |= shadowed_origins.at(
i).second;