Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // $Id: lArCal.cc,v 1.10 2005/12/08 16:39:16 ribon Exp $ >> 24 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 26 // 25 // 27 // << 26 // 28 // ------------------------------------------- 27 // -------------------------------------------------------------- 29 // GEANT 4 - exampleN03 << 28 // GEANT 4 - exampleN03 30 // 29 // 31 // For information related to this code c 30 // For information related to this code contact: 32 // CERN, IT Division, ASD Group 31 // CERN, IT Division, ASD Group 33 // ------------------------------------------- 32 // -------------------------------------------------------------- 34 // Comments 33 // Comments 35 // 34 // 36 // ------------------------------------------- 35 // -------------------------------------------------------------- 37 36 38 #include "G4Types.hh" << 37 #include "G4RunManager.hh" 39 #include "G4RunManagerFactory.hh" << 40 #include "G4UImanager.hh" 38 #include "G4UImanager.hh" >> 39 #include "G4UIterminal.hh" >> 40 >> 41 #ifdef G4UI_USE_XM >> 42 #include "G4UIXm.hh" >> 43 #endif >> 44 41 #include "Randomize.hh" 45 #include "Randomize.hh" >> 46 >> 47 #ifdef G4VIS_USE 42 #include "G4VisExecutive.hh" 48 #include "G4VisExecutive.hh" 43 #include "G4UIExecutive.hh" << 49 #endif >> 50 44 #include "FCALTestbeamSetup.hh" 51 #include "FCALTestbeamSetup.hh" 45 #include "G4PhysListFactory.hh" << 52 #include "FCALSteppingVerbose.hh" 46 #include "FCALActionInitialization.hh" << 53 #include "FCALPrimaryGeneratorAction.hh" >> 54 #include "" >> 55 #include "" >> 56 #include "" >> 57 >> 58 >> 59 #ifdef G4ANALYSIS_USE >> 60 >> 61 >> 62 #include "FCALRunAction.hh" >> 63 #include "FCALTBEventAction.hh" >> 64 #include "FCALSteppingAction.hh" >> 65 >> 66 #endif >> 67 47 68 48 int main(int argc,char** argv) { 69 int main(int argc,char** argv) { 49 70 50 auto* runManager = G4RunManagerFactory::Crea << 71 // choose the Random engine 51 G4int nThreads = 4; << 72 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); 52 runManager->SetNumberOfThreads(nThreads); << 73 >> 74 //my Verbose output class >> 75 G4VSteppingVerbose::SetInstance(new FCALSteppingVerbose); >> 76 >> 77 // Construct the default run manager >> 78 G4RunManager * runManager = new G4RunManager; 53 79 54 // set mandatory initialization classes 80 // set mandatory initialization classes 55 FCALTestbeamSetup* detector = new FCALTestbe 81 FCALTestbeamSetup* detector = new FCALTestbeamSetup; 56 runManager->SetUserInitialization(detector); 82 runManager->SetUserInitialization(detector); 57 83 58 G4PhysListFactory factory; << 84 //***LOOKHERE*** CHOOSE THE PHYSICS LIST. 59 runManager->SetUserInitialization(factory.Re << 85 // runManager->SetUserInitialization(new LHEP); // LHEP 60 << 86 runManager->SetUserInitialization(new QGSP); // QGSP 61 runManager->SetUserInitialization(new FCALAc << 87 // runManager->SetUserInitialization(new QGSC); // QGSC 62 << 88 //***endLOOKHERE*** 63 // get the pointer to the User Interface man << 89 64 G4UImanager* UImanager = G4UImanager::GetUIp << 90 G4UIsession* session=0; 65 << 91 >> 92 if (argc==1) // Define UI session for interactive mode. >> 93 { >> 94 // G4UIterminal is a (dumb) terminal. >> 95 #ifdef G4UI_USE_XM >> 96 session = new G4UIXm(argc,argv); >> 97 #else >> 98 session = new G4UIterminal; >> 99 #endif >> 100 } >> 101 >> 102 #ifdef G4VIS_USE 66 // visualization manager 103 // visualization manager 67 G4VisManager* visManager = new G4VisExecutiv 104 G4VisManager* visManager = new G4VisExecutive; 68 visManager->Initialize(); 105 visManager->Initialize(); >> 106 #endif >> 107 >> 108 // set user action classes >> 109 runManager->SetUserAction(new FCALPrimaryGeneratorAction()); >> 110 >> 111 #ifdef G4ANALYSIS_USE >> 112 >> 113 FCALRunAction* RunAction = new FCALRunAction; >> 114 runManager ->SetUserAction(RunAction); >> 115 >> 116 FCALSteppingAction* StepAction = new FCALSteppingAction; >> 117 runManager->SetUserAction(StepAction); >> 118 >> 119 // runManager->SetUserAction(new FCALRunAction); >> 120 >> 121 runManager->SetUserAction(new FCALTBEventAction(StepAction)); >> 122 >> 123 >> 124 #endif >> 125 >> 126 //Initialize G4 kernel >> 127 runManager->Initialize(); >> 128 >> 129 // get the pointer to the User Interface manager >> 130 G4UImanager* UI = G4UImanager::GetUIpointer(); 69 131 70 if (argc==1) // Define UI session for inte << 132 if (session) // Define UI session for interactive mode. 71 { << 133 { 72 G4UIExecutive* ui = new G4UIExecutive(a << 134 // G4UIterminal is a (dumb) terminal. 73 UImanager->ApplyCommand("/control/execu << 135 // UI->ApplyCommand("/control/execute prerunlArcal.mac"); 74 if (ui->IsGUI()) << 136 #ifdef G4UI_USE_XM 75 UImanager->ApplyCommand("/control/execute g << 137 // Customize the G4UIXm menubar with a macro file : 76 ui->SessionStart(); << 138 UI->ApplyCommand("/control/execute gui.mac"); 77 delete ui; << 139 #endif >> 140 session->SessionStart(); >> 141 delete session; 78 } 142 } 79 else // Batch mode 143 else // Batch mode 80 { << 144 { 81 G4String command = "/control/execute "; 145 G4String command = "/control/execute "; 82 G4String fileName = argv[1]; 146 G4String fileName = argv[1]; 83 UImanager->ApplyCommand(command+fileName << 147 UI->ApplyCommand(command+fileName); 84 } 148 } 85 149 86 // job termination 150 // job termination >> 151 #ifdef G4VIS_USE 87 delete visManager; 152 delete visManager; >> 153 #endif 88 delete runManager; 154 delete runManager; 89 155 90 return 0; 156 return 0; 91 } 157 } 92 158 93 159