50 inTag(params.getParameter<edm::
InputTag>(
"src")),
51 prunedInTag(params.exists(
"prunedGenParticles") ? params.getParameter<edm::
InputTag>(
"prunedGenParticles") : edm::
InputTag(
"prunedGenParticles")),
52 partonicFinalState(params.getParameter<bool>(
"partonicFinalState")),
53 excludeResonances(params.getParameter<bool>(
"excludeResonances")),
54 tausAsJets(params.getParameter<bool>(
"tausAsJets")),
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){
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
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
edm::EDGetTokenT< reco::CandidateView > input_genpartcoll_token_
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
static bool isHadron(int pdgId)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
virtual int status() const =0
status word
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
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)
int testPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
void setIgnoredParticles(const std::vector< unsigned int > &particleIDs)
virtual size_type numberOfDaughters() const =0
number of daughters
bool isParton(int pdgId) const
bool isExcludedFromResonance(int pdgId) const
edm::EDGetTokenT< reco::CandidateView > input_prunedgenpartcoll_token_
bool isIgnored(int pdgId) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ResonanceState fromResonance(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
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...
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
void setExcludeFromResonancePids(const std::vector< unsigned int > &particleIDs)
tuple size
Write out results.
~InputGenJetsParticleSelector()