CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
gen::Herwig6Instance Class Reference

#include <Herwig6Instance.h>

Inheritance diagram for gen::Herwig6Instance:
gen::FortranInstance gen::PomwigHadronizer Herwig6Hadronizer MCatNLOSource

Public Member Functions

bool callWithTimeout (unsigned int secs, void(*fn)())
 
bool give (const std::string &line)
 
 Herwig6Instance (CLHEP::HepRandomEngine *randomEngine=0)
 
 Herwig6Instance (int dummy)
 
virtual ~Herwig6Instance ()
 
- Public Member Functions inherited from gen::FortranInstance
void call (void(&fn)())
 
template<typename T >
call (T(&fn)())
 
template<typename A >
void call (void(&fn)(A), A a)
 
template<typename T , typename A >
call (T(&fn)(A), A a)
 
template<typename A1 , typename A2 >
void call (void(&fn)(A1, A2), A1 a1, A2 a2)
 
template<typename T , typename A1 , typename A2 >
call (T(&fn)(A1, A2), A1 a1, A2 a2)
 
virtual void enter ()
 
 FortranInstance ()
 
virtual void leave ()
 
virtual void upEvnt ()
 
virtual void upInit ()
 
virtual bool upVeto ()
 
virtual ~FortranInstance ()
 

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 *)
 

Additional Inherited Members

- Static Public Member Functions inherited from gen::FortranInstance
template<typename T >
static T * getInstance ()
 

Detailed Description

Definition at line 16 of file Herwig6Instance.h.

Constructor & Destructor Documentation

Herwig6Instance::Herwig6Instance ( CLHEP::HepRandomEngine *  randomEngine = 0)

Definition at line 61 of file Herwig6Instance.cc.

61  :
64 {
65 }
CLHEP::HepRandomEngine & getEngineReference()
CLHEP::HepRandomEngine * randomEngine
Herwig6Instance::Herwig6Instance ( int  dummy)

Definition at line 67 of file Herwig6Instance.cc.

67  :
68  randomEngine(0),
70 {
71 }
CLHEP::HepRandomEngine * randomEngine
Herwig6Instance::~Herwig6Instance ( )
virtual

Definition at line 73 of file Herwig6Instance.cc.

74 {
75 }

Member Function Documentation

static void gen::Herwig6Instance::_timeout_sighandler ( int  signr)
staticprivate
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().

26  { InstanceWrapper wrapper(this); return timeout(secs, fn); }
bool timeout(unsigned int secs, void(*fn)())
static HepMC::HEPEVT_Wrapper wrapper
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().

176 {
177  typedef std::istringstream::traits_type traits;
178 
179  const char *p = line.c_str(), *q;
180  p += std::strspn(p, " \t\r\n");
181 
182  for(q = p; std::isalnum(*q); q++);
183  std::string name(p, q - p);
184 
185  const ConfigParam *param;
186  for(param = configParams; param->name; param++)
187  if (name == param->name)
188  break;
189  if (!param->name)
190  return false;
191 
192  p = q + std::strspn(q, " \t\r\n");
193 
194  std::size_t pos = 0;
195  std::size_t mult = 1;
196  for(unsigned int i = 0; i < 3; i++) {
197  if (!param->dim[i].size)
198  break;
199 
200  if (*p++ != (i ? ',' : '('))
201  return false;
202 
203  p += std::strspn(p, " \t\r\n");
204 
205  for(q = p; std::isdigit(*q); q++);
206  std::istringstream ss(std::string(p, q - p));
207  std::size_t index;
208  ss >> index;
209  if (ss.bad() || ss.peek() != traits::eof())
210  return false;
211 
212  if (index < param->dim[i].offset)
213  return false;
214  index -= param->dim[i].offset;
215  if (index >= param->dim[i].size)
216  return false;
217 
218  p = q + std::strspn(q, " \t\r\n");
219 
220  pos += mult * index;
221  mult *= param->dim[i].size;
222  }
223 
224  if (param->dim[0].size) {
225  if (*p++ != ')')
226  return false;
227  p += std::strspn(p, " \t\r\n");
228  }
229 
230  if (*p++ != '=')
231  return false;
232  p += std::strspn(p, " \t\r\n");
233 
234  for(q = p; *q && (std::isalnum(*q) || std::strchr(".-+", *q)); q++);
235  std::istringstream ss(std::string(p, q - p));
236 
237  p = q + std::strspn(q, " \t\r\n");
238  if (*p && *p != '!')
239  return false;
240 
241  switch(param->type) {
242  case kInt: {
243  int value;
244  ss >> value;
245  if (ss.bad() || ss.peek() != traits::eof())
246  return false;
247 
248  ((int*)param->ptr)[pos] = value;
249  break;
250  }
251  case kDouble: {
252  double value;
253  ss >> value;
254  if (ss.bad() || ss.peek() != traits::eof())
255  return false;
256 
257  ((double*)param->ptr)[pos] = value;
258  break;
259  }
260  case kLogical: {
261  std::string value_;
262  ss >> value_;
263  if (ss.bad() || ss.peek() != traits::eof())
264  return false;
265 
266  for(std::string::iterator iter = value_.begin();
267  iter != value_.end(); ++iter)
268  *iter = std::tolower(*iter);
269  bool value;
270  if (value_ == "yes" || value_ == "true" || value_ == "1")
271  value = true;
272  else if (value_ == "no" || value_ == "false" || value_ == "0")
273  value = false;
274  else
275  return false;
276 
277  ((int*)param->ptr)[pos] = value;
278  break;
279  }
280  }
281 
282  return true;
283 }
int i
Definition: DBlmapReader.cc:9
double p[5][pyjets_maxn]
unsigned int offset(bool)
bool Herwig6Instance::hwwarn ( const std::string &  fn,
int  code 
)
protectedvirtual

Reimplemented in MCatNLOSource.

Definition at line 168 of file Herwig6Instance.cc.

169 {
170  return false;
171 }
bool Herwig6Instance::timeout ( unsigned int  secs,
void(*)()  fn 
)
private

Definition at line 161 of file Herwig6Instance.cc.

Referenced by callWithTimeout().

162 {
163  fn();
164  return false;
165 }

Friends And Related Function Documentation

void gen::cms_hwwarn_ ( char  fn[6],
int *  ,
int *   
)
friend
double gen::hwrgen_ ( int *  )
friend

Member Data Documentation

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.