File indexing completed on 2024-04-06 12:23:34
0001
0002
0003
0004
0005
0006
0007
0008 #include "PhysicsTools/JetMCAlgos/interface/Pythia8PartonSelector.h"
0009 #include "PhysicsTools/JetMCUtils/interface/CandMCTag.h"
0010
0011 Pythia8PartonSelector::Pythia8PartonSelector() {}
0012
0013 Pythia8PartonSelector::~Pythia8PartonSelector() {}
0014
0015 void Pythia8PartonSelector::run(const edm::Handle<reco::GenParticleCollection>& particles,
0016 std::unique_ptr<reco::GenParticleRefVector>& partons) {
0017
0018 for (reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) {
0019 int status = it->status();
0020 if (status == 1)
0021 continue;
0022 if (status == 2)
0023 continue;
0024 if (!CandMCTagUtils::isParton(*it))
0025 continue;
0026
0027
0028 int nparton_daughters = 0;
0029 for (unsigned i = 0; i < it->numberOfDaughters(); ++i) {
0030 if (CandMCTagUtils::isParton(*(it->daughter(i))))
0031 ++nparton_daughters;
0032 }
0033
0034 if (nparton_daughters == 0)
0035 partons->push_back(reco::GenParticleRef(particles, it - particles->begin()));
0036 }
0037
0038 return;
0039 }