#include <PhysicsTools/CandAlgos/interface/GenJetParticleSelector.h>
Public Member Functions | |
GenJetParticleSelector (const edm::ParameterSet &) | |
void | init (const edm::EventSetup &) |
bool | operator() (const reco::Candidate &) |
Private Types | |
typedef std::vector< PdtEntry > | vpdt |
Private Attributes | |
bool | bInclude_ |
bool | partons_ |
vpdt | pdtList_ |
std::set< int > | pIds_ |
bool | stableOnly_ |
Definition at line 16 of file GenJetParticleSelector.h.
typedef std::vector<PdtEntry> GenJetParticleSelector::vpdt [private] |
Definition at line 22 of file GenJetParticleSelector.h.
GenJetParticleSelector::GenJetParticleSelector | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 10 of file GenJetParticleSelector.cc.
References bInclude_, Exception, find(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), partons_, pdtList_, and stableOnly_.
00010 : 00011 stableOnly_(cfg.getParameter<bool>("stableOnly")), 00012 partons_(false), bInclude_(false) { 00013 const string excludeString("excludeList"); 00014 const string includeString("includeList"); 00015 vpdt includeList, excludeList; 00016 vector<string> vPdtParams = cfg.getParameterNamesForType<vpdt>(); 00017 bool found = std::find(vPdtParams.begin(), vPdtParams.end(), includeString) != vPdtParams.end(); 00018 if(found) includeList = cfg.getParameter<vpdt>(includeString); 00019 found = find(vPdtParams.begin(), vPdtParams.end(), excludeString) != vPdtParams.end(); 00020 if(found) excludeList = cfg.getParameter<vpdt>(excludeString); 00021 const string partonsString("partons"); 00022 vector<string> vBoolParams = cfg.getParameterNamesForType<bool>(); 00023 found = find(vBoolParams.begin(), vBoolParams.end(), partonsString) != vBoolParams.end(); 00024 if(found) partons_ = cfg.getParameter<bool>(partonsString); 00025 bool bExclude = false; 00026 if (includeList.size() > 0) bInclude_ = true; 00027 if (excludeList.size() > 0) bExclude = true; 00028 00029 if (bInclude_ && bExclude) { 00030 throw cms::Exception("ConfigError", "not allowed to use both includeList and excludeList at the same time\n"); 00031 } 00032 else if (bInclude_) { 00033 pdtList_ = includeList; 00034 } 00035 else { 00036 pdtList_ = excludeList; 00037 } 00038 if(stableOnly_ && partons_) { 00039 throw cms::Exception("ConfigError", "not allowed to have both stableOnly and partons true at the same time\n"); 00040 } 00041 }
void GenJetParticleSelector::init | ( | const edm::EventSetup & | es | ) |
bool GenJetParticleSelector::operator() | ( | const reco::Candidate & | p | ) |
Definition at line 43 of file GenJetParticleSelector.cc.
References funct::abs(), bInclude_, reco::Candidate::daughter(), reco::Candidate::numberOfDaughters(), partons_, reco::Particle::pdgId(), pIds_, stableOnly_, StDecayID::status, and reco::Particle::status().
00043 { 00044 int status = p.status(); 00045 int id = abs(p.pdgId()); 00046 if((!stableOnly_ || status == 1) && !partons_ && 00047 (pIds_.find(id) == pIds_.end() ^ bInclude_)) 00048 return true; 00049 else if(partons_ && 00050 (p.numberOfDaughters() > 0 && (p.daughter(0)->pdgId() == 91 || p.daughter(0)->pdgId() == 92)) && 00051 ((pIds_.find(id) == pIds_.end() ^ bInclude_))) 00052 return true; 00053 else 00054 return false; 00055 }
bool GenJetParticleSelector::bInclude_ [private] |
Definition at line 26 of file GenJetParticleSelector.h.
Referenced by GenJetParticleSelector(), and operator()().
bool GenJetParticleSelector::partons_ [private] |
Definition at line 24 of file GenJetParticleSelector.h.
Referenced by GenJetParticleSelector(), and operator()().
vpdt GenJetParticleSelector::pdtList_ [private] |
Definition at line 25 of file GenJetParticleSelector.h.
Referenced by GenJetParticleSelector(), and init().
std::set<int> GenJetParticleSelector::pIds_ [private] |
bool GenJetParticleSelector::stableOnly_ [private] |
Definition at line 23 of file GenJetParticleSelector.h.
Referenced by GenJetParticleSelector(), and operator()().