source: trunk/examples/advanced/lAr_calorimeter/lArCal.cc @ 1304

Last change on this file since 1304 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 4.9 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// $Id: lArCal.cc,v 1.12 2009/11/12 12:43:14 ribon Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29//
30// --------------------------------------------------------------
31//      GEANT 4 - exampleN03
32//
33//      For information related to this code contact:
34//      CERN, IT Division, ASD Group
35// --------------------------------------------------------------
36// Comments
37//
38// --------------------------------------------------------------
39
40#include "G4RunManager.hh"
41#include "G4UImanager.hh"
42#include "G4UIterminal.hh"
43
44#ifdef G4UI_USE_XM
45#include "G4UIXm.hh"
46#endif
47
48#include "Randomize.hh"
49
50#ifdef G4VIS_USE
51#include "G4VisExecutive.hh"
52#endif
53
54#include "FCALTestbeamSetup.hh"
55#include "FCALSteppingVerbose.hh"
56#include "FCALPrimaryGeneratorAction.hh"
57#include "LHEP.hh"
58#include "QGSP.hh"
59#include "QGSC.hh"
60#include "QGSP_BIC_EMY.hh"
61
62
63#ifdef G4ANALYSIS_USE
64
65#include "FCALRunAction.hh"
66#include "FCALTBEventAction.hh"
67#include "FCALSteppingAction.hh"
68
69#endif
70
71
72int main(int argc,char** argv) {
73
74  // choose the Random engine
75  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
76 
77  //my Verbose output class
78  G4VSteppingVerbose::SetInstance(new FCALSteppingVerbose);
79     
80  // Construct the default run manager
81  G4RunManager * runManager = new G4RunManager;
82
83  // set mandatory initialization classes
84  FCALTestbeamSetup* detector = new FCALTestbeamSetup;
85  runManager->SetUserInitialization(detector);
86
87  //***LOOKHERE*** CHOOSE THE PHYSICS LIST.
88  // runManager->SetUserInitialization(new LHEP);     // LHEP     
89  // runManager->SetUserInitialization(new QGSP);     // QGSP   
90  // runManager->SetUserInitialization(new QGSC);     // QGSC
91  runManager->SetUserInitialization(new QGSP_BIC_EMY);     // QGSP_BIC_EMY   
92  //***endLOOKHERE***
93 
94 G4UIsession* session=0;
95 
96  if (argc==1)   // Define UI session for interactive mode.
97    {
98      // G4UIterminal is a (dumb) terminal.
99#ifdef G4UI_USE_XM
100      session = new G4UIXm(argc,argv);
101#else
102      session = new G4UIterminal;
103#endif
104    }
105 
106#ifdef G4VIS_USE
107  // visualization manager
108  G4VisManager* visManager = new G4VisExecutive;
109  visManager->Initialize();
110#endif
111   
112  // set user action classes
113  runManager->SetUserAction(new FCALPrimaryGeneratorAction());
114
115#ifdef G4ANALYSIS_USE
116
117  FCALRunAction* RunAction = new FCALRunAction;
118  runManager ->SetUserAction(RunAction);
119
120  FCALSteppingAction* StepAction = new FCALSteppingAction;
121  runManager->SetUserAction(StepAction);
122
123  //  runManager->SetUserAction(new FCALRunAction);
124 
125  runManager->SetUserAction(new FCALTBEventAction(StepAction));
126 
127 
128#endif
129
130  //Initialize G4 kernel
131  runManager->Initialize();
132   
133  // get the pointer to the User Interface manager
134  G4UImanager* UI = G4UImanager::GetUIpointer(); 
135
136  if (session)   // Define UI session for interactive mode.
137    {
138      // G4UIterminal is a (dumb) terminal.
139      //      UI->ApplyCommand("/control/execute prerunlArcal.mac");   
140#ifdef G4UI_USE_XM
141      // Customize the G4UIXm menubar with a macro file :
142      UI->ApplyCommand("/control/execute gui.mac");
143#endif
144      session->SessionStart();
145      delete session;
146    }
147  else           // Batch mode
148    { 
149      G4String command = "/control/execute ";
150      G4String fileName = argv[1];
151      UI->ApplyCommand(command+fileName);
152    }
153
154  // job termination
155#ifdef G4VIS_USE
156  delete visManager;
157#endif
158  delete runManager;
159
160  return 0;
161}
162
Note: See TracBrowser for help on using the repository browser.