ATLAS Offline Software
Herwig7.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 // -*- C++ -*-
5 
11 #ifndef GENERATORMODULES_HERWIG7_H
12 #define GENERATORMODULES_HERWIG7_H
13 
15 
16 #include "ThePEG/Repository/Repository.h"
17 #include "ThePEG/Repository/EventGenerator.h"
18 #include "ThePEG/EventRecord/Event.h"
19 #include "Herwig/API/HerwigUI.h"
20 
22 
24 class Herwig7API : public Herwig::HerwigUI {
25 
26 public:
27 
30  // ATH_MSG_DEBUG("HERWIG7_PATH is "+getenv("HERWIG7_PATH"));
31  // ThePEG::Repository::load(getenv("HERWIG7_PATH")+"/share/Herwig/HerwigDefaults.rpo");
32  // };
33 
36 
37 
40 
42  virtual bool resume() const { return false; }
43 
45  virtual bool tics() const { return false; }
46 
47 
49  virtual std::string repository() const { return(m_repository); }
50 
52  virtual std::string inputfile() const { return(m_inputfile); }
53  void inputfile(const std::string& inputfile) { m_inputfile = inputfile; }
54 
56  virtual std::string setupfile() const { return(m_setupfile); }
57 
59  virtual std::string tag() const { return(m_tag); }
60 
62  virtual std::string integrationList() const { return(m_integrationList); }
63 
64 
66  virtual const std::vector<std::string> & prependReadDirectories() const { return(m_prependReadDirectories); }
67 
69  virtual const std::vector<std::string> & appendReadDirectories() const { return(m_appendReadDirectories); }
70 
71 
72  virtual long N() const { return 0; }
73 
74  virtual int seed() const { return(m_seed); }
75  void seed(int seed) { m_seed = seed; }
76 
77  virtual int jobs() const { return(m_jobs); }
78  virtual unsigned int jobSize() const { return(m_jobsize); }
79  virtual unsigned int maxJobs() const { return(m_maxjobs); }
80 
82  virtual void quitWithHelp() const {
83  std::cerr << "=================================\n";
84  std::cerr << "HERE I CAN PUT SOME ERROR MESSAGE\n";
85  std::cerr << "=================================\n";
86  quit();
87  }
88 
90  virtual void quit() const {
91  ThePEG::Repository::cleanup();
92  std::abort();
93  }
94 
96  virtual std::ostream& outStream() const { return(std::cout); }
97 
99  virtual std::ostream& errStream() const { return(std::cerr); }
100 
102  virtual std::istream& inStream() const { return(std::cin); }
103 
104 
105 private:
106 
108 
109  std::string m_repository;
110  std::string m_inputfile;
111  std::string m_setupfile;
112  std::string m_tag;
113 
114  std::string m_integrationList;
115 
116  std::vector<std::string> m_prependReadDirectories;
117  std::vector<std::string> m_appendReadDirectories;
118 
119  int m_seed{};
120  int m_jobs{};
121  unsigned int m_jobsize{};
122  unsigned int m_maxjobs{};
123 
124 };
125 
126 
127 
129 class Herwig7 : public GenModule {
130 
131 public:
132 
134  Herwig7(const std::string& name, ISvcLocator* pSvcLocator);
135 
138 
141 
143  StatusCode fillEvt(HepMC::GenEvent* evt);
144 
147 
148 
149 private:
150 
153 
155  ThePEG::EGPtr m_gen;
156 
158  ThePEG::EventPtr m_event;
159 
160 
162 
163 
165  std::string m_runname;
166 
168  std::string m_runfile;
169 
171  std::string m_setupfile;
172 
173 
176 
179 
181  std::string m_pdfname_me;
182 
184  // std::string m_pdfname_ps;
185 
187  std::string m_pdfname_mpi;
188 
191 
193  double m_xsscale;
194 
196  int m_dsid;
197 
199  , "EventInfo"
200  , "TMPEvtInfo"
201  , "ReadHandleKey for xAOD::EventInfo"};
202 
204 
205 };
206 
207 #endif
Herwig7API::m_inputfile
std::string m_inputfile
Definition: Herwig7.h:110
Herwig7API::m_jobsize
unsigned int m_jobsize
Definition: Herwig7.h:121
Herwig7API::prependReadDirectories
virtual const std::vector< std::string > & prependReadDirectories() const
Directories from which Herwig reads input files, will be prepended to the search path.
Definition: Herwig7.h:66
Herwig7API::inputfile
virtual std::string inputfile() const
Name of the file to be read.
Definition: Herwig7.h:52
Herwig7::m_pdfname_mpi
std::string m_pdfname_mpi
PS PDF name, stored for AMI capture at finalize.
Definition: Herwig7.h:187
Herwig7::m_xsscale
double m_xsscale
Scale integrated cross section by a factor for MetaData output.
Definition: Herwig7.h:193
Herwig7::m_pdfname_me
std::string m_pdfname_me
ME PDF name, stored for AMI capture at finalize.
Definition: Herwig7.h:181
Herwig7API::seed
void seed(int seed)
The seed to use.
Definition: Herwig7.h:75
Herwig7API::Herwig7API
Herwig7API()
Constructor.
Definition: Herwig7.h:29
Herwig7API::tag
virtual std::string tag() const
A user-defined tag to append to the run name.
Definition: Herwig7.h:59
Herwig7API::resume
virtual bool resume() const
Try to resume execution from an earlier interrupted run.
Definition: Herwig7.h:42
Herwig7API::inStream
virtual std::istream & inStream() const
Return the standard in stream to be used.
Definition: Herwig7.h:102
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
Herwig7API::m_seed
int m_seed
Definition: Herwig7.h:119
Herwig7API::appendReadDirectories
virtual const std::vector< std::string > & appendReadDirectories() const
Directories from which Herwig reads input files, will be appended to the search path.
Definition: Herwig7.h:69
SG::ReadHandleKey< xAOD::EventInfo >
Herwig7API::quit
virtual void quit() const
Bail out and be quiet.
Definition: Herwig7.h:90
Herwig7::genFinalize
StatusCode genFinalize()
Close down the generator.
Definition: Herwig7.cxx:231
Herwig7::m_seed_from_generatetf
int m_seed_from_generatetf
Random number seed from Generate_tf.py.
Definition: Herwig7.h:178
Herwig7::genInitialize
StatusCode genInitialize()
Initialize the generator.
Definition: Herwig7.cxx:66
Herwig7API::m_jobs
int m_jobs
Definition: Herwig7.h:120
Herwig7::m_runname
std::string m_runname
Run name, used in the Herwig/ThePEG config system.
Definition: Herwig7.h:165
Herwig7::m_event
ThePEG::EventPtr m_event
ThePEG event object.
Definition: Herwig7.h:158
Herwig7::m_evtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition: Herwig7.h:198
Herwig7::m_dsid
int m_dsid
Gen_tf.py run args needed in interface.
Definition: Herwig7.h:196
GenModule
Base class for common behaviour of generator interfaces.
Definition: GenModule.h:39
Herwig7API::m_repository
std::string m_repository
Definition: Herwig7.h:109
Herwig7API::m_runMode
Herwig::RunMode::Mode m_runMode
Definition: Herwig7.h:107
Herwig7
Interface to athena.
Definition: Herwig7.h:129
Herwig7API::m_appendReadDirectories
std::vector< std::string > m_appendReadDirectories
Definition: Herwig7.h:117
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Herwig7API::jobSize
virtual unsigned int jobSize() const
The number of jobs to fork.
Definition: Herwig7.h:78
Herwig7API
Interface to the Herwig7 API.
Definition: Herwig7.h:24
Herwig7API::integrationList
virtual std::string integrationList() const
An identifier for the integration job to be handled.
Definition: Herwig7.h:62
Herwig7API::m_maxjobs
unsigned int m_maxjobs
Definition: Herwig7.h:122
Herwig7API::quitWithHelp
virtual void quitWithHelp() const
The maximum number of integration jobs.
Definition: Herwig7.h:82
Herwig7API::maxJobs
virtual unsigned int maxJobs() const
The number of subprocesses to integrate per integratoin job.
Definition: Herwig7.h:79
Herwig7::m_api
Herwig7API m_api
Herwig7 API object.
Definition: Herwig7.h:152
Herwig7API::setupfile
virtual std::string setupfile() const
Name of the setup file to be read, to modify the repository.
Definition: Herwig7.h:56
Herwig7::Herwig7
Herwig7(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: Herwig7.cxx:38
Herwig7API::m_integrationList
std::string m_integrationList
Definition: Herwig7.h:114
Herwig7API::inputfile
void inputfile(const std::string &inputfile)
Definition: Herwig7.h:53
Herwig7API::outStream
virtual std::ostream & outStream() const
Return the standard out stream to be used.
Definition: Herwig7.h:96
Herwig7API::runMode
Herwig::RunMode::Mode runMode() const
Requested Herwig run mode.
Definition: Herwig7.h:39
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Herwig7API::tics
virtual bool tics() const
Require verbose progress markers.
Definition: Herwig7.h:45
EventContainers::Mode
Mode
Definition: IdentifiableContainerBase.h:13
Herwig7API::jobs
virtual int jobs() const
Definition: Herwig7.h:77
Herwig7::m_gen
ThePEG::EGPtr m_gen
ThePEG generator object.
Definition: Herwig7.h:155
EventInfo.h
Herwig7API::~Herwig7API
~Herwig7API()
Destructor.
Definition: Herwig7.h:35
Herwig7API::repository
virtual std::string repository() const
Repository name to operate on.
Definition: Herwig7.h:49
Herwig7API::m_prependReadDirectories
std::vector< std::string > m_prependReadDirectories
Definition: Herwig7.h:116
Herwig7::m_runfile
std::string m_runfile
Name of run file.
Definition: Herwig7.h:168
Herwig7::callGenerator
StatusCode callGenerator()
Run the generator for one event.
Definition: Herwig7.cxx:142
Herwig7::fillEvt
StatusCode fillEvt(HepMC::GenEvent *evt)
Convert the generated event into the HepMC format.
Definition: Herwig7.cxx:157
GenModule.h
Herwig7::m_use_seed_from_generatetf
bool m_use_seed_from_generatetf
Ignore random number seed provided by athena and use the one from Generate_tf.py instead.
Definition: Herwig7.h:175
Herwig7API::errStream
virtual std::ostream & errStream() const
Return the standard err stream to be used.
Definition: Herwig7.h:99
Herwig7API::seed
virtual int seed() const
The number of events to generate.
Definition: Herwig7.h:74
Herwig7API::N
virtual long N() const
Definition: Herwig7.h:72
Herwig7API::m_setupfile
std::string m_setupfile
Definition: Herwig7.h:111
Herwig7::m_setupfile
std::string m_setupfile
Name of setup file.
Definition: Herwig7.h:171
Herwig7::m_cleanup_herwig_scratch
bool m_cleanup_herwig_scratch
Possibly remove Herwig-scratch folder after finishing the event generation.
Definition: Herwig7.h:190
Herwig7API::m_tag
std::string m_tag
Definition: Herwig7.h:112