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

Last change on this file since 1166 was 807, checked in by garnier, 16 years ago

update

File size: 4.8 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.11 2006/06/29 16:01:01 gunter Exp $
27// GEANT4 tag $Name:  $
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
61
62#ifdef G4ANALYSIS_USE
63
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  //***endLOOKHERE***
92 
93 G4UIsession* session=0;
94 
95  if (argc==1)   // Define UI session for interactive mode.
96    {
97      // G4UIterminal is a (dumb) terminal.
98#ifdef G4UI_USE_XM
99      session = new G4UIXm(argc,argv);
100#else
101      session = new G4UIterminal;
102#endif
103    }
104 
105#ifdef G4VIS_USE
106  // visualization manager
107  G4VisManager* visManager = new G4VisExecutive;
108  visManager->Initialize();
109#endif
110   
111  // set user action classes
112  runManager->SetUserAction(new FCALPrimaryGeneratorAction());
113
114#ifdef G4ANALYSIS_USE
115
116  FCALRunAction* RunAction = new FCALRunAction;
117  runManager ->SetUserAction(RunAction);
118
119  FCALSteppingAction* StepAction = new FCALSteppingAction;
120  runManager->SetUserAction(StepAction);
121
122  //  runManager->SetUserAction(new FCALRunAction);
123 
124  runManager->SetUserAction(new FCALTBEventAction(StepAction));
125 
126 
127#endif
128
129  //Initialize G4 kernel
130  runManager->Initialize();
131   
132  // get the pointer to the User Interface manager
133  G4UImanager* UI = G4UImanager::GetUIpointer(); 
134
135  if (session)   // Define UI session for interactive mode.
136    {
137      // G4UIterminal is a (dumb) terminal.
138      //      UI->ApplyCommand("/control/execute prerunlArcal.mac");   
139#ifdef G4UI_USE_XM
140      // Customize the G4UIXm menubar with a macro file :
141      UI->ApplyCommand("/control/execute gui.mac");
142#endif
143      session->SessionStart();
144      delete session;
145    }
146  else           // Batch mode
147    { 
148      G4String command = "/control/execute ";
149      G4String fileName = argv[1];
150      UI->ApplyCommand(command+fileName);
151    }
152
153  // job termination
154#ifdef G4VIS_USE
155  delete visManager;
156#endif
157  delete runManager;
158
159  return 0;
160}
161
Note: See TracBrowser for help on using the repository browser.