109 partonMode_(iConfig.getParameter<
std::
string>(
"partonMode")),
110 fullChainPhysPartons_(iConfig.getParameter<
bool>(
"fullChainPhysPartons"))
114 produces<reco::GenParticleRefVector>(
"bHadrons");
115 produces<reco::GenParticleRefVector>(
"cHadrons");
116 produces<reco::GenParticleRefVector>(
"algorithmicPartons");
117 produces<reco::GenParticleRefVector>(
"physicsPartons");
118 produces<reco::GenParticleRefVector>(
"leptons");
141 if (genEvtInfoProduct.
isValid()) {
144 if (
moduleName ==
"ExternalGeneratorFilter") {
146 edm::LogInfo(
"SpecialModule") <<
"GEN events are produced by ExternalGeneratorFilter, " 147 <<
"which is a wrapper of the original module: " <<
moduleName;
151 if (
moduleName.find(
"Pythia6") != std::string::npos)
153 else if (
moduleName.find(
"Pythia8") != std::string::npos)
155 else if (
moduleName.find(
"ThePEG") != std::string::npos)
157 else if (
moduleName.find(
"Herwig7") != std::string::npos)
159 else if (
moduleName.find(
"Sherpa") != std::string::npos)
169 <<
"Could not automatically determine the hadronizer type and set the correct parton selection mode. " 170 "Parton-based jet flavour will not be defined.";
173 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia6 parton selection mode.";
176 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia8 parton selection mode.";
179 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig++ parton selection mode.";
182 edm::LogInfo(
"PartonModeDefined") <<
"Using Sherpa parton selection mode.";
185 <<
", use Auto | Pythia6 | Pythia8 | Herwig++ | Sherpa" << std::endl;
193 auto bHadrons = std::make_unique<reco::GenParticleRefVector>();
194 auto cHadrons = std::make_unique<reco::GenParticleRefVector>();
195 auto partons = std::make_unique<reco::GenParticleRefVector>();
196 auto physicsPartons = std::make_unique<reco::GenParticleRefVector>();
197 auto leptons = std::make_unique<reco::GenParticleRefVector>();
200 for (reco::GenParticleCollection::const_iterator it =
particles->begin(); it !=
particles->end(); ++it) {
204 bool hasbHadronDaughter =
false;
205 for (
size_t i = 0;
i < it->numberOfDaughters(); ++
i) {
207 hasbHadronDaughter =
true;
211 if (hasbHadronDaughter)
220 bool hascHadronDaughter =
false;
221 for (
size_t i = 0;
i < it->numberOfDaughters(); ++
i) {
223 hascHadronDaughter =
true;
227 if (hascHadronDaughter)
248 for (reco::GenParticleCollection::const_iterator it =
particles->begin(); it !=
particles->end(); ++it) {
250 if (!(it->status() == 3 || ((
partonMode_ ==
"Pythia8") && (it->status() == 23))))
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
PartonSelectorPtr partonSelector_
Selects hadrons and partons from a collection of GenParticles.
bool isMuon(const Candidate &part)
bool fullChainPhysPartons_
std::shared_ptr< BasePartonSelector > PartonSelectorPtr
#define DEFINE_FWK_MODULE(type)
bool hasCharm(const reco::Candidate &c)
Herwig++ parton selector derived from the base parton selector.
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
const edm::EDGetTokenT< reco::GenParticleCollection > particlesToken_
void produce(edm::Event &, const edm::EventSetup &) override
Sherpa parton selector derived from the base parton selector.
void addDefault(ParameterSetDescription const &psetDescription)
~HadronAndPartonSelector() override
bool isElectron(const Candidate &part)
Pythia6 parton selector derived from the base parton selector.
Pythia8 parton selector derived from the base parton selector.
Log< level::Info, false > LogInfo
bool isParton(const reco::Candidate &c)
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
HadronAndPartonSelector(const edm::ParameterSet &)
Log< level::Warning, false > LogWarning
bool hasBottom(const reco::Candidate &c)
const edm::EDGetTokenT< GenEventInfoProduct > srcToken_
bool isTau(const Candidate &part)