VMC Examples Version 6.6
Loading...
Searching...
No Matches
test_E03_6.C
Go to the documentation of this file.
1//------------------------------------------------
2// The Virtual Monte Carlo examples
3// Copyright (C) 2007 - 2015 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/// \ingroup Tests
11/// \file test_E03_6.C
12/// \brief Example E03 Test macro 6
13///
14/// Running Example03
15
16// Activate this code to check curving of trajectories in field
17//#include "set_vis.C"
18
19void test_E03_6(const TString& configMacro = "g4Config5.C", Bool_t oldGeometry = kFALSE)
20{
21/// Macro function for testing example E03
22/// \param configMacro configuration macro loaded in initialization
23/// (g4Config5.C or g4tgeoConfig5.C)
24/// \param oldGeometry if true - geometry is defined via VMC, otherwise
25/// via TGeo
26///
27/// Activate user defined magnetic field equation of motion and stepper
28/// and run an event of 5 muons.
29
30 // Create application if it does not yet exist
31 Bool_t needDelete = kFALSE;
32 if ( ! TVirtualMCApplication::Instance() ) {
33 new Ex03MCApplication("Example03", "The example03 MC application");
34 needDelete = kTRUE;
35 }
36
37 // MC application
39 = (Ex03MCApplication*)TVirtualMCApplication::Instance();
42 appl->SetField(20); // Set field value in z-direction to 20 kGauss (2tesla)
43
44 // Set geometry defined via VMC
45 appl->SetOldGeometry(oldGeometry);
46
47 appl->InitMC(configMacro);
48
49 // Visualization setting
50 // Activate this code to check curving of trajectories in field
51 //set_vis();
52
53 appl->RunMC(1);
54
55 // Inactivate this code to check curving of trajectories in field
56 if ( needDelete ) delete appl;
57}
Ex03bMCApplication Ex03MCApplication
Implementation of the TVirtualMCApplication.
void InitMC(const char *setup)
void RunMC(Int_t nofEvents)
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
void SetField(Double_t bz)
Ex03PrimaryGenerator * GetPrimaryGenerator() const
void SetNofPrimaries(Int_t nofPrimaries)
@ kTestField
mu+ with a suitable energy to test magnetic field
void SetPrimaryType(Type primaryType)
void test_E03_6(const TString &configMacro="g4Config5.C", Bool_t oldGeometry=kFALSE)
Definition test_E03_6.C:19