Skip to content

Commit 7a967a6

Browse files
preghenellasawenzel
authored andcommitted
External generator configuration moved to configurable params
1 parent d5e681c commit 7a967a6

File tree

28 files changed

+97
-55
lines changed

28 files changed

+97
-55
lines changed

Common/SimConfig/include/SimConfig/SimConfig.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ struct SimConfigData {
2727
std::string mTrigger; // chosen VMC generator trigger
2828
unsigned int mNEvents; // number of events to be simulated
2929
std::string mExtKinFileName; // file name of external kinematics file (needed for ext kinematics generator)
30-
std::string mExtGenFileName; // file name containing the external generator configuration
31-
std::string mExtGenFuncName; // function call to retrieve the external generator configuration
3230
std::string mEmbedIntoFileName; // filename containing the reference events to be used for the embedding
3331
unsigned int mStartEvent; // index of first event to be taken
3432
float mBMax; // maximum for impact parameter sampling
@@ -98,8 +96,6 @@ class SimConfig
9896
unsigned int getNEvents() const { return mConfigData.mNEvents; }
9997

10098
std::string getExtKinematicsFileName() const { return mConfigData.mExtKinFileName; }
101-
std::string getExtGeneratorFileName() const { return mConfigData.mExtGenFileName; }
102-
std::string getExtGeneratorFuncName() const { return mConfigData.mExtGenFuncName; }
10399
std::string getEmbedIntoFileName() const { return mConfigData.mEmbedIntoFileName; }
104100
unsigned int getStartEvent() const { return mConfigData.mStartEvent; }
105101
float getBMax() const { return mConfigData.mBMax; }

Common/SimConfig/src/SimConfig.cxx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ void SimConfig::initOptions(boost::program_options::options_description& options
3131
"startEvent", bpo::value<unsigned int>()->default_value(0), "index of first event to be used (when applicable)")(
3232
"extKinFile", bpo::value<std::string>()->default_value("Kinematics.root"),
3333
"name of kinematics file for event generator from file (when applicable)")(
34-
"extGenFile", bpo::value<std::string>()->default_value("extgen.C"),
35-
"name of .C file with definition of external event generator")(
36-
"extGenFunc", bpo::value<std::string>()->default_value(""),
37-
"function call to load the definition of external event generator")(
3834
"embedIntoFile", bpo::value<std::string>()->default_value(""),
3935
"filename containing the reference events to be used for the embedding")(
4036
"bMax,b", bpo::value<float>()->default_value(0.), "maximum value for impact parameter sampling (when applicable)")(
@@ -94,8 +90,6 @@ bool SimConfig::resetFromParsedMap(boost::program_options::variables_map const&
9490
mConfigData.mTrigger = vm["trigger"].as<std::string>();
9591
mConfigData.mNEvents = vm["nEvents"].as<unsigned int>();
9692
mConfigData.mExtKinFileName = vm["extKinFile"].as<std::string>();
97-
mConfigData.mExtGenFileName = vm["extGenFile"].as<std::string>();
98-
mConfigData.mExtGenFuncName = vm["extGenFunc"].as<std::string>();
9993
mConfigData.mEmbedIntoFileName = vm["embedIntoFile"].as<std::string>();
10094
mConfigData.mStartEvent = vm["startEvent"].as<unsigned int>();
10195
mConfigData.mBMax = vm["bMax"].as<float>();

Generators/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ o2_add_library(Generators
2525
src/Trigger.cxx
2626
src/TriggerParticle.cxx
2727
src/GeneratorTGenerator.cxx
28+
src/GeneratorExternalParam.cxx
2829
src/GeneratorFromFile.cxx
2930
src/PDG.cxx
3031
src/PrimaryGenerator.cxx
@@ -65,6 +66,7 @@ set(headers
6566
include/Generators/Trigger.h
6667
include/Generators/TriggerParticle.h
6768
include/Generators/GeneratorTGenerator.h
69+
include/Generators/GeneratorExternalParam.h
6870
include/Generators/GeneratorFromFile.h
6971
include/Generators/PDG.h
7072
include/Generators/PrimaryGenerator.h
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \author R+Preghenella - September 2020
12+
13+
#ifndef ALICEO2_EVENTGEN_GENERATOREXTERNALPARAM_H_
14+
#define ALICEO2_EVENTGEN_GENERATOREXTERNALPARAM_H_
15+
16+
#include "CommonUtils/ConfigurableParam.h"
17+
#include "CommonUtils/ConfigurableParamHelper.h"
18+
19+
namespace o2
20+
{
21+
namespace eventgen
22+
{
23+
24+
/**
25+
** a parameter class/struct to keep the settings of
26+
** the external event-generator and
27+
** allow the user to modify them
28+
**/
29+
struct GeneratorExternalParam : public o2::conf::ConfigurableParamHelper<GeneratorExternalParam> {
30+
std::string fileName = "";
31+
std::string funcName = "";
32+
O2ParamDef(GeneratorExternalParam, "GeneratorExternal");
33+
};
34+
35+
} // end namespace eventgen
36+
} // end namespace o2
37+
38+
#endif // ALICEO2_EVENTGEN_GENERATOREXTERNALPARAM_H_

Generators/share/external/QEDLoader.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// or submit itself to any jurisdiction.
1010

1111
//< Loader macro to run QED background generator from QEDepem.C macro, use it as e.g.
12-
//< o2-sim -n10000 -m PIPE ITS T0 MFT --noemptyevents -g extgen --extGenFile QEDloader.C
12+
//< o2-sim -n10000 -m PIPE ITS T0 MFT --noemptyevents -g external --configKeyValues "GeneratorExternal.fileName=QEDloader.C"
1313
#include <FairLogger.h>
1414

1515
FairGenerator* fg = nullptr;

Generators/share/external/QEDepem.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// or submit itself to any jurisdiction.
1010

1111
//< Macro to run QED background generator, us it as e.g.
12-
//< o2-sim -n10000 -m PIPE ITS T0 MFT --noemptyevents -g extgen --extGenFile QEDloader.C
12+
//< o2-sim -n10000 -m PIPE ITS T0 MFT --noemptyevents -g external --configKeyValues "GeneratorExternal.fileName=QEDloader.C"
1313

1414
R__LOAD_LIBRARY(libTEPEMGEN.so)
1515

Generators/share/external/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- Invokes TGenEpEmv1 generator from [AEGIS](https://github.com/AliceO2Group/AEGIS) package for Pb-Pb &rarr; e+e- generation.
1414
+ optional parameters are rapidity and pT ranges to generate, can be provided as key/value option, e.g.
1515
``
16-
o2-sim -n 1000 -m PIPE ITS -g extgen --extGenFile $O2_ROOT/share/Generators/external/QEDLoader.C --configKeyValues 'QEDGenParam.yMin=-3;QEDGenParam.ptMin=0.001'
16+
o2-sim -n 1000 -m PIPE ITS -g external --configKeyValues 'GeneratorExternal.fileName=$O2_ROOT/share/Generators/external/QEDLoader.C;QEDGenParam.yMin=-3;QEDGenParam.ptMin=0.001'
1717
``
1818
The x-section of the process depends on the applied cuts, it is calculated on the fly and stored in the ``qedgenparam.ini`` file.
1919

Generators/share/external/hijing.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// configures a AliGenHijing class from AliRoot
2-
// usage: o2sim -g extgen --extGenFile hijing.C
3-
// options: --extGenFunc hijing(5020., 0., 20.)
2+
// usage: o2sim -g external --configKeyValues 'GeneratorExternal.fileName=hijing.C;GeneratorExternal.funcName="hijing(5020., 0., 20.)"'
43

54
/// \author R+Preghenella - October 2018
65

Generators/share/external/pythia6.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// configures a TPythia6 class
2-
// usage: o2sim -g extgen --extGenFile pythia6.C
3-
// options: --extGenFunc pythia6(14000., "pythia.settings")
2+
// usage: o2sim -g external --configKeyValues 'GeneratorExternal.fileName=pythia6.C;GeneratorExternal.funcName="pythia6(14000., "pythia.settings")"'
43

54
/// \author R+Preghenella - October 2018
65

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \author R+Preghenella - September 2020
12+
13+
#include "Generators/GeneratorExternalParam.h"
14+
O2ParamImpl(o2::eventgen::GeneratorExternalParam);

0 commit comments

Comments
 (0)