#include <Herwig6Instance.h>
Public Member Functions | |
bool | callWithTimeout (unsigned int secs, void(*fn)()) |
bool | give (const std::string &line) |
Herwig6Instance (int dummy) | |
Herwig6Instance (CLHEP::HepRandomEngine *randomEngine=0) | |
virtual | ~Herwig6Instance () |
Protected Member Functions | |
virtual bool | hwwarn (const std::string &fn, int code) |
Private Member Functions | |
bool | timeout (unsigned int secs, void(*fn)()) |
Static Private Member Functions | |
static void | _timeout_sighandler (int signr) |
Private Attributes | |
CLHEP::HepRandomEngine * | randomEngine |
void * | timeoutPrivate |
Friends | |
void | gen::cms_hwwarn_ (char fn[6], int *, int *) |
double | gen::hwrgen_ (int *) |
Definition at line 16 of file Herwig6Instance.h.
Herwig6Instance::Herwig6Instance | ( | CLHEP::HepRandomEngine * | randomEngine = 0 | ) |
Definition at line 61 of file Herwig6Instance.cc.
: randomEngine(randomEngine ? randomEngine : &getEngineReference()), timeoutPrivate(0) { }
Herwig6Instance::Herwig6Instance | ( | int | dummy | ) |
Definition at line 67 of file Herwig6Instance.cc.
: randomEngine(0), timeoutPrivate(0) { }
Herwig6Instance::~Herwig6Instance | ( | ) | [virtual] |
Definition at line 73 of file Herwig6Instance.cc.
{ }
static void gen::Herwig6Instance::_timeout_sighandler | ( | int | signr | ) | [static, private] |
bool gen::Herwig6Instance::callWithTimeout | ( | unsigned int | secs, |
void(*)() | fn | ||
) | [inline] |
Definition at line 25 of file Herwig6Instance.h.
References timeout(), and wrapper.
Referenced by gen::PomwigHadronizer::generatePartonsAndHadronize(), and Herwig6Hadronizer::hadronize().
bool Herwig6Instance::give | ( | const std::string & | line | ) |
Definition at line 175 of file Herwig6Instance.cc.
References i, getHLTprescales::index, VarParsing::mult, AlCaRecoCosmics_cfg::name, evf::evtn::offset(), gen::p, pos, lumiQueryAPI::q, and relativeConstraints::value.
Referenced by Herwig6Hadronizer::initialize(), gen::PomwigHadronizer::initializeForInternalPartons(), Herwig6Hadronizer::upEvnt(), and Herwig6Hadronizer::upInit().
{ typedef std::istringstream::traits_type traits; const char *p = line.c_str(), *q; p += std::strspn(p, " \t\r\n"); for(q = p; std::isalnum(*q); q++); std::string name(p, q - p); const ConfigParam *param; for(param = configParams; param->name; param++) if (name == param->name) break; if (!param->name) return false; p = q + std::strspn(q, " \t\r\n"); std::size_t pos = 0; std::size_t mult = 1; for(unsigned int i = 0; i < 3; i++) { if (!param->dim[i].size) break; if (*p++ != (i ? ',' : '(')) return false; p += std::strspn(p, " \t\r\n"); for(q = p; std::isdigit(*q); q++); std::istringstream ss(std::string(p, q - p)); std::size_t index; ss >> index; if (ss.bad() || ss.peek() != traits::eof()) return false; if (index < param->dim[i].offset) return false; index -= param->dim[i].offset; if (index >= param->dim[i].size) return false; p = q + std::strspn(q, " \t\r\n"); pos += mult * index; mult *= param->dim[i].size; } if (param->dim[0].size) { if (*p++ != ')') return false; p += std::strspn(p, " \t\r\n"); } if (*p++ != '=') return false; p += std::strspn(p, " \t\r\n"); for(q = p; *q && (std::isalnum(*q) || std::strchr(".-+", *q)); q++); std::istringstream ss(std::string(p, q - p)); p = q + std::strspn(q, " \t\r\n"); if (*p && *p != '!') return false; switch(param->type) { case kInt: { int value; ss >> value; if (ss.bad() || ss.peek() != traits::eof()) return false; ((int*)param->ptr)[pos] = value; break; } case kDouble: { double value; ss >> value; if (ss.bad() || ss.peek() != traits::eof()) return false; ((double*)param->ptr)[pos] = value; break; } case kLogical: { std::string value_; ss >> value_; if (ss.bad() || ss.peek() != traits::eof()) return false; for(std::string::iterator iter = value_.begin(); iter != value_.end(); ++iter) *iter = std::tolower(*iter); bool value; if (value_ == "yes" || value_ == "true" || value_ == "1") value = true; else if (value_ == "no" || value_ == "false" || value_ == "0") value = false; else return false; ((int*)param->ptr)[pos] = value; break; } } return true; }
bool Herwig6Instance::hwwarn | ( | const std::string & | fn, |
int | code | ||
) | [protected, virtual] |
Reimplemented in MCatNLOSource.
Definition at line 168 of file Herwig6Instance.cc.
{ return false; }
bool Herwig6Instance::timeout | ( | unsigned int | secs, |
void(*)() | fn | ||
) | [private] |
Definition at line 161 of file Herwig6Instance.cc.
Referenced by callWithTimeout().
{ fn(); return false; }
void gen::cms_hwwarn_ | ( | char | fn[6], |
int * | , | ||
int * | |||
) | [friend] |
double gen::hwrgen_ | ( | int * | ) | [friend] |
CLHEP::HepRandomEngine* gen::Herwig6Instance::randomEngine [private] |
Definition at line 50 of file Herwig6Instance.h.
void* gen::Herwig6Instance::timeoutPrivate [private] |
Definition at line 53 of file Herwig6Instance.h.