Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Generators/include/Generators/GeneratorPythia8.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class GeneratorPythia8 : public Generator
/** default constructor **/
GeneratorPythia8();
/** constructor **/
GeneratorPythia8(Pythia8GenConfig const& pars);
GeneratorPythia8(Pythia8GenConfig const&);
/** constructor **/
GeneratorPythia8(const Char_t* name, const Char_t* title = "ALICEo2 Pythia8 Generator");
/** destructor **/
Expand Down Expand Up @@ -285,7 +285,7 @@ class GeneratorPythia8 : public Generator
long mInitialRNGSeed = -1; // initial seed for Pythia random number state;
// will be transported to Pythia in the Init function through the Pythia::readString("Random:seed") mechanism.
// Value of -1 means unitialized; 0 will be time-dependent and values >1 <= MAX_SEED concrete reproducible seeding
std::unique_ptr<Pythia8GenConfig> mGenConfig; // configuration object
Pythia8GenConfig mGenConfig; // configuration object

constexpr static long MAX_SEED = 900000000;

Expand Down
37 changes: 21 additions & 16 deletions Generators/src/GeneratorPythia8.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,39 @@ GeneratorPythia8::GeneratorPythia8() : Generator("ALICEo2", "ALICEo2 Pythia8 Gen
mInterfaceName = "pythia8";

auto& param = GeneratorPythia8Param::Instance();
LOG(info) << "Instance \'Pythia8\' generator with following parameters";
LOG(info) << "Default Instance \'Pythia8\' generator with following parameters";
LOG(info) << param;

setConfig(param.config);
setHooksFileName(param.hooksFileName);
setHooksFuncName(param.hooksFuncName);
// convert the outside singleton config to the internally used one
o2::eventgen::Pythia8GenConfig config{param.config,
param.hooksFileName, param.hooksFuncName, param.includePartonEvent, param.particleFilter, param.verbose};
mGenConfig = config;

setConfig(config.config);
setHooksFileName(config.hooksFileName);
setHooksFuncName(config.hooksFuncName);
// TODO: use constructor delegation to other interface
}

/*****************************************************************/

GeneratorPythia8::GeneratorPythia8(Pythia8GenConfig const& pars) : Generator("ALICEo2", "ALICEo2 Pythia8 Generator")
GeneratorPythia8::GeneratorPythia8(Pythia8GenConfig const& config) : Generator("ALICEo2", "ALICEo2 Pythia8 Generator")
{
/** constructor **/

mInterface = reinterpret_cast<void*>(&mPythia);
mInterfaceName = "pythia8";

LOG(info) << "Instance \'Pythia8\' generator with following parameters";
LOG(info) << "config: " << pars.config;
LOG(info) << "hooksFileName: " << pars.hooksFileName;
LOG(info) << "hooksFuncName: " << pars.hooksFuncName;
LOG(info) << "config: " << config.config;
LOG(info) << "hooksFileName: " << config.hooksFileName;
LOG(info) << "hooksFuncName: " << config.hooksFuncName;

mGenConfig = std::make_unique<Pythia8GenConfig>(pars);
mGenConfig = config;

setConfig(pars.config);
setHooksFileName(pars.hooksFileName);
setHooksFuncName(pars.hooksFuncName);
setConfig(mGenConfig.config);
setHooksFileName(mGenConfig.hooksFileName);
setHooksFuncName(mGenConfig.hooksFuncName);
}

/*****************************************************************/
Expand Down Expand Up @@ -578,8 +584,7 @@ void GeneratorPythia8::pruneEvent(Pythia8::Event& event, Select select)
}
}
}
int verbose = mGenConfig->verbose;
if (verbose) {
if (mGenConfig.verbose) {
LOG(info) << "Pythia event was pruned from " << event.size()
<< " to " << pruned.size() << " particles";
}
Expand All @@ -592,7 +597,7 @@ void GeneratorPythia8::initUserFilterCallback()
{
mUserFilterFcn = [](Pythia8::Particle const&) -> bool { return true; };

std::string filter = mGenConfig->particleFilter;
std::string filter = mGenConfig.particleFilter;
if (filter.size() > 0) {
LOG(info) << "Initializing the callback for user-based particle pruning " << filter;
auto expandedFileName = o2::utils::expandShellVarsInFileName(filter);
Expand Down Expand Up @@ -621,7 +626,7 @@ Bool_t
// event record in the AOD.

std::function<bool(const Pythia8::Particle&)> partonSelect = [](const Pythia8::Particle&) { return true; };
bool includeParton = mGenConfig->includePartonEvent;
bool includeParton = mGenConfig.includePartonEvent;
if (not includeParton) {

// Select pythia particles
Expand Down
Loading