115 partonMode_(iConfig.getParameter<std::
string>(
"partonMode"))
119 produces<reco::GenParticleRefVector>(
"bHadrons" );
120 produces<reco::GenParticleRefVector>(
"cHadrons" );
121 produces<reco::GenParticleRefVector>(
"algorithmicPartons" );
122 produces<reco::GenParticleRefVector>(
"physicsPartons" );
123 produces<reco::GenParticleRefVector>(
"leptons" );
151 if( genEvtInfoProduct.
isValid() ) {
156 if( moduleName.find(
"Pythia6")!=std::string::npos )
158 else if( moduleName.find(
"Pythia8")!=std::string::npos )
160 else if( moduleName.find(
"Herwig6")!=std::string::npos )
162 else if( moduleName.find(
"ThePEG")!=std::string::npos )
164 else if( moduleName.find(
"Sherpa")!=std::string::npos )
174 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.";
178 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia6 parton selection mode.";
183 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia8 parton selection mode.";
188 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig6 parton selection mode.";
193 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig++ parton selection mode.";
198 edm::LogInfo(
"PartonModeDefined") <<
"Using Sherpa parton selection mode.";
201 throw cms::Exception(
"InvalidPartonMode") <<
"Parton selection mode is invalid: " <<
partonMode_ <<
", use Auto | Pythia6 | Pythia8 | Herwig6 | Herwig++ | Sherpa" << std::endl;
214 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
220 bool hasbHadronDaughter =
false;
221 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
225 if( hasbHadronDaughter )
continue;
234 bool hascHadronDaughter =
false;
235 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
239 if( hascHadronDaughter )
continue;
256 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
258 if( !(it->status()==3 || ((
partonMode_==
"Pythia8" ) && (it->status()==23))))
continue;
264 iEvent.
put( bHadrons,
"bHadrons" );
265 iEvent.
put( cHadrons,
"cHadrons" );
266 iEvent.
put( partons,
"algorithmicPartons" );
267 iEvent.
put( physicsPartons,
"physicsPartons" );
268 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 &)
bool isParton(const reco::Candidate &c)
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)