forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneratorPythia8.h
More file actions
118 lines (95 loc) · 3.73 KB
/
GeneratorPythia8.h
File metadata and controls
118 lines (95 loc) · 3.73 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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;
/** methods to override **/
Bool_t generateEvent() override;
Bool_t importParticles() override { return importParticles(mPythia.event); };
/** 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); };
/** utilities **/
void getNcoll(int& nColl)
{
getNcoll(mPythia.info, nColl);
};
void getNpart(int& nPart)
{
getNpart(mPythia.info, nPart);
};
void getNpart(int& nProtonProj, int& nNeutronProj, int& nProtonTarg, int& nNeutronTarg)
{
getNpart(mPythia.info, nProtonProj, nNeutronProj, nProtonTarg, nNeutronTarg);
};
void getNremn(int& nProtonProj, int& nNeutronProj, int& nProtonTarg, int& nNeutronTarg)
{
getNremn(mPythia.event, nProtonProj, nNeutronProj, nProtonTarg, nNeutronTarg);
};
protected:
/** copy constructor **/
GeneratorPythia8(const GeneratorPythia8&);
/** operator= **/
GeneratorPythia8& operator=(const GeneratorPythia8&);
/** methods that can be overridded **/
void updateHeader(o2::dataformats::MCEventHeader* eventHeader) override;
/** internal methods **/
Bool_t importParticles(Pythia8::Event& event);
/** utilities **/
void selectFromAncestor(int ancestor, Pythia8::Event& inputEvent, Pythia8::Event& outputEvent);
void getNcoll(const Pythia8::Info& info, int& nColl);
void getNpart(const Pythia8::Info& info, int& nPart);
void getNpart(const Pythia8::Info& info, int& nProtonProj, int& nNeutronProj, int& nProtonTarg, int& nNeutronTarg);
void getNremn(const Pythia8::Event& event, int& nProtonProj, int& nNeutronProj, int& nProtonTarg, int& nNeutronTarg);
/** 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_ */