ATLAS Offline Software
Loading...
Searching...
No Matches
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
10
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
24class Herwig7API : public Herwig::HerwigUI {
25
26public:
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
39 Herwig::RunMode::Mode runMode() const { return(m_runMode); }
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 void repository(const std::string& repository) { m_repository = repository; }
51
53 virtual std::string inputfile() const { return(m_inputfile); }
54 void inputfile(const std::string& inputfile) { m_inputfile = inputfile; }
55
57 virtual std::string setupfile() const { return(m_setupfile); }
58
60 virtual std::string tag() const { return(m_tag); }
61
63 virtual std::string integrationList() const { return(m_integrationList); }
64
65
67 virtual const std::vector<std::string> & prependReadDirectories() const { return(m_prependReadDirectories); }
69
71 virtual const std::vector<std::string> & appendReadDirectories() const { return(m_appendReadDirectories); }
72
73
74 virtual long N() const { return 0; }
75
76 virtual int seed() const { return(m_seed); }
77 void seed(int seed) { m_seed = seed; }
78
79 virtual int jobs() const { return(m_jobs); }
80 virtual unsigned int jobSize() const { return(m_jobsize); }
81 virtual unsigned int maxJobs() const { return(m_maxjobs); }
82
84 virtual void quitWithHelp() const {
85 std::cerr << "=================================\n";
86 std::cerr << "HERE I CAN PUT SOME ERROR MESSAGE\n";
87 std::cerr << "=================================\n";
88 quit();
89 }
90
92 virtual void quit() const {
93 ThePEG::Repository::cleanup();
94 std::abort();
95 }
96
98 virtual std::ostream& outStream() const { return(std::cout); }
99
101 virtual std::ostream& errStream() const { return(std::cerr); }
102
104 virtual std::istream& inStream() const { return(std::cin); }
105
106
107private:
108
109 Herwig::RunMode::Mode m_runMode{};
110
111 std::string m_repository;
112 std::string m_inputfile;
113 std::string m_setupfile;
114 std::string m_tag;
115
116 std::string m_integrationList;
117
118 std::vector<std::string> m_prependReadDirectories;
119 std::vector<std::string> m_appendReadDirectories;
120
121 int m_seed{};
122 int m_jobs{};
123 unsigned int m_jobsize{};
124 unsigned int m_maxjobs{};
125
126};
127
128
129
131class Herwig7 : public GenModule {
132
133public:
134
136 Herwig7(const std::string& name, ISvcLocator* pSvcLocator);
137
139 StatusCode genInitialize();
140
142 StatusCode callGenerator();
143
145 StatusCode fillEvt(HepMC::GenEvent* evt);
146
148 StatusCode genFinalize();
149
151 StatusCode writeRunFileFromText(const std::string& share_path);
152
153
154private:
155
158
160 ThePEG::EGPtr m_gen;
161
163 ThePEG::EventPtr m_event;
164
165
167
168
170 std::string m_runname;
171
173 std::string m_runfile;
174
177 std::string m_runSettings;
178
180 std::string m_repository;
181
183 std::string m_setupfile;
184
185
188
191
193 std::string m_pdfname_me;
194
196 // std::string m_pdfname_ps;
197
199 std::string m_pdfname_mpi;
200
203
205 double m_xsscale;
206
209
211 , "EventInfo"
212 , "TMPEvtInfo"
213 , "ReadHandleKey for xAOD::EventInfo"};
214
216
217};
218
219#endif
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenModule.cxx:14
Interface to the Herwig7 API.
Definition Herwig7.h:24
Herwig::RunMode::Mode runMode() const
Requested Herwig run mode.
Definition Herwig7.h:39
Herwig::RunMode::Mode m_runMode
Definition Herwig7.h:109
std::string m_tag
Definition Herwig7.h:114
virtual bool resume() const
Try to resume execution from an earlier interrupted run.
Definition Herwig7.h:42
std::string m_setupfile
Definition Herwig7.h:113
std::vector< std::string > m_prependReadDirectories
Definition Herwig7.h:118
virtual int seed() const
The number of events to generate.
Definition Herwig7.h:76
virtual unsigned int maxJobs() const
The number of subprocesses to integrate per integratoin job.
Definition Herwig7.h:81
int m_jobs
Definition Herwig7.h:122
virtual std::string repository() const
Repository name to operate on.
Definition Herwig7.h:49
virtual int jobs() const
Definition Herwig7.h:79
unsigned int m_jobsize
Definition Herwig7.h:123
std::vector< std::string > m_appendReadDirectories
Definition Herwig7.h:119
std::string m_integrationList
Definition Herwig7.h:116
virtual void quitWithHelp() const
The maximum number of integration jobs.
Definition Herwig7.h:84
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:71
virtual std::string setupfile() const
Name of the setup file to be read, to modify the repository.
Definition Herwig7.h:57
std::string m_inputfile
Definition Herwig7.h:112
virtual void quit() const
Bail out and be quiet.
Definition Herwig7.h:92
std::string m_repository
Definition Herwig7.h:111
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:67
virtual std::ostream & outStream() const
Return the standard out stream to be used.
Definition Herwig7.h:98
void repository(const std::string &repository)
Definition Herwig7.h:50
void inputfile(const std::string &inputfile)
Definition Herwig7.h:54
unsigned int m_maxjobs
Definition Herwig7.h:124
virtual std::string integrationList() const
An identifier for the integration job to be handled.
Definition Herwig7.h:63
virtual long N() const
Definition Herwig7.h:74
virtual std::string tag() const
A user-defined tag to append to the run name.
Definition Herwig7.h:60
~Herwig7API()
Destructor.
Definition Herwig7.h:35
virtual std::string inputfile() const
Name of the file to be read.
Definition Herwig7.h:53
virtual std::ostream & errStream() const
Return the standard err stream to be used.
Definition Herwig7.h:101
int m_seed
Definition Herwig7.h:121
virtual std::istream & inStream() const
Return the standard in stream to be used.
Definition Herwig7.h:104
virtual bool tics() const
Require verbose progress markers.
Definition Herwig7.h:45
void seed(int seed)
The seed to use.
Definition Herwig7.h:77
void prependReadDirectory(const std::string &prependReadDirectory)
Definition Herwig7.h:68
virtual unsigned int jobSize() const
The number of jobs to fork.
Definition Herwig7.h:80
Herwig7API()
Constructor.
Definition Herwig7.h:29
std::string m_pdfname_mpi
PS PDF name, stored for AMI capture at finalize.
Definition Herwig7.h:199
StatusCode callGenerator()
Run the generator for one event.
Definition Herwig7.cxx:202
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition Herwig7.h:210
StatusCode genFinalize()
Close down the generator.
Definition Herwig7.cxx:280
ThePEG::EventPtr m_event
ThePEG event object.
Definition Herwig7.h:163
std::string m_repository
Herwig/ThePEG repository used to materialise CA run settings.
Definition Herwig7.h:180
int m_seed_from_generatetf
Random number seed from Generate_tf.py.
Definition Herwig7.h:190
StatusCode writeRunFileFromText(const std::string &share_path)
Write the CA input text into a real Herwig runfile.
Definition Herwig7.cxx:159
std::string m_pdfname_me
ME PDF name, stored for AMI capture at finalize.
Definition Herwig7.h:193
bool m_cleanup_herwig_scratch
Possibly remove Herwig-scratch folder after finishing the event generation.
Definition Herwig7.h:202
Herwig7(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition Herwig7.cxx:41
double m_xsscale
Scale integrated cross section by a factor for MetaData output.
Definition Herwig7.h:205
std::string m_runSettings
In-memory run settings provided by CA fragments.
Definition Herwig7.h:177
StatusCode fillEvt(HepMC::GenEvent *evt)
Convert the generated event into the HepMC format.
Definition Herwig7.cxx:217
int m_dsid
Gen_tf.py run args needed in interface.
Definition Herwig7.h:208
ThePEG::EGPtr m_gen
ThePEG generator object.
Definition Herwig7.h:160
std::string m_runfile
Name of run file.
Definition Herwig7.h:173
StatusCode genInitialize()
Initialize the generator.
Definition Herwig7.cxx:71
Herwig7API m_api
Herwig7 API object.
Definition Herwig7.h:157
std::string m_setupfile
Name of setup file.
Definition Herwig7.h:183
std::string m_runname
Run name, used in the Herwig/ThePEG config system.
Definition Herwig7.h:170
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:187
Property holding a SG store/key/clid from which a ReadHandle is made.
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39