ATLAS Offline Software
Loading...
Searching...
No Matches
PdgIdFilter< T > Class Template Reference

PdgIdFilter selects particles from their pdg id code. More...

#include <PdgIdFilter.h>

Inheritance diagram for PdgIdFilter< T >:
Collaboration diagram for PdgIdFilter< T >:

Public Member Functions

 PdgIdFilter ()
 Default constructor:
 PdgIdFilter (const PdgIdFilter< T > &rhs)
 Copy constructor:
virtual ~PdgIdFilter ()
 Destructor:
PdgIdFilter< T > & operator= (const PdgIdFilter< T > &rhs)
 Assignment operator:
virtual bool isAccepted (const T *element) const
 Main filter method.
const ParticleCandidateListpdgIds () const
 Return the list of pdg ids the filter is looking for.
bool matchSign () const
 Return true if the filter requires a strict sign matching.
void setFilter (const IFilterCuts *filter)
 Pure virtual function (to be overloaded by each of the children classes) to copy the cut properties of a given filter to another one.
void setPdgId (const int &pdgId)
void setPdgIds (const std::list< int > &pdgIds)
void setPdgIds (const ParticleCandidateList &pdgIds)
void setMatchSign (const bool matchSign)
bool operator() (const T *element) const

Protected Attributes

ParticleCandidateList m_pdgIds
 The list of particles ids which might be accepted.
bool m_matchSign
 Tells to also match the sign of the pdg id of particles => true by default.

Detailed Description

template<typename T>
class PdgIdFilter< T >

PdgIdFilter selects particles from their pdg id code.

Up to now, it is based on a ParticleCandidateList but it is very likely that internally it will be based on DecayPattern See AnalysisExamples/FilterExample.cxx for a concrete example

Definition at line 34 of file PdgIdFilter.h.

Constructor & Destructor Documentation

◆ PdgIdFilter() [1/2]

template<typename T>
PdgIdFilter< T >::PdgIdFilter ( )
inline

Default constructor:

I/O operators.

Inline methods:

Definition at line 114 of file PdgIdFilter.h.

114 :
115 IFilterCuts(),
116 IFilter<T>(),
117 m_pdgIds(),
118 m_matchSign( true )
119{}
IFilterCuts()
Default constructor:
Definition IFilterCuts.h:69
IFilter()
Default constructor:
Definition IFilter.h:78
bool m_matchSign
Tells to also match the sign of the pdg id of particles => true by default.
ParticleCandidateList m_pdgIds
The list of particles ids which might be accepted.
Definition PdgIdFilter.h:96

◆ PdgIdFilter() [2/2]

template<typename T>
PdgIdFilter< T >::PdgIdFilter ( const PdgIdFilter< T > & rhs)
inline

Copy constructor:

Definition at line 122 of file PdgIdFilter.h.

122 :
127{}
PdgIdFilter selects particles from their pdg id code.
Definition PdgIdFilter.h:35

◆ ~PdgIdFilter()

template<typename T>
PdgIdFilter< T >::~PdgIdFilter ( )
virtual

Destructor:

Definition at line 130 of file PdgIdFilter.h.

130{}

Member Function Documentation

◆ isAccepted()

template<typename T>
bool PdgIdFilter< T >::isAccepted ( const T * element) const
virtual

Main filter method.

This method takes the decision whether or not the filter has to accept the element. It returns true or false accordingly if the particle's id matches one of the required one.

Check if a pdg-id set has been set-up

Otherwise return true by convention

Implements IFilter< T >.

Definition at line 150 of file PdgIdFilter.h.

151{
153 if ( false == m_pdgIds.empty() ) {
154 const int pdgId = element->pdgId();
155 //std::cout << "Received PDG: " << pdgId << std::endl;
156 //m_pdgIds.dropList();
157 if ( m_pdgIds.hasInList( pdgId, m_matchSign ) ) return true;
158 else return false;
159 }
160
162 return true;
163}

◆ matchSign()

template<typename T>
bool PdgIdFilter< T >::matchSign ( ) const
inline

Return true if the filter requires a strict sign matching.

Definition at line 172 of file PdgIdFilter.h.

173{
174 return m_matchSign;
175}

◆ operator()()

template<typename T>
bool IFilter< T >::operator() ( const T * element) const
inlineinherited

Definition at line 101 of file IFilter.h.

102{
103 return isAccepted(element);
104}
IFilter is the main interface to the filters.
Definition IFilter.h:31
virtual bool isAccepted(const T *element) const =0
Main filter method.

◆ operator=()

template<typename T>
PdgIdFilter< T > & PdgIdFilter< T >::operator= ( const PdgIdFilter< T > & rhs)
inline

Assignment operator:

Definition at line 134 of file PdgIdFilter.h.

135{
136 if ( this != &rhs ) {
141 }
142 return *this;
143}
IFilterCuts & operator=(const IFilterCuts &rhs)
Assignment operator:
Definition IFilterCuts.h:78
IFilter< T > & operator=(const IFilter< T > &rhs)
Assignment operator:
Definition IFilter.h:91

◆ pdgIds()

template<typename T>
const ParticleCandidateList * PdgIdFilter< T >::pdgIds ( ) const
inline

Return the list of pdg ids the filter is looking for.

Definition at line 166 of file PdgIdFilter.h.

167{
168 return &m_pdgIds;
169}

◆ setFilter()

template<typename T>
void PdgIdFilter< T >::setFilter ( const IFilterCuts * ifilter)
virtual

Pure virtual function (to be overloaded by each of the children classes) to copy the cut properties of a given filter to another one.

It copies the properties of ifilter to the current IFilterCuts object.

Parameters
ifilterthe IFilterCuts which holds a set of properties one wants to copy to the current IFilterCuts object.

Implements IFilterCuts.

Definition at line 178 of file PdgIdFilter.h.

179{
180 if ( filter ) {
181 const PdgIdFilter<T> * pdgFilter =
182 dynamic_cast<const PdgIdFilter<T> *>(filter );
183
184 if ( pdgFilter ) {
186 } else {
187 MsgStream log( Athena::getMessageSvc(), "PdgIdFilter" );
188 log << MSG::ERROR
189 << "Can't dynamic_cast " << typeid(filter).name()
190 << " to a PdgIdFilter"
191 << endmsg;
192 }
193 } //> filter is not a NULL pointer
194}
PdgIdFilter< T > & operator=(const PdgIdFilter< T > &rhs)
Assignment operator:
PdgIdFilter()
Default constructor:

◆ setMatchSign()

template<typename T>
void PdgIdFilter< T >::setMatchSign ( const bool matchSign)
inline

Definition at line 219 of file PdgIdFilter.h.

220{
222}
bool matchSign() const
Return true if the filter requires a strict sign matching.

◆ setPdgId()

template<typename T>
void PdgIdFilter< T >::setPdgId ( const int & pdgId)
inline

Definition at line 197 of file PdgIdFilter.h.

198{
199 m_pdgIds.add( pdgId );
200}

◆ setPdgIds() [1/2]

template<typename T>
void PdgIdFilter< T >::setPdgIds ( const ParticleCandidateList & pdgIds)
inline

Definition at line 213 of file PdgIdFilter.h.

214{
215 setPdgIds( pdgIds.list() );
216}
const ParticleCandidateList * pdgIds() const
Return the list of pdg ids the filter is looking for.
void setPdgIds(const std::list< int > &pdgIds)

◆ setPdgIds() [2/2]

template<typename T>
void PdgIdFilter< T >::setPdgIds ( const std::list< int > & pdgIds)

Definition at line 203 of file PdgIdFilter.h.

204{
205 for ( auto itr = pdgIds.begin();
206 itr != pdgIds.end();
207 ++itr ) {
208 m_pdgIds.add( *itr );
209 }
210}

Member Data Documentation

◆ m_matchSign

template<typename T>
bool PdgIdFilter< T >::m_matchSign
protected

Tells to also match the sign of the pdg id of particles => true by default.

Definition at line 101 of file PdgIdFilter.h.

◆ m_pdgIds

template<typename T>
ParticleCandidateList PdgIdFilter< T >::m_pdgIds
protected

The list of particles ids which might be accepted.

Definition at line 96 of file PdgIdFilter.h.


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