-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathg4Config.C
More file actions
executable file
·84 lines (72 loc) · 3.79 KB
/
g4Config.C
File metadata and controls
executable file
·84 lines (72 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/********************************************************************************
* 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" *
********************************************************************************/
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include <iostream>
#include "TGeant4.h"
#include "TString.h"
#include "FairRunSim.h"
#include "TSystem.h"
#include "TG4RunConfiguration.h"
#include "SimConfig/G4Params.h"
#endif
#include "commonConfig.C"
// Configuration macro for Geant4 VirtualMC
void Config()
{
/// Create the run configuration
/// In constructor user has to specify the geometry input
/// and select geometry navigation via the following options:
/// - geomVMCtoGeant4 - geometry defined via VMC, G4 native navigation
/// - geomVMCtoRoot - geometry defined via VMC, Root navigation
/// - geomRoot - geometry defined via Root, Root navigation
/// - geomRootToGeant4 - geometry defined via Root, G4 native navigation
/// - geomGeant4 - geometry defined via Geant4, G4 native navigation
///
/// The second argument in the constructor selects physics list:
/// Available options:
/// EMonly, EMonly+Extra, Hadron_EM, Hadron_EM+Extra
/// where EMonly = emStandard
/// Hadron = FTFP_BERT FTFP_BERT_TRV FTFP_BERT_HP FTFP_INCLXX FTFP_INCLXX_HP FTF_BIC LBE QBBC QGSP_BERT
/// QGSP_BERT_HP QGSP_BIC QGSP_BIC_HP QGSP_FTFP_BERT QGSP_INCLXX QGSP_INCLXX_HP QGS_BIC
/// Shielding ShieldingLEND
/// EM = _EMV _EMX _EMY _EMZ _LIV _PEN
/// Extra = extra optical radDecay
/// The Extra selections are cumulative, while Hadron selections are exlusive.
/// The third argument activates the special processes in the TG4SpecialPhysicsList,
/// which implement VMC features:
/// - stepLimiter - step limiter (default)
/// - specialCuts - VMC cuts
/// - specialControls - VMC controls for activation/inactivation selected processes
/// - stackPopper - stackPopper process
/// When more than one options are selected, they should be separated with '+'
/// character: eg. stepLimit+specialCuts.
//Geant4 VMC 3.x
Bool_t mtMode = FairRunSim::Instance()->IsMT();
Bool_t specialStacking = true; // leads to default stack behaviour in which new primaries are only started if the previous
// one and all of its secondaries have been transported
// any other choice is dangerously inconsistent with the FinishPrimary() interface of VMCApp
auto& physicsSetup = ::o2::conf::G4Params::Instance().getPhysicsConfigString();
std::cout << "PhysicsSetup wanted " << physicsSetup << "\n";
auto runConfiguration = new TG4RunConfiguration("geomRoot", physicsSetup, "stepLimiter+specialCuts",
specialStacking, mtMode);
/// Create the G4 VMC
TGeant4* geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
std::cout << "Geant4 has been created." << std::endl;
// setup the stack
stackSetup(geant4, FairRunSim::Instance());
// setup decayer
decayerSetup(geant4);
TString configm(gSystem->Getenv("VMCWORKDIR"));
auto configm1 = configm + "/Detectors/gconfig/g4config.in";
/// Customise Geant4 setting
/// (verbose level, global range cut, ..)
geant4->ProcessGeantMacro(configm1.Data());
// Enter in Geant4 Interactive mode
// geant4->StartGeantUI();
std::cout << "g4Config.C finished" << std::endl;
}