/[PAMELA software]/PamVMC/examples/run_g4_test.C
ViewVC logotype

Contents of /PamVMC/examples/run_g4_test.C

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Jun 12 18:39:15 2009 UTC (15 years, 5 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v1r0, HEAD
Changes since 1.3: +49 -70 lines
File MIME type: text/plain
- Introduced user-defined names of output files and random seeds number.
Users can do it use options of PamVMCApplication constructor:
PamVMCApplication(const char* name,  const char *title, const char*
filename="pamtest", Int_t seed=0).
The Random object that I use is TRandom3 object which has astronomical
large period (in case of default initialization 0). All random generators
in the code use this object by calling of gRandom singleton which keeps
it.

- Corrected TOF digitization routine. No problems with TDC hits due to
hadronic interactions anymore.

- Some small changes was done to compile code under Root 5.23. +
geant4_vmc v. 2.6 without any warnings

- Some classes of PamG4RunConfiguartion was changed for geant4_vmc v.
2.6.Some obsolete classes was deleted as soon as developers implemented
regions.

- Navigation was changed from "geomRootToGeant4" to "geomRoot", because on
VMC web page written that as soon as Geant4 has no option ONLY/MANY
translation of overlapped geometry to Geant4 through VGM could be wrong.
I'd like to stay with Root navigation:
http://root.cern.ch/root/vmc/Geant4VMC.html. This should be default
option.

- New Tracker digitization routine written by Sergio was implemented

- PamVMC again became compatible with geant4_vmc v.2.5 and ROOT 5.20.
 The problem was that ROOT developers introduced in TVirtualMC class a new
method SetMagField and new base class:TVirtualMagField from which
user-defined classes shoukd be derived

1 void run_g4_test() {
2
3 TString PAM_VMC=gSystem->Getenv("PAM_VMC");
4 TString PLAT=gSystem->Getenv("PLATFORM");
5
6 // Load basic libraries
7 gROOT->LoadMacro(PAM_VMC+"/macro/basiclibs.C");
8 basiclibs();
9
10 // Load PAMELA libs
11 TString PAMLIB=gSystem->Getenv("PAM_LIB");
12 gSystem->Load(PAMLIB+"/libyoda.so");
13 gSystem->Load(PAMLIB+"/libDarthVader.so");
14 gSystem->Load(PAMLIB+"/libPamLevel2.so");
15
16 // Load Geant4 libraries
17 gROOT->LoadMacro(PAM_VMC+"/macro/PamG4Libs.C");
18 PamG4Libs();
19
20 // Load application library
21 gSystem->Load(PAM_VMC+"/lib/tgt_"+PLAT+"/libPamVMC_fc");
22
23 // MC application
24 PamVMCApplication* appl
25 = new PamVMCApplication("PAMG4_VMC", "PAMELA GEANT4 VMC application","nik1");
26
27 //verbose level (0-4), 0 means no verbose
28 appl->SetVerboseLevel(0);
29
30 //initialise physycs with specific RunConfiguration, defined in macro
31 appl->InitMC(PAM_VMC+"/config/g4Config.C");
32
33
34 //additional flags and controls related to G4 core
35 ((TGeant4*)gMC)->ProcessGeantMacro(PAM_VMC+"/config/g4config2.in");
36
37
38 //maximum allowed steps per track, default 30000
39 ((TGeant4*)gMC)->SetMaxNStep(50000);
40
41 //define particle. Important. Is shold be done before any
42 //definition of energy or momentum
43 appl->GetPrimaryGenerator()->SetParticle(1000020040);
44
45 //define direction, theta, phi (radians)
46 appl->GetPrimaryGenerator()->SetDirection(-TMath::Pi()/180.*0.,
47 TMath::Pi()/90.*0.);
48
49 //define total kinetic energy (GeV)
50 appl->GetPrimaryGenerator()->SetKinEnergy(8.);
51
52 //define initial position in PAMELA reference system
53 appl->GetPrimaryGenerator()->SetPosition(2.,2.,120.);
54
55
56 //run MC in loop and visualize for 1 evnent
57 for (Int_t i=0; i<11; i++){
58 if (i==10) ((TGeant4*)gMC)->ProcessGeantMacro(PAM_VMC+"/config/g4vis.in");
59 appl->RunMC(1);
60 }
61
62 //Starting Geant-4 interface if needed
63 //((TGeant4*)gMC)->StartGeantUI();
64
65 // finish run, write output files
66 appl->FinishRun();
67 delete appl;
68 }

  ViewVC Help
Powered by ViewVC 1.1.23