00001 #include <vector> 00002 00003 #include "TruthHelper/IsGenType.h" 00004 #include "HepMC/GenParticle.h" 00005 using std::vector; 00006 using std::abs; 00007 00008 //**************************************************************** 00009 //* IsGenType * 00010 //**************************************************************** 00011 IsGenType::IsGenType(int ParticleType){ 00012 m_TypeList.push_back(ParticleType); 00013 } 00014 IsGenType::IsGenType(std::vector<int> ParticleTypeList){ 00015 vector<int>::const_iterator itype = ParticleTypeList.begin(); 00016 for(; itype !=ParticleTypeList.end(); ++itype ){ 00017 m_TypeList.push_back((*itype)); 00018 } 00019 } 00020 IsGenType::IsGenType(const IsGenType& rhs):GenIMCselector(),m_TypeList(rhs.m_TypeList){} 00021 00022 bool IsGenType::operator()( const Particle* const p ) const { 00023 vector<int>::const_iterator itype = m_TypeList.begin(); 00024 for(; itype != m_TypeList.end(); ++itype ){ 00025 if( abs(p->pdg_id()) == (*itype) ) return true ; 00026 } 00027 return false; 00028 } 00029 00030 bool IsGenType::operator() ( const Particle& p ) const { 00031 return this->operator()(&p); 00032 } 00033 GenIMCselector* IsGenType::create() const {return new IsGenType(*this);}