VMC Examples
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
E03
E03c
exampleE03c.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Virtual Monte Carlo examples
3
// Copyright (C) 2014 Ivana Hrivnacova
4
// All rights reserved.
5
//
6
// For the licensing terms see geant4_vmc/LICENSE.
7
// Contact: root-vmc@cern.ch
8
//-------------------------------------------------
9
10
/// \file exampleE03c.cxx
11
/// \brief The Geant4 VMC example E03c application executable
12
///
13
/// \date 30/04/2019
14
/// \author Benedikt Volkel, CERN
15
16
#include "Ex03PrimaryGenerator.h"
17
#include "
Ex03cMCApplication.h
"
18
19
#ifdef USE_GEANT4
20
#include "TG4RunConfiguration.h"
21
#include "TGeant4.h"
22
#endif
23
24
#ifdef USE_GEANT3
25
#include "TGeant3TGeo.h"
26
#endif
27
28
#include "TROOT.h"
29
30
/// Application main program
31
int
main
(
int
argc,
char
** argv)
32
{
33
// Initialize Root threading.
34
// (Multi-threading is triggered automatically if Geant4 was built
35
// in MT mode.)
36
#ifdef G4MULTITHREADED
37
ROOT::EnableThreadSafety();
38
#endif
39
40
Bool_t isMulti =
false
;
41
Int_t debug = 0;
42
#ifdef USE_MULTI
43
isMulti =
true
;
44
debug = 1;
45
#endif
46
47
// Create MC application (thread local)
48
Ex03cMCApplication
* appl =
new
Ex03cMCApplication
(
49
"ExampleE03"
,
"The exampleE03 MC application"
, isMulti, isMulti);
50
appl->
GetPrimaryGenerator
()->
SetNofPrimaries
(20);
51
appl->
SetPrintModulo
(1);
52
appl->
SetDebug
(debug);
53
54
#ifdef USE_GEANT4
55
// RunConfiguration for Geant4
56
TG4RunConfiguration
* runConfiguration =
57
new
TG4RunConfiguration
(
"geomRoot"
,
"FTFP_BERT"
,
""
,
false
,
false
);
58
59
// TGeant4
60
TGeant4* geant4 =
new
TGeant4(
61
"TGeant4"
,
"The Geant4 Monte Carlo"
, runConfiguration, argc, argv);
62
63
// Customise Geant4 setting
64
// (verbose level, global range cut, ..)
65
geant4->ProcessGeantMacro(
"g4config.in"
);
66
#endif
67
68
#ifdef USE_GEANT3
69
TGeant3TGeo* geant3 =
70
new
TGeant3TGeo(
"C++ Interface to Geant3 with TGeo geometry"
);
71
geant3->SetProcess(
"DRAY"
, 1);
72
geant3->SetProcess(
"LOSS"
, 1);
73
geant3->SetProcess(
"HADR"
, 0);
74
#endif
75
76
// Run example
77
#ifdef USE_MULTI
78
appl->
InitMC
();
79
#else
80
appl->
InitMC
(
""
);
81
#endif
82
83
#ifdef USE_GEANT4
84
#ifndef USE_MULTI
85
// Setting Geant4 visualization
86
geant4->ProcessGeantMacro(
"g4vis.in"
);
87
#endif
88
#endif
89
90
appl->
RunMC
(5);
91
92
delete
appl;
93
}
Ex03cMCApplication.h
Definition of the Ex03cMCApplication class.
Ex03PrimaryGenerator::SetNofPrimaries
void SetNofPrimaries(Int_t nofPrimaries)
Definition
Ex03PrimaryGenerator.h:102
Ex03cMCApplication
Implementation of the TVirtualMCApplication.
Definition
Ex03cMCApplication.h:46
Ex03cMCApplication::InitMC
void InitMC(const char *setup)
Definition
Ex03cMCApplication.cxx:209
Ex03cMCApplication::RunMC
void RunMC(Int_t nofEvents)
Definition
Ex03cMCApplication.cxx:327
Ex03cMCApplication::SetDebug
void SetDebug(Int_t debug)
Set debug option for multiple run.
Definition
Ex03cMCApplication.h:147
Ex03cMCApplication::GetPrimaryGenerator
Ex03PrimaryGenerator * GetPrimaryGenerator() const
Definition
Ex03cMCApplication.h:163
Ex03cMCApplication::SetPrintModulo
void SetPrintModulo(Int_t value)
Definition
Ex03cMCApplication.h:127
TG4RunConfiguration
main
int main(int argc, char **argv)
Application main program.
Definition
exampleE03c.cxx:31
Generated on
for VMC Examples by
1.17.0