ATLAS Offline Software
dRMatchingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "dRMatchingTool.h"
7 
8 // InDetPhysValMonitoring include(s)
9 #include "../src/TrackTruthSelectionTool.h" /* to perform dynamic_cast */
10 
11 namespace { // Placing utility functions in anonymous namespace.
12 // Utility definitions.
13 
14 // Accessor utility function, for getting the best available value of pT.
15  template<class U>
16  float
17  pt(const U* p) {
18  return p->pt();
19  }
20 
21 // Accessor utility function, for getting the best available value of phi.
22 // Need to explicitly state that 'isAvailable' and 'auxdata' are templated
23 // functions.
24  template<class U>
25  float
26  phi(const U* p) {
27  static const SG::ConstAccessor<float> phiAcc("phi");
28  return(phiAcc.isAvailable(*p) ? phiAcc(*p) : p->phi());
29  }
30 
31 // Accessor utility function, for getting the best available value of eta.
32 // Need to explicitly state that 'isAvailable' and 'auxdata' are templated
33 // functions.
34  template<class U>
35  float
36  eta(const U* p) {
37  static const SG::ConstAccessor<float> etaAcc("eta");
38  return(etaAcc.isAvailable(*p) ? etaAcc(*p) : p->eta());
39  }
40 
41 // Function to compute dPhi-separation using best available parameter values.
42  template<class U, class V>
43  float
44  comp_deltaPhi(const U* p1, const V* p2) {
45  // Ensures that $\Delta\phi \in [-pi, pi)$, and takes absolute value.
46  float dphi = phi(p1) - phi(p2);
47 
48  while (dphi >= M_PI) {
49  dphi -= 2.*M_PI;
50  }
51  while (dphi < -M_PI) {
52  dphi += 2.*M_PI;
53  }
54  return std::fabs(dphi);
55  }
56 
57 // Function to compute dEta-separation using best available parameter values.
58  template<class U, class V>
59  float
60  comp_deltaEta(const U* p1, const V* p2) {
61  return eta(p1) - eta(p2);
62  }
63 
64 // Function to compute dR-separation using best available parameter values.
65  template<class U, class V>
66  float
67  comp_deltaR(const U* p1, const V* p2) {
68  return sqrt(pow(comp_deltaPhi(p1, p2), 2.) + pow(comp_deltaEta(p1, p2), 2.));
69  }
70 
71 // Function for sorting vector of xAOD particles by increasing pT.
72  template<class U>
73  bool
74  sort_pt(const U* p1, const U* p2) {
75  return pt(p1) < pt(p2);
76  }
77 
78 // Function for sorting vector of xAOD particles by increasing eta.
79  template<class U>
80  bool
81  sort_eta(const U* p1, const U* p2) {
82  return eta(p1) < eta(p2);
83  }
84 
85 // Function for sorting vector of xAOD particles by increasing phi.
86  template<class U>
87  bool
88  sort_phi(const U* p1, const U* p2) {
89  return phi(p1) < phi(p2);
90  }
91 } // namespace
92 
93 
94 dRMatchingTool::dRMatchingTool(const std::string& name) :
95  asg::AsgTool(name),
96  m_accept("dRMatching"),
97  m_numProcessed(0),
98  m_numPassed(0) {
99  declareInterface<IAsgSelectionTool>(this);
100 
101  // Decleare cut properties, for access in job option.
102  declareProperty("dRmax", m_dRmax = -1);
103  declareProperty("pTResMax", m_pTResMax = -1);
104 }
105 
107 
110  if (asg::AsgTool::initialize().isFailure()) {
111  return StatusCode::FAILURE;
112  }
113 
114  ATH_MSG_INFO("Initializing " << name() << "...");
115 
116  // Clear cuts container.
117  m_cuts.clear();
118 
119  // Define cut names and descriptions.
120  if (m_dRmax > -1) {
121  m_cuts.emplace_back("dRmax", "Cut on maximal dR between track and truth particle.");
122  }
123  if (m_pTResMax > -1) {
124  m_cuts.emplace_back("pTResMax",
125  "Cut on maximal, relativ pT difference between track and truth particle.");
126  }
127 
128  // Add cuts to the AcceptOmfp.
129  for (const auto& cut : m_cuts) {
130  if (m_accept.addCut(cut.first, cut.second) < 0) {
131  ATH_MSG_ERROR("Failed to add cut " << cut.first << " because the AcceptInfo object is full.");
132  return StatusCode::FAILURE;
133  }
134  }
135 
136  // Initialise counters.
137  m_numPassedCuts.resize(m_accept.getNCuts(), 0);
138 
144  if (m_accept.getNCuts() == 0) {
145  m_accept.addCut("nop", "Forcing to have length 1.");
146  }
147 
148  return StatusCode::SUCCESS;
149 }
150 
151 const asg::AcceptInfo&
153  return m_accept;
154 }
155 
158 
160  "accept(...) function called without needed Truth- or TrackParticleContainer. Please use one of the dRMatchingTool-specific accept methods.");
161 
162  return asg::AcceptData (&m_accept);
163 }
164 
165 template<class T, class U>
166 void
168  std::vector< const U* >& vec_pt,
169  std::vector< const U* >& vec_eta,
170  std::vector< const U* >& vec_phi,
171  bool (* selectionTool)(const U*)) const {
172  // Look all particles in container.
173  for (const U* p : *container) {
174  // Ignore particles not passing the selection, if applicable.
175  if (selectionTool and !(*selectionTool)(p)) {
176  continue;
177  }
178 
179  // Append passing particles to cached vectors.
180  vec_pt.push_back(p);
181  vec_eta.push_back(p);
182  vec_phi.push_back(p);
183  }
184 
185  // Sort vectors.
186  std::sort(vec_pt.begin(), vec_pt.end(), sort_pt <U>);
187  std::sort(vec_eta.begin(), vec_eta.end(), sort_eta<U>);
188  std::sort(vec_phi.begin(), vec_phi.end(), sort_phi<U>);
189 }
190 
191 void
193  CacheEntry* ent,
194  bool (* trackSelectionTool)(const xAOD::TrackParticle*)) const {
195  // Check whether to cache.
196  if (*trackParticles == ent->m_baseTrackContainer) {
197  return;
198  }
199 
200  // Clear existing cache.
201  clearTrackParticles(ent);
202 
203  // Cache track particles.
205  xAOD::TrackParticle>(trackParticles,
209  trackSelectionTool);
210 
211  // Store copy of base track container.
212  ent->m_baseTrackContainer = *trackParticles;
213 }
214 
215 void
217  CacheEntry* ent,
218  bool (* truthSelectionTool)(const xAOD::TruthParticle*)) const {
219  // Check whether to cache.
220  if (*truthParticles == ent->m_baseTruthContainer) {
221  return;
222  }
223 
224  // Clear existing cache.
225  clearTruthParticles(ent);
226 
227  // Cache truth particles.
229  xAOD::TruthParticle>(truthParticles,
233  truthSelectionTool);
234 
235  // Store copy of base truth container.
236  ent->m_baseTruthContainer = *truthParticles;
237 }
238 
239 template<class U, class V>
240 bool
242  std::vector< const V* >& vec_pt,
243  std::vector< const V* >& vec_eta,
244  std::vector< const V* >& vec_phi,
245  float& dRmin) const {
246  // (Re-)set variables.
247  dRmin = 9999.;
248 
249  // Perform search in cached vectors.
250  auto it_pt_lower = m_pTResMax < 0 ? vec_pt.begin() :
251  std::lower_bound(vec_pt.begin(), vec_pt.end(),
252  pt(p) * (1. - m_pTResMax),
253  [](const V* o, const float& val) -> bool {
254  return pt(o) < val;
255  });
256 
257  auto it_pt_upper = m_pTResMax < 0 ? vec_pt.end() :
258  std::upper_bound(vec_pt.begin(), vec_pt.end(),
259  pt(p) * (1. + m_pTResMax),
260  [](const float& val, const V* o) -> bool {
261  return val < pt(o);
262  });
263 
264  auto it_eta_lower = m_dRmax < 0 ? vec_eta.begin() :
265  std::lower_bound(vec_eta.begin(), vec_eta.end(),
266  eta(p) - m_dRmax,
267  [](const V* o, const float& val) -> bool {
268  return eta(o) < val;
269  });
270 
271  auto it_eta_upper = m_dRmax < 0 ? vec_eta.end() :
272  std::upper_bound(vec_eta.begin(), vec_eta.end(),
273  eta(p) + m_dRmax,
274  [](const float& val, const V* o) -> bool {
275  return val < eta(o);
276  });
277 
278  // Dealing with cyclic nature of phi: Determining whether phi range wraps
279  // around +-pi.
280  bool wrapLow = phi(p) - m_dRmax < -M_PI;
281  bool wrapHigh = phi(p) + m_dRmax > M_PI;
282  bool wrap = wrapLow or wrapHigh;
283 
284  auto it_phi_lower = m_dRmax < 0 ? vec_phi.begin() :
285  std::lower_bound(vec_phi.begin(), vec_phi.end(),
286  phi(p) - m_dRmax + (wrapLow ? 2.*M_PI : 0),
287  [](const V* o, const float& val) -> bool {
288  return phi(o) < val;
289  });
290 
291  auto it_phi_upper = m_dRmax < 0 ? vec_phi.end() :
292  std::upper_bound(vec_phi.begin(), vec_phi.end(),
293  phi(p) + m_dRmax + (wrapHigh ? -2.*M_PI : 0),
294  [](const float& val, const V* o) -> bool {
295  return val < phi(o);
296  });
297 
298  // Break early if no truth particles passed selection.
299  if (m_pTResMax > 0 and it_pt_upper < it_pt_lower) {
300  return false;
301  } else if (m_dRmax > 0 and it_eta_upper < it_eta_lower) {
302  return false;
303  } else if (m_dRmax > 0 and((!wrap and it_phi_upper < it_phi_lower)or
304  (wrap and it_phi_upper > it_phi_lower))) {
305  return false;
306  }
307 
308  // Initialise base set.
309  std::vector< const V* > set(vec_pt);
310 
311  // -- Sort, pointer-based; necessary for set_intersection.
312  std::sort(set.begin(), set.end());
313 
314  // Compute subset of selected truth particles.
315  std::vector< const V* > subset_pt(it_pt_lower, it_pt_upper);
316  std::vector< const V* > subset_eta(it_eta_lower, it_eta_upper);
317  std::vector< const V* > subset_phi;
318  if (!wrap) {
319  subset_phi = std::vector< const V* >(it_phi_lower, it_phi_upper);
320  } else {
321  subset_phi = std::vector< const V* >(vec_phi.begin(), it_phi_upper);
322  subset_phi.insert(subset_phi.end(), it_phi_lower, vec_phi.end());
323  }
324 
325  // Add subsets according to specified cut values.
326  std::vector< std::vector< const V* > > subsets;
327  if (m_pTResMax > 0) {
328  subsets.push_back(subset_pt);
329  }
330  if (m_dRmax > 0) {
331  subsets.push_back(subset_eta);
332  subsets.push_back(subset_phi);
333  }
334 
335  // Compute successive intersections between base set and subset.
336  for (std::vector< const V* > subset : subsets) {
337  // -- Sort, pointer-based; necessary for set::set_intersection.
338  std::sort(subset.begin(), subset.end());
339 
340  // -- Set intersection.
341  std::vector< const V* > intersection;
342  std::set_intersection(set.begin(), set.end(),
343  subset.begin(), subset.end(),
344  std::back_inserter(intersection));
345 
346  // -- Break early if intersection is empty.
347  if (intersection.size() == 0) {
348  return false;
349  }
350 
351  set = intersection;
352  }
353 
354  // If only pT-matching, we're done.
355  if (m_dRmax < 0) {
356  return set.size() > 0;
357  }
358 
359  // Otherwise, compute dR for all remaining particles.
360  bool passes = false;
361  for (const V* other : set) {
362  float dR = comp_deltaR(p, other);
363  dRmin = (dR < dRmin ? dR : dRmin);
364  passes |= dRmin < m_dRmax;
365  }
366 
367  return passes;
368 }
369 
372  const xAOD::TruthParticleContainer* truthParticles,
373  bool (* truthSelectionTool)(const xAOD::TruthParticle*)) const {
374  asg::AcceptData acceptData (&m_accept);
375 
376  std::lock_guard<std::mutex> lock{m_mutex}; // To guard m_numPassedCuts and m_cache
377  const EventContext& ctx{Gaudi::Hive::currentContext()};
378  CacheEntry* ent{m_cache.get(ctx)};
379  ent->check(ctx.evt());
380 
381  // Determine whether to cache current truth particle container
382  checkCacheTruthParticles(truthParticles, ent, truthSelectionTool);
383 
384  bool passes = sortedMatch<xAOD::TrackParticle,
389  ent->m_dRmin);
390 
391  // Set cut values.
392  if (m_dRmax > -1) {
393  acceptData.setCutResult("dRmax", passes);
394  }
395  if (m_pTResMax > -1) {
396  acceptData.setCutResult("pTResMax", passes);
397  }
398 
399  // Book keep cuts
400  for (const auto& cut : m_cuts) {
401  unsigned int pos = acceptData.getCutPosition(cut.first);
402  if (acceptData.getCutResult(pos)) {
403  m_numPassedCuts[pos]++;
404  }
405  }
406 
407  m_numProcessed++;
408  if (acceptData) {
409  m_numPassed++;
410  }
411 
412  return acceptData;
413 }
414 
417  const xAOD::TrackParticleContainer* trackParticles,
418  bool (* trackSelectionTool)(const xAOD::TrackParticle*)) const {
419  asg::AcceptData acceptData (&m_accept);
420 
421  std::lock_guard<std::mutex> lock{m_mutex}; // To guard m_numPassedCuts and m_cache
422  const EventContext& ctx{Gaudi::Hive::currentContext()};
423  CacheEntry* ent{m_cache.get(ctx)};
424  ent->check(ctx.evt());
425 
426  // Determine whether to cache current track particle container
427  checkCacheTrackParticles(trackParticles, ent, trackSelectionTool);
428 
429  bool passes = sortedMatch<xAOD::TruthParticle,
430  xAOD::TrackParticle>(truth,
434  ent->m_dRmin);
435 
436  // Set cut values.
437  if (m_dRmax > -1) {
438  acceptData.setCutResult("dRmax", passes);
439  }
440  if (m_pTResMax > -1) {
441  acceptData.setCutResult("pTResMax", passes);
442  }
443 
444  // Book keep cuts
445  for (const auto& cut : m_cuts) {
446  unsigned int pos = acceptData.getCutPosition(cut.first);
447  if (acceptData.getCutResult(pos)) {
448  m_numPassedCuts[pos]++;
449  }
450  }
451 
452  m_numProcessed++;
453  if (acceptData) {
454  m_numPassed++;
455  }
456 
457  return acceptData;
458 }
459 
462  const xAOD::TruthParticleContainer* truthParticles,
463  bool (* truthSelectionTool)(const xAOD::TruthParticle*)) const {
464  asg::AcceptData acceptData (&m_accept);
465 
466  std::lock_guard<std::mutex> lock{m_mutex}; // To guard m_numPassedCuts and m_cache
467  const EventContext& ctx{Gaudi::Hive::currentContext()};
468  CacheEntry* ent{m_cache.get(ctx)};
469  ent->check(ctx.evt());
470 
471  ent->m_dRmin = 9999.;
472 
473  // Define variables.
474  const unsigned int Ncuts(m_cuts.size());
475  bool passes(false), passesThis(false);
476 
477  // Loop all truth particles.
478  for (const xAOD::TruthParticle* truth : *truthParticles) {
479  // Ignore all truth particles failing the selection.
480  if (truthSelectionTool and !(*truthSelectionTool)(truth)) {
481  continue;
482  }
483 
484  // Compute cut variable values.
485  float dR = comp_deltaR(p, truth);
486  float pTRes = std::fabs(pt(truth) / pt(p) - 1.);
487 
488  // Initialise cut monitoring objects.
489  std::vector<bool> vecPassesThis(Ncuts, false);
490 
491  // Check whether each individual cut passed.
492  unsigned int icut = 0;
493  if (m_dRmax > -1) {
494  vecPassesThis[icut++] = dR < m_dRmax;
495  }
496  if (m_pTResMax > -1) {
497  vecPassesThis[icut++] = pTRes < m_pTResMax;
498  }
499 
500  // Check whether all cuts passed.
501  passesThis = std::all_of(vecPassesThis.begin(),
502  vecPassesThis.end(),
503  [](const bool& v) {
504  return v;
505  });
506  passes |= passesThis;
507 
508  // If the current truth particle was matched, check minimal dR.
509  if (passesThis) {
510  ent->m_dRmin = (dR < ent->m_dRmin ? dR : ent->m_dRmin);
511  }
512  }
513 
514  // Set cut values.
515  if (m_dRmax > -1) {
516  acceptData.setCutResult("dRmax", passes);
517  }
518  if (m_pTResMax > -1) {
519  acceptData.setCutResult("pTResMax", passes);
520  }
521 
522  // Book keep cuts
523  for (const auto& cut : m_cuts) {
524  unsigned int pos = acceptData.getCutPosition(cut.first);
525  if (acceptData.getCutResult(pos)) {
526  m_numPassedCuts[pos]++;
527  }
528  }
529 
530  m_numProcessed++;
531  if (acceptData) {
532  m_numPassed++;
533  }
534 
535  return acceptData;
536 }
537 
540  const xAOD::TrackParticleContainer* trackParticles,
541  bool (* trackSelectionTool)(const xAOD::TrackParticle*)) const {
542  // Reset the results.
543  asg::AcceptData acceptData (&m_accept);
544 
545  std::lock_guard<std::mutex> lock{m_mutex}; // To guard m_numPassedCuts and m_cache
546  const EventContext& ctx{Gaudi::Hive::currentContext()};
547  CacheEntry* ent{m_cache.get(ctx)};
548  ent->check(ctx.evt());
549 
550  ent->m_dRmin = 9999.;
551 
552  // Define variables.
553  const unsigned int Ncuts(m_cuts.size());
554  bool passes(false), passesThis(false);
555 
556  // Loop all track particles.
557  for (const xAOD::TrackParticle* track : *trackParticles) {
558  // Ignore all tracks failing the selection.
559  if (trackSelectionTool and !(*trackSelectionTool)(track)) {
560  continue;
561  }
562 
563  // Compute cut variable values.
564  float dR = comp_deltaR(p, track);
565  float pTRes = std::fabs(pt(track) / pt(p) - 1.);
566 
567  // Initialise cut monitoring objects.
568  std::vector<bool> vecPassesThis(Ncuts, false);
569 
570  // Check whether each individual cut passed.
571  unsigned int icut = 0;
572  if (m_dRmax > -1) {
573  vecPassesThis[icut++] = dR < m_dRmax;
574  }
575  if (m_pTResMax > -1) {
576  vecPassesThis[icut++] = pTRes < m_pTResMax;
577  }
578 
579  // Check whether all cuts passed.
580  passesThis = std::all_of(vecPassesThis.begin(),
581  vecPassesThis.end(),
582  [](const bool& v) {
583  return v;
584  });
585  passes |= passesThis;
586 
587  // If the current track particle was matched, check minimal dR.
588  if (passesThis) {
589  ent->m_dRmin = (dR < ent->m_dRmin ? dR : ent->m_dRmin);
590  }
591  }
592 
593  // Set cut values.
594  if (m_dRmax > -1) {
595  acceptData.setCutResult("dRmax", passes);
596  }
597  if (m_pTResMax > -1) {
598  acceptData.setCutResult("pTResMax", passes);
599  }
600 
601  // Book keep cuts
602  for (const auto& cut : m_cuts) {
603  unsigned int pos = acceptData.getCutPosition(cut.first);
604  if (acceptData.getCutResult(pos)) {
605  m_numPassedCuts[pos]++;
606  }
607  }
608 
609  m_numProcessed++;
610  if (acceptData) {
611  m_numPassed++;
612  }
613 
614  return acceptData;
615 }
616 
619  ATH_MSG_INFO("Finalizing " << name() << "...");
620 
621  if (m_numProcessed == 0) {
622  ATH_MSG_INFO("No tracks processed in selection tool.");
623  return StatusCode::SUCCESS;
624  }
625  ATH_MSG_INFO(m_numPassed << " / " << m_numProcessed << " = "
626  << m_numPassed * 100. / m_numProcessed
627  << "% passed all cuts.");
628  for (const auto& cut : m_cuts) {
629  ULong64_t numPassed = m_numPassedCuts.at(m_accept.getCutPosition(cut.first));
630  ATH_MSG_INFO(numPassed << " = " << numPassed * 100. / m_numProcessed
631  << "% passed " << cut.first << " cut.");
632  }
633 
634  return StatusCode::SUCCESS;
635 }
636 
637 float
639  std::lock_guard<std::mutex> lock{m_mutex}; // To guard m_cache
640  const EventContext& ctx{Gaudi::Hive::currentContext()};
641  CacheEntry* ent{m_cache.get(ctx)};
642  ent->check(ctx.evt());
643 
644  return ent->m_dRmin;
645 }
dRMatchingTool::acceptLegacy
virtual asg::AcceptData acceptLegacy(const xAOD::TrackParticle *p, const xAOD::TruthParticleContainer *truthParticles, bool(*truthSelectionTool)(const xAOD::TruthParticle *)=nullptr) const
dR-matching specific method(s).
Definition: dRMatchingTool.cxx:461
dRMatchingTool::CacheEntry::m_trackParticlesSortedEta
std::vector< const xAOD::TrackParticle * > m_trackParticlesSortedEta
Definition: dRMatchingTool.h:150
dRMatchingTool::m_pTResMax
float m_pTResMax
Definition: dRMatchingTool.h:230
dRMatchingTool::CacheEntry::m_truthParticlesSortedPt
std::vector< const xAOD::TruthParticle * > m_truthParticlesSortedPt
Definition: dRMatchingTool.h:144
dRMatchingTool.h
Tool to perform dR-based matching of tracks and truth particles.
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
dRMatchingTool::checkCacheTruthParticles
void checkCacheTruthParticles(const xAOD::TruthParticleContainer *truthParticles, CacheEntry *ent, bool(*truthSelectionTool)(const xAOD::TruthParticle *)=nullptr) const
Definition: dRMatchingTool.cxx:216
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
dRMatchingTool::CacheEntry::m_truthParticlesSortedEta
std::vector< const xAOD::TruthParticle * > m_truthParticlesSortedEta
Definition: dRMatchingTool.h:145
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
dRMatchingTool::CacheEntry::m_truthParticlesSortedPhi
std::vector< const xAOD::TruthParticle * > m_truthParticlesSortedPhi
Definition: dRMatchingTool.h:146
asg
Definition: DataHandleTestTool.h:28
test_pyathena.pt
pt
Definition: test_pyathena.py:11
xAOD::TrackParticleContainer
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticleContainer.h:14
M_PI
#define M_PI
Definition: ActiveFraction.h:11
dRMatchingTool::CacheEntry::check
void check(EventContext::ContextEvt_t evt)
Definition: dRMatchingTool.h:153
asg::AcceptInfo::getCutPosition
unsigned int getCutPosition(const std::string &cutName) const
Get the bit position of a cut.
Definition: AcceptInfo.h:73
SG::ConstAccessor< float >
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
asg::AcceptData::getCutPosition
unsigned int getCutPosition(const std::string &cutName) const
Get the bit position of a cut.
Definition: AcceptData.h:71
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition: compareFlatTrees.cxx:25
Ncuts
const size_t Ncuts
Definition: SUSYToolsTester.cxx:77
dRMatchingTool::sortedMatch
bool sortedMatch(const U *p, std::vector< const V * > &vec_pt, std::vector< const V * > &vec_eta, std::vector< const V * > &vec_phi, float &dRmin) const
Definition: dRMatchingTool.cxx:241
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
dRMatchingTool::dRMatchingTool
dRMatchingTool(const std::string &name)
Constructor(s).
Definition: dRMatchingTool.cxx:94
dRMatchingTool::m_dRmax
float m_dRmax
Cut vales.
Definition: dRMatchingTool.h:228
dRMatchingTool::m_cuts
std::vector< std::pair< std::string, std::string > > m_cuts
Definition: dRMatchingTool.h:218
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
asg::AcceptInfo
Definition: AcceptInfo.h:28
dRMatchingTool::CacheEntry::m_trackParticlesSortedPhi
std::vector< const xAOD::TrackParticle * > m_trackParticlesSortedPhi
Definition: dRMatchingTool.h:151
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
asg::AcceptInfo::getNCuts
unsigned int getNCuts() const
Get the number of cuts defined.
Definition: AcceptInfo.h:46
dRMatchingTool::CacheEntry::m_baseTruthContainer
xAOD::TruthParticleContainer m_baseTruthContainer
Definition: dRMatchingTool.h:138
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition: Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
dRMatchingTool::checkCacheTrackParticles
void checkCacheTrackParticles(const xAOD::TrackParticleContainer *trackParticles, CacheEntry *ent, bool(*trackSelectionTool)(const xAOD::TrackParticle *)=nullptr) const
Internal method(s).
Definition: dRMatchingTool.cxx:192
dRMatchingTool::getAcceptInfo
virtual const asg::AcceptInfo & getAcceptInfo() const override
Declare the interface ID for this pure-virtual interface class to the Athena framework.
Definition: dRMatchingTool.cxx:152
dRMatchingTool::CacheEntry::m_baseTrackContainer
xAOD::TrackParticleContainer m_baseTrackContainer
Definition: dRMatchingTool.h:140
dRMatchingTool::m_numPassed
std::atomic< ULong64_t > m_numPassed
Definition: dRMatchingTool.h:222
dRMatchingTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *p) const override
The main accept method: the actual cuts are applied here.
Definition: dRMatchingTool.cxx:157
DataVector< xAOD::TrackParticle_v1 >
dRMatchingTool::CacheEntry
Definition: dRMatchingTool.h:129
dRMatchingTool::m_mutex
std::mutex m_mutex
Definition: dRMatchingTool.h:224
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
xAOD::TruthParticleContainer
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Definition: Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainer.h:17
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.PyAthena.v
v
Definition: PyAthena.py:157
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
asg::AcceptData::setCutResult
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
Definition: AcceptData.h:134
dRMatchingTool::sortVectors
void sortVectors(const T *container, std::vector< const U * > &vec_pt, std::vector< const U * > &vec_eta, std::vector< const U * > &vec_phi, bool(*selectionTool)(const U *)) const
Definition: dRMatchingTool.cxx:167
asg::AcceptData::getCutResult
bool getCutResult(const std::string &cutName) const
Get the result of a cut, based on the cut name (safer)
Definition: AcceptData.h:98
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
dRMatchingTool::~dRMatchingTool
virtual ~dRMatchingTool()
Destructor.
dRMatchingTool::clearTruthParticles
void clearTruthParticles(CacheEntry *ent) const
Definition: dRMatchingTool.h:189
dRMatchingTool::m_accept
asg::AcceptInfo m_accept
Data member(s).
Definition: dRMatchingTool.h:216
dRMatchingTool::initialize
virtual StatusCode initialize() override
SelectionTool method(s).
Definition: dRMatchingTool.cxx:109
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
dRMatchingTool::CacheEntry::m_dRmin
float m_dRmin
Definition: dRMatchingTool.h:133
dRMatchingTool::dRmin
float dRmin() const
Definition: dRMatchingTool.cxx:638
dRMatchingTool::CacheEntry::m_trackParticlesSortedPt
std::vector< const xAOD::TrackParticle * > m_trackParticlesSortedPt
Definition: dRMatchingTool.h:149
asg::AcceptData
Definition: AcceptData.h:30
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
asg::AsgTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgTool.h:133
dRMatchingTool::finalize
virtual StatusCode finalize() override
Definition: dRMatchingTool.cxx:618
dRMatchingTool::m_numProcessed
std::atomic< ULong64_t > m_numProcessed
Definition: dRMatchingTool.h:221
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
dRMatchingTool::clearTrackParticles
void clearTrackParticles(CacheEntry *ent) const
Definition: dRMatchingTool.h:180
asg::AcceptInfo::addCut
int addCut(const std::string &cutName, const std::string &cutDescription)
Add a cut; returning the cut position.
Definition: AcceptInfo.h:53