Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TruthParentDecoratorAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
5 
7 
9 
10 #include <format>
11 
12 // structure to hold info on a matched parent particle
14 {
17  float deltaR;
18  unsigned int parent_index;
19  std::set<int> cascade_pids;
20 };
21 
22 namespace {
23 
24  using Barcodex = TruthParentDecoratorAlg::Barcodex;
25  using IPMap = TruthParentDecoratorAlg::IPMap;
26  using JC = TruthParentDecoratorAlg::JC;
27  using TPC = TruthParentDecoratorAlg::TPC;
28  using parent_mask_t = unsigned long long;
29 
30  parent_mask_t matchMask(const std::vector<MatchedParent>& matches) {
31  parent_mask_t mask = 0x0;
32  for (const auto& match: matches) {
33  constexpr size_t max_idx = std::numeric_limits<decltype(mask)>::digits;
34  if (match.parent_index > max_idx) {
35  throw std::runtime_error(
36  "parent index overflowed the match mask "
37  "[index: " + std::to_string(match.parent_index) +
38  " , max_mask: " + std::to_string(max_idx) + "]");
39  }
40  mask |= (0x1u << match.parent_index);
41  }
42  return mask;
43  }
44 
45  // debugging functions
46  std::string join(const std::vector<std::string>& v, const std::string& sep = ", ") {
47  std::string out;
48  for (unsigned int pos = 0; pos < v.size(); pos++) {
49  out.append(v.at(pos));
50  if (pos + 1 < v.size()) out.append(sep);
51  }
52  return out;
53  }
54  template <typename T>
55  std::vector<std::string> stringify(const T& container) {
56  std::vector<std::string> out;
57  for (const auto& v: container) out.push_back(std::to_string(v));
58  return out;
59  }
60  // debugging function, not used now
61  [[maybe_unused]]
62  std::string listAllChildren(const xAOD::TruthParticle* p) {
63  std::vector<std::string> output;
64  for (unsigned int child_n = 0; child_n < p->nChildren(); child_n++) {
65  output.push_back(std::to_string(p->child(child_n)->pdgId()));
66  }
67  if (output.empty()) return "none";
68  return "[" + join(output) + "]";
69  }
70 
71 
72  // debugging functions using MsgStream
73  void logInputs(MsgStream& msg,SG::ReadHandle<JC>& targets,SG::ReadHandle<TPC>& truth,std::vector<SG::ReadHandle<TPC>>& cascades_raw,const MSG::Level level = MSG::DEBUG)
74  {
75  if (msg.level() > level) return;
76  unsigned int n_cascade_candidates = 0;
77  for (auto& cascade: cascades_raw) {
78  n_cascade_candidates += cascade->size();
79  }
80  msg << level <<
81  "n_targets: " << targets->size() << ", "
82  "n_parents: " << truth->size() << ", "
83  "n_cascade_candidates: " << n_cascade_candidates <<
84  endmsg;
85  }
86  void logIPMap(MsgStream& msg,const IPMap& ipmap,const MSG::Level level = MSG::VERBOSE)
87  {
88  if (msg.level() > level) return;
89  for (const auto& [barcode, children]: ipmap) {
90  std::set<int> ids;
91  for (const xAOD::TruthParticle* dup: children) ids.insert(dup->pdgId());
92  msg << level << "barcode: " << barcode << ", n_dup: " << children.size()
93  << " idg_ids: [" << join(stringify(ids)) << "]" << endmsg;
94  }
95  }
96 
97 
98  // functions to traverse barcodex and disambiguate the selected
99  // child
100  std::map<int, std::set<int>> findAllDescendants(int parent, const Barcodex& barcodex, std::set<int> history = {})
101  {
102  using return_t = std::map<int,std::set<int>>;
103  auto itr = barcodex.find(parent);
104  if (itr == barcodex.end()) {
105  auto hist = stringify(history);
106  throw std::runtime_error(
107  "can't find barcode " + std::to_string(parent) + " history:"
108  " {" + join(hist) + "}");
109  }
110  const std::set<int>& children = itr->second;
111  if (children.empty()) return return_t{{parent, history}};
112  if (!history.insert(parent).second) {
113  auto hist = stringify(history);
114  throw std::runtime_error("found cycle, tried to add " + std::to_string(parent) + " to {" + join(hist) + "}");
115  }
116  return_t all_children;
117  for (int child: children) {
118  // We don't just merge the children here in case there are
119  // multiple histories that lead to the same discendent. Instead
120  // we merge the histories of all descendents.
121  for (auto& [dec, dh]: findAllDescendants(child, barcodex, history)) {
122  all_children[dec].merge(dh);
123  }
124  }
125  return all_children;
126  }
127 
128 
129  const xAOD::TruthParticle* selectChild(const IPMap::mapped_type& barkids)
130  {
131  const xAOD::TruthParticle* child = *barkids.begin();
132  if (barkids.size() > 1) {
133  std::set<int> pdg_ids;
134  TLorentzVector sum_p4;
135  // look at duplicates, take the one with the most children
136  for (const xAOD::TruthParticle* dupkid: barkids) {
137  sum_p4 += dupkid->p4();
138  pdg_ids.insert(dupkid->pdgId());
139  if (dupkid->nChildren() > child->nChildren()) child = dupkid;
140  }
141  if (pdg_ids.size() != 1) {
142  throw std::runtime_error("same barcode, different pdgid: [" + join(stringify(pdg_ids)) + "]");
143  }
144  if (float dr = child->p4().DeltaR(sum_p4); dr > 0.001) {
145  throw std::runtime_error( "Same barcode, different vector: { deltaR: " + std::to_string(dr) + ", pdgid: " + std::to_string(child->pdgId()) + "}"
146  );
147  }
148  }
149  return child;
150  }
151 
152 
153  bool isOriginal(const xAOD::TruthParticle* p) {
154  for (unsigned int parent_n = 0; parent_n < p->nParents(); parent_n++) {
155  const xAOD::TruthParticle* parent = p->parent(parent_n);
156  if (!parent) throw std::runtime_error("broken truth record");
157  if (parent->pdgId() == p->pdgId()) return false;
158  }
159  return true;
160  }
161 
162 
163  // these functions are for dealing with specific vertices
164 
165  const xAOD::TruthParticle* getParent(const xAOD::TruthParticle* p) {
166  if (int n_parents = p->nParents(); n_parents != 1) {
167  throw std::logic_error("can't get parent [n_parents: " + std::to_string(n_parents) + "]");
168  }
169  return p->parent(0);
170  }
171  bool isSoftLepton(const xAOD::TruthParticle* p) {
172  const xAOD::TruthParticle* parent = getParent(p);
173  return (parent->hasCharm() || parent->hasBottom()) && p->isChLepton();
174  }
175  bool isSoftCharm(const xAOD::TruthParticle* p) {
176  const xAOD::TruthParticle* parent = getParent(p);
177  return parent->hasBottom() && p->hasCharm();
178  }
179 
180 }
181 
182 
183 // cascade count decorator
184 CascadeCountDecorator::CascadeCountDecorator( const std::string& name, const std::vector<int>& pids):
185  m_pids(pids.begin(), pids.end()),
186  m_dec(name),
187  // also hang on to the auxid so we can lock it later
188  m_auxid(SG::AuxTypeRegistry::instance().findAuxID(name))
189 {
190 }
191 void CascadeCountDecorator::decorate(const SG::AuxElement& target,const std::vector<MatchedParent>& parents) const
192 {
193  unsigned char n_match = 0;
194  for (const auto& parent: parents) {
195  for (const auto& pid: m_pids) {
196  if (parent.cascade_pids.contains(pid)) n_match++;
197  }
198  }
199  m_dec(target) = n_match;
200 }
202 {
203  m_dec(target) = 0;
204 }
206 {
207  // We're locking a decoration on a const container, which would be a
208  // problem if they were made by anyone else since someone else might
209  // be messing with them. But here it shouldn't be a problem since we
210  // made them.
211  auto* cont ATLAS_THREAD_SAFE = const_cast<xAOD::IParticleContainer*>(target);
212  cont->lockDecoration(m_auxid);
213 }
214 
215 
216 // main algorithm
217 TruthParentDecoratorAlg::TruthParentDecoratorAlg(const std::string& name, ISvcLocator* loc):
219 {
220  // these aren't user configurable
221  declare(m_target_pdgid_key);
222  declare(m_target_dr_truth_key);
223  declare(m_target_link_key);
224  declare(m_target_index_key);
225  declare(m_target_n_matched_key);
226  declare(m_target_match_mask_key);
227  declare(m_match_pdgid_key);
228  declare(m_match_children_key);
229  declare(m_match_link_key);
230 }
231 
233  // initialize inputs
234  ATH_CHECK(m_parents_key.initialize());
235  ATH_CHECK(m_target_container_key.initialize());
236  ATH_CHECK(m_cascades_key.initialize());
237  // weird hack because Gaudi can't handle an infinite default
238  if (m_match_delta_r.value() <= 0) m_match_delta_r.value() = INFINITY;
239  // initialize outputs
240  std::string jc = m_target_container_key.key();
241  std::string pfx = jc + "." + m_prefix.value();
242  m_target_pdgid_key = pfx + "PdgId";
243  m_target_dr_truth_key = pfx + "DRTruthParticle";
244  m_target_link_key = pfx + "Link";
245  m_target_index_key = pfx + "Index";
246  m_target_n_matched_key = pfx + "NMatchedChildren";
247  m_target_match_mask_key = pfx + "ParentsMask";
248  m_match_pdgid_key = pfx + "MatchingParticlePdgId";
249  m_match_children_key = pfx + "MatchingParticleNChildren";
250  m_match_link_key = pfx + "MatchingParticleLink";
251  ATH_CHECK(m_target_pdgid_key.initialize());
252  ATH_CHECK(m_target_dr_truth_key.initialize());
253  ATH_CHECK(m_target_link_key.initialize());
254  ATH_CHECK(m_target_index_key.initialize());
255  ATH_CHECK(m_target_n_matched_key.initialize());
256  ATH_CHECK(m_target_match_mask_key.initialize());
257  ATH_CHECK(m_match_pdgid_key.initialize());
258  ATH_CHECK(m_match_children_key.initialize());
259  ATH_CHECK(m_match_link_key.initialize());
260 
261  for (auto& [key, pids]: m_counts_matching_cascade) {
262  m_cascade_count_writer_keys.emplace_back(jc + "." + key);
263  m_cascade_count_decorators.emplace_back(key, pids);
264  }
265  for (auto& key: m_cascade_count_writer_keys) declare(key);
267 
268  return StatusCode::SUCCESS;
269 }
270 
271 StatusCode TruthParentDecoratorAlg::execute(const EventContext& cxt) const
272 {
273  ATH_MSG_DEBUG("Executing");
274 
276  // part 1: read in the particles
279 
280  using uc_t = unsigned char;
290 
291  if (targets->empty()) return StatusCode::SUCCESS;
292 
293  // read in and sort the parent collection
294  SG::ReadHandle<TPC> phandle(m_parents_key, cxt);
295  std::set<int> parentids(m_parent_pdgids.begin(), m_parent_pdgids.end());
296  std::vector<const xAOD::TruthParticle*> psort;
297  for (const xAOD::TruthParticle* p: *phandle) {
298  if (!parentids.contains(p->pdgId())) continue;
299  if (!isOriginal(p)) continue;
300  psort.push_back(p);
301  }
302  // for lack of a better idea, store truth parents sorted by mass
303  std::sort(psort.begin(), psort.end(),[](const auto* p1, const auto* p2) {return p1->m() > p2->m();});
304  // check to make sure we don't overflow the match mask
305  constexpr size_t max_idx = std::numeric_limits<parent_mask_t>::digits;
306  if (psort.size() > max_idx) {
308  "Found too many parent particles to store in parent match mask "
309  "truncating the parent collection [max: " << max_idx << ", "
310  "n: " << psort.size() << "]");
311  psort.resize(max_idx);
312  }
313 
314 
315  std::vector<SG::ReadHandle<TPC>> cascades_raw;
316  for (const auto& key: m_cascades_key) {
317  cascades_raw.emplace_back(key, cxt);
318  }
319  logInputs(msgStream(), targets, phandle, cascades_raw);
320 
322  // part 2: build the barcodex
324  Barcodex barcodex;
325  IPMap ipmap;
326  addTruthContainer(barcodex, ipmap, *phandle);
327  for (auto& cascade: cascades_raw) {
328  addTruthContainer(barcodex, ipmap, *cascade);
329  }
330  logIPMap(msg(), ipmap);
331 
332  ATH_MSG_DEBUG("merged cascade contains " << barcodex.size() << " particles");
333 
335  // Part 3: build map from targets to parents
337  std::unordered_map<const J*, std::vector<MatchedParent>> labeled_targets;
338  unsigned int n_parents = 0;
339  for (const auto* p: psort) {
340  unsigned int parent_index = n_parents++;
341  ATH_MSG_VERBOSE("pdgid: " << p->pdgId() << ", barcode: " << HepMC::barcode(p));
342  for (auto& [cbar, histbars]: findAllDescendants(HepMC::barcode(p), barcodex)) {
343  IPMap::mapped_type& barkids = ipmap.at(cbar);
344  const xAOD::TruthParticle* child = selectChild(barkids);
345  std::vector<std::pair<float, const J*>> drs;
346  float drsMinDR=9999;
347  const J* drsMinMatch = 0;
348  for (const auto* j: *targets) {
349  if(j->p4().DeltaR(child->p4()) < drsMinDR) {
350  drsMinDR=j->p4().DeltaR(child->p4());
351  drsMinMatch=j;
352  }
353  }
354  if(drsMinMatch){
356  match.parent = p;
357  match.child = child;
358  match.deltaR = drsMinDR;
359  match.parent_index = parent_index;
360  match.cascade_pids.insert(child->pdgId());
361  for (auto& histbar: histbars) {
362  match.cascade_pids.insert(selectChild(ipmap.at(histbar))->pdgId());
363  }
364  if (match.deltaR < m_match_delta_r) {
365  labeled_targets[drsMinMatch].push_back(match);
366  }
367  }
368  }
369  }
370 
372  // Part 4: decorate!
374 
375  for (const J* j: *targets) {
376  if (labeled_targets.contains(j)) {
377  const std::vector<MatchedParent>& matches = labeled_targets.at(j);
378  auto min_dr = [](auto& p1, auto& p2) {
379  return p1.deltaR < p2.deltaR;
380  };
381  const MatchedParent& nearest = *std::min_element(
382  matches.begin(), matches.end(), min_dr);
383  const xAOD::TruthParticle* p = nearest.parent;
384  pdgid(*j) = p->pdgId();
385  deltaR(*j) = nearest.deltaR;
386  auto* container = dynamic_cast<const TPC*>(p->container());
387  link(*j) = JL(*container, p->index());
388  index(*j) = nearest.parent_index;
389  nMatched(*j) = matches.size();
390  mask(*j) = matchMask(matches);
391  const xAOD::TruthParticle* child = nearest.child;
392  matchPdgId(*j) = child->pdgId();
393  matchChildCount(*j) = child->nChildren();
394  auto* matchedContainer = dynamic_cast<const TPC*>(child->container());
395  matchLink(*j) = JL(*matchedContainer, child->index());
396  for (const auto& cascadeCount: m_cascade_count_decorators) {
397  cascadeCount.decorate(*j, matches);
398  }
399  } else {
400  pdgid(*j) = 0;
401  deltaR(*j) = NAN;
402  link(*j) = JL();
403  index(*j) = -1;
404  nMatched(*j) = -1;
405  mask(*j) = 0x0;
406  matchPdgId(*j) = 0;
407  matchChildCount(*j) = 0;
408  matchLink(*j) = JL();
409  for (const auto& cascadeCount: m_cascade_count_decorators) {
410  cascadeCount.decorateDefault(*j);
411  }
412  }
413  }
414 
416  // Part 5: lock decorations
418 
419  for (const auto& dec: m_cascade_count_decorators) {
420  dec.lock(targets.get());
421  }
422 
423  return StatusCode::SUCCESS;
424 }
425 
427  if (!m_allow_missing_children_pdgids.empty()) {
428  float missing_fraction = double(m_missing_n_ignored) / m_total_children;
429  auto msg = std::format("ignored {} missing children out of {} ({:.2}%)",m_missing_n_ignored.load(),m_total_children.load(),missing_fraction * 100);
430  if (missing_fraction > m_missing_children_fraction_warning_threshold) {
432  } else {
433  ATH_MSG_INFO(msg);
434  }
435  }
436  if (!m_warn_missing_children_pdgids.empty()) {
437  auto msg = std::format("warned of {} missing children out of {}", m_missing_n_warned.load(), m_total_children.load());
438  if (m_missing_n_warned > 0) {
440  } else {
441  ATH_MSG_INFO(msg);
442  }
443  }
444  return StatusCode::SUCCESS;
445 }
446 
448 
449  std::set<int> targid(m_cascade_pdgids.begin(), m_cascade_pdgids.end());
450  // we allow decays through any of the parent pdgids
451  targid.insert(m_parent_pdgids.begin(), m_parent_pdgids.end());
452 
453  // this determines if a cascade vertex should be saved or not
454  auto cascadeWants = [
455  &targid,
456  b=m_add_b,
457  c=m_add_c,
458  vsl=m_veto_soft_lepton,
460  ] (const xAOD::TruthParticle* p) {
461  if (int n_parents = p->nParents(); n_parents == 1) {
462  if (vsl && isSoftLepton(p)) return false;
463  if (vsc && isSoftCharm(p)) return false;
464  }
465  if (targid.contains(p->pdgId())) return true;
466  if (b && p->hasBottom()) return true;
467  if (c && p->hasCharm()) return true;
468  return false;
469  };
470 
471  // insert a particle into the record, return the child set
472  auto insert = [&barcodex, &ipmap](const xAOD::TruthParticle* p) -> auto& {
473  ipmap[HepMC::barcode(p)].insert(p);
474  return barcodex[HepMC::barcode(p)];
475  };
476 
477  for (const xAOD::TruthParticle* p: container) {
478  if (cascadeWants(p)) {
479  auto& child_set = insert(p);
480  for (unsigned int child_n = 0; child_n < p->nChildren(); child_n++) {
481  const xAOD::TruthParticle* c = p->child(child_n);
482 
483  // Unfortunately the truth record is often broken in various
484  // ways. There are a few configurable ways to deal with
485  // this. We keep track of the total number and how often we
486  // use these workarounds to make sure things don't go too
487  // crazy.
489  const auto& ok_missing = m_allow_missing_children_pdgids.value();
490  if (!c) {
491  if(ok_missing.contains(p->pdgId())) {
493  } else {
494  auto problem = std::format(
495  "null truth child [barcode={},pdg_id={},child={}of{}]",
496  HepMC::barcode(p), p->pdgId(), child_n, p->nChildren());
497  const auto& warn_missing = m_warn_missing_children_pdgids.value();
498  if (warn_missing.contains(p->pdgId())) {
500  ATH_MSG_WARNING(problem);
501  } else {
502  throw std::runtime_error(problem);
503  }
504  }
505  } else if (cascadeWants(c)) {
506  insert(c);
507  child_set.insert(HepMC::barcode(c));
508  }
509  };
510  }
511  }
512 }
TruthParentDecoratorAlg::m_parent_pdgids
Gaudi::Property< std::vector< int > > m_parent_pdgids
Definition: TruthParentDecoratorAlg.h:53
TruthParentDecoratorAlg::m_cascades_key
SG::ReadHandleKeyArray< TPC > m_cascades_key
Definition: TruthParentDecoratorAlg.h:80
TruthParentDecoratorAlg::initialize
virtual StatusCode initialize() override
Definition: TruthParentDecoratorAlg.cxx:232
MatchedParent::child
const xAOD::TruthParticle * child
Definition: TruthParentDecoratorAlg.cxx:16
TruthParentDecoratorAlg::m_veto_soft_lepton
Gaudi::Property< bool > m_veto_soft_lepton
Definition: TruthParentDecoratorAlg.h:65
TruthParentDecoratorAlg::addTruthContainer
void addTruthContainer(Barcodex &, IPMap &, const TPC &) const
Definition: TruthParentDecoratorAlg.cxx:447
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
MatchedParent::deltaR
float deltaR
Definition: TruthParentDecoratorAlg.cxx:17
vtune_athena.format
format
Definition: vtune_athena.py:14
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CascadeCountDecorator::m_auxid
SG::auxid_t m_auxid
Definition: TruthParentDecoratorAlg.h:28
TruthParentDecoratorAlg::JL
ElementLink< JC > JL
Definition: TruthParentDecoratorAlg.h:39
CascadeCountDecorator::CascadeCountDecorator
CascadeCountDecorator(const std::string &name, const std::vector< int > &pids)
Definition: TruthParentDecoratorAlg.cxx:184
TruthParentDecoratorAlg::m_match_link_key
SG::WriteDecorHandleKey< JC > m_match_link_key
Definition: TruthParentDecoratorAlg.h:91
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:483
python.DecayParser.parents
parents
print ("==> buf:",buf)
Definition: DecayParser.py:31
TruthParentDecoratorAlg::finalize
virtual StatusCode finalize() override
Definition: TruthParentDecoratorAlg.cxx:426
plotmaker.hist
hist
Definition: plotmaker.py:148
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
TruthParentDecoratorAlg::m_target_container_key
SG::ReadHandleKey< JC > m_target_container_key
Definition: TruthParentDecoratorAlg.h:47
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
TruthParentDecoratorAlg::m_add_b
Gaudi::Property< bool > m_add_b
Definition: TruthParentDecoratorAlg.h:59
PyPoolBrowser.dh
dh
Definition: PyPoolBrowser.py:102
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
TruthParentDecoratorAlg::TPC
xAOD::TruthParticleContainer TPC
Definition: TruthParentDecoratorAlg.h:38
TruthParentDecoratorAlg::m_cascade_count_decorators
std::vector< CascadeCountDecorator > m_cascade_count_decorators
Definition: TruthParentDecoratorAlg.h:99
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
TruthParentDecoratorAlg::TruthParentDecoratorAlg
TruthParentDecoratorAlg(const std::string &name, ISvcLocator *loc)
Definition: TruthParentDecoratorAlg.cxx:217
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
TruthParentDecoratorAlg::m_parents_key
SG::ReadHandleKey< TPC > m_parents_key
Definition: TruthParentDecoratorAlg.h:77
TruthParentDecoratorAlg::m_target_pdgid_key
SG::WriteDecorHandleKey< JC > m_target_pdgid_key
Definition: TruthParentDecoratorAlg.h:83
CascadeCountDecorator::m_pids
std::vector< int > m_pids
Definition: TruthParentDecoratorAlg.h:26
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
TruthParentDecoratorAlg::m_match_delta_r
Gaudi::Property< float > m_match_delta_r
Definition: TruthParentDecoratorAlg.h:73
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
CascadeCountDecorator::m_dec
SG::AuxElement::Decorator< unsigned char > m_dec
Definition: TruthParentDecoratorAlg.h:27
TruthParentDecoratorAlg::IPMap
std::map< int, std::set< const xAOD::TruthParticle * > > IPMap
Definition: TruthParentDecoratorAlg.h:35
TruthParentDecoratorAlg::m_add_c
Gaudi::Property< bool > m_add_c
Definition: TruthParentDecoratorAlg.h:62
TruthParentDecoratorAlg::m_cascade_pdgids
Gaudi::Property< std::vector< int > > m_cascade_pdgids
Definition: TruthParentDecoratorAlg.h:56
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
stringify
std::string stringify(T obj)
Definition: VolumeTreeNavigator.h:73
TruthParentDecoratorAlg::m_total_children
std::atomic< unsigned long long > m_total_children
Definition: TruthParentDecoratorAlg.h:115
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TruthParentDecoratorAlg::Barcodex
std::map< int, std::set< int > > Barcodex
Definition: TruthParentDecoratorAlg.h:34
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
rerun_display.pfx
pfx
Definition: rerun_display.py:60
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
TruthParentDecoratorAlg::m_counts_matching_cascade
Gaudi::Property< cascade_counter_property_t > m_counts_matching_cascade
Definition: TruthParentDecoratorAlg.h:93
PyAlgorithmExample.min_dr
def min_dr(p, l)
Definition: PyAlgorithmExample.py:57
TruthParentDecoratorAlg::m_match_children_key
SG::WriteDecorHandleKey< JC > m_match_children_key
Definition: TruthParentDecoratorAlg.h:90
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
TruthParentDecoratorAlg::m_target_n_matched_key
SG::WriteDecorHandleKey< JC > m_target_n_matched_key
Definition: TruthParentDecoratorAlg.h:87
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TruthParentDecoratorAlg::m_warn_missing_children_pdgids
Gaudi::Property< std::unordered_set< int > > m_warn_missing_children_pdgids
Definition: TruthParentDecoratorAlg.h:109
TruthParentDecoratorAlg::m_missing_n_ignored
std::atomic< unsigned long long > m_missing_n_ignored
Definition: TruthParentDecoratorAlg.h:113
TruthParentDecoratorAlg::m_cascade_count_writer_keys
SG::WriteDecorHandleKeyArray< JC > m_cascade_count_writer_keys
Definition: TruthParentDecoratorAlg.h:98
MatchedParent::parent_index
unsigned int parent_index
Definition: TruthParentDecoratorAlg.cxx:18
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TruthParentDecoratorAlg::m_prefix
Gaudi::Property< std::string > m_prefix
Definition: TruthParentDecoratorAlg.h:50
CascadeCountDecorator::decorate
void decorate(const SG::AuxElement &target, const std::vector< MatchedParent > &parents) const
Definition: TruthParentDecoratorAlg.cxx:191
merge.output
output
Definition: merge.py:17
grepfile.sep
sep
Definition: grepfile.py:38
TruthParentDecoratorAlg::m_missing_children_fraction_warning_threshold
Gaudi::Property< float > m_missing_children_fraction_warning_threshold
Definition: TruthParentDecoratorAlg.h:105
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
TruthParentDecoratorAlg::m_target_index_key
SG::WriteDecorHandleKey< JC > m_target_index_key
Definition: TruthParentDecoratorAlg.h:86
xAOD::TruthParticle_v1::nChildren
size_t nChildren() const
Number of children of this particle.
Definition: TruthParticle_v1.cxx:140
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TruthParentDecoratorAlg::execute
virtual StatusCode execute(const EventContext &) const override
Definition: TruthParentDecoratorAlg.cxx:271
xAOD::IParticle::p4
virtual FourMom_t p4() const =0
The full 4-momentum of the particle.
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MatchedParent::cascade_pids
std::set< int > cascade_pids
Definition: TruthParentDecoratorAlg.cxx:19
MatchedParent
Definition: TruthParentDecoratorAlg.cxx:14
python.PyAthena.v
v
Definition: PyAthena.py:154
TruthParentDecoratorAlg::m_target_dr_truth_key
SG::WriteDecorHandleKey< JC > m_target_dr_truth_key
Definition: TruthParentDecoratorAlg.h:84
DeMoScan.index
string index
Definition: DeMoScan.py:364
TruthParentDecoratorAlg.h
TruthParentDecoratorAlg::m_veto_soft_charm
Gaudi::Property< bool > m_veto_soft_charm
Definition: TruthParentDecoratorAlg.h:69
CascadeCountDecorator::decorateDefault
void decorateDefault(const SG::AuxElement &target) const
Definition: TruthParentDecoratorAlg.cxx:201
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
copySelective.target
string target
Definition: copySelective.py:37
DEBUG
#define DEBUG
Definition: page_access.h:11
TruthParentDecoratorAlg::m_target_match_mask_key
SG::WriteDecorHandleKey< JC > m_target_match_mask_key
Definition: TruthParentDecoratorAlg.h:88
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
TruthParentDecoratorAlg::m_allow_missing_children_pdgids
Gaudi::Property< std::unordered_set< int > > m_allow_missing_children_pdgids
Definition: TruthParentDecoratorAlg.h:101
CascadeCountDecorator::lock
void lock(const xAOD::IParticleContainer *target) const
Definition: TruthParentDecoratorAlg.cxx:205
TruthParentDecoratorAlg::m_target_link_key
SG::WriteDecorHandleKey< JC > m_target_link_key
Definition: TruthParentDecoratorAlg.h:85
python.DecayParser.children
children
Definition: DecayParser.py:32
TruthParentDecoratorAlg::JC
xAOD::IParticleContainer JC
Definition: TruthParentDecoratorAlg.h:36
TruthParentDecoratorAlg::m_match_pdgid_key
SG::WriteDecorHandleKey< JC > m_match_pdgid_key
Definition: TruthParentDecoratorAlg.h:89
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:196
SG::AuxElement::container
const SG::AuxVectorData * container() const
Return the container holding this element.
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
MatchedParent::parent
const xAOD::TruthParticle * parent
Definition: TruthParentDecoratorAlg.cxx:15
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
python.compressB64.c
def c
Definition: compressB64.py:93
TruthParentDecoratorAlg::m_missing_n_warned
std::atomic< unsigned long long > m_missing_n_warned
Definition: TruthParentDecoratorAlg.h:114
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
HepMCHelpers.h
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37