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); }
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
105private:
106
107 Herwig::RunMode::Mode m_runMode{};
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
129class Herwig7 : public GenModule {
130
131public:
132
134 Herwig7(const std::string& name, ISvcLocator* pSvcLocator);
135
137 StatusCode genInitialize();
138
140 StatusCode callGenerator();
141
143 StatusCode fillEvt(HepMC::GenEvent* evt);
144
146 StatusCode genFinalize();
147
148
149private:
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
197
199 , "EventInfo"
200 , "TMPEvtInfo"
201 , "ReadHandleKey for xAOD::EventInfo"};
202
204
205};
206
207#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:107
std::string m_tag
Definition Herwig7.h:112
virtual bool resume() const
Try to resume execution from an earlier interrupted run.
Definition Herwig7.h:42
std::string m_setupfile
Definition Herwig7.h:111
std::vector< std::string > m_prependReadDirectories
Definition Herwig7.h:116
virtual int seed() const
The number of events to generate.
Definition Herwig7.h:74
virtual unsigned int maxJobs() const
The number of subprocesses to integrate per integratoin job.
Definition Herwig7.h:79
int m_jobs
Definition Herwig7.h:120
virtual std::string repository() const
Repository name to operate on.
Definition Herwig7.h:49
virtual int jobs() const
Definition Herwig7.h:77
unsigned int m_jobsize
Definition Herwig7.h:121
std::vector< std::string > m_appendReadDirectories
Definition Herwig7.h:117
std::string m_integrationList
Definition Herwig7.h:114
virtual void quitWithHelp() const
The maximum number of integration jobs.
Definition Herwig7.h:82
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
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:110
virtual void quit() const
Bail out and be quiet.
Definition Herwig7.h:90
std::string m_repository
Definition Herwig7.h:109
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:96
void inputfile(const std::string &inputfile)
Definition Herwig7.h:53
unsigned int m_maxjobs
Definition Herwig7.h:122
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:72
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:99
int m_seed
Definition Herwig7.h:119
virtual std::istream & inStream() const
Return the standard in stream to be used.
Definition Herwig7.h:102
virtual bool tics() const
Require verbose progress markers.
Definition Herwig7.h:45
void seed(int seed)
The seed to use.
Definition Herwig7.h:75
virtual unsigned int jobSize() const
The number of jobs to fork.
Definition Herwig7.h:78
Herwig7API()
Constructor.
Definition Herwig7.h:29
std::string m_pdfname_mpi
PS PDF name, stored for AMI capture at finalize.
Definition Herwig7.h:187
StatusCode callGenerator()
Run the generator for one event.
Definition Herwig7.cxx:152
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition Herwig7.h:198
StatusCode genFinalize()
Close down the generator.
Definition Herwig7.cxx:241
ThePEG::EventPtr m_event
ThePEG event object.
Definition Herwig7.h:158
int m_seed_from_generatetf
Random number seed from Generate_tf.py.
Definition Herwig7.h:178
std::string m_pdfname_me
ME PDF name, stored for AMI capture at finalize.
Definition Herwig7.h:181
bool m_cleanup_herwig_scratch
Possibly remove Herwig-scratch folder after finishing the event generation.
Definition Herwig7.h:190
Herwig7(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition Herwig7.cxx:39
double m_xsscale
Scale integrated cross section by a factor for MetaData output.
Definition Herwig7.h:193
StatusCode fillEvt(HepMC::GenEvent *evt)
Convert the generated event into the HepMC format.
Definition Herwig7.cxx:167
int m_dsid
Gen_tf.py run args needed in interface.
Definition Herwig7.h:196
ThePEG::EGPtr m_gen
ThePEG generator object.
Definition Herwig7.h:155
std::string m_runfile
Name of run file.
Definition Herwig7.h:168
StatusCode genInitialize()
Initialize the generator.
Definition Herwig7.cxx:67
Herwig7API m_api
Herwig7 API object.
Definition Herwig7.h:152
std::string m_setupfile
Name of setup file.
Definition Herwig7.h:171
std::string m_runname
Run name, used in the Herwig/ThePEG config system.
Definition Herwig7.h:165
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
Property holding a SG store/key/clid from which a ReadHandle is made.