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_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 |
|
|
appl->InitMC(configMacro); |
39 |
|
|
|
40 |
|
|
// Customise Geant4 setting after initialization: |
41 |
|
|
// Physics list |
42 |
|
|
// gMC->SetCut("CUTGAM", 1.0e-6); |
43 |
|
|
// gMC->SetCut("BCUTE", 1.0e-6); |
44 |
|
|
// gMC->SetCut("CUTELE", 1.0e-6); |
45 |
|
|
// gMC->SetCut("DCUTE", 1.0e-6); |
46 |
|
|
// gMC->SetCut("CUTNEU", 1.0e-6); |
47 |
|
|
// gMC->SetCut("CUTHAD", 1.0e-6); |
48 |
|
|
// gMC->SetCut("CUTMUO", 1.0e-6); |
49 |
|
|
// gMC->SetCut("DCUTM", 1.0e-6); |
50 |
|
|
// gMC->SetCut("BCUTM", 1.0e-6); |
51 |
|
|
// gMC->SetCut("PPCUTM", 1.0e-6); |
52 |
|
|
// gMC->SetCut("TOFMAX", 1.0e-3); |
53 |
|
|
|
54 |
|
|
((TGeant4*)gMC)->ProcessGeantMacro("g4config2.in"); |
55 |
|
|
// Visualization settings |
56 |
|
|
// ((TGeant4*)gMC)->ProcessGeantMacro("g4vis.in"); |
57 |
|
|
|
58 |
|
|
((TGeant4*)gMC)->SetMaxNStep(50000); |
59 |
|
|
//appl->GetPrimaryGenerator()->SetParticle(1000060120); |
60 |
|
|
appl->GetPrimaryGenerator()->SetParticle(kElectron); |
61 |
|
|
appl->GetPrimaryGenerator()->SetDirection(0.,0.); |
62 |
|
|
appl->GetPrimaryGenerator()->SetKinEnergy(1.); |
63 |
|
|
//appl->GetPrimaryGenerator()->SetRigidity(1.0); //GV |
64 |
|
|
appl->GetPrimaryGenerator()->SetPosition(1.,1.,130.); |
65 |
|
|
// Run MC |
66 |
|
|
for (Int_t i=0; i<100; i++){ |
67 |
|
|
cout<<"Event "<<i<<endl; |
68 |
|
|
// appl->GetPrimaryGenerator()->GenPosition(-22.4,22.4, -18.5, 18.5, 110.0,110.0); |
69 |
|
|
//appl->GetPrimaryGenerator()->GenDirection(0.,TMath::Pi()/2.,0.,2*TMath::Pi()); |
70 |
|
|
//appl->GetPrimaryGenerator()->GenSpe(1.,5.,-2.75); |
71 |
|
|
// appl->GetPrimaryGenerator()->Print(); |
72 |
|
|
// if (i==9) ((TGeant4*)gMC)->ProcessGeantMacro("g4vis.in"); |
73 |
|
|
appl->RunMC(1); |
74 |
|
|
|
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
appl->FinishRun(); |
78 |
|
|
// ((TGeant4*)gMC)->StartGeantUI(); |
79 |
|
|
delete appl; |
80 |
|
|
|
81 |
|
|
} |