VMC Examples Version 6.6
Loading...
Searching...
No Matches
run_g4.C
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#include "TVirtualMC.h"
11
12#include "set_g4_vis.C"
13
14/// \ingroup Monopole
15/// \file Monopole/run_g4.C
16/// \brief Macro for running Monopole example with Geant4.
17
18void run_g4(const TString& configMacro = "g4Config.C")
19{
20/// Macro function for running Monopole example with Geant4 from
21/// Root interactive session.
22/// Note that since Root 6 the libraries have to be loaded first
23/// via load_g4.C.
24/// \param configMacro configuration macro name, default \ref Monopole/g4Config.C
25
26 // MC application
28 = new VMC::Monopole::MCApplication("ExampleMonopole", "The example Monopole MC application");
29
30 // Set detector parameters
31 // /testex/det/setMat G4_Si
32 // /testex/det/setSizeX 10 cm
33 // /testex/det/setSizeYZ 20 cm
34 // /testex/det/setStepSize 0.2 mm
35 // /testex/run/binSize 0.2 mm
37 detector->SetAbsorberMaterial("Si");
38 detector->SetAbsorberSizeX(10);
39 detector->SetAbsorberSizeYZ(20);
40 detector->SetMaxStepSize(0.02);
41 appl->SetBinSize(0.02);
42
43 // Initialize MC
44 appl->InitMC(configMacro);
45
46 // Customise Geant4 setting after initialization:
47 // Physics list
48 ((TGeant4*)gMC)->ProcessGeantMacro("g4config2.in");
49
50 // ((TGeant4*)gMC)->StartGeantUI();
51
52 // Visualization setting
53 set_g4_vis();
54
55 // Run MC
56 TStopwatch timer;
57 timer.Start();
58 appl->RunMC(5);
59 timer.Stop();
60 timer.Print();
61
62 delete appl;
63}
64
void run_g4(const TString &configMacro="g4Config.C")
Definition run_g4.C:16
void set_g4_vis()
Definition set_g4_vis.C:15
Macro for setting G4 visualization for Monopole.
The detector construction (via TGeo )
void SetAbsorberMaterial(const TString &name)
Implementation of the TVirtualMCApplication.
void InitMC(const char *setup)
void SetBinSize(Double_t binSize)
void RunMC(Int_t nofEvents)
DetectorConstruction * GetDetectorConstruction() const