R3BROOT
R3B analysis software
Toggle main menu visibility
Loading...
Searching...
No Matches
testNeulandSimulation.C
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3
* Copyright (C) 2019-2025 Members of R3B Collaboration *
4
* *
5
* This software is distributed under the terms of the *
6
* GNU General Public Licence (GPL) version 3, *
7
* copied verbatim in the file "LICENSE". *
8
* *
9
* In applying this license GSI does not waive the privileges and immunities *
10
* granted to it by virtue of its status as an Intergovernmental Organization *
11
* or submit itself to any jurisdiction. *
12
******************************************************************************/
13
14
void
testNeulandSimulation
()
15
{
16
// Timer
17
TStopwatch timer;
18
timer.Start();
19
20
// Logging
21
FairLogger::GetLogger()->SetLogVerbosityLevel(
"LOW"
);
22
FairLogger::GetLogger()->SetLogScreenLevel(
"warn"
);
23
24
// System paths
25
const
TString workDirectory = getenv(
"VMCWORKDIR"
);
26
gSystem->Setenv(
"GEOMPATH"
, workDirectory +
"/geometry"
);
27
gSystem->Setenv(
"CONFIG_DIR"
, workDirectory +
"/gconfig"
);
28
29
// Output files
30
const
TString simufile =
"test.simu.root"
;
31
const
TString parafile =
"test.para.root"
;
32
33
// Basic simulation setup
34
auto
run =
new
FairRunSim();
35
run->SetName(
"TGeant4"
);
36
run->SetStoreTraj(
false
);
37
run->SetMaterials(
"media_r3b.geo"
);
38
run->SetSink(
new
FairRootFileSink(simufile));
39
40
// Primary particle generator
41
auto
boxGen =
new
FairBoxGenerator(2112, 4);
42
boxGen->SetXYZ(0, 0, 0.);
43
boxGen->SetThetaRange(0., 3.);
44
boxGen->SetPhiRange(0., 360.);
45
boxGen->SetEkinRange(0.6, 0.6);
46
auto
primGen =
new
FairPrimaryGenerator();
47
primGen->AddGenerator(boxGen);
48
run->SetGenerator(primGen);
49
50
// Geometry: Cave
51
auto
cave =
new
R3BCave
(
"CAVE"
);
52
cave->SetGeometryFileName(
"r3b_cave.geo"
);
53
run->AddModule(cave);
54
55
// Geometry: Neuland
56
run->AddModule(
new
R3BNeuland
(30, { 0., 0., 1650. }));
57
58
// Init
59
run->Init();
60
61
// Connect runtime parameter file
62
auto
parFileIO =
new
FairParRootFileIo(
true
);
63
parFileIO->open(parafile);
64
auto
rtdb = run->GetRuntimeDb();
65
rtdb->setOutput(parFileIO);
66
rtdb->saveOutput();
67
68
// Simulate
69
run->Run(100);
70
71
// Report
72
timer.Stop();
73
cout <<
"Macro finished successfully."
<< endl;
74
cout <<
"Real time: "
<< timer.RealTime() <<
"s, CPU time: "
<< timer.CpuTime() <<
"s"
<< endl;
75
}
R3BCave::R3BCave
R3BCave()
Definition
R3BCave.cxx:31
R3BNeuland::R3BNeuland
R3BNeuland()
Default constructor.
Definition
R3BNeuland.cxx:71
testNeulandSimulation
void testNeulandSimulation()
Definition
testNeulandSimulation.C:14
neuland
test
testNeulandSimulation.C
Generated by
1.18.0