115 partonMode_(iConfig.getParameter<std::
string>(
"partonMode"))
119 produces<reco::GenParticleRefVector>(
"bHadrons" );
120 produces<reco::GenParticleRefVector>(
"cHadrons" );
121 produces<reco::GenParticleRefVector>(
"partons" );
122 produces<reco::GenParticleRefVector>(
"leptons" );
150 if( genEvtInfoProduct.
isValid() ) {
155 if( moduleName.find(
"Pythia6")!=std::string::npos )
157 else if( moduleName.find(
"Pythia8")!=std::string::npos )
159 else if( moduleName.find(
"Herwig6")!=std::string::npos )
161 else if( moduleName.find(
"ThePEG")!=std::string::npos )
163 else if( moduleName.find(
"Sherpa")!=std::string::npos )
173 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.";
177 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia6 parton selection mode.";
182 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia8 parton selection mode.";
187 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig6 parton selection mode.";
192 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig++ parton selection mode.";
197 edm::LogInfo(
"PartonModeDefined") <<
"Using Sherpa parton selection mode.";
200 throw cms::Exception(
"InvalidPartonMode") <<
"Parton selection mode is invalid: " <<
partonMode_ <<
", use Auto | Pythia6 | Pythia8 | Herwig6 | Herwig++ | Sherpa" << std::endl;
212 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
218 bool hasbHadronDaughter =
false;
219 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
223 if( hasbHadronDaughter )
continue;
232 bool hascHadronDaughter =
false;
233 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
237 if( hascHadronDaughter )
continue;
255 iEvent.
put( bHadrons,
"bHadrons" );
256 iEvent.
put( cHadrons,
"cHadrons" );
257 iEvent.
put( partons,
"partons" );
258 iEvent.
put( leptons,
"leptons" );
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~HadronAndPartonSelector()
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
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.
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 &)
virtual void beginLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
void addDefault(ParameterSetDescription const &psetDescription)
bool isElectron(const Candidate &part)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
boost::shared_ptr< BasePartonSelector > PartonSelectorPtr
Pythia6 parton selector derived from the base parton selector.
Pythia8 parton selector derived from the base parton selector.
virtual void endLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
virtual void beginRun(edm::Run &, edm::EventSetup const &)
HadronAndPartonSelector(const edm::ParameterSet &)
virtual void endRun(edm::Run &, edm::EventSetup const &)
Provenance getProvenance(BranchID const &theID) const
bool hasBottom(const reco::Candidate &c)
const edm::EDGetTokenT< GenEventInfoProduct > srcToken_
bool isTau(const Candidate &part)