108 partonMode_(iConfig.getParameter<std::
string>(
"partonMode"))
112 produces<reco::GenParticleRefVector>(
"bHadrons" );
113 produces<reco::GenParticleRefVector>(
"cHadrons" );
114 produces<reco::GenParticleRefVector>(
"algorithmicPartons" );
115 produces<reco::GenParticleRefVector>(
"physicsPartons" );
116 produces<reco::GenParticleRefVector>(
"leptons" );
144 if( genEvtInfoProduct.
isValid() ) {
149 if( moduleName.find(
"Pythia6")!=std::string::npos )
151 else if( moduleName.find(
"Pythia8")!=std::string::npos )
153 else if( moduleName.find(
"Herwig6")!=std::string::npos )
155 else if( moduleName.find(
"ThePEG")!=std::string::npos )
157 else if( moduleName.find(
"Sherpa")!=std::string::npos )
167 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.";
171 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia6 parton selection mode.";
176 edm::LogInfo(
"PartonModeDefined") <<
"Using Pythia8 parton selection mode.";
181 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig6 parton selection mode.";
186 edm::LogInfo(
"PartonModeDefined") <<
"Using Herwig++ parton selection mode.";
191 edm::LogInfo(
"PartonModeDefined") <<
"Using Sherpa parton selection mode.";
194 throw cms::Exception(
"InvalidPartonMode") <<
"Parton selection mode is invalid: " <<
partonMode_ <<
", use Auto | Pythia6 | Pythia8 | Herwig6 | Herwig++ | Sherpa" << std::endl;
207 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
213 bool hasbHadronDaughter =
false;
214 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
218 if( hasbHadronDaughter )
continue;
227 bool hascHadronDaughter =
false;
228 for(
size_t i=0;
i < it->numberOfDaughters(); ++
i)
232 if( hascHadronDaughter )
continue;
249 for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it)
251 if( !(it->status()==3 || ((
partonMode_==
"Pythia8" ) && (it->status()==23))))
continue;
257 iEvent.
put( bHadrons,
"bHadrons" );
258 iEvent.
put( cHadrons,
"cHadrons" );
259 iEvent.
put( partons,
"algorithmicPartons" );
260 iEvent.
put( physicsPartons,
"physicsPartons" );
261 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 &)
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.
bool isParton(const reco::Candidate &c)
HadronAndPartonSelector(const edm::ParameterSet &)
Provenance getProvenance(BranchID const &theID) const
bool hasBottom(const reco::Candidate &c)
const edm::EDGetTokenT< GenEventInfoProduct > srcToken_
bool isTau(const Candidate &part)