QwGeant4
QweakSimG4.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "G4Version.hh"
#include "G4StepLimiterBuilder.hh"
#include "G4OpticalPhysics.hh"
#include "G4PhysListFactory.hh"
#include "G4VModularPhysicsList.hh"
#include "G4UIExecutive.hh"
#include "QweakSimUserInformation.hh"
#include "QweakSimDetectorConstruction.hh"
#include "QweakSimPrimaryGeneratorAction.hh"
#include "QweakSimRunAction.hh"
#include "QweakSimEventAction.hh"
#include "QweakSimStackingAction.hh"
#include "QweakSimSteppingAction.hh"
#include "QweakSimTrackingAction.hh"
#include "QweakSimSteppingVerbose.hh"
#include "QweakSimAnalysis.hh"
#include "QweakSimEPEvent.hh"
+ Include dependency graph for QweakSimG4.cc:

Go to the source code of this file.

Macros

#define USE_CUSTOM_NUCLEAR_SCATTERING   0
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Revision:
1.2
Date:
2005/12/27 19:09:32
Author
Klaus Hans Grimm

Definition in file QweakSimG4.cc.

Macro Definition Documentation

#define USE_CUSTOM_NUCLEAR_SCATTERING   0

Definition at line 63 of file QweakSimG4.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 71 of file QweakSimG4.cc.

71  {
72 
73  // Verbose output class
74  //G4VSteppingVerbose::SetInstance( new QweakSimSteppingVerbose() );
75 
76  // Run manager
77  G4RunManager * runManager = new G4RunManager();
78 
79  // UserInitialization classes (mandatory)
80  QweakSimUserInformation* myQweakSimUserInformation = new QweakSimUserInformation();
81  QweakSimDetectorConstruction* myQweakSimExperiment = new QweakSimDetectorConstruction(myQweakSimUserInformation);
82  QweakSimAnalysis* myQweakSimAnalysis = new QweakSimAnalysis(myQweakSimUserInformation);
83 
84 //jpan@nuclear.uwinnipeg.ca
85  QweakSimEPEvent* myEPEvent = new QweakSimEPEvent(myQweakSimUserInformation);
86 
87  runManager->SetUserInitialization(myQweakSimExperiment);
88 
89 
90  // Calls a reference physics list for the simulation
91  G4PhysListFactory factory;
92  G4VModularPhysicsList* physlist = factory.GetReferencePhysList("QGSP_BERT_LIV");
93  physlist->RegisterPhysics(new G4OpticalPhysics());
94  #if G4VERSION_NUMBER < 1000
95  physlist->RegisterPhysics(new G4StepLimiterBuilder());
96  #else
97  physlist->RegisterPhysics(new G4StepLimiterPhysics());
98  #endif
99  // Replace the standard EM with the customized version to add Pb A_T
100  #if USE_CUSTOM_NUCLEAR_SCATTERING
101  physlist->ReplacePhysics(new QweakSimEmLivermorePhysics());
102  #endif
103 
104  runManager->SetUserInitialization(physlist);
105 
106  // Original Qweak Physics List, uncomment to use and add correct #include lines
107  //runManager->SetUserInitialization(new QweakSimPhysicsList() );
108 
109  // UserAction classes
110  runManager->SetUserAction( new QweakSimPrimaryGeneratorAction(myQweakSimUserInformation, myEPEvent) );
111  //runManager->SetUserAction( new QweakSimPrimaryGeneratorAction( ) );
112  runManager->SetUserAction( new QweakSimSteppingAction(myQweakSimUserInformation, myEPEvent));
113  runManager->SetUserAction( new QweakSimStackingAction() );
114  runManager->SetUserAction( new QweakSimTrackingAction(myQweakSimUserInformation) );
115  runManager->SetUserAction( new QweakSimEventAction(myQweakSimAnalysis, myQweakSimUserInformation) );
116  runManager->SetUserAction( new QweakSimRunAction(myQweakSimAnalysis) );
117 
118  runManager->StoreRandomNumberStatusToG4Event(1);
119 
120  //Initialize G4 kernel
121  runManager->Initialize();
122  G4UIsession* session = 0;
123 
124  if (argc==1) // Define UI session for interactive mode.
125  {
126 
127  // G4UIterminal is a (dumb) terminal.
128  #if defined(G4UI_USE_QT)
129  session = new G4UIQt(argc,argv);
130  #elif defined(G4UI_USE_XM)
131  session = new G4UIXm(argc,argv);
132  #elif defined(G4UI_USE_WIN32)
133  session = new G4UIWin32();
134  #elif defined(G4UI_USE_TCSH)
135  session = new G4UIterminal(new G4UItcsh);
136  #else
137  session = new G4UIterminal();
138  #endif
139 
140  }
141 
142 
143 #ifdef G4VIS_USE
144  // Visualization, if you choose to have it!
145  //
146  // Simple graded message scheme - give first letter or a digit:
147  // 0) quiet, // Nothing is printed.
148  // 1) startup, // Startup and endup messages are printed...
149  // 2) errors, // ...and errors...
150  // 3) warnings, // ...and warnings...
151  // 4) confirmations, // ...and confirming messages...
152  // 5) parameters, // ...and parameters of scenes and views...
153  // 6) all // ...and everything available.
154 
155  G4VisManager* visManager = new G4VisExecutive;
156  //visManager -> SetVerboseLevel (1);
157  visManager ->Initialize();
158 #endif
159 
160 
161  //get the pointer to the User Interface manager
162  G4UImanager * UI = G4UImanager::GetUIpointer();
163 
164  if (session) // Define UI session for interactive mode.
165  {
166  // G4UIterminal is a (dumb) terminal.
167  //UI->ApplyCommand("/control/execute myVis.mac");
168 
169 #if defined(G4UI_USE_XM) || defined(G4UI_USE_WIN32) || defined(G4UI_USE_QT)
170  // Customize the G4UIXm,Win32 menubar with a macro file :
171  UI->ApplyCommand("/control/execute gui.mac");
172 #endif
173 
174  session->SessionStart();
175  delete session;
176  }
177  else // Batch mode
178  {
179 #ifdef G4VIS_USE
180  visManager->SetVerboseLevel("quiet");
181 #endif
182  G4String command = "/control/execute ";
183  G4String fileName = argv[1];
184  UI->ApplyCommand(command+fileName);
185  }
186 
187 
188 
189 #ifdef G4VIS_USE
190  delete visManager;
191 #endif
192 
193  delete runManager;
194  delete myEPEvent;
195 
196  return 0;
197 }
main class of QweakSim. All experiment components are are placed here.
Deal with primary particle generation and inject it in the detector.
Adds additional information to primary/secondary track before track starts stepping.
Defines actions at the beginning and the end of run.
Handling of the output ROOT file.
Mainly filling/storing the hit event structure at the end of an event.