Skip to content

Commit d3bb0ff

Browse files
committed
o2-sim: Offer option to disable Geant transport
This is useful for cases when only the generator kinematics is of interest.
1 parent 9a8ed23 commit d3bb0ff

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

Common/SimConfig/include/SimConfig/SimConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct SimConfigData {
5252
int mField; // L3 field setting in kGauss: +-2,+-5 and 0
5353
bool mUniformField = false; // uniform magnetic field
5454
bool mAsService = false; // if simulation should be run as service/deamon (does not exit after run)
55+
bool mNoGeant = false; // if Geant transport should be turned off (when one is only interested in the generated events)
5556

5657
ClassDefNV(SimConfigData, 4);
5758
};
@@ -118,6 +119,7 @@ class SimConfig
118119
bool isFilterOutNoHitEvents() const { return mConfigData.mFilterNoHitEvents; }
119120
bool asService() const { return mConfigData.mAsService; }
120121
uint64_t getTimestamp() const { return mConfigData.mTimestamp; }
122+
bool isNoGeant() const { return mConfigData.mNoGeant; }
121123

122124
private:
123125
SimConfigData mConfigData; //!

Common/SimConfig/src/SimConfig.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ void SimConfig::initOptions(boost::program_options::options_description& options
5353
"noemptyevents", "only writes events with at least one hit")(
5454
"CCDBUrl", bpo::value<std::string>()->default_value("ccdb-test.cern.ch:8080"), "URL for CCDB to be used.")(
5555
"timestamp", bpo::value<uint64_t>(), "global timestamp value in ms (for anchoring) - default is now")(
56-
"asservice", bpo::value<bool>()->default_value(false), "run in service/server mode");
56+
"asservice", bpo::value<bool>()->default_value(false), "run in service/server mode")(
57+
"noGeant", bpo::bool_switch(), "prohibits any Geant transport/physics (by using tight cuts)");
5758
}
5859

5960
bool SimConfig::resetFromParsedMap(boost::program_options::variables_map const& vm)
@@ -168,6 +169,7 @@ bool SimConfig::resetFromParsedMap(boost::program_options::variables_map const&
168169
}
169170
mConfigData.mCCDBUrl = vm["CCDBUrl"].as<std::string>();
170171
mConfigData.mAsService = vm["asservice"].as<bool>();
172+
mConfigData.mNoGeant = vm["noGeant"].as<bool>();
171173
if (vm.count("noemptyevents")) {
172174
mConfigData.mFilterNoHitEvents = true;
173175
}

macro/o2sim.C

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@
3535
#endif
3636
#include "migrateSimFiles.C"
3737

38+
void check_notransport()
39+
{
40+
// Sometimes we just want to inspect
41+
// the generator kinematics and prohibit any transport.
42+
43+
// We allow users to give the noGeant option. In this case
44+
// we set the geometry cuts to almost zero. Other adjustments (disable physics procs) could
45+
// be done on top.
46+
// This is merely offered for user convenience as it can be done from outside as well.
47+
auto& confref = o2::conf::SimConfig::Instance();
48+
if (confref.isNoGeant()) {
49+
LOG(info) << "Initializing without Geant transport by applying very tight geometry cuts";
50+
o2::conf::ConfigurableParam::setValue("SimCutParams", "maxRTracking", 0.0000001); // 1 nanometer of tracking
51+
o2::conf::ConfigurableParam::setValue("SimCutParams", "maxAbsZTracking", 0.0000001); // 1 nanometer of tracking
52+
// TODO: disable physics processes for material sitting at the vertex
53+
}
54+
}
55+
3856
FairRunSim* o2sim_init(bool asservice)
3957
{
4058
auto& confref = o2::conf::SimConfig::Instance();
@@ -50,6 +68,8 @@ FairRunSim* o2sim_init(bool asservice)
5068
LOG(info) << "Initialized CCDB Manager with timestamp : " << ccdbmgr.getTimestamp();
5169
}
5270

71+
check_notransport();
72+
5373
// update the parameters from an INI/JSON file, if given (overrides code-based version)
5474
o2::conf::ConfigurableParam::updateFromFile(confref.getConfigFile());
5575

0 commit comments

Comments
 (0)