VMC Examples
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
Monopole
exampleMonopole.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Virtual Monte Carlo examples
3
// Copyright (C) 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 exampleMonopole.cxx
11
/// \brief The Geant4 VMC example Monopole application executable
12
///
13
/// The Geant4 VMC application executable
14
/// with explicitely instantiated TGeant3 or TGeant4 and linked
15
/// with all libraries.
16
///
17
/// \date 15/07/2018
18
/// \author I. Hrivnacova; IPN, Orsay
19
20
#include "DetectorConstruction.h"
21
#include "MCApplication.h"
22
23
#ifdef USE_GEANT4
24
#include "TG4RunConfiguration.h"
25
#include "TGeant4.h"
26
#endif
27
28
#include "TROOT.h"
29
30
/// Application main program
31
int
main
(
int
argc,
char
** argv)
32
{
33
#ifdef USE_GEANT3
34
// This example cannot run with Geant3
35
std::cerr <<
"Monopole example: Geant3 is not supported."
<< std::endl;
36
return
1;
37
#endif
38
39
// Initialize Root threading.
40
// (Multi-threading is triggered automatically if Geant4 was built
41
// in MT mode.)
42
#ifdef G4MULTITHREADED
43
ROOT::EnableThreadSafety();
44
#endif
45
46
// Create MC application
47
VMC::Monopole::MCApplication
* appl =
new
VMC::Monopole::MCApplication
(
48
"ExampleMonopole"
,
"The exampleMonopole MC application"
);
49
// Set detector parameters
50
// /testex/det/setMat G4_Si
51
// /testex/det/setSizeX 10 cm
52
// /testex/det/setSizeYZ 20 cm
53
// /testex/det/setStepSize 0.2 mm
54
// /testex/run/binSize 0.2 mm
55
VMC::Monopole::DetectorConstruction
* detector =
56
appl->
GetDetectorConstruction
();
57
detector->
SetAbsorberMaterial
(
"Si"
);
58
detector->
SetAbsorberSizeX
(10);
59
detector->
SetAbsorberSizeYZ
(20);
60
detector->
SetMaxStepSize
(0.02);
61
appl->
SetBinSize
(0.02);
62
63
#ifdef USE_GEANT4
64
// RunConfiguration for Geant4
65
TG4RunConfiguration
* runConfiguration =
new
TG4RunConfiguration
(
66
"geomRootToGeant4"
,
"FTFP_BERT+monopole"
,
"stepLimiter"
,
false
,
false
);
67
68
// TGeant4
69
TGeant4* geant4 =
new
TGeant4(
70
"TGeant4"
,
"The Geant4 Monte Carlo"
, runConfiguration, argc, argv);
71
std::cout <<
"Geant4 has been created."
<< std::endl;
72
73
// Customise Geant4 setting
74
// (verbose level, global range cut, ..)
75
geant4->ProcessGeantMacro(
"g4config.in"
);
76
#endif
77
78
// Run from this main
79
appl->
InitMC
(
""
);
80
81
#ifdef USE_GEANT4
82
// Customise Geant4 setting after initialization:
83
// Physics list
84
geant4->ProcessGeantMacro(
"g4config2.in"
);
85
#endif
86
87
#ifdef USE_GEANT4
88
// Setting Geant4 visualization
89
geant4->ProcessGeantMacro(
"g4vis.in"
);
90
#endif
91
92
appl->
RunMC
(5);
93
94
delete
appl;
95
}
TG4RunConfiguration
VMC::Monopole::DetectorConstruction
The detector construction (via TGeo ).
Definition
DetectorConstruction.h:38
VMC::Monopole::DetectorConstruction::SetAbsorberSizeYZ
void SetAbsorberSizeYZ(Double_t sizeYZ)
Definition
DetectorConstruction.cxx:200
VMC::Monopole::DetectorConstruction::SetAbsorberSizeX
void SetAbsorberSizeX(Double_t sizeX)
Definition
DetectorConstruction.cxx:186
VMC::Monopole::DetectorConstruction::SetMaxStepSize
void SetMaxStepSize(Double_t maxStepSize)
Definition
DetectorConstruction.cxx:286
VMC::Monopole::DetectorConstruction::SetAbsorberMaterial
void SetAbsorberMaterial(const TString &name)
Definition
DetectorConstruction.cxx:214
VMC::Monopole::MCApplication
Implementation of the TVirtualMCApplication.
Definition
MCApplication.h:41
VMC::Monopole::MCApplication::InitMC
void InitMC(const char *setup)
Definition
MCApplication.cxx:153
VMC::Monopole::MCApplication::SetBinSize
void SetBinSize(Double_t binSize)
Definition
MCApplication.cxx:507
VMC::Monopole::MCApplication::RunMC
void RunMC(Int_t nofEvents)
Definition
MCApplication.cxx:221
VMC::Monopole::MCApplication::GetDetectorConstruction
DetectorConstruction * GetDetectorConstruction() const
Definition
MCApplication.h:104
main
int main(int argc, char **argv)
Application main program.
Definition
exampleMonopole.cxx:31
Generated on
for VMC Examples by
1.17.0