Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:34

0001 
0002 /**
0003  * This is a Herwig++-specific parton selector that selects all status==2 partons. This is likely a temporary choice since
0004  * Herwig++ status codes in CMSSW currently break the HepMC convention. Once the status codes are fixed, the selector will
0005  * be updated.
0006  */
0007 
0008 #include "PhysicsTools/JetMCAlgos/interface/HerwigppPartonSelector.h"
0009 #include "PhysicsTools/JetMCUtils/interface/CandMCTag.h"
0010 
0011 HerwigppPartonSelector::HerwigppPartonSelector() {}
0012 
0013 HerwigppPartonSelector::~HerwigppPartonSelector() {}
0014 
0015 void HerwigppPartonSelector::run(const edm::Handle<reco::GenParticleCollection>& particles,
0016                                  std::unique_ptr<reco::GenParticleRefVector>& partons) {
0017   // loop over particles and select partons
0018   for (reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) {
0019     if (it->status() != 2)
0020       continue;  // only accept status==2 particles
0021     if (!CandMCTagUtils::isParton(*it))
0022       continue;  // skip particle if not a parton
0023 
0024     partons->push_back(reco::GenParticleRef(particles, it - particles->begin()));
0025   }
0026 
0027   return;
0028 }