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

Annotation of /PamVMC/examples/run_g4_test.C

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Thu Feb 19 17:39:48 2009 UTC (15 years, 9 months ago) by nikolas
Branch: MAIN
Changes since 1.1: +4 -4 lines
File MIME type: text/plain
Cleaning up before releasing

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_test(const TString& configMacro = "g4Config.C") {
5    
6     // Load basic libraries
7 nikolas 1.2 gROOT->LoadMacro("../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    
18 nikolas 1.2 gROOT->LoadMacro("../macro/PamG4Libs.C");
19 nikolas 1.1 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_fc");
25    
26     // MC application
27     PamVMCApplication* appl
28     = new PamVMCApplication("PAMG4_VMC", "PAMELA GEANT4 VMC application");
29    
30     appl->GetPrimaryGenerator()->SetNofPrimaries(1);
31    
32    
33     // Initialize MC
34     appl->InitMC(configMacro);
35 nikolas 1.2 ((TGeant4*)gMC)->ProcessGeantMacro("../macro/g4config2.in");
36 nikolas 1.1
37     #define EVENTS 5000
38    
39     #define RMIN 1.0
40     #define RMAX 2.0
41    
42     #define X0 0.
43     #define Y0 0.
44     #define Z0 110.
45    
46     #define DX 10.0
47     #define DY 10.0
48    
49     #define PX 0.
50     #define PY 0.
51     //#define PEEE -1.
52    
53     #define DPX 0.1
54     #define DPY 0.1
55     #define DPZ 0.1
56    
57     TRandom3 r(123456);
58     TRandom3 dprx(123);
59     TRandom3 dpry(456);
60     TRandom3 dprz(321);
61     TRandom3 drx(132);
62     TRandom3 dry(465);
63    
64     for (Int_t i=0; i<EVENTS; i++){
65     Double_t rig = r.Uniform(RMIN,RMAX);
66     appl->GetPrimaryGenerator()->SetRigidity(rig);
67    
68     Double_t dpx = dprx.Uniform(-DPX,DPX);
69     Double_t dpy = dpry.Uniform(-DPY,DPY);
70     Double_t dpz = dprz.Uniform(-DPZ,DPZ);
71     appl->GetPrimaryGenerator()->SetDirection(PX+dpx,PY+dpy,-1.0+dpz);
72    
73     Double_t dx = drx.Uniform(-DX,DX);
74     Double_t dy = dry.Uniform(-DY,DY);
75    
76     appl->GetPrimaryGenerator()->SetPosition(X0+dx,Y0+dy,Z0);
77     appl->RunMC(1);
78     }
79    
80     // Visualization settings
81 nikolas 1.2 // ((TGeant4*)gMC)->ProcessGeantMacro("../macro/g4vis.in");
82 nikolas 1.1
83     // Run MC
84     // appl->RunMC(1000);
85     appl->FinishRun();
86     // ((TGeant4*)gMC)->StartGeantUI();
87     // delete appl;
88    
89     }

  ViewVC Help
Powered by ViewVC 1.1.23