LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
examplePar01.cc File Reference

Main program of the Par01 example. More...

#include "Par01DetectorConstruction.hh"
#include "Par01ParallelWorldForPion.hh"
#include "FTFP_BERT.hh"
#include "G4FastSimulationPhysics.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "Par01ActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the Par01 example.

Definition in file examplePar01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 76 of file examplePar01.cc.

References Initialize().

77 {
78  //-------------------------------
79  // Initialization of Run manager
80  //-------------------------------
81 #ifdef G4MULTITHREADED
82  G4MTRunManager * runManager = new G4MTRunManager;
83  runManager->SetNumberOfThreads(4);
84  G4cout<<"+-------------------------------------------------------+"<<G4endl;
85  G4cout<<"| Constructing MT run manager |"<<G4endl;
86  G4cout<<"+-------------------------------------------------------+"<<G4endl;
87 #else
88  G4RunManager * runManager = new G4RunManager;
89  G4cout<<"+-------------------------------------------------------+"<<G4endl;
90  G4cout<<"| Constructing sequential run manager |"<<G4endl;
91  G4cout<<"+-------------------------------------------------------+"<<G4endl;
92 #endif
93 
94  // -----------------------------------------------------
95  // -- Detector/mass geometry and parallel geometry(ies):
96  // -----------------------------------------------------
97  // -- Mass geometry (ie : standard geometry):
98  G4VUserDetectorConstruction* detector = new Par01DetectorConstruction();
99  // -- Parallel geometry for pion parameterisation
100  detector->RegisterParallelWorld(new Par01ParallelWorldForPion("pionGhostWorld"));
101  // -- Passed to the run manager:
102  runManager->SetUserInitialization(detector);
103 
104  // ----------------------------------------------
105  // -- PhysicsList and fast simulation activation:
106  // ----------------------------------------------
107  // -- Create a physics list (note : FTFP_BERT is a G4VModularPhysicsList
108  // -- which allows to use the subsequent G4FastSimulationPhysics tool to
109  // -- activate the fast simulation):
110  FTFP_BERT* physicsList = new FTFP_BERT;
111  // -- Create helper tool, used to activate the fast simulation:
112  G4FastSimulationPhysics* fastSimulationPhysics = new G4FastSimulationPhysics();
113  fastSimulationPhysics->BeVerbose();
114  // -- activation of fast simulation for particles having fast simulation models
115  // -- attached in the mass geometry:
116  fastSimulationPhysics->ActivateFastSimulation("e-");
117  fastSimulationPhysics->ActivateFastSimulation("e+");
118  fastSimulationPhysics->ActivateFastSimulation("gamma");
119  // -- activation of fast simulation for particles having fast simulation models
120  // -- attached in the parallel geometry:
121  fastSimulationPhysics->ActivateFastSimulation("pi+","pionGhostWorld");
122  fastSimulationPhysics->ActivateFastSimulation("pi-","pionGhostWorld");
123  // -- Attach the fast simulation physics constructor to the physics list:
124  physicsList->RegisterPhysics( fastSimulationPhysics );
125  // -- Finally passes the physics list to the run manager:
126  runManager->SetUserInitialization(physicsList);
127 
128  //-------------------------------
129  // UserAction classes
130  //-------------------------------
131  runManager->SetUserInitialization( new Par01ActionInitialization );
132 
133  // Initialize Run manager
134  runManager->Initialize();
135 
136  //----------------
137  // Visualization:
138  //----------------
139 #ifdef G4VIS_USE
140  G4cout << "Instantiating Visualization Manager......." << G4endl;
141  G4VisManager* visManager = new G4VisExecutive;
142  visManager -> Initialize ();
143 #endif
144 
145  if(argc==1)
146  {
147  //--------------------------
148  // Define (G)UI
149  //--------------------------
150 #ifdef G4UI_USE
151  G4UIExecutive * ui = new G4UIExecutive(argc, argv);
152  ui->SessionStart();
153  delete ui;
154 #endif
155  }
156  else
157  {
158  G4String command = "/control/execute ";
159  G4String fileName = argv[1];
160  G4UImanager * UImanager = G4UImanager::GetUIpointer();
161  UImanager->ApplyCommand(command+fileName);
162  }
163 
164  // Free the store: user actions, physics_list and detector_description are
165  // owned and deleted by the run manager, so they should not
166  // be deleted in the main() program !
167 
168 #ifdef G4VIS_USE
169  delete visManager;
170 #endif
171  delete runManager;
172 
173  return 0;
174 }
void Initialize()
Definition: errprop.cc:101