source: trunk/source/processes/electromagnetic/lowenergy/test/fluoTest/XrayFluo.cc @ 1199

Last change on this file since 1199 was 1199, checked in by garnier, 15 years ago

nvx fichiers dans CVS

File size: 4.6 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//
27// $Id: XrayFluo.cc
28// GEANT4 tag $Name: xray_fluo-V03-02-00
29//
30// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
31//
32// History:
33// -----------
34// 28 Nov 2001 Elena Guardincerri     Created
35//
36// -------------------------------------------------------------------
37#include "G4RunManager.hh"
38#include "G4UImanager.hh"
39#include "G4UIterminal.hh"
40#include "G4UItcsh.hh"
41#ifdef G4UI_USE_XM
42#include "G4UIXm.hh"
43#endif
44#include "Randomize.hh"
45#ifdef G4VIS_USE
46#include "XrayFluoVisManager.hh"
47#endif
48#include "XrayFluoDetectorConstruction.hh"
49#include "XrayFluoPhysicsList.hh"
50#include "XrayFluoPrimaryGeneratorAction.hh"
51#include "XrayFluoRunAction.hh"
52#include "XrayFluoEventAction.hh"
53#include "XrayFluoSteppingAction.hh"
54#include "XrayFluoSteppingVerbose.hh"
55
56int main(int argc,char** argv) {
57
58  // choose the Random engine
59  HepRandom::setTheEngine(new RanecuEngine);
60
61  //XrayFluo Verbose output class
62  G4VSteppingVerbose::SetInstance(new XrayFluoSteppingVerbose);
63     
64  // Construct the default run manager
65  G4RunManager * runManager = new G4RunManager;
66
67  // set mandatory initialization classes
68  XrayFluoDetectorConstruction* detector = new XrayFluoDetectorConstruction;
69  runManager->SetUserInitialization(detector);
70  XrayFluoPhysicsList* list = new   XrayFluoPhysicsList(detector);
71  runManager->SetUserInitialization(list);
72 
73  G4UIsession* session=0;
74 
75  if (argc==1)   // Define UI session for interactive mode.
76    {
77      // G4UIterminal is a (dumb) terminal.
78#ifdef G4UI_USE_XM
79      session = new G4UIXm(argc,argv);
80#else           
81#ifdef G4UI_USE_TCSH
82      session = new G4UIterminal(new G4UItcsh);
83#else
84      session = new G4UIterminal();
85#endif
86#endif
87    }
88 
89#ifdef G4VIS_USE
90  //visualization manager
91  G4VisManager* visManager = new XrayFluoVisManager;
92  visManager->Initialize();
93#endif
94 
95  XrayFluoEventAction* eventAction = new XrayFluoEventAction();
96  XrayFluoRunAction* runAction = new XrayFluoRunAction();
97  XrayFluoSteppingAction* stepAction = new XrayFluoSteppingAction();
98
99  runManager->SetUserAction(new XrayFluoPrimaryGeneratorAction(detector));
100 
101  runManager->SetUserAction(eventAction); 
102  runManager->SetUserAction(runAction);
103  runManager->SetUserAction(stepAction);
104 
105  //Initialize G4 kernel
106  runManager->Initialize();
107 
108  // get the pointer to the User Interface manager
109  G4UImanager* UI = G4UImanager::GetUIpointer();
110 
111  if (session)   // Define UI session for interactive mode.
112    {
113      // G4UIterminal is a (dumb) terminal.
114      UI->ApplyCommand("/control/execute initInter.mac");   
115#ifdef G4UI_USE_XM
116      // Customize the G4UIXm menubar with a macro file :
117      UI->ApplyCommand("/control/execute gui.mac");
118#endif
119      session->SessionStart();
120      delete session;
121    }
122  else           // Batch mode
123    { 
124      G4String command = "/control/execute ";
125      G4String fileName = argv[1];
126      UI->ApplyCommand(command+fileName);
127    }
128 
129  // job termination
130 
131#ifdef G4VIS_USE
132  delete visManager;
133#endif
134   
135   delete runManager;
136   return 0;
137}
138
139 
140
141
Note: See TracBrowser for help on using the repository browser.