1 |
// $Id: run_g4.C,v 1.0 2007/06/01 |
2 |
// |
3 |
// Macro for running G4PAM_VMC with Geant4. |
4 |
void run_g4_testTRK(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_fc"); |
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(0); |
32 |
|
33 |
// Macro to run with primary = polarized optical photon |
34 |
//gROOT->LoadMacro("optPhoton.C"); |
35 |
//optPhoton(); |
36 |
appl->SetVerboseLevel(2); |
37 |
// Initialize MC |
38 |
TString G4ConfMacro=G4WD+"/config/"+configMacro; |
39 |
appl->InitMC(G4ConfMacro); |
40 |
// appl->InitMC(configMacro); |
41 |
|
42 |
// Customise Geant4 setting after initialization: |
43 |
// Physics list |
44 |
// gMC->SetCut("CUTGAM", 1.0e-6); |
45 |
// gMC->SetCut("BCUTE", 1.0e-6); |
46 |
// gMC->SetCut("CUTELE", 1.0e-6); |
47 |
// gMC->SetCut("DCUTE", 1.0e-6); |
48 |
// gMC->SetCut("CUTNEU", 1.0e-6); |
49 |
// gMC->SetCut("CUTHAD", 1.0e-6); |
50 |
// gMC->SetCut("CUTMUO", 1.0e-6); |
51 |
// gMC->SetCut("DCUTM", 1.0e-6); |
52 |
// gMC->SetCut("BCUTM", 1.0e-6); |
53 |
// gMC->SetCut("PPCUTM", 1.0e-6); |
54 |
// gMC->SetCut("TOFMAX", 1.0e-3); |
55 |
|
56 |
((TGeant4*)gMC)->ProcessGeantMacro(G4WD+"/config/g4config2.in"); |
57 |
// Visualization settings |
58 |
// ((TGeant4*)gMC)->ProcessGeantMacro(G4WD+"/config/g4vis.in"); |
59 |
|
60 |
((TGeant4*)gMC)->SetMaxNStep(50000); |
61 |
//appl->GetPrimaryGenerator()->SetParticle(1000060120); |
62 |
appl->GetPrimaryGenerator()->SetParticle(kElectron); |
63 |
appl->GetPrimaryGenerator()->SetDirection(0.,0.); |
64 |
appl->GetPrimaryGenerator()->SetKinEnergy(1.); |
65 |
//appl->GetPrimaryGenerator()->SetRigidity(1.0); //GV |
66 |
appl->GetPrimaryGenerator()->SetPosition(1.,1.,130.); |
67 |
// Run MC |
68 |
for (Int_t i=0; i<100; i++){ |
69 |
cout<<"Event "<<i<<endl; |
70 |
// appl->GetPrimaryGenerator()->GenPosition(-22.4,22.4, -18.5, 18.5, 110.0,110.0); |
71 |
//appl->GetPrimaryGenerator()->GenDirection(0.,TMath::Pi()/2.,0.,2*TMath::Pi()); |
72 |
//appl->GetPrimaryGenerator()->GenSpe(1.,5.,-2.75); |
73 |
// appl->GetPrimaryGenerator()->Print(); |
74 |
// if (i==9) ((TGeant4*)gMC)->ProcessGeantMacro(G4WD+"/macro/g4vis.in"); |
75 |
appl->RunMC(1); |
76 |
|
77 |
} |
78 |
|
79 |
appl->FinishRun(); |
80 |
// ((TGeant4*)gMC)->StartGeantUI(); |
81 |
delete appl; |
82 |
|
83 |
} |