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" );
151 if( genEvtInfoProduct.
isValid() )
154 if( moduleName.find(
"Pythia6")!=std::string::npos )
156 else if( moduleName.find(
"Pythia8")!=std::string::npos )
158 else if( moduleName.find(
"Herwig6")!=std::string::npos )
160 else if( moduleName.find(
"ThePEG")!=std::string::npos )
162 else if( moduleName.find(
"Sherpa")!=std::string::npos )
172 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.";
176 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia6 parton selection mode.";
181 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia8 parton selection mode.";
186 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig6 parton selection mode.";
191 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig++ parton selection mode.";
196 edm::LogInfo(
"PartonModeDefined") <<
"Using Sherpa parton selection mode.";
199 throw cms::Exception(
"InvalidPartonMode") <<
"Parton selection mode is invalid: " <<
partonMode_ <<
", use Auto | Pythia6 | Pythia8 | Herwig6 | Herwig++ | Sherpa" << std::endl;
211 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
217 bool hasbHadronDaughter =
false;
218 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
222 if( hasbHadronDaughter )
continue;
231 bool hascHadronDaughter =
false;
232 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
236 if( hascHadronDaughter )
continue;
254 iEvent.
put( bHadrons,
"bHadrons" );
255 iEvent.
put( cHadrons,
"cHadrons" );
256 iEvent.
put( partons,
"partons" );
257 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 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)