50 inTag(params.getParameter<
edm::InputTag>(
"src")),
51 prunedInTag(params.exists(
"prunedGenParticles") ? params.getParameter<
edm::InputTag>(
"prunedGenParticles") :
edm::InputTag(
"prunedGenParticles")),
56 if (params.
exists(
"ignoreParticleIDs"))
58 (
"ignoreParticleIDs"));
60 (
"excludeFromResonancePids"));
64 edm::LogError(
"PartonicFinalStateFromMiniAOD") <<
"Partonic final state not supported for MiniAOD. Falling back to the stable particle selection.";
68 produces <reco::CandidatePtrVector> ();
91 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
92 return (pdgId > 0 && pdgId < 6) ||
93 pdgId == 9 || (
tausAsJets && pdgId == 15) || pdgId == 21;
100 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
101 return (pdgId > 100 && pdgId < 900) ||
102 (pdgId > 1000 && pdgId < 9000);
108 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
109 return (pdgId > 21 && pdgId <= 42) || pdgId == 6 || pdgId == 7 || pdgId == 8 ;
114 pdgId = pdgId > 0 ? pdgId : -
pdgId;
115 std::vector<unsigned int>::const_iterator
pos =
118 (
unsigned int)pdgId);
124 pdgId = pdgId > 0 ? pdgId : -
pdgId;
125 std::vector<unsigned int>::const_iterator
pos =
128 (
unsigned int)pdgId);
136 InputGenJetsParticleSelector::ParticleVector::const_iterator
pos =
137 std::lower_bound(p.begin(), p.end(), particle);
138 if (pos == p.end() || *pos != particle)
140 <<
"reco::GenEvent corrupted: Unlisted particles" 141 " in decay tree." << std::endl;
143 return pos - p.begin();
170 if (!npart) {
return 0;}
183 if (result)
return result;
194 int id = particle->
pdgId();
213 for(
unsigned int i=0;
i<nMo;++
i){
242 auto selected_ = std::make_unique<reco::CandidatePtrVector>();
253 if(iter->status()!=1)
254 particles.push_back(&*iter);
261 std::map<const reco::Candidate*,size_t> particlePtrIdxMap;
264 particles.push_back(&*iter);
265 particlePtrIdxMap[&*iter] = (iter - genParticles->
begin());
268 std::sort(particles.begin(), particles.end());
269 unsigned int size = particles.size();
274 for(
unsigned int i = 0;
i <
size;
i++) {
278 if (particle->
status() == 1)
283 particle->
status() != 1) {
298 if (!selected[
idx] || invalid[
idx]){
315 selected_->push_back(genParticles->
ptrAt(particlePtrIdxMap[particle]));
bool hasPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
T getParameter(std::string const &) const
void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &evtSetup) const override
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::CandidateView > input_genpartcoll_token_
static bool isHadron(int pdgId)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Ptr< value_type > ptrAt(size_type i) const
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
bool exists(std::string const ¶meterName) const
checks if a parameter exists
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
std::vector< unsigned int > excludeFromResonancePids
int testPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
void setIgnoredParticles(const std::vector< unsigned int > &particleIDs)
virtual int status() const =0
status word
bool isParton(int pdgId) const
bool isExcludedFromResonance(int pdgId) const
edm::EDGetTokenT< reco::CandidateView > input_prunedgenpartcoll_token_
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
bool isIgnored(int pdgId) const
virtual int pdgId() const =0
PDG identifier.
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
ResonanceState fromResonance(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
std::vector< bool > ParticleBitmap
static bool isResonance(int pdgId)
virtual double pt() const =0
transverse momentum
static void invalidateTree(InputGenJetsParticleSelector::ParticleBitmap &invalid, const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
InputGenJetsParticleSelector()
std::vector< unsigned int > ignoreParticleIDs
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::InputTag prunedInTag
std::vector< const reco::Candidate * > ParticleVector
const_iterator end() const
void setExcludeFromResonancePids(const std::vector< unsigned int > &particleIDs)
~InputGenJetsParticleSelector() override
virtual size_type numberOfDaughters() const =0
number of daughters