48 inTag(params.getParameter<edm::InputTag>(
"src")),
49 partonicFinalState(params.getParameter<bool>(
"partonicFinalState")),
50 excludeResonances(params.getParameter<bool>(
"excludeResonances")),
51 tausAsJets(params.getParameter<bool>(
"tausAsJets")),
53 if (params.
exists(
"ignoreParticleIDs"))
55 (
"ignoreParticleIDs"));
57 (
"excludeFromResonancePids"));
59 produces <reco::GenParticleRefVector> ();
80 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
81 return (pdgId > 0 && pdgId < 6) ||
82 pdgId == 9 || (
tausAsJets && pdgId == 15) || pdgId == 21;
89 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
90 return (pdgId > 100 && pdgId < 900) ||
91 (pdgId > 1000 && pdgId < 9000);
97 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
98 return (pdgId > 21 && pdgId <= 42) || pdgId == 6 || pdgId == 7 || pdgId == 8 ;
103 pdgId = pdgId > 0 ? pdgId : -
pdgId;
104 std::vector<unsigned int>::const_iterator pos =
107 (
unsigned int)pdgId);
113 pdgId = pdgId > 0 ? pdgId : -
pdgId;
114 std::vector<unsigned int>::const_iterator pos =
117 (
unsigned int)pdgId);
125 InputGenJetsParticleSelector::ParticleVector::const_iterator pos =
126 std::lower_bound(p.begin(), p.end(), particle);
127 if (pos == p.end() || *pos != particle)
129 <<
"reco::GenEvent corrupted: Unlisted particles"
130 " in decay tree." << std::endl;
132 return pos - p.begin();
159 if (!npart) {
return 0;}
162 unsigned int idx =
partIdx(p,dynamic_cast<const reco::GenParticle*>(particle->
daughter(
i)));
171 int result = testPartonChildren(invalid,p,dynamic_cast<const reco::GenParticle*>(particle->
daughter(
i)));
172 if (result)
return result;
183 int id = particle->
pdgId();
202 for(
unsigned int i=0;
i<nMo;++
i){
236 std::map<const reco::GenParticle*,size_t> particlePtrIdxMap;
238 for (reco::GenParticleCollection::const_iterator
iter=genParticles->begin();
iter!=genParticles->end();++
iter){
239 particles.push_back(&*
iter);
240 particlePtrIdxMap[&*
iter] = (
iter - genParticles->begin());
243 std::sort(particles.begin(), particles.end());
244 unsigned int size = particles.size();
249 for(
unsigned int i = 0;
i <
size;
i++) {
253 if (particle->
status() == 1)
258 particle->
status() != 1) {
273 if (!selected[
idx] || invalid[
idx]){
291 selected_->push_back(particleRef);
T getParameter(std::string const &) const
bool hasPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::GenParticle *particle) const
std::vector< const reco::GenParticle * > ParticleVector
static bool isHadron(int pdgId)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual int pdgId() const GCC11_FINAL
PDG identifier.
#define DEFINE_FWK_MODULE(type)
int testPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::GenParticle *particle) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< unsigned int > excludeFromResonancePids
virtual void produce(edm::Event &evt, const edm::EventSetup &evtSetup)
void setIgnoredParticles(const std::vector< unsigned int > &particleIDs)
bool isParton(int pdgId) const
edm::EDGetTokenT< reco::GenParticleCollection > input_genpartcoll_token_
bool isExcludedFromResonance(int pdgId) const
virtual int status() const GCC11_FINAL
status word
bool isIgnored(int pdgId) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
static void invalidateTree(InputGenJetsParticleSelector::ParticleBitmap &invalid, const InputGenJetsParticleSelector::ParticleVector &p, const reco::GenParticle *particle)
virtual size_t numberOfMothers() const
number of mothers
virtual size_t numberOfDaughters() const
number of daughters
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::GenParticle *particle)
std::vector< bool > ParticleBitmap
virtual int pdgId() const =0
PDG identifier.
bool isParton(const reco::Candidate &c)
static bool isResonance(int pdgId)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
InputGenJetsParticleSelector()
std::vector< unsigned int > ignoreParticleIDs
void setExcludeFromResonancePids(const std::vector< unsigned int > &particleIDs)
virtual float pt() const GCC11_FINAL
transverse momentum
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
tuple size
Write out results.
ResonanceState fromResonance(ParticleBitmap &invalid, const ParticleVector &p, const reco::GenParticle *particle) const
~InputGenJetsParticleSelector()