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

82  :
85 {
86 }
CLHEP::HepRandomEngine & getEngineReference()
CLHEP::HepRandomEngine * randomEngine
Herwig6Instance::Herwig6Instance ( int  dummy)

Definition at line 88 of file Herwig6Instance.cc.

88  :
89  randomEngine(0),
91 {
92 }
CLHEP::HepRandomEngine * randomEngine
Herwig6Instance::~Herwig6Instance ( )
virtual

Definition at line 94 of file Herwig6Instance.cc.

95 {
96 }

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

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

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

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

195 {
196  return false;
197 }
void Herwig6Instance::openParticleSpecFile ( const std::string  fileName)

Definition at line 311 of file Herwig6Instance.cc.

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

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

311  {
312 
313  edm::FileInPath fileAndPath( fileName );
314  // WARING : This will call HWWARN if file does not exist.
315  lunread_( fileAndPath.fullPath().c_str(),strlen(fileAndPath.fullPath().c_str()) );
316 
317  return;
318 }
void lunread_(const char filename[], const int length)
bool Herwig6Instance::timeout ( unsigned int  secs,
void(*)()  fn 
)
private

Definition at line 187 of file Herwig6Instance.cc.

Referenced by callWithTimeout().

188 {
189  fn();
190  return false;
191 }

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.

Referenced by gen::hwrgen_().

void* gen::Herwig6Instance::timeoutPrivate
private

Definition at line 56 of file Herwig6Instance.h.