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
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); }
68
70 virtual const std::vector<std::string> & appendReadDirectories() const { return(m_appendReadDirectories); }
71
72
73 virtual long N() const { return 0; }
74
75 virtual int seed() const { return(m_seed); }
76 void seed(int seed) { m_seed = seed; }
77
78 virtual int jobs() const { return(m_jobs); }
79 virtual unsigned int jobSize() const { return(m_jobsize); }
80 virtual unsigned int maxJobs() const { return(m_maxjobs); }
81
83 virtual void quitWithHelp() const {
84 std::cerr << "=================================\n";
85 std::cerr << "HERE I CAN PUT SOME ERROR MESSAGE\n";
86 std::cerr << "=================================\n";
87 quit();
88 }
89
91 virtual void quit() const {
92 ThePEG::Repository::cleanup();
93 std::abort();
94 }
95
97 virtual std::ostream& outStream() const { return(std::cout); }
98
100 virtual std::ostream& errStream() const { return(std::cerr); }
101
103 virtual std::istream& inStream() const { return(std::cin); }
104
105
106private:
107
108 Herwig::RunMode::Mode m_runMode{};
109
110 std::string m_repository;
111 std::string m_inputfile;
112 std::string m_setupfile;
113 std::string m_tag;
114
115 std::string m_integrationList;
116
117 std::vector<std::string> m_prependReadDirectories;
118 std::vector<std::string> m_appendReadDirectories;
119
120 int m_seed{};
121 int m_jobs{};
122 unsigned int m_jobsize{};
123 unsigned int m_maxjobs{};
124
125};
126
127
128
130class Herwig7 : public GenModule {
131
132public:
133
135 Herwig7(const std::string& name, ISvcLocator* pSvcLocator);
136
138 StatusCode genInitialize();
139
141 StatusCode callGenerator();
142
144 StatusCode fillEvt(HepMC::GenEvent* evt);
145
147 StatusCode genFinalize();
148
150 StatusCode writeRunFileFromText(const std::string& share_path);
151
152
153private:
154
157
159 ThePEG::EGPtr m_gen;
160
162 ThePEG::EventPtr m_event;
163
164
166
167
169 std::string m_runname;
170
172 std::string m_runfile;
173
176 std::string m_runSettings;
177
179 std::string m_setupfile;
180
181
184
187
189 std::string m_pdfname_me;
190
192 // std::string m_pdfname_ps;
193
195 std::string m_pdfname_mpi;
196
199
201 double m_xsscale;
202
205
207 , "EventInfo"
208 , "TMPEvtInfo"
209 , "ReadHandleKey for xAOD::EventInfo"};
210
212
213};
214
215#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:108
std::string m_tag
Definition Herwig7.h:113
virtual bool resume() const
Try to resume execution from an earlier interrupted run.
Definition Herwig7.h:42
std::string m_setupfile
Definition Herwig7.h:112
std::vector< std::string > m_prependReadDirectories
Definition Herwig7.h:117
virtual int seed() const
The number of events to generate.
Definition Herwig7.h:75
virtual unsigned int maxJobs() const
The number of subprocesses to integrate per integratoin job.
Definition Herwig7.h:80
int m_jobs
Definition Herwig7.h:121
virtual std::string repository() const
Repository name to operate on.
Definition Herwig7.h:49
virtual int jobs() const
Definition Herwig7.h:78
unsigned int m_jobsize
Definition Herwig7.h:122
std::vector< std::string > m_appendReadDirectories
Definition Herwig7.h:118
std::string m_integrationList
Definition Herwig7.h:115
virtual void quitWithHelp() const
The maximum number of integration jobs.
Definition Herwig7.h:83
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:70
virtual std::string setupfile() const
Name of the setup file to be read, to modify the repository.
Definition Herwig7.h:56
std::string m_inputfile
Definition Herwig7.h:111
virtual void quit() const
Bail out and be quiet.
Definition Herwig7.h:91
std::string m_repository
Definition Herwig7.h:110
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
virtual std::ostream & outStream() const
Return the standard out stream to be used.
Definition Herwig7.h:97
void inputfile(const std::string &inputfile)
Definition Herwig7.h:53
unsigned int m_maxjobs
Definition Herwig7.h:123
virtual std::string integrationList() const
An identifier for the integration job to be handled.
Definition Herwig7.h:62
virtual long N() const
Definition Herwig7.h:73
virtual std::string tag() const
A user-defined tag to append to the run name.
Definition Herwig7.h:59
~Herwig7API()
Destructor.
Definition Herwig7.h:35
virtual std::string inputfile() const
Name of the file to be read.
Definition Herwig7.h:52
virtual std::ostream & errStream() const
Return the standard err stream to be used.
Definition Herwig7.h:100
int m_seed
Definition Herwig7.h:120
virtual std::istream & inStream() const
Return the standard in stream to be used.
Definition Herwig7.h:103
virtual bool tics() const
Require verbose progress markers.
Definition Herwig7.h:45
void seed(int seed)
The seed to use.
Definition Herwig7.h:76
void prependReadDirectory(const std::string &prependReadDirectory)
Definition Herwig7.h:67
virtual unsigned int jobSize() const
The number of jobs to fork.
Definition Herwig7.h:79
Herwig7API()
Constructor.
Definition Herwig7.h:29
std::string m_pdfname_mpi
PS PDF name, stored for AMI capture at finalize.
Definition Herwig7.h:195
StatusCode callGenerator()
Run the generator for one event.
Definition Herwig7.cxx:197
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition Herwig7.h:206
StatusCode genFinalize()
Close down the generator.
Definition Herwig7.cxx:275
ThePEG::EventPtr m_event
ThePEG event object.
Definition Herwig7.h:162
int m_seed_from_generatetf
Random number seed from Generate_tf.py.
Definition Herwig7.h:186
StatusCode writeRunFileFromText(const std::string &share_path)
Write the CA input text into a real Herwig runfile.
Definition Herwig7.cxx:155
std::string m_pdfname_me
ME PDF name, stored for AMI capture at finalize.
Definition Herwig7.h:189
bool m_cleanup_herwig_scratch
Possibly remove Herwig-scratch folder after finishing the event generation.
Definition Herwig7.h:198
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:201
std::string m_runSettings
In-memory run settings provided by CA fragments.
Definition Herwig7.h:176
StatusCode fillEvt(HepMC::GenEvent *evt)
Convert the generated event into the HepMC format.
Definition Herwig7.cxx:212
int m_dsid
Gen_tf.py run args needed in interface.
Definition Herwig7.h:204
ThePEG::EGPtr m_gen
ThePEG generator object.
Definition Herwig7.h:159
std::string m_runfile
Name of run file.
Definition Herwig7.h:172
StatusCode genInitialize()
Initialize the generator.
Definition Herwig7.cxx:70
Herwig7API m_api
Herwig7 API object.
Definition Herwig7.h:156
std::string m_setupfile
Name of setup file.
Definition Herwig7.h:179
std::string m_runname
Run name, used in the Herwig/ThePEG config system.
Definition Herwig7.h:169
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:183
Property holding a SG store/key/clid from which a ReadHandle is made.
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39