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)
 
void openParticleSpecFile (const std::string fileName)
 
virtual ~Herwig6Instance ()
 
- Public Member Functions inherited from gen::FortranInstance
void call (void(&fn)())
 
template<typename T >
T call (T(&fn)())
 
template<typename A >
void call (void(&fn)(A), A a)
 
template<typename T , typename A >
T 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 >
T 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 TgetInstance ()
 

Detailed Description

Definition at line 16 of file Herwig6Instance.h.

Constructor & Destructor Documentation

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

Definition at line 76 of file Herwig6Instance.cc.

76  :
79 {
80 }
CLHEP::HepRandomEngine & getEngineReference()
CLHEP::HepRandomEngine * randomEngine
Herwig6Instance::Herwig6Instance ( int  dummy)

Definition at line 82 of file Herwig6Instance.cc.

82  :
83  randomEngine(0),
85 {
86 }
CLHEP::HepRandomEngine * randomEngine
Herwig6Instance::~Herwig6Instance ( )
virtual

Definition at line 88 of file Herwig6Instance.cc.

89 {
90 }

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 190 of file Herwig6Instance.cc.

References i, getHLTprescales::index, VarParsing::mult, mergeVDriftHistosByStation::name, evf::evtn::offset(), gen::p, pos, lumiQueryAPI::q, and relativeConstraints::value.

Referenced by Herwig6Hadronizer::initialize(), gen::PomwigHadronizer::readSettings(), Herwig6Hadronizer::readSettings(), Herwig6Hadronizer::upEvnt(), and Herwig6Hadronizer::upInit().

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

184 {
185  return false;
186 }
void Herwig6Instance::openParticleSpecFile ( const std::string  fileName)

Definition at line 300 of file Herwig6Instance.cc.

References edm::FileInPath::fullPath(), and lunread_().

Referenced by Herwig6Hadronizer::initialize(), and Herwig6Hadronizer::readSettings().

300  {
301 
302  edm::FileInPath fileAndPath( fileName );
303  // WARING : This will call HWWARN if file does not exist.
304  lunread_( fileAndPath.fullPath().c_str(),strlen(fileAndPath.fullPath().c_str()) );
305 
306  return;
307 }
void lunread_(const char filename[], const int length)
bool Herwig6Instance::timeout ( unsigned int  secs,
void(*)()  fn 
)
private

Definition at line 176 of file Herwig6Instance.cc.

Referenced by callWithTimeout().

177 {
178  fn();
179  return false;
180 }

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 53 of file Herwig6Instance.h.

void* gen::Herwig6Instance::timeoutPrivate
private

Definition at line 56 of file Herwig6Instance.h.