BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
IsGenType.cxx
Go to the documentation of this file.
1#include <vector>
2
3#include "HepMC/GenParticle.h"
5using std::abs;
6using std::vector;
7
8//****************************************************************
9//* IsGenType *
10//****************************************************************
11IsGenType::IsGenType( int ParticleType ) { m_TypeList.push_back( ParticleType ); }
12IsGenType::IsGenType( std::vector<int> ParticleTypeList ) {
13 vector<int>::const_iterator itype = ParticleTypeList.begin();
14 for ( ; itype != ParticleTypeList.end(); ++itype ) { m_TypeList.push_back( ( *itype ) ); }
15}
17 : GenIMCselector(), m_TypeList( rhs.m_TypeList ) {}
18
19bool IsGenType::operator()( const Particle* const p ) const {
20 vector<int>::const_iterator itype = m_TypeList.begin();
21 for ( ; itype != m_TypeList.end(); ++itype )
22 {
23 if ( abs( p->pdg_id() ) == ( *itype ) ) return true;
24 }
25 return false;
26}
27
28bool IsGenType::operator()( const Particle& p ) const { return this->operator()( &p ); }
29GenIMCselector* IsGenType::create() const { return new IsGenType( *this ); }
HepMC::GenParticle Particle
virtual bool operator()(const Particle *const p) const
Definition IsGenType.cxx:19
IsGenType(int ParticleType)
Definition IsGenType.cxx:11
GenIMCselector * create() const
Definition IsGenType.cxx:29