source: trunk/examples/extended/geometry/olap/olapex.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

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//
27// $Id: olapex.cc,v 1.4 2010/05/12 20:38:24 allison Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31// --------------------------------------------------------------
32// GEANT 4 - OLAP, Debugging Tool for Ovelapping Geometries
33//
34// Author: Martin Liendl - Martin.Liendl@cern.ch
35//
36// --------------------------------------------------------------
37//
38// the detector-construction
39#include "RandomDetector.hh"
40
41// Geant4
42#include "G4RunManager.hh"
43
44// this module
45#include "OlapGenerator.hh"
46#include "OlapDetConstr.hh"
47#include "OlapPhysicsList.hh"
48#include "OlapManager.hh"
49#include "OlapRunAction.hh"
50#include "OlapEventAction.hh"
51#include "OlapSteppingAction.hh"
52#include "G4GeoNav.hh"
53
54#ifdef G4VIS_USE
55  #include "G4VisExecutive.hh"
56#endif
57
58#ifdef G4UI_USE
59#include "G4UIExecutive.hh"
60#endif
61
62#ifdef debug
63 #include "G4LogicalVolumeStore.hh"
64 #include "G4PhysicalVolumeStore.hh"
65#endif
66
67
68int main(int argc,char** argv) {
69
70
71  G4RunManager * runManager = new G4RunManager;
72 
73  // particle-generator must be the first useraction!!!
74  runManager->SetUserAction(new OlapGenerator);
75 
76  // put the user-geometry here
77  G4VUserDetectorConstruction * origGeom = new RandomDetector(0);
78  OlapDetConstr * olapGeom = new OlapDetConstr(origGeom);
79  runManager->SetUserInitialization(olapGeom);
80  runManager->SetUserInitialization(new OlapPhysicsList); 
81 
82  // initialize G4
83  runManager->Initialize();
84 
85  // initialize overlap-detection
86  OlapManager * olap = OlapManager::GetOlapManager();
87  olap->GotoLV(olap->GetFullWorld()->GetLogicalVolume()->GetName());
88 
89  //User action classes.
90  OlapRunAction * olapRunAction = new OlapRunAction;
91  OlapEventAction * olapEventAction = new OlapEventAction(olapRunAction);
92  OlapSteppingAction * olapSteppingAction = new OlapSteppingAction(olapEventAction);
93  runManager->SetUserAction(olapRunAction);
94  runManager->SetUserAction(olapEventAction);
95  runManager->SetUserAction(olapSteppingAction);
96
97#ifdef debug
98  //Get number of logical and physical volumes
99  G4LogicalVolumeStore*  logstore = G4LogicalVolumeStore::GetInstance();
100  G4PhysicalVolumeStore* phystore = G4PhysicalVolumeStore::GetInstance();
101  G4cout << endl
102       << "Number of Logical volumes     " << logstore->entries() << endl
103       << "====================================" << endl
104       << "Number of Physical volumes    " << phystore->entries() << endl
105       << "====================================" << endl << endl;
106#endif
107   
108#ifdef G4VIS_USE
109  //Instantiating VisManager
110  G4VisManager *visManager = new G4VisExecutive;
111  visManager -> Initialize();
112#endif
113
114  //Get the pointer for the User Interface maager
115  G4UImanager* UImanager = G4UImanager::GetUIpointer();
116
117  if (argc!=1)   // batch mode
118    {
119#ifdef G4VIS_USE
120      visManager->SetVerboseLevel("quiet");
121#endif
122      G4String command = "/control/execute ";
123      G4String fileName = argv[1];
124      UImanager->ApplyCommand(command+fileName);   
125    }
126  else
127    {  // interactive mode : define UI session
128#ifdef G4UI_USE
129      G4UIExecutive* ui = new G4UIExecutive(argc, argv);
130      ui->SessionStart();
131      delete ui;
132#endif
133    }
134
135#ifdef G4VIS_USE
136  delete visManager;
137#endif
138  delete runManager;
139
140  return 0;
141}
Note: See TracBrowser for help on using the repository browser.