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

Annotation of /PamVMC_update/examples/run_g4_test.C

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Tue Oct 15 15:51:35 2013 UTC (11 years, 1 month ago) by formato
Branch: MAIN, rel
CVS Tags: reltag, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
PamVMC update

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

  ViewVC Help
Powered by ViewVC 1.1.23