-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathGeneratorPythia8.h
More file actions
95 lines (73 loc) · 2.8 KB
/
GeneratorPythia8.h
File metadata and controls
95 lines (73 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \author R+Preghenella - January 2020
#ifndef ALICEO2_EVENTGEN_GENERATORPYTHIA8_H_
#define ALICEO2_EVENTGEN_GENERATORPYTHIA8_H_
#include "Generators/Generator.h"
#include "Pythia8/Pythia.h"
namespace o2
{
namespace eventgen
{
/*****************************************************************/
/*****************************************************************/
class GeneratorPythia8 : public Generator
{
public:
/** default constructor **/
GeneratorPythia8();
/** constructor **/
GeneratorPythia8(const Char_t* name, const Char_t* title = "ALICEo2 Pythia8 Generator");
/** destructor **/
~GeneratorPythia8() override = default;
/** Initialize the generator if needed **/
Bool_t Init() override;
/** setters **/
void setConfig(std::string val) { mConfig = val; };
void setHooksFileName(std::string val) { mHooksFileName = val; };
void setHooksFuncName(std::string val) { mHooksFuncName = val; };
void setUserHooks(Pythia8::UserHooks* hooks)
{
#if PYTHIA_VERSION_INTEGER < 8300
mPythia.setUserHooksPtr(hooks);
#else
mPythia.setUserHooksPtr(std::shared_ptr<Pythia8::UserHooks>(hooks));
#endif
}
/** methods **/
bool readString(std::string val) { return mPythia.readString(val, true); };
bool readFile(std::string val) { return mPythia.readFile(val, true); };
protected:
/** copy constructor **/
GeneratorPythia8(const GeneratorPythia8&);
/** operator= **/
GeneratorPythia8& operator=(const GeneratorPythia8&);
/** methods to override **/
Bool_t generateEvent() override;
Bool_t importParticles() override { return importParticles(mPythia.event); };
/** methods that can be overridded **/
void updateHeader(FairMCEventHeader* eventHeader) override;
/** internal methods **/
Bool_t importParticles(Pythia8::Event& event);
/** utilities **/
void selectFromAncestor(int ancestor, Pythia8::Event& inputEvent, Pythia8::Event& outputEvent);
/** Pythia8 **/
Pythia8::Pythia mPythia; //!
/** configuration **/
std::string mConfig;
std::string mHooksFileName;
std::string mHooksFuncName;
ClassDefOverride(GeneratorPythia8, 1);
}; /** class GeneratorPythia8 **/
/*****************************************************************/
/*****************************************************************/
} // namespace eventgen
} // namespace o2
#endif /* ALICEO2_EVENTGEN_GENERATORPYTHIA8_H_ */