| 1 |
pam-rm2 |
1.5 |
void run_g4_test() { |
| 2 |
|
|
|
| 3 |
|
|
TString PAM_VMC=gSystem->Getenv("PAM_VMC"); |
| 4 |
|
|
TString PLAT=gSystem->Getenv("PLATFORM"); |
| 5 |
nikolas |
1.1 |
|
| 6 |
|
|
// Load basic libraries |
| 7 |
pam-rm2 |
1.5 |
gROOT->LoadMacro(PAM_VMC+"/macro/basiclibs.C"); |
| 8 |
nikolas |
1.1 |
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 |
pam-rm2 |
1.5 |
gROOT->LoadMacro(PAM_VMC+"/macro/PamG4Libs.C"); |
| 18 |
nikolas |
1.1 |
PamG4Libs(); |
| 19 |
pam-rm2 |
1.5 |
|
| 20 |
|
|
// Load application library |
| 21 |
|
|
gSystem->Load(PAM_VMC+"/lib/tgt_"+PLAT+"/libPamVMC_fc"); |
| 22 |
|
|
|
| 23 |
nikolas |
1.1 |
// MC application |
| 24 |
|
|
PamVMCApplication* appl |
| 25 |
pam-rm2 |
1.5 |
= new PamVMCApplication("PAMG4_VMC", "PAMELA GEANT4 VMC application","nik1"); |
| 26 |
|
|
|
| 27 |
|
|
//verbose level (0-4), 0 means no verbose |
| 28 |
|
|
appl->SetVerboseLevel(0); |
| 29 |
nikolas |
1.1 |
|
| 30 |
pam-rm2 |
1.5 |
//initialise physycs with specific RunConfiguration, defined in macro |
| 31 |
|
|
appl->InitMC(PAM_VMC+"/config/g4Config.C"); |
| 32 |
nikolas |
1.1 |
|
| 33 |
|
|
|
| 34 |
pam-rm2 |
1.5 |
//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 |
nikolas |
1.1 |
} |
| 61 |
|
|
|
| 62 |
pam-rm2 |
1.5 |
//Starting Geant-4 interface if needed |
| 63 |
|
|
//((TGeant4*)gMC)->StartGeantUI(); |
| 64 |
|
|
|
| 65 |
|
|
// finish run, write output files |
| 66 |
|
|
appl->FinishRun(); |
| 67 |
|
|
delete appl; |
| 68 |
|
|
} |