CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Pythia8PartonSelector.cc
Go to the documentation of this file.
1 
10 
12 
14 
16  std::unique_ptr<reco::GenParticleRefVector>& partons) {
17  // loop over particles and select partons
18  for (reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) {
19  int status = it->status();
20  if (status == 1)
21  continue; // skip stable particles
22  if (status == 2)
23  continue; // skip decayed Standard Model hadrons and leptons
24  if (!CandMCTagUtils::isParton(*it))
25  continue; // skip particle if not a parton
26 
27  // check if the parton has other partons as daughters
28  int nparton_daughters = 0;
29  for (unsigned i = 0; i < it->numberOfDaughters(); ++i) {
30  if (CandMCTagUtils::isParton(*(it->daughter(i))))
31  ++nparton_daughters;
32  }
33 
34  if (nparton_daughters == 0)
35  partons->push_back(reco::GenParticleRef(particles, it - particles->begin()));
36  }
37 
38  return;
39 }
list status
Definition: mps_update.py:107
bool isParton(const reco::Candidate &c)
Definition: CandMCTag.cc:46
void run(const edm::Handle< reco::GenParticleCollection > &particles, std::unique_ptr< reco::GenParticleRefVector > &partons) override