| [1316] | 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: exampleDiv.cc,v 1.4 2009/05/18 13:49:53 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 |
|
|---|
| 31 | #include "ExDivDetectorConstruction.hh"
|
|---|
| 32 | #include "ExDivPhysicsList.hh"
|
|---|
| 33 | #include "ExDivPrimaryGeneratorAction.hh"
|
|---|
| 34 | #include "ExDivRunAction.hh"
|
|---|
| 35 | #include "ExDivEventAction.hh"
|
|---|
| 36 | #include "ExDivSteppingAction.hh"
|
|---|
| 37 | #include "ExDivSteppingVerbose.hh"
|
|---|
| 38 |
|
|---|
| 39 | #include "G4RunManager.hh"
|
|---|
| 40 | #include "G4UImanager.hh"
|
|---|
| 41 | #include "G4UIterminal.hh"
|
|---|
| 42 | #include "G4UItcsh.hh"
|
|---|
| 43 |
|
|---|
| 44 | #ifdef G4VIS_USE
|
|---|
| 45 | #include "G4VisExecutive.hh"
|
|---|
| 46 | #endif
|
|---|
| 47 |
|
|---|
| 48 | #include "ExDivTesterBox.hh"
|
|---|
| 49 | #include "ExDivTesterTubs.hh"
|
|---|
| 50 | #include "ExDivTesterCons.hh"
|
|---|
| 51 | #include "ExDivTesterTrd.hh"
|
|---|
| 52 | #include "ExDivTesterPara.hh"
|
|---|
| 53 | #include "ExDivTesterPolycone.hh"
|
|---|
| 54 | #include "ExDivTesterPolyhedra.hh"
|
|---|
| 55 |
|
|---|
| 56 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 57 |
|
|---|
| 58 | int main(int argc,char** argv)
|
|---|
| 59 | {
|
|---|
| 60 | G4String theSolidTypeStr="box";
|
|---|
| 61 | G4String thePVTypeStr="division";
|
|---|
| 62 | G4String thePosTypeStr="normal";
|
|---|
| 63 | std::vector<G4String> theExtraPars;
|
|---|
| 64 |
|
|---|
| 65 | // First argument is the type of divisioning replica or division
|
|---|
| 66 | // the second argument is the type of solid
|
|---|
| 67 | std::vector<std::string> vsarg;
|
|---|
| 68 | for( G4int jj = 0; jj < argc; jj ++ )
|
|---|
| 69 | {
|
|---|
| 70 | vsarg.push_back( std::string(argv[jj] ) );
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | G4int narg = vsarg.size();
|
|---|
| 74 | if( narg == 1 )
|
|---|
| 75 | {
|
|---|
| 76 | G4cout << "!!! No input division type provided. Defaulting to 'division' "
|
|---|
| 77 | << G4endl;
|
|---|
| 78 | G4cout << "!!! No positioning type provided. Defaulting to 'normal' "
|
|---|
| 79 | << G4endl;
|
|---|
| 80 | G4cout << "!!! No input solid type provided. Defaulting to 'box' "
|
|---|
| 81 | << G4endl;
|
|---|
| 82 | }
|
|---|
| 83 | else
|
|---|
| 84 | {
|
|---|
| 85 | if( narg == 2 )
|
|---|
| 86 | {
|
|---|
| 87 | G4cout << "!!! No positioning type provided. Defaulting to 'normal' "
|
|---|
| 88 | << G4endl;
|
|---|
| 89 | G4cout << "!!! No input solid type provided. Defaulting to 'box' "
|
|---|
| 90 | << G4endl;
|
|---|
| 91 | }
|
|---|
| 92 | else
|
|---|
| 93 | {
|
|---|
| 94 | if( narg == 3 )
|
|---|
| 95 | {
|
|---|
| 96 | G4cout << "!!! No input solid type provided. Defaulting to 'box' "
|
|---|
| 97 | << G4endl;
|
|---|
| 98 | }
|
|---|
| 99 | else
|
|---|
| 100 | {
|
|---|
| 101 | theSolidTypeStr = G4String(vsarg[3]);
|
|---|
| 102 | }
|
|---|
| 103 | thePosTypeStr = G4String(vsarg[2]);
|
|---|
| 104 | }
|
|---|
| 105 | thePVTypeStr = G4String(vsarg[1]);
|
|---|
| 106 | }
|
|---|
| 107 | if( narg > 4 )
|
|---|
| 108 | {
|
|---|
| 109 | for( G4int ii = 4; ii < narg; ii++ )
|
|---|
| 110 | {
|
|---|
| 111 | theExtraPars.push_back( vsarg[ii] );
|
|---|
| 112 | }
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | // Stepping Verbose output class
|
|---|
| 116 | G4VSteppingVerbose::SetInstance(new ExDivSteppingVerbose);
|
|---|
| 117 |
|
|---|
| 118 | // Run manager
|
|---|
| 119 | G4RunManager * runManager = new G4RunManager;
|
|---|
| 120 |
|
|---|
| 121 | // UserInitialization classes (mandatory)
|
|---|
| 122 | ExDivDetectorConstruction* ExDivdetector =
|
|---|
| 123 | new ExDivDetectorConstruction(theSolidTypeStr, thePVTypeStr,
|
|---|
| 124 | thePosTypeStr, theExtraPars );
|
|---|
| 125 | runManager->SetUserInitialization(ExDivdetector);
|
|---|
| 126 | runManager->SetUserInitialization(new ExDivPhysicsList);
|
|---|
| 127 |
|
|---|
| 128 | #ifdef G4VIS_USE
|
|---|
| 129 | // Visualization, if you choose to have it!
|
|---|
| 130 | G4VisManager* visManager = new G4VisExecutive;
|
|---|
| 131 | visManager->Initialize();
|
|---|
| 132 | #endif
|
|---|
| 133 |
|
|---|
| 134 | // UserAction classes
|
|---|
| 135 | runManager->SetUserAction(new ExDivPrimaryGeneratorAction(ExDivdetector));
|
|---|
| 136 | runManager->SetUserAction(new ExDivRunAction);
|
|---|
| 137 | runManager->SetUserAction(new ExDivEventAction);
|
|---|
| 138 | runManager->SetUserAction(new ExDivSteppingAction);
|
|---|
| 139 |
|
|---|
| 140 | // Initialize G4 kernel
|
|---|
| 141 | runManager->Initialize();
|
|---|
| 142 |
|
|---|
| 143 | // Get the pointer to the User Interface manager
|
|---|
| 144 | G4UImanager * UI = G4UImanager::GetUIpointer();
|
|---|
| 145 |
|
|---|
| 146 | // Define (G)UI terminal for interactive mode
|
|---|
| 147 | if(argc>=1)
|
|---|
| 148 | {
|
|---|
| 149 | G4UIsession * session = 0;
|
|---|
| 150 | #ifdef G4UI_USE_TCSH
|
|---|
| 151 | session = new G4UIterminal(new G4UItcsh);
|
|---|
| 152 | #else
|
|---|
| 153 | session = new G4UIterminal();
|
|---|
| 154 | #endif
|
|---|
| 155 |
|
|---|
| 156 | UI->ApplyCommand("/control/execute vis.mac");
|
|---|
| 157 | session->SessionStart();
|
|---|
| 158 | delete session;
|
|---|
| 159 | }
|
|---|
| 160 | else
|
|---|
| 161 | // Batch mode
|
|---|
| 162 | {
|
|---|
| 163 | G4String command = "/control/execute ";
|
|---|
| 164 | G4String fileName = argv[1];
|
|---|
| 165 | UI->ApplyCommand(command+fileName);
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | #ifdef G4VIS_USE
|
|---|
| 169 | delete visManager;
|
|---|
| 170 | #endif
|
|---|
| 171 | delete runManager;
|
|---|
| 172 |
|
|---|
| 173 | return 0;
|
|---|
| 174 | }
|
|---|