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

Contents of /PamVMC/examples/run_fluka_GP.C

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Jun 12 18:39:14 2009 UTC (15 years, 9 months ago) by pam-rm2
Branch: MAIN
Changes since 1.2: +0 -0 lines
File MIME type: text/plain
- Introduced user-defined names of output files and random seeds number.
Users can do it use options of PamVMCApplication constructor:
PamVMCApplication(const char* name,  const char *title, const char*
filename="pamtest", Int_t seed=0).
The Random object that I use is TRandom3 object which has astronomical
large period (in case of default initialization 0). All random generators
in the code use this object by calling of gRandom singleton which keeps
it.

- Corrected TOF digitization routine. No problems with TDC hits due to
hadronic interactions anymore.

- Some small changes was done to compile code under Root 5.23. +
geant4_vmc v. 2.6 without any warnings

- Some classes of PamG4RunConfiguartion was changed for geant4_vmc v.
2.6.Some obsolete classes was deleted as soon as developers implemented
regions.

- Navigation was changed from "geomRootToGeant4" to "geomRoot", because on
VMC web page written that as soon as Geant4 has no option ONLY/MANY
translation of overlapped geometry to Geant4 through VGM could be wrong.
I'd like to stay with Root navigation:
http://root.cern.ch/root/vmc/Geant4VMC.html. This should be default
option.

- New Tracker digitization routine written by Sergio was implemented

- PamVMC again became compatible with geant4_vmc v.2.5 and ROOT 5.20.
 The problem was that ROOT developers introduced in TVirtualMC class a new
method SetMagField and new base class:TVirtualMagField from which
user-defined classes shoukd be derived

1 // $Id: run_g4.C,v 1.0 2007/06/01
2 //
3 // Macro for running G4PAM_VMC with
4 class TFluka;
5
6 void run_fluka_GP(const TString& configMacro = "flukaConfig.C")
7 {
8 // Load basic libraries
9 gROOT->LoadMacro("../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
19 // Load TFluka libraries
20 gSystem->Load("/home/nikolas/francesco/vmc/fluka_vmc/lib/tgt_linux/libfluka");
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("PAMFLUKA_VMC", "PAMELA GEANT4 VMC application");
29
30
31 appl->SetVerboseLevel(1);
32
33
34 // Initialize MC
35
36 appl->InitMC(configMacro);
37 // appl->SetVerboseLevel(1);
38
39 // Run MC
40
41
42 //START READING INPUT FILE
43
44 Int_t Ipa;
45 Float_t X0, Y0, Z0, Theta, Phi, P0;
46 TTree * h20 = 0;
47
48 TString Filename = "pbar_r3_1-2.Beam.root";
49
50 TString HOME=gSystem->Getenv("HOME");
51
52 TSystemDirectory *readdir=new TSystemDirectory("readdir",HOME+"/RES");
53
54 if ((TList*)(readdir->GetListOfFiles())->FindObject(Filename) ){
55 cout<< Filename<<" found..."<<endl;
56 TFile* inpf = new TFile(HOME+"/RES/"+Filename);
57 h20 = (TTree*)inpf->Get("h20");
58 if (h20->GetBranch("Ipa")){
59 h20->SetBranchAddress("Ipa",&Ipa);
60 h20->SetBranchStatus("Ipa",1);
61 }
62 if (h20->GetBranch("X0")){
63 h20->SetBranchAddress("X0",&X0);
64 h20->SetBranchStatus("X0",1);
65 }
66 if (h20->GetBranch("Y0")){
67 h20->SetBranchAddress("Y0",&Y0);
68 h20->SetBranchStatus("Y0",1);
69 }
70 if (h20->GetBranch("Z0")){
71 h20->SetBranchAddress("Z0",&Z0);
72 h20->SetBranchStatus("Z0",1);
73 }
74 if (h20->GetBranch("P0")){
75 h20->SetBranchAddress("P0",&P0);
76 h20->SetBranchStatus("P0",1);
77 }
78 if (h20->GetBranch("Theta")){
79 h20->SetBranchAddress("Theta",&Theta);
80 h20->SetBranchStatus("Theta",1);
81 }
82 if (h20->GetBranch("Phi")){
83 h20->SetBranchAddress("Phi",&Phi);
84 h20->SetBranchStatus("Phi",1);
85 }
86 }
87 Int_t nevents = (Int_t)h20->GetEntries();
88
89 // nevents = 15;
90 cout<<"PROCESS "<<nevents<<" EVENTS"<<endl;
91
92 Double_t PX, PY, PZ;
93 Int_t runNo = 0;
94 for (Int_t i=0; i<nevents; i++){
95 h20->GetEntry(i);
96 cout<<"Ipa="<<Ipa<<endl;
97 appl->GetPrimaryGenerator()->SetParticle(kProtonBar);
98 appl->GetPrimaryGenerator()->SetMomentum(P0);
99 cout<<"EKIN "<<appl->GetPrimaryGenerator()->GetKinEnergy()<<" GeV"<<endl;
100 //cout<<"applP0="<<appl->GetPrimaryGenerator()->GetMomentum()<<" GV"<<endl;
101 cout<<"applRIG "<<appl->GetPrimaryGenerator()->GetRigidity()<<" GV"<<endl
102 PX=P0*sin(Theta)*cos(Phi);
103 PY=P0*sin(Theta)*sin(Phi);
104 PZ=-P0*cos(Theta);
105 cout<<"(PX0,PY0,PZ0)="<<PX<<","<<PY<<","<<PZ<<endl;
106 appl->GetPrimaryGenerator()->SetDirection(Theta,Phi);
107 cout<<"(X0,Y0,Z0)"<<X0<<","<<Y0<<","<<Z0<<endl;
108 appl->GetPrimaryGenerator()->SetPosition(X0,Y0,Z0);
109
110 cout<<">StartRUN: "<<runNo<<endl;
111 runNo++;
112
113 appl->RunMC(1);
114
115 }
116
117
118
119
120 appl->FinishRun();
121 delete appl;
122
123 // return
124
125 }

  ViewVC Help
Powered by ViewVC 1.1.23