43 inTag(params.getParameter<edm::InputTag>(
"src")),
44 partonicFinalState(params.getParameter<bool>(
"partonicFinalState")),
45 excludeResonances(params.getParameter<bool>(
"excludeResonances")),
46 tausAsJets(params.getParameter<bool>(
"tausAsJets")),
48 if (params.
exists(
"ignoreParticleIDs"))
50 (
"ignoreParticleIDs"));
52 (
"excludeFromResonancePids"));
54 produces <reco::GenParticleRefVector> ();
73 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
74 return (pdgId > 0 && pdgId < 6) || pdgId == 7 ||
75 pdgId == 9 || (
tausAsJets && pdgId == 15) || pdgId == 21;
82 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
83 return (pdgId > 100 && pdgId < 900) ||
84 (pdgId > 1000 && pdgId < 9000);
90 pdgId = (pdgId > 0 ? pdgId : -
pdgId) % 10000;
91 return (pdgId > 21 && pdgId <= 42) || pdgId == 6 || pdgId == 8 ;
96 pdgId = pdgId > 0 ? pdgId : -
pdgId;
97 std::vector<unsigned int>::const_iterator
pos =
100 (
unsigned int)pdgId);
106 pdgId = pdgId > 0 ? pdgId : -
pdgId;
107 std::vector<unsigned int>::const_iterator
pos =
110 (
unsigned int)pdgId);
119 InputGenJetsParticleSelector::ParticleVector::const_iterator
pos =
120 std::lower_bound(p.begin(), p.end(), particle);
121 if (pos == p.end() || *pos != particle)
123 <<
"reco::GenEvent corrupted: Unlisted particles"
124 " in decay tree." << std::endl;
126 return pos - p.begin();
137 unsigned int idx=
partIdx(p,dynamic_cast<const reco::GenParticle*>(particle->
daughter(
i)));
153 if (!npart) {
return 0;}
156 unsigned int idx =
partIdx(p,dynamic_cast<const reco::GenParticle*>(particle->
daughter(
i)));
165 int result = testPartonChildren(invalid,p,dynamic_cast<const reco::GenParticle*>(particle->
daughter(
i)));
166 if (result)
return result;
176 unsigned int idx =
partIdx(p, particle);
177 int id = particle->
pdgId();
196 for(
unsigned int i=0;
i<nMo;++
i){
233 for (reco::GenParticleCollection::const_iterator iter=genParticles->begin();iter!=genParticles->end();++iter){
234 particles.push_back(&*iter);
237 std::sort(particles.begin(), particles.end());
238 unsigned int size = particles.size();
243 for(
unsigned int i = 0;
i <
size;
i++) {
247 if (particle->
status() == 1)
252 particle->
status() != 1) {
264 unsigned int count=0;
265 for(
size_t idx=0;idx<genParticles->size();++idx){
267 if (!selected[idx] || invalid[idx]){
285 selected_->push_back(particleRef);
T getParameter(std::string const &) const
virtual int pdgId() const
PDG identifier.
bool hasPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::GenParticle *particle) const
std::vector< const reco::GenParticle * > ParticleVector
static bool isHadron(int pdgId)
#define DEFINE_FWK_MODULE(type)
virtual int status() const
status word
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
bool isExcludedFromResonance(int pdgId) const
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) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::GenParticle *particle)
std::vector< bool > ParticleBitmap
virtual int pdgId() const =0
PDG identifier.
static bool isResonance(int pdgId)
virtual double pt() const
transverse momentum
InputGenJetsParticleSelector()
std::vector< unsigned int > ignoreParticleIDs
void setExcludeFromResonancePids(const std::vector< unsigned int > &particleIDs)
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()