115 produces<reco::GenParticleRefVector>(
"bHadrons" );
116 produces<reco::GenParticleRefVector>(
"cHadrons" );
117 produces<reco::GenParticleRefVector>(
"algorithmicPartons" );
118 produces<reco::GenParticleRefVector>(
"physicsPartons" );
119 produces<reco::GenParticleRefVector>(
"leptons" );
150 if( genEvtInfoProduct.
isValid() ) {
153 if (moduleName ==
"ExternalGeneratorFilter") {
155 edm::LogInfo(
"SpecialModule") <<
"GEN events are produced by ExternalGeneratorFilter, " 156 <<
"which is a wrapper of the original module: " <<
moduleName;
160 if( moduleName.find(
"Pythia6")!=std::string::npos )
162 else if( moduleName.find(
"Pythia8")!=std::string::npos )
164 else if( moduleName.find(
"Herwig6")!=std::string::npos )
166 else if( moduleName.find(
"ThePEG")!=std::string::npos )
168 else if( moduleName.find(
"Herwig7")!=std::string::npos )
170 else if( moduleName.find(
"Sherpa")!=std::string::npos )
180 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.";
184 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia6 parton selection mode.";
189 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia8 parton selection mode.";
194 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig6 parton selection mode.";
199 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig++ parton selection mode.";
204 edm::LogInfo(
"PartonModeDefined") <<
"Using Sherpa parton selection mode.";
207 throw cms::Exception(
"InvalidPartonMode") <<
"Parton selection mode is invalid: " <<
partonMode_ <<
", use Auto | Pythia6 | Pythia8 | Herwig6 | Herwig++ | Sherpa" << std::endl;
215 auto bHadrons = std::make_unique<reco::GenParticleRefVector>();
216 auto cHadrons = std::make_unique<reco::GenParticleRefVector>();
217 auto partons = std::make_unique<reco::GenParticleRefVector>();
218 auto physicsPartons = std::make_unique<reco::GenParticleRefVector>();
219 auto leptons = std::make_unique<reco::GenParticleRefVector>();
222 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
228 bool hasbHadronDaughter =
false;
229 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
233 if( hasbHadronDaughter )
continue;
242 bool hascHadronDaughter =
false;
243 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
247 if( hascHadronDaughter )
continue;
267 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
271 if( !(it->status()==3 || ((
partonMode_==
"Pythia8" ) && (it->status()==23))))
continue;
280 iEvent.
put(
std::move(physicsPartons),
"physicsPartons" );
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
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
bool fullChainPhysPartons_
bool hasCharm(const reco::Candidate &c)
Herwig++ parton selector derived from the base parton selector.
const edm::EDGetTokenT< reco::GenParticleCollection > particlesToken_
Herwig6 parton selector derived from the base parton selector.
void produce(edm::Event &, const edm::EventSetup &) override
std::string moduleName(Provenance const &provenance)
#define DEFINE_FWK_MODULE(type)
Sherpa parton selector derived from the base parton selector.
void addDefault(ParameterSetDescription const &psetDescription)
~HadronAndPartonSelector() override
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
bool hasBottom(const reco::Candidate &c)
ParameterSet const & parameterSet(Provenance const &provenance)
const edm::EDGetTokenT< GenEventInfoProduct > srcToken_
bool isTau(const Candidate &part)