| 1 | nikolas | 1.1 | #include "TROOT.h" | 
| 2 |  |  | #include "TVirtualMC.h" | 
| 3 |  |  | #include "TGeant4.h" | 
| 4 |  |  | #include "TString.h" | 
| 5 |  |  | #include "PamVMCApplication.h" | 
| 6 |  |  |  | 
| 7 |  |  | #include <iostream> | 
| 8 |  |  | // $Id: run_g4.C,v 1.0 2007/06/01 | 
| 9 |  |  | // | 
| 10 |  |  | // Macro for running G4PAM_VMC with Geant4. | 
| 11 |  |  |  | 
| 12 |  |  | using std::cout; | 
| 13 |  |  | using std::endl; | 
| 14 |  |  |  | 
| 15 |  |  | //void run_g4(const TString& configMacro = "g4Config.C") | 
| 16 |  |  | int main(){ | 
| 17 |  |  | TROOT nik("Nikolay","Nikonov"); | 
| 18 |  |  |  | 
| 19 |  |  | TString configMacro = "g4Config.C"; | 
| 20 |  |  | // Load basic libraries | 
| 21 |  |  | gROOT->LoadMacro("./macro/basiclibs.C"); | 
| 22 |  |  | basiclibs(); | 
| 23 |  |  |  | 
| 24 |  |  | // Load PAMELA libs | 
| 25 |  |  | TString PAMLIB=gSystem->Getenv("PAM_LIB"); | 
| 26 |  |  | gSystem->Load(PAMLIB+"/libyoda.so"); | 
| 27 |  |  | gSystem->Load(PAMLIB+"/libDarthVader.so"); | 
| 28 |  |  | gSystem->Load(PAMLIB+"/libPamLevel2.so"); | 
| 29 |  |  |  | 
| 30 |  |  | // Load Geant4 libraries | 
| 31 |  |  |  | 
| 32 |  |  | gROOT->LoadMacro("./macro/PamG4Libs.C"); | 
| 33 |  |  | PamG4Libs(); | 
| 34 |  |  |  | 
| 35 |  |  | // Load this example libraries | 
| 36 |  |  | TString G4WD=gSystem->Getenv("G4WORKDIR"); | 
| 37 |  |  | TString PLAT=gSystem->Getenv("PLATFORM"); | 
| 38 |  |  | gSystem->Load(G4WD+"/lib/tgt_"+PLAT+"/libPamVMC"); | 
| 39 |  |  |  | 
| 40 |  |  | // MC application | 
| 41 |  |  | PamVMCApplication* appl | 
| 42 |  |  | = new PamVMCApplication("PAMG4_VMC", "PAMELA GEANT4 VMC application"); | 
| 43 |  |  |  | 
| 44 |  |  | appl->GetPrimaryGenerator()->SetNofPrimaries(1); | 
| 45 |  |  | appl->SetVerboseLevel(1); | 
| 46 |  |  |  | 
| 47 |  |  | // Macro to run with primary = polarized optical photon | 
| 48 |  |  | //gROOT->LoadMacro("optPhoton.C"); | 
| 49 |  |  | //optPhoton(); | 
| 50 |  |  |  | 
| 51 |  |  | // Initialize MC | 
| 52 |  |  | appl->InitMC(configMacro); | 
| 53 |  |  |  | 
| 54 |  |  | // Customise Geant4 setting after initialization: | 
| 55 |  |  | // Physics list | 
| 56 |  |  | ((TGeant4*)gMC)->ProcessGeantMacro("g4config2.in"); | 
| 57 |  |  | // Visualization settings | 
| 58 |  |  | //   ((TGeant4*)gMC)->ProcessGeantMacro("g4vis.in"); | 
| 59 |  |  |  | 
| 60 |  |  | // Run MC | 
| 61 |  |  | appl->RunMC(5000); | 
| 62 |  |  | appl->FinishRun(); | 
| 63 |  |  | delete appl; | 
| 64 |  |  | return 0; | 
| 65 |  |  | } |