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