CMS 3D CMS Logo

Herwig6Instance.h
Go to the documentation of this file.
1 #ifndef gen_Herwig6Instance_h
2 #define gen_Herwig6Instance_h
3 
5 #include <memory>
6 
7 namespace CLHEP {
8  class HepRandomEngine;
9 }
10 
11 namespace gen {
12 
13  // the callbacks from Herwig which are passed on to the Herwig6Instance
14  extern "C" {
15  double hwrgen_(int *);
16  void cms_hwwarn_(char fn[6], int *, int *);
17  }
18 
19  //Forward declare here to avoid system dependency
20  struct TimeoutHolder;
21 
23  public:
25  ~Herwig6Instance() override;
26 
27  // passes a configuration parameter
28  bool give(const std::string &line);
29 
30  bool callWithTimeout(unsigned int secs, void (*fn)()) {
32  return timeout(secs, fn);
33  }
34 
35  // method to open External Particle Spectra Files
37 
38  void setHerwigRandomEngine(CLHEP::HepRandomEngine *v) { randomEngine = v; }
39 
40  protected:
41  // intercept HERWIG warnings and errors (default: no)
42  virtual bool hwwarn(const std::string &fn, int code);
43 
44  private:
45  // list all the Fortran callbacks here
46  friend double gen::hwrgen_(int *);
47  friend void gen::cms_hwwarn_(char fn[6], int *, int *);
48 
49  // call with timeout
50  bool timeout(unsigned int secs, void (*fn)());
51 
52  // used from timeout
53  static void _timeout_sighandler(int signr);
54 
55  // the random engine
56  // in order to make sure no one else uses this engine
57  // the access is only possible if pyr_ is called after
58  // the current instance has been selected using enter()
59  // if Herwig is called without an active instance and does
60  // either a callback or requests a random number an
61  // an exception will be thrown
62  CLHEP::HepRandomEngine *randomEngine;
63 
64  // for timeout facility
65  std::unique_ptr<TimeoutHolder> timeoutPrivate;
66  };
67 
68 } // namespace gen
69 
70 #endif // gen_Herwig6Instance_h
gen::FortranInstance
Definition: FortranInstance.h:15
gen::Herwig6Instance::hwwarn
virtual bool hwwarn(const std::string &fn, int code)
Definition: Herwig6Instance.cc:169
gen::Herwig6Instance::randomEngine
CLHEP::HepRandomEngine * randomEngine
Definition: Herwig6Instance.h:62
gen::Herwig6Instance::setHerwigRandomEngine
void setHerwigRandomEngine(CLHEP::HepRandomEngine *v)
Definition: Herwig6Instance.h:38
gen::cms_hwwarn_
void cms_hwwarn_(char fn[6], int *, int *)
Definition: Herwig6Instance.cc:58
wrapper
static HepMC::HEPEVT_Wrapper wrapper
Definition: BeamHaloProducer.cc:47
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
gen::FortranInstance::InstanceWrapper
Definition: FortranInstance.h:54
gen::Herwig6Instance::_timeout_sighandler
static void _timeout_sighandler(int signr)
gen
Definition: PythiaDecays.h:13
FortranInstance.h
CLHEP
Definition: CocoaGlobals.h:27
gen::Herwig6Instance::timeout
bool timeout(unsigned int secs, void(*fn)())
Definition: Herwig6Instance.cc:163
gen::Herwig6Instance
Definition: Herwig6Instance.h:22
gen::v
double v[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:76
gen::Herwig6Instance::timeoutPrivate
std::unique_ptr< TimeoutHolder > timeoutPrivate
Definition: Herwig6Instance.h:65
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
gen::Herwig6Instance::callWithTimeout
bool callWithTimeout(unsigned int secs, void(*fn)())
Definition: Herwig6Instance.h:30
personalPlayback.fn
fn
Definition: personalPlayback.py:515
gen::Herwig6Instance::~Herwig6Instance
~Herwig6Instance() override
Definition: Herwig6Instance.cc:79
mps_splice.line
line
Definition: mps_splice.py:76
gen::Herwig6Instance::openParticleSpecFile
void openParticleSpecFile(const std::string fileName)
Definition: Herwig6Instance.cc:284
gen::hwrgen_
double hwrgen_(int *)
Definition: Herwig6Instance.cc:51
gen::Herwig6Instance::give
bool give(const std::string &line)
Definition: Herwig6Instance.cc:173
gen::Herwig6Instance::Herwig6Instance
Herwig6Instance()
Definition: Herwig6Instance.cc:77