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 {
7  class HepRandomEngine;
8 }
9 
10 namespace gen {
11 
12 // the callbacks from Herwig which are passed on to the Herwig6Instance
13 extern "C" {
14  double hwrgen_(int*);
15  void cms_hwwarn_(char fn[6], int*, int*);
16 }
17 
19  public:
21  virtual ~Herwig6Instance();
22 
23  // passes a configuration parameter
24  bool give(const std::string &line);
25 
26  bool callWithTimeout(unsigned int secs, void (*fn)())
27  { InstanceWrapper wrapper(this); return timeout(secs, fn); }
28 
29  // method to open External Particle Spectra Files
31 
32  void setHerwigRandomEngine(CLHEP::HepRandomEngine* v) { randomEngine = v; }
33 
34  protected:
35  // intercept HERWIG warnings and errors (default: no)
36  virtual bool hwwarn(const std::string &fn, int code);
37 
38  private:
39  // list all the Fortran callbacks here
40  friend double gen::hwrgen_(int*);
41  friend void gen::cms_hwwarn_(char fn[6], int*, int*);
42 
43  // call with timeout
44  bool timeout(unsigned int secs, void (*fn)());
45 
46  // used from timeout
47  static void _timeout_sighandler(int signr);
48 
49  // the random engine
50  // in order to make sure no one else uses this engine
51  // the access is only possible if pyr_ is called after
52  // the current instance has been selected using enter()
53  // if Herwig is called without an active instance and does
54  // either a callback or requests a random number an
55  // an exception will be thrown
56  CLHEP::HepRandomEngine *randomEngine;
57 
58  // for timeout facility
60 };
61 
62 } // namespace gen
63 
64 #endif // gen_Herwig6Instance_h
bool timeout(unsigned int secs, void(*fn)())
static void _timeout_sighandler(int signr)
void openParticleSpecFile(const std::string fileName)
double v[5][pyjets_maxn]
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
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
void setHerwigRandomEngine(CLHEP::HepRandomEngine *v)
double hwrgen_(int *)
static HepMC::HEPEVT_Wrapper wrapper