306 "convertPythiaCodes",
true);
308 std::getenv(
"PYTHIA8DATA");
309 if (pythiaDir.empty()) {
311 <<
"EvtGenInterface::init() PYTHIA8DATA not defined. Terminating program ";
315 bool useEvtGenRandom(
true);
318 EvtExternalGenList genList(convertPythiaCodes, pythiaDir,
photonType, useEvtGenRandom);
319 EvtAbsRadCorr* radCorrEngine =
nullptr;
321 radCorrEngine = genList.getPhotosModel();
322 std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
323 std::list<EvtDecayBase*> myExtraModels;
324 for (
unsigned int i = 0;
i < extraModels.size();
i++) {
325 std::list<EvtDecayBase*>::iterator it = extraModels.begin();
327 TString
name = (*it)->getName();
328 if (
name.Contains(
"PYTHIA") && usePythia)
329 myExtraModels.push_back(*it);
330 if (
name.Contains(
"TAUOLA") && useTauola)
331 myExtraModels.push_back(*it);
337 std::list<EvtDecayBase*> userModels = userList.
getUserModels();
338 for (
unsigned int i = 0;
i < userModels.size();
i++) {
339 std::list<EvtDecayBase*>::iterator it = userModels.begin();
341 TString
name = (*it)->getName();
342 edm::LogInfo(
"EvtGenInterface::~EvtGenInterface") <<
"Adding user model: " <<
name;
343 myExtraModels.push_back(*it);
349 throw cms::Exception(
"Configuration") <<
"EvtGenProducer requires B_Mixing to be 0 (coherent) or 1 (incoherent) \n"
350 "Please fix this in your configuration.";
356 decay_table.fullPath().c_str(), pdt.fullPath().c_str(),
the_engine, radCorrEngine, &myExtraModels,
BmixingOption);
360 std::vector<std::string> user_decays =
fPSet->
getParameter<std::vector<std::string> >(
"user_decay_file");
361 for (
unsigned int i = 0;
i < user_decays.size();
i++) {
363 m_EvtGen->readUDecay(user_decay.fullPath().c_str());
368 std::vector<std::string> user_decay_lines =
fPSet->
getParameter<std::vector<std::string> >(
"user_decay_embedded");
369 auto tmp_dir = boost::filesystem::temp_directory_path();
370 tmp_dir +=
"/%%%%-%%%%-%%%%-%%%%";
371 auto tmp_path = boost::filesystem::unique_path(tmp_dir);
373 FILE* tmpf = std::fopen(user_decay_tmp.c_str(),
"w");
376 <<
"EvtGenInterface::init() fails when trying to open a temporary file for embedded user.dec. Terminating "
380 for (
unsigned int i = 0;
i < user_decay_lines.size();
i++) {
381 user_decay_lines.at(
i) +=
"\n";
382 std::fputs(user_decay_lines.at(
i).c_str(), tmpf);
385 m_EvtGen->readUDecay(user_decay_tmp.c_str());
390 std::vector<int> tmpPIDs =
fPSet->
getParameter<std::vector<int> >(
"operates_on_particles");
392 bool goodinput =
false;
393 if (!tmpPIDs.empty()) {
394 if (tmpPIDs.size() == 1 && tmpPIDs[0] == 0)
408 for (
unsigned int i = 0;
i <
m_PDGs.size();
i++) {
410 <<
"EvtGenInterface::init() Particles to Operate on: " <<
m_PDGs[
i];
418 <<
"EvtGenProducer requires that the particles_to_polarize and particle_polarization\n"
419 "vectors be the same size. Please fix this in your configuration.";
421 for (
unsigned int ndx = 0; ndx <
polarize_ids.size(); ndx++) {
424 <<
"EvtGenProducer error: particle polarizations must be in the range -1 < P < 1";
431 std::vector<std::string> forced_names =
fPSet->
getParameter<std::vector<std::string> >(
"list_forced_decays");
432 for (
unsigned int i = 0;
i < forced_names.size();
i++) {
434 if (
found.getId() == -1)
435 throw cms::Exception(
"Configuration") <<
"name in part list for ignored decays not found: " << forced_names[
i];
437 throw cms::Exception(
"Configuration") <<
"name of ignored decays is not an alias: " << forced_names[
i];
443 <<
"Number of Forced Paricles is: " <<
forced_pdgids.size() << std::endl;