CbmRoot
CbmGeant4Settings.cxx
Go to the documentation of this file.
1 #include "CbmGeant4Settings.h"
2 
3 #include <FairLogger.h>
4 #include <FairRunSim.h>
5 
6 #include <TGeant4.h>
7 #include <TPythia6Decayer.h>
8 #include <TVirtualMC.h>
9 
10 #include <G4NuclearLevelData.hh>
11 
12 void CbmGeant4Settings::Init(TVirtualMC* vmc) {
13 
15 
16  TGeant4* vmcg4 = dynamic_cast<TGeant4*>(vmc);
17 
18  assert(vmcg4);
19 
20  // TODO: These settings were taken over from g4Config.C. To be documented.
21 
22  // --- Set external decayer (Pythia) if required
23  if (FairRunSim::Instance()->IsExtDecayer()) {
24  TVirtualMCDecayer* decayer = TPythia6Decayer::Instance();
25  vmcg4->SetExternalDecayer(decayer);
26  LOG(info) << ": Using Phythia6 decayer";
27  }
28 
29  // --- Random seed and maximum number of steps
30  Text_t buffer[50];
31  sprintf(
32  buffer, "/random/setSeeds %i %i ", gRandom->GetSeed(), gRandom->GetSeed());
33  vmcg4->ProcessGeantCommand(buffer);
34 
35  vmcg4->SetMaxNStep(fMaxNumSteps);
36 
37  for (std::string command : fG4Commands) {
38  LOG(info) << "Passing the following command to Geant4: " << command;
39  vmcg4->ProcessGeantCommand(command.c_str());
40  }
41 
42  LOG(warning) << "Fix for Geant4 bug applied (see "
43  "https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2226)";
44  G4NuclearLevelData::GetInstance()->GetParameters()->SetMaxLifeTime(
45  1 * CLHEP::microsecond);
46 }
47 
ClassImp
ClassImp(CbmGeant4Settings)
CbmGeant4Settings::fMaxNumSteps
Int_t fMaxNumSteps
Definition: CbmGeant4Settings.h:86
CbmGeant4Settings::fG4Commands
std::vector< std::string > fG4Commands
Definition: CbmGeant4Settings.h:80
CbmVMCSettings::Init
void Init(TVirtualMC *)
Set all parameters defined in this class.
Definition: CbmVMCSettings.cxx:7
buffer
@ buffer
Definition: CbmMvdSensorPlugin.h:22
CbmGeant4Settings::Init
void Init(TVirtualMC *)
Set all parameters defined in this class.
Definition: CbmGeant4Settings.cxx:12
CbmGeant4Settings
User interface class to define the Geant4 simulation settings.
Definition: CbmGeant4Settings.h:23
CbmGeant4Settings.h