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
17 changes: 12 additions & 5 deletions MC/config/examples/epos4/generator_EPOS4.C
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,26 @@ FairGenerator* generateEPOS4(const std::string &name, const int& nEvents)
buffer << line << "\n";
}
file.close();
auto gen = new GeneratorEPOS4();
auto &param0 = o2::eventgen::GeneratorFileOrCmdParam::Instance();
auto &param = o2::eventgen::GeneratorHepMCParam::Instance();
auto &conf = o2::conf::SimConfig::Instance();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is fine for event pool productions. (SimConfig is not initialized within dpl-eventgen / hyperloop, I think).

// Randomise seed (useful for multiple instances of the generator)
int randomSeed = gRandom->Integer(conf.getStartSeed());
// Write the updated content back to a file in the current directory
std::ofstream outFile("cfg.optns");
std::string optnsFileName(Form("cfg%d.optns", randomSeed));
std::ofstream outFile(optnsFileName);
outFile << buffer.str();
if (!found)
{
outFile << "set nfull " + std::to_string(nEvents);
}
outFile.close();
auto gen = new GeneratorEPOS4();
auto& param0 = o2::eventgen::GeneratorFileOrCmdParam::Instance();
auto& param = o2::eventgen::GeneratorHepMCParam::Instance();
auto& conf = o2::conf::SimConfig::Instance();
optnsFileName = optnsFileName.substr(0, optnsFileName.find_last_of('.')); // remove the .optns extension
// setup the HepMC generator to run with automatic FIFOs
gen->setup(param0, param, conf);
// Replace seed and optns file
gen->setCmd(param0.cmd + " -i " + optnsFileName);
gen->setSeed(randomSeed);
return gen;
}
2 changes: 1 addition & 1 deletion MC/config/examples/ini/GeneratorEPOS4.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/generator_EPOS4.C
funcName=generateEPOS4("${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/generator/example.optns", 2147483647)

[GeneratorFileOrCmd]
cmd=${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/epos.sh -i cfg
cmd=${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/epos.sh
bMaxSwitch=none

# Set to version 2 if EPOS4.0.0 is used
Expand Down
2 changes: 1 addition & 1 deletion MC/config/examples/ini/GeneratorEPOS4HQ.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/generator_EPOS4.C
funcName=generateEPOS4("${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/generator/examplehq.optns", 2147483647)

[GeneratorFileOrCmd]
cmd=${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/epos.sh -i cfg
cmd=${O2DPG_MC_CONFIG_ROOT}/MC/config/examples/epos4/epos.sh
bMaxSwitch=none

[HepMC]
Expand Down