source: trunk/examples/advanced/Rich/RichTbSim.cc@ 1295

Last change on this file since 1295 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 5.2 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Rich Test Beam Simulation Main program
27// History:
28// Created: Sajan Easo (Sajan.Easo@cern.ch)
29// Revision and changes: Patricia Mendez (Patricia.Mendez@cern.ch)
30// ----------------------------------------------------------------
31#include <iostream>
32#include "RichTbRunAction.hh"
33#include "RichTbEventAction.hh"
34#include "RichTbDetectorConstruction.hh"
35#include "RichTbPrimaryGeneratorAction.hh"
36#include "RichTbStackingAction.hh"
37#include "RichTbSteppingAction.hh"
38#include "RichTbTrackingAction.hh"
39#include "RichTbPhysicsList.hh"
40#include "G4VPhysicalVolume.hh"
41#include "G4RunManager.hh"
42#include "RichTbRunConfig.hh"
43#include "RichTbIOData.hh"
44#include "G4UImanager.hh"
45#include "G4UIterminal.hh"
46#include "QGSP_BIC_EMY.hh"
47
48#ifdef G4UI_USE_XM
49#include "G4UIXm.hh"
50#endif
51
52#include "Randomize.hh"
53
54#ifdef G4VIS_USE
55#include "G4VisExecutive.hh"
56#endif
57
58#include "G4ios.hh"
59#include <stdlib.h>
60
61
62int main(int argc,char** argv) {
63
64 // Seed the random number generator manually
65 // ------------------------------------------
66
67 G4long myseed = 345354;
68
69 CLHEP::HepRandom::setTheSeed(myseed);
70
71 // Run manager
72
73 G4RunManager * runManager = new G4RunManager;
74 //Job and Run options.
75 RichTbRunConfig* rConfig= new RichTbRunConfig();
76 // Datafile streams for input and output
77 RichTbIOData* rIOData = new RichTbIOData( rConfig );
78 RichTbDetectorConstruction* RichTbDet
79 = new RichTbDetectorConstruction(rConfig);
80
81 runManager->SetUserInitialization(RichTbDet);
82
83 //***LOOKHERE*** : Choose the Physics List
84 RichTbPhysicsList* RichTbPhy =new RichTbPhysicsList(rConfig);
85 runManager->SetUserInitialization(RichTbPhy); // Use example's Physics List
86 //runManager->SetUserInitialization(new QGSP_BIC_EMY); // Use QGSP_BIC_EMY
87
88
89// UserAction classes - optional
90
91 #ifdef G4VIS_USE
92 G4VisManager* visManager = new G4VisExecutive();
93 visManager->SetVerboseLevel(0);
94 visManager->Initialize();
95
96 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
97 G4cout<<" PVVisManager "<<pVVisManager<<G4endl;
98 G4cout<<"VisManager "<<visManager<<G4endl;
99#endif
100
101 runManager->SetUserAction(new RichTbRunAction);
102
103 RichTbPrimaryGeneratorAction* PrimaryGenAction =
104 new RichTbPrimaryGeneratorAction(RichTbDet);
105
106 runManager->SetUserAction( PrimaryGenAction );
107
108 #ifdef G4VIS_USE
109 RichTbEventAction* eventAction=new RichTbEventAction(rConfig,visManager,rIOData);
110#endif
111
112 #ifndef G4VIS_USE
113 RichTbEventAction* eventAction=new RichTbEventAction(rConfig,0,rIOData);
114#endif
115
116 runManager->SetUserAction(eventAction);
117
118 runManager->SetUserAction(new RichTbStackingAction);
119
120 RichTbSteppingAction* StepAction= new RichTbSteppingAction(rConfig, PrimaryGenAction );
121 runManager->SetUserAction(StepAction);
122
123 runManager->SetUserAction(new RichTbTrackingAction);
124
125 G4UImanager* UI = G4UImanager::GetUIpointer();
126
127 G4UIsession* session=0;
128
129 //Initialize G4 kernel
130 runManager -> Initialize();
131
132 if(argc==1){
133
134 session = new G4UIterminal;
135 }
136
137 if (session){ // Interactive mode
138
139 UI->ApplyCommand("/run/verbose 0");
140 UI->ApplyCommand("/event/verbose 0");
141 UI->ApplyCommand("/tracking/verbose 0");
142 UI->ApplyCommand("/particle/process/verbose 0");
143
144 session->SessionStart();
145 delete session;
146
147 }
148 else // Batch mode
149 {
150 G4UImanager * UI = G4UImanager::GetUIpointer();
151 G4String command = "/control/execute ";
152 G4String fileName = argv[1];
153 UI->ApplyCommand(command+fileName);
154 }
155#ifdef G4VIS_USE
156 delete visManager;
157 G4cout << "\nVisManager deleted..\n" <<G4endl;
158#endif
159
160 delete runManager;
161
162 G4cout << "\nRunManager deleted..\n" <<G4endl;
163
164 return 0;
165}
166
167
168
169
170
171
Note: See TracBrowser for help on using the repository browser.