[807] | 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.3 2006/06/29 17:21:55 gunter Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 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 | #include "G4UIterminal.hh" |
---|
| 44 | #include "G4UItcsh.hh" |
---|
| 45 | |
---|
| 46 | // this module |
---|
| 47 | #include "OlapGenerator.hh" |
---|
| 48 | #include "OlapDetConstr.hh" |
---|
| 49 | #include "OlapPhysicsList.hh" |
---|
| 50 | #include "OlapManager.hh" |
---|
| 51 | #include "OlapRunAction.hh" |
---|
| 52 | #include "OlapEventAction.hh" |
---|
| 53 | #include "OlapSteppingAction.hh" |
---|
| 54 | #include "G4GeoNav.hh" |
---|
| 55 | |
---|
| 56 | #ifdef G4VIS_USE |
---|
| 57 | #include "G4VisExecutive.hh" |
---|
| 58 | #endif |
---|
| 59 | |
---|
| 60 | #ifdef debug |
---|
| 61 | #include "G4LogicalVolumeStore.hh" |
---|
| 62 | #include "G4PhysicalVolumeStore.hh" |
---|
| 63 | #endif |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | int main(int argc,char** argv) { |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | G4RunManager * runManager = new G4RunManager; |
---|
| 70 | |
---|
| 71 | // particle-generator must be the first useraction!!! |
---|
| 72 | runManager->SetUserAction(new OlapGenerator); |
---|
| 73 | |
---|
| 74 | // put the user-geometry here |
---|
| 75 | G4VUserDetectorConstruction * origGeom = new RandomDetector(0); |
---|
| 76 | OlapDetConstr * olapGeom = new OlapDetConstr(origGeom); |
---|
| 77 | runManager->SetUserInitialization(olapGeom); |
---|
| 78 | runManager->SetUserInitialization(new OlapPhysicsList); |
---|
| 79 | |
---|
| 80 | // initialize G4 |
---|
| 81 | runManager->Initialize(); |
---|
| 82 | |
---|
| 83 | // initialize overlap-detection |
---|
| 84 | OlapManager * olap = OlapManager::GetOlapManager(); |
---|
| 85 | olap->GotoLV(olap->GetFullWorld()->GetLogicalVolume()->GetName()); |
---|
| 86 | |
---|
| 87 | #ifdef G4VIS_USE |
---|
| 88 | //Instantiating VisManager |
---|
| 89 | G4VisManager *visManager = new G4VisExecutive; |
---|
| 90 | visManager -> Initialize(); |
---|
| 91 | #endif |
---|
| 92 | |
---|
| 93 | //User action classes. |
---|
| 94 | OlapRunAction * olapRunAction = new OlapRunAction; |
---|
| 95 | OlapEventAction * olapEventAction = new OlapEventAction(olapRunAction); |
---|
| 96 | OlapSteppingAction * olapSteppingAction = new OlapSteppingAction(olapEventAction); |
---|
| 97 | runManager->SetUserAction(olapRunAction); |
---|
| 98 | runManager->SetUserAction(olapEventAction); |
---|
| 99 | runManager->SetUserAction(olapSteppingAction); |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | #ifdef debug |
---|
| 104 | //Get number of logical and physical volumes |
---|
| 105 | G4LogicalVolumeStore* logstore = G4LogicalVolumeStore::GetInstance(); |
---|
| 106 | G4PhysicalVolumeStore* phystore = G4PhysicalVolumeStore::GetInstance(); |
---|
| 107 | G4cout << endl |
---|
| 108 | << "Number of Logical volumes " << logstore->entries() << endl |
---|
| 109 | << "====================================" << endl |
---|
| 110 | << "Number of Physical volumes " << phystore->entries() << endl |
---|
| 111 | << "====================================" << endl << endl; |
---|
| 112 | #endif |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | //Get the pointer for the User Interface maager |
---|
| 117 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
| 118 | |
---|
| 119 | if (argc == 1) { |
---|
| 120 | G4VUIshell * s = new G4UItcsh("Idle> ",10); |
---|
| 121 | G4UIsession* session = new G4UIterminal(s); |
---|
| 122 | |
---|
| 123 | G4String command = "/control/execute gui.mac"; |
---|
| 124 | UI->ApplyCommand(command); |
---|
| 125 | session->SessionStart(); |
---|
| 126 | |
---|
| 127 | delete session; |
---|
| 128 | } |
---|
| 129 | //Batch mode |
---|
| 130 | else { |
---|
| 131 | G4String command = "/control/execute "; |
---|
| 132 | G4String fileName = argv[1]; |
---|
| 133 | UI->ApplyCommand(command+fileName); |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | #ifdef G4VIS_USE |
---|
| 138 | delete visManager; |
---|
| 139 | #endif |
---|
| 140 | delete runManager; |
---|
| 141 | |
---|
| 142 | return 0; |
---|
| 143 | } |
---|