CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Herwig6Instance.h
Go to the documentation of this file.
1 #ifndef gen_Herwig6Instance_h
2 #define gen_Herwig6Instance_h
3 
5 
6 namespace CLHEP { class HepRandomEngine; } // forward declaration
7 
8 namespace gen {
9 
10 // the callbacks from Herwig which are passed on to the Herwig6Instance
11 extern "C" {
12  double hwrgen_(int*);
13  void cms_hwwarn_(char fn[6], int*, int*);
14 }
15 
17  public:
18  Herwig6Instance(CLHEP::HepRandomEngine *randomEngine = 0);
19  Herwig6Instance(int dummy);
20  virtual ~Herwig6Instance();
21 
22  // passes a configuration parameter
23  bool give(const std::string &line);
24 
25  bool callWithTimeout(unsigned int secs, void (*fn)())
26  { InstanceWrapper wrapper(this); return timeout(secs, fn); }
27 
28  // method to open External Particle Spectra Files
30 
31  protected:
32  // intercept HERWIG warnings and errors (default: no)
33  virtual bool hwwarn(const std::string &fn, int code);
34 
35  private:
36  // list all the Fortran callbacks here
37  friend double gen::hwrgen_(int*);
38  friend void gen::cms_hwwarn_(char fn[6], int*, int*);
39 
40  // call with timeout
41  bool timeout(unsigned int secs, void (*fn)());
42 
43  // used from timeout
44  static void _timeout_sighandler(int signr);
45 
46  // the random engine
47  // in order to make sure no one else uses this engine
48  // the access is only possible if pyr_ is called after
49  // the current instance has been selected using enter()
50  // if Herwig is called without an active instance and does
51  // either a callback or requests a random number an
52  // an exception will be thrown
53  CLHEP::HepRandomEngine *randomEngine;
54 
55  // for timeout facility
57 };
58 
59 } // namespace gen
60 
61 #endif // gen_Herwig6Instance_h
Herwig6Instance(CLHEP::HepRandomEngine *randomEngine=0)
bool timeout(unsigned int secs, void(*fn)())
static void _timeout_sighandler(int signr)
void openParticleSpecFile(const std::string fileName)
bool callWithTimeout(unsigned int secs, void(*fn)())
bool give(const std::string &line)
void cms_hwwarn_(char fn[6], int *, int *)
virtual bool hwwarn(const std::string &fn, int code)
CLHEP::HepRandomEngine * randomEngine
double hwrgen_(int *)
static HepMC::HEPEVT_Wrapper wrapper