113 produces<reco::GenParticleRefVector>(
"bHadrons" );
114 produces<reco::GenParticleRefVector>(
"cHadrons" );
115 produces<reco::GenParticleRefVector>(
"algorithmicPartons" );
116 produces<reco::GenParticleRefVector>(
"physicsPartons" );
117 produces<reco::GenParticleRefVector>(
"leptons" );
148 if( genEvtInfoProduct.
isValid() ) {
153 if( moduleName.find(
"Pythia6")!=std::string::npos )
155 else if( moduleName.find(
"Pythia8")!=std::string::npos )
157 else if( moduleName.find(
"Herwig6")!=std::string::npos )
159 else if( moduleName.find(
"ThePEG")!=std::string::npos )
161 else if( moduleName.find(
"Sherpa")!=std::string::npos )
171 edm::LogWarning(
"UndefinedPartonMode") <<
"Could not automatically determine the hadronizer type and set the correct parton selection mode. Parton-based jet flavour will not be defined.";
175 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia6 parton selection mode.";
180 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia8 parton selection mode.";
185 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig6 parton selection mode.";
190 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig++ parton selection mode.";
195 edm::LogInfo(
"PartonModeDefined") <<
"Using Sherpa parton selection mode.";
198 throw cms::Exception(
"InvalidPartonMode") <<
"Parton selection mode is invalid: " <<
partonMode_ <<
", use Auto | Pythia6 | Pythia8 | Herwig6 | Herwig++ | Sherpa" << std::endl;
206 auto bHadrons = std::make_unique<reco::GenParticleRefVector>();
207 auto cHadrons = std::make_unique<reco::GenParticleRefVector>();
208 auto partons = std::make_unique<reco::GenParticleRefVector>();
209 auto physicsPartons = std::make_unique<reco::GenParticleRefVector>();
210 auto leptons = std::make_unique<reco::GenParticleRefVector>();
213 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
219 bool hasbHadronDaughter =
false;
220 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
224 if( hasbHadronDaughter )
continue;
233 bool hascHadronDaughter =
false;
234 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
238 if( hascHadronDaughter )
continue;
255 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
257 if( !(it->status()==3 || ((
partonMode_==
"Pythia8" ) && (it->status()==23))))
continue;
266 iEvent.
put(
std::move(physicsPartons),
"physicsPartons" );
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~HadronAndPartonSelector()
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
PartonSelectorPtr partonSelector_
Selects hadrons and partons from a collection of GenParticles.
bool isMuon(const Candidate &part)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
bool hasCharm(const reco::Candidate &c)
Herwig++ parton selector derived from the base parton selector.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< reco::GenParticleCollection > particlesToken_
Herwig6 parton selector derived from the base parton selector.
std::string moduleName(Provenance const &provenance)
Sherpa parton selector derived from the base parton selector.
virtual void produce(edm::Event &, const edm::EventSetup &)
void addDefault(ParameterSetDescription const &psetDescription)
bool isElectron(const Candidate &part)
boost::shared_ptr< BasePartonSelector > PartonSelectorPtr
Pythia6 parton selector derived from the base parton selector.
Pythia8 parton selector derived from the base parton selector.
bool isParton(const reco::Candidate &c)
HadronAndPartonSelector(const edm::ParameterSet &)
Provenance getProvenance(BranchID const &theID) const
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
bool hasBottom(const reco::Candidate &c)
const edm::EDGetTokenT< GenEventInfoProduct > srcToken_
bool isTau(const Candidate &part)