Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:20:20

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // This is the *BASIC* version of IORT, a Geant4-based application
0027 // 
0028 //
0029 // ----------------------------------------------------------------------------
0030 //                 GEANT 4 - IORT example
0031 // ----------------------------------------------------------------------------
0032 // Main Authors:
0033 // G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
0034 // 
0035 // Contributor Authors:
0036 // S.Guatelli(e)
0037 //
0038 // Past Authors:
0039 // G.Arnetta(c), S.E.Mazzaglia(d)
0040 //
0041 // (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
0042 //
0043 // (b) IBFM-CNR , Segrate (Milano), Italy
0044 //
0045 // (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
0046 //
0047 // (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
0048 //
0049 // (e) University of Wollongong, Australia
0050 //
0051 //
0052 //  *Corresponding Author, email to carlo.casarino@polooncologicocefalu.it
0053 // ----------------------------------------------------------------------------
0054 
0055 #include "G4RunManager.hh"
0056 #include "G4UImanager.hh"
0057 #include "G4PhysListFactory.hh"
0058 #include "G4VModularPhysicsList.hh"
0059 #include "IORTEventAction.hh"
0060 #include "IORTPhysicsList.hh"
0061 #include "IORTPrimaryGeneratorAction.hh"
0062 #include "IORTRunAction.hh"
0063 #include "Randomize.hh"  
0064 #include "G4RunManager.hh"
0065 #include "G4UImessenger.hh"
0066 #include "globals.hh"
0067 #include "IORTSteppingAction.hh"
0068 #include "IORTGeometryController.hh"
0069 #include "IORTGeometryMessenger.hh"
0070 #include "G4VisExecutive.hh"
0071 #include "G4UIExecutive.hh"
0072 #include <ctime>
0073 #include "G4ScoringManager.hh"
0074 
0075 //////////////////////////////////////////////////////////////////////////////////////////////
0076 
0077 int main(int argc ,char ** argv)
0078 {
0079 
0080 //  G4int seed = time(NULL); 
0081  // CLHEP::HepRandom::setTheSeed(seed);
0082   
0083   G4RunManager* runManager = new G4RunManager;
0084 
0085   G4ScoringManager::GetScoringManager();
0086   // Scoring mesh
0087 
0088   // Geometry controller is responsible for instantiating the
0089   // geometries. All geometry specific setup tasks are now in class
0090   // IORTGeometryController.
0091   IORTGeometryController *geometryController = new IORTGeometryController();
0092     
0093   // Connect the geometry controller to the G4 user interface
0094   IORTGeometryMessenger *geometryMessenger = new IORTGeometryMessenger(geometryController);
0095         
0096   // Initialize the default IORT geometry
0097   geometryController->SetGeometry("default");  
0098 
0099   runManager->SetUserInitialization(new IORTPhysicsList());
0100 
0101   // Initialize the primary particles
0102   IORTPrimaryGeneratorAction *pPrimaryGenerator = new IORTPrimaryGeneratorAction();
0103   runManager -> SetUserAction(pPrimaryGenerator);
0104     
0105   // Optional UserActions: run, event, stepping
0106   IORTRunAction* pRunAction = new IORTRunAction();
0107   runManager -> SetUserAction(pRunAction);
0108     
0109   IORTEventAction* pEventAction = new IORTEventAction();
0110   runManager -> SetUserAction(pEventAction);
0111     
0112   IORTSteppingAction* steppingAction = new IORTSteppingAction(pRunAction); 
0113   runManager -> SetUserAction(steppingAction);    
0114 
0115   // Visualization manager
0116   G4VisManager* visManager = new G4VisExecutive;
0117   visManager -> Initialize();
0118     
0119   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0120   if (argc!=1)   // batch mode
0121     {
0122       G4String command = "/control/execute ";
0123       G4String fileName = argv[1];
0124       UImanager->ApplyCommand(command+fileName);    
0125     }
0126   else
0127     {  // interactive mode : define UI session
0128        
0129       G4UIExecutive* ui = new G4UIExecutive(argc, argv);
0130   
0131       UImanager->ApplyCommand("/control/execute defaultMacro.mac"); 
0132 
0133       if (ui->IsGUI())
0134       ui->SessionStart();
0135       delete ui;
0136     }
0137 
0138 
0139   delete visManager;           
0140 
0141   delete geometryMessenger;
0142   delete geometryController;
0143   delete runManager;
0144   return 0;
0145   
0146 }
0147