VMC Examples
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
E03
E03b
exampleE03b.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Virtual Monte Carlo examples
3
// Copyright (C) 2014 - 2018 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 exampleE03b.cxx
11
/// \brief The Geant4 VMC example E03 application executable
12
///
13
/// \date 26/02/2014
14
/// \author I. Hrivnacova; IPN, Orsay
15
16
#include "Ex03PrimaryGenerator.h"
17
#include "
Ex03bMCApplication.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
// Create MC application (thread local)
41
Ex03bMCApplication
* appl =
42
new
Ex03bMCApplication
(
"ExampleE03"
,
"The exampleE03 MC application"
);
43
appl->
GetPrimaryGenerator
()->
SetNofPrimaries
(20);
44
appl->
SetPrintModulo
(1);
45
46
#ifdef USE_GEANT4
47
// RunConfiguration for Geant4
48
TG4RunConfiguration
* runConfiguration =
49
new
TG4RunConfiguration
(
"geomRootToGeant4"
,
"FTFP_BERT"
);
50
51
// TGeant4
52
TGeant4* geant4 =
new
TGeant4(
53
"TGeant4"
,
"The Geant4 Monte Carlo"
, runConfiguration, argc, argv);
54
55
// Customise Geant4 setting
56
// (verbose level, global range cut, ..)
57
geant4->ProcessGeantMacro(
"g4config.in"
);
58
#endif
59
60
#ifdef USE_GEANT3
61
new
TGeant3TGeo(
"C++ Interface to Geant3"
);
62
gMC->SetProcess(
"DRAY"
, 1);
63
gMC->SetProcess(
"LOSS"
, 1);
64
gMC->SetProcess(
"HADR"
, 0);
65
#endif
66
67
// Run example
68
appl->
InitMC
(
""
);
69
70
#ifdef USE_GEANT4
71
// Setting Geant4 visualization
72
geant4->ProcessGeantMacro(
"g4vis.in"
);
73
#endif
74
75
appl->
RunMC
(5);
76
77
delete
appl;
78
}
Ex03bMCApplication.h
Definition of the Ex03bMCApplication class.
Ex03PrimaryGenerator::SetNofPrimaries
void SetNofPrimaries(Int_t nofPrimaries)
Definition
Ex03PrimaryGenerator.h:102
Ex03bMCApplication
Implementation of the TVirtualMCApplication.
Definition
Ex03bMCApplication.h:43
Ex03bMCApplication::InitMC
void InitMC(const char *setup)
Definition
Ex03bMCApplication.cxx:175
Ex03bMCApplication::SetPrintModulo
void SetPrintModulo(Int_t value)
Definition
Ex03bMCApplication.h:117
Ex03bMCApplication::RunMC
void RunMC(Int_t nofEvents)
Definition
Ex03bMCApplication.cxx:214
Ex03bMCApplication::GetPrimaryGenerator
Ex03PrimaryGenerator * GetPrimaryGenerator() const
Definition
Ex03bMCApplication.h:150
TG4RunConfiguration
main
int main(int argc, char **argv)
Application main program.
Definition
exampleE03b.cxx:31
Generated on
for VMC Examples by
1.17.0