VMC Examples Version 6.6
Loading...
Searching...
No Matches
exampleE06.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 exampleE06.cxx
11/// \brief The Geant4 VMC example E06 application executable
12///
13/// \date 26/02/2014
14/// \author I. Hrivnacova; IPN, Orsay
15
16#include "Ex06MCApplication.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
31int 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 Ex06MCApplication* appl =
42 new Ex06MCApplication("ExampleE06", "The exampleE06 MC application");
44 // appl->SetVerboseLevel(3);
45
46#ifdef USE_GEANT4
47 // RunConfiguration for Geant4
48 TG4RunConfiguration* runConfiguration =
49 new TG4RunConfiguration("geomRootToGeant4", "emStandard+optical");
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 TGeant3* geant3 = new TGeant3TGeo("C++ Interface to Geant3");
62 gMC->SetProcess("CKOV", 1);
63 gMC->SetCut("CUTELE", 10e-06);
64 gMC->SetCut("CUTGAM", 10e-06);
65 geant3->SetSWIT(4, 1000);
66 // reduce printing from GTREVE_ROOT (sets one printing per 1000 tracks)
67#endif
68
69 // Run example
70 appl->InitMC("");
71
72 // Activate storing tracks
73 // gMC->SetCollectTracks(kTRUE);
74
75#ifdef USE_GEANT4
76 // Customise Geant4 setting
77 // (verbose level, global range cut, ..)
78 geant4->ProcessGeantMacro("g4config2.in");
79 // Setting Geant4 visualization
80 geant4->ProcessGeantMacro("g4vis.in");
81#endif
82
83 // Run MC
84 appl->RunMC(5);
85
86 delete appl;
87}
Definition of the Ex06MCApplication class.
Definition of the Ex06PrimaryGenerator class.
Implementation of the TVirtualMCApplication.
void RunMC(Int_t nofEvents)
void InitMC(const char *setup)
Ex06PrimaryGenerator * GetPrimaryGenerator() const
void SetNofPrimaries(Int_t nofPrimaries)
int main(int argc, char **argv)
Application main program.