1 |
// $Id: run_g4.C,v 1.0 2007/06/01 |
2 |
// |
3 |
// Macro for running G4PAM_VMC with Geant4. |
4 |
|
5 |
void run_g4(const TString& configMacro = "g4Config.C") |
6 |
{ |
7 |
// Load basic libraries |
8 |
gROOT->LoadMacro("./macro/basiclibs.C"); |
9 |
basiclibs(); |
10 |
|
11 |
// Load PAMELA libs |
12 |
TString PAMLIB=gSystem->Getenv("PAM_LIB"); |
13 |
gSystem->Load(PAMLIB+"/libyoda.so"); |
14 |
gSystem->Load(PAMLIB+"/libDarthVader.so"); |
15 |
gSystem->Load(PAMLIB+"/libPamLevel2.so"); |
16 |
|
17 |
// Load Geant4 libraries |
18 |
|
19 |
gROOT->LoadMacro("./macro/PamG4Libs.C"); |
20 |
PamG4Libs(); |
21 |
|
22 |
// Load this example libraries |
23 |
TString G4WD=gSystem->Getenv("G4WORKDIR"); |
24 |
TString PLAT=gSystem->Getenv("PLATFORM"); |
25 |
gSystem->Load(G4WD+"/lib/tgt_"+PLAT+"/libPam_VMC"); |
26 |
|
27 |
// MC application |
28 |
PamVMCApplication* appl |
29 |
= new PamVMCApplication("PAMG4_VMC", "PAMELA GEANT4 VMC application"); |
30 |
|
31 |
appl->GetPrimaryGenerator()->SetNofPrimaries(1); |
32 |
///appl->SetVerboseLevel(3); |
33 |
|
34 |
// Macro to run with primary = polarized optical photon |
35 |
//gROOT->LoadMacro("optPhoton.C"); |
36 |
//optPhoton(); |
37 |
|
38 |
// Initialize MC |
39 |
appl->InitMC(configMacro); |
40 |
|
41 |
// Customise Geant4 setting after initialization: |
42 |
// Physics list |
43 |
((TGeant4*)gMC)->ProcessGeantMacro("g4config2.in"); |
44 |
// Visualization settings |
45 |
((TGeant4*)gMC)->ProcessGeantMacro("g4vis.in"); |
46 |
|
47 |
// Run MC |
48 |
appl->RunMC(1); |
49 |
|
50 |
delete appl; |
51 |
} |