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
9 changes: 9 additions & 0 deletions Common/SimConfig/include/SimConfig/G4Params.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,22 @@ enum class EG4Physics {
kUSER = 8 /* allows to give own string combination */
};

// enumerating possible geometry navigation modes
// (understanding that geometry description is always done with TGeo)
enum class EG4Nav {
kTGeo = 0, /* navigate with TGeo */
kG4 = 1 /* navigate with G4 native geometry */
};

// parameters to influence the G4 engine
struct G4Params : public o2::conf::ConfigurableParamHelper<G4Params> {
EG4Physics physicsmode = EG4Physics::kFTFP_BERT_EMV_optical; // default physics mode with which to configure G4

std::string configMacroFile = ""; // a user provided g4Config.in file (otherwise standard one fill be taken)
std::string userPhysicsList = ""; // possibility to directly give physics list as string

EG4Nav navmode = EG4Nav::kTGeo; // geometry navigation mode (default TGeo)

std::string const& getPhysicsConfigString() const;

O2ParamDef(G4Params, "G4");
Expand Down
1 change: 1 addition & 0 deletions Common/SimConfig/src/SimConfigLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::conf::DigiParams> + ;

#pragma link C++ enum o2::conf::EG4Physics;
#pragma link C++ enum o2::conf::EG4Nav;
#pragma link C++ enum o2::conf::SimFieldMode;
#pragma link C++ struct o2::conf::G4Params + ;
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::conf::G4Params> + ;
Expand Down
11 changes: 10 additions & 1 deletion Detectors/gconfig/g4Config.C
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
R__LOAD_LIBRARY(libG4ptl)
R__LOAD_LIBRARY(libG4zlib)
R__LOAD_LIBRARY(libG4expat)

Check failure on line 10 in Detectors/gconfig/g4Config.C

View workflow job for this annotation

GitHub Actions / PR formatting / copyright headers

Missing or malformed copyright notice

This source file is missing the correct copyright notice.
R__LOAD_LIBRARY(libG4clhep)
R__LOAD_LIBRARY(libG4tools)
R__LOAD_LIBRARY(libG4global)
Expand Down Expand Up @@ -100,7 +100,16 @@
auto& g4Params = ::o2::conf::G4Params::Instance();
auto& physicsSetup = g4Params.getPhysicsConfigString();
std::cout << "PhysicsSetup wanted " << physicsSetup << "\n";
auto runConfiguration = new TG4RunConfiguration("geomRoot", physicsSetup, "stepLimiter+specialCuts",
std::string geomNavStr;
if (g4Params.navmode == o2::conf::EG4Nav::kTGeo) {
geomNavStr = "geomRoot";
} else if (g4Params.navmode == o2::conf::EG4Nav::kG4) {
geomNavStr = "geomVMC+RootToGeant4";
} else {
LOG(fatal) << "Unsupported geometry navigation mode";
}

auto runConfiguration = new TG4RunConfiguration(geomNavStr, physicsSetup, "stepLimiter+specialCuts",
specialStacking, mtMode);
/// avoid the use of G4BACKTRACE (it seems to inferfere with process logic in o2-sim)
setenv("G4BACKTRACE", "none", 1);
Expand Down
6 changes: 6 additions & 0 deletions Steer/src/O2MCApplication.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <TGeoTessellated.h>
#include <DetectorsBase/O2Tessellated.h>
#include <unordered_set>
#include "SimConfig/G4Params.h"

namespace o2
{
Expand Down Expand Up @@ -223,6 +224,11 @@ bool O2MCApplicationBase::MisalignGeometry()

void O2MCApplicationBase::fixTGeoRuntimeShapes()
{
auto& g4Params = o2::conf::G4Params::Instance();
if (g4Params.navmode != o2::conf::EG4Nav::kTGeo) {
return;
}

// Replace TGeo shapes by other ones for performance or other reasons.
// Should only affect runtime of simulation.

Expand Down
Loading