309 edm::LogError(
"EvtGenInterface::~EvtGenInterface") <<
"EvtGenInterface::init() PYTHIA8DATA not defined. Terminating program ";
313 bool useEvtGenRandom(
true);
316 EvtExternalGenList genList(convertPythiaCodes, pythiaDir,
photonType, useEvtGenRandom);
317 EvtAbsRadCorr* radCorrEngine=0;
318 if(usePhotos) radCorrEngine = genList.getPhotosModel();
319 std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
320 std::list<EvtDecayBase*> myExtraModels;
321 for(
unsigned int i=0;
i<extraModels.size();
i++){
322 std::list<EvtDecayBase*>::iterator it = extraModels.begin();
324 TString
name=(*it)->getName();
325 if(name.Contains(
"PYTHIA") && usePythia) myExtraModels.push_back(*it);
326 if(name.Contains(
"TAUOLA") && useTauola) myExtraModels.push_back(*it);
332 std::list<EvtDecayBase*> userModels = userList.
getUserModels();
333 for(
unsigned int i=0;
i<userModels.size();
i++){
334 std::list<EvtDecayBase*>::iterator it = userModels.begin();
336 TString name=(*it)->getName();
337 edm::LogInfo(
"EvtGenInterface::~EvtGenInterface") <<
"Adding user model: "<<
name;
338 myExtraModels.push_back(*it);
346 throw cms::Exception(
"Configuration") <<
"EvtGenProducer requires B_Mixing to be 0 (coherent) or 1 (incoherent) \n"
347 "Please fix this in your configuration.";
356 std::vector<std::string> user_decays =
fPSet->
getParameter<std::vector<std::string> >(
"user_decay_file");
357 for(
unsigned int i=0;
i<user_decays.size();
i++){
359 m_EvtGen->readUDecay(user_decay.fullPath().c_str());
364 std::vector<std::string> user_decay_lines =
fPSet->
getParameter<std::vector<std::string> >(
"user_decay_embedded");
365 auto tmp_dir = boost::filesystem::temp_directory_path();
366 tmp_dir +=
"%%%%-%%%%-%%%%-%%%%";
367 auto tmp_path = boost::filesystem::unique_path(tmp_dir);
369 FILE* tmpf = std::fopen(user_decay_tmp.c_str(),
"w");
371 edm::LogError(
"EvtGenInterface::~EvtGenInterface") <<
"EvtGenInterface::init() fails when trying to open a temporary file for embedded user.dec. Terminating program ";
374 for (
unsigned int i=0;
i<user_decay_lines.size();
i++) {
375 user_decay_lines.at(
i) +=
"\n";
376 std::fputs(user_decay_lines.at(
i).c_str(), tmpf);
379 m_EvtGen->readUDecay(user_decay_tmp.c_str());
384 std::vector<int> tmpPIDs =
fPSet->
getParameter< std::vector<int> >(
"operates_on_particles");
386 bool goodinput=
false;
387 if(tmpPIDs.size()>0){
if(tmpPIDs.size()==1 && tmpPIDs[0]==0) goodinput=
false;
390 else{goodinput=
false;}
391 if(goodinput)
m_PDGs = tmpPIDs;
396 for(
unsigned int i=0;
i<
m_PDGs.size();
i++){
397 edm::LogInfo(
"EvtGenInterface::~EvtGenInterface") <<
"EvtGenInterface::init() Particles to Operate on: " <<
m_PDGs[
i];
404 throw cms::Exception(
"Configuration") <<
"EvtGenProducer requires that the particles_to_polarize and particle_polarization\n"
405 "vectors be the same size. Please fix this in your configuration.";
407 for (
unsigned int ndx = 0; ndx <
polarize_ids.size(); ndx++) {
409 throw cms::Exception(
"Configuration") <<
"EvtGenProducer error: particle polarizations must be in the range -1 < P < 1";
416 std::vector<std::string> forced_names =
fPSet->
getParameter< std::vector<std::string> >(
"list_forced_decays");
417 for(
unsigned int i=0;
i<forced_names.size();
i++){
419 if(found.getId() == -1)
throw cms::Exception(
"Configuration") <<
"name in part list for ignored decays not found: " << forced_names[
i];
420 if(found.getId() == found.getAlias())
throw cms::Exception(
"Configuration") <<
"name of ignored decays is not an alias: " << forced_names[
i];
425 edm::LogInfo(
"EvtGenInterface::~EvtGenInterface") <<
"Number of Forced Paricles is: " <<
forced_pdgids.size() << std::endl;
T getParameter(std::string const &) const
edm::ParameterSet * fPSet
T getUntrackedParameter(std::string const &, T const &) const
static unsigned int getId(void)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< int > polarize_ids
std::vector< int > forced_pdgids
std::map< int, float > polarizations
std::vector< EvtId > forced_id
std::vector< double > polarize_pol
std::vector< int > m_PDGs
myEvtRandomEngine * the_engine
std::vector< std::string > fSpecialSettings
std::list< EvtDecayBase * > getUserModels()
std::vector< int > ignore_pdgids