ATLAS Offline Software
Loading...
Searching...
No Matches
IDTPM2::HadronAncestorFinder< T > Class Template Reference

allows more sophisticated selection predicates that use class functions, such as isBottomHadron() etc, rather than MC::isBottomHadron( t ) which woudl seem to be justified since people unacccountably like to use MC::isTau( ... ) etc More...

#include <AncestorFinder.h>

Inheritance diagram for IDTPM2::HadronAncestorFinder< T >:
Collaboration diagram for IDTPM2::HadronAncestorFinder< T >:

Public Types

using Predicate = bool (T::*)() const

Public Member Functions

 HadronAncestorFinder (Predicate p)
bool predicate (const T *t) const override
const T * findAncestor (const T *t) const

Private Attributes

Predicate m_predicate

Detailed Description

template<typename T>
class IDTPM2::HadronAncestorFinder< T >

allows more sophisticated selection predicates that use class functions, such as isBottomHadron() etc, rather than MC::isBottomHadron( t ) which woudl seem to be justified since people unacccountably like to use MC::isTau( ... ) etc

Definition at line 196 of file AncestorFinder.h.

Member Typedef Documentation

◆ Predicate

template<typename T>
using IDTPM2::HadronAncestorFinder< T >::Predicate = bool (T::*)() const

Definition at line 200 of file AncestorFinder.h.

Constructor & Destructor Documentation

◆ HadronAncestorFinder()

template<typename T>
IDTPM2::HadronAncestorFinder< T >::HadronAncestorFinder ( Predicate p)
inline

Definition at line 202 of file AncestorFinder.h.

202: m_predicate(p) { }
allows more sophisticated selection predicates that use class functions, such as isBottomHadron() etc...

Member Function Documentation

◆ findAncestor()

template<typename T>
const T * IDTPM2::IFinder< T >::findAncestor ( const T * t) const
inlineinherited

successful stopping condition ...

isn't recursion great boys and girls ?

Definition at line 33 of file AncestorFinder.h.

33 {
34
35 // reached the end ...
36 if (!t) return 0;
37
39 if ( predicate(t) ) return t;
40
41 for ( size_t p=0 ; p<t->nParents() ; p++ ) {
42 const T* parent = t->parent(p);
43
44 if ( parent==t ) continue;
45
47 if ( const T* found = findAncestor(parent) ) return found;
48 }
49
50 return 0;
51 }
const T * findAncestor(const T *t) const
virtual bool predicate(const T *t) const =0

◆ predicate()

template<typename T>
bool IDTPM2::HadronAncestorFinder< T >::predicate ( const T * t) const
inlineoverridevirtual

Implements IDTPM2::IFinder< T >.

Definition at line 204 of file AncestorFinder.h.

204{ return (t->*m_predicate)(); }

Member Data Documentation

◆ m_predicate

template<typename T>
Predicate IDTPM2::HadronAncestorFinder< T >::m_predicate
private

Definition at line 208 of file AncestorFinder.h.


The documentation for this class was generated from the following file: