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 ()
 
void openParticleSpecFile (const std::string fileName)
 
void setHerwigRandomEngine (CLHEP::HepRandomEngine *v)
 
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 ()
 
- Static Public Attributes inherited from gen::FortranInstance
static const std::string kFortranInstance = "FortranInstance"
 

Detailed Description

Definition at line 18 of file Herwig6Instance.h.

Constructor & Destructor Documentation

Herwig6Instance::Herwig6Instance ( )

Definition at line 80 of file Herwig6Instance.cc.

80  :
81  randomEngine(nullptr),
83 {
84 }
CLHEP::HepRandomEngine * randomEngine
Herwig6Instance::~Herwig6Instance ( )
virtual

Definition at line 86 of file Herwig6Instance.cc.

87 {
88 }

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

References personalPlayback::fn, timeout(), and wrapper.

Referenced by gen::PomwigHadronizer::generatePartonsAndHadronize(), and Herwig6Hadronizer::hadronize().

27  { 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 193 of file Herwig6Instance.cc.

References i, cmsHarvester::index, getDQMSummary::iter, VarParsing::mult, mergeVDriftHistosByStation::name, hltrates_dqm_sourceclient-live_cfg::offset, gen::p, lumiQueryAPI::q, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

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

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

Reimplemented in MCatNLOSource.

Definition at line 186 of file Herwig6Instance.cc.

187 {
188  return false;
189 }
void Herwig6Instance::openParticleSpecFile ( const std::string  fileName)

Definition at line 303 of file Herwig6Instance.cc.

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

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

303  {
304 
305  edm::FileInPath fileAndPath( fileName );
306  // WARING : This will call HWWARN if file does not exist.
307  lunread_( fileAndPath.fullPath().c_str(),strlen(fileAndPath.fullPath().c_str()) );
308 
309  return;
310 }
void lunread_(const char filename[], const int length)
void gen::Herwig6Instance::setHerwigRandomEngine ( CLHEP::HepRandomEngine *  v)
inline

Definition at line 32 of file Herwig6Instance.h.

References randomEngine, and gen::v.

Referenced by gen::PomwigHadronizer::doSetRandomEngine(), and Herwig6Hadronizer::doSetRandomEngine().

32 { randomEngine = v; }
double v[5][pyjets_maxn]
CLHEP::HepRandomEngine * randomEngine
bool Herwig6Instance::timeout ( unsigned int  secs,
void(*)()  fn 
)
private

Definition at line 179 of file Herwig6Instance.cc.

References personalPlayback::fn.

Referenced by callWithTimeout().

180 {
181  fn();
182  return false;
183 }

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

Referenced by gen::hwrgen_(), and setHerwigRandomEngine().

void* gen::Herwig6Instance::timeoutPrivate
private

Definition at line 59 of file Herwig6Instance.h.