Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:39:57

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 // --------------------------------------------------------------
0027 //                 GEANT 4 - Brachytherapy example
0028 // --------------------------------------------------------------
0029 //
0030 // Code developed currently by:
0031 //  S.Guatelli & D. Cutajar
0032 
0033 //
0034 //    *******************************
0035 //    *                             *
0036 //    *    Brachy.cc                *
0037 //    *                             *
0038 //    *******************************
0039 //
0040 //
0041 #include "G4Types.hh"
0042 #include "G4RunManagerFactory.hh"
0043 #include "G4UImanager.hh"
0044 #include "G4UIExecutive.hh"
0045 #include "BrachyActionInitialization.hh"
0046 #include "G4VisExecutive.hh"
0047 #include "BrachyDetectorConstruction.hh"
0048 #include "BrachyPhysicsList.hh"
0049 #include "BrachyPrimaryGeneratorAction.hh"
0050 #include "G4SDManager.hh"
0051 #include "Randomize.hh"
0052 #include "G4RunManager.hh"
0053 #include "G4SDManager.hh"
0054 #include "G4UImanager.hh"
0055 #include "G4UImessenger.hh"
0056 
0057 #include "G4ScoringManager.hh"
0058 #include "G4UIExecutive.hh"
0059 
0060 #include "G4ScoringManager.hh"
0061 #include "BrachyUserScoreWriter.hh"
0062 
0063 int main(int argc ,char ** argv)
0064 
0065 {
0066  // Construct the default run manager
0067  //
0068   auto* pRunManager = G4RunManagerFactory::CreateRunManager();
0069   G4int nThreads = 4;
0070   pRunManager->SetNumberOfThreads(nThreads);
0071  
0072   G4cout << "***********************" << G4endl;
0073   G4cout << "*** Seed: " << G4Random::getTheSeed() << " ***" << G4endl;
0074   G4cout << "***********************" << G4endl;
0075  
0076   // Access to the Scoring Manager pointer
0077 
0078   G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManager();
0079 
0080   // Overwrite the default output file with user-defined one
0081   scoringManager->SetScoreWriter(new BrachyUserScoreWriter());
0082 
0083   // Initialize the physics component
0084   pRunManager -> SetUserInitialization(new BrachyPhysicsList);
0085 
0086   // Initialize the detector component
0087   auto pDetectorConstruction = new  BrachyDetectorConstruction();
0088   pRunManager -> SetUserInitialization(pDetectorConstruction);
0089 
0090   // User action initialization
0091 
0092  auto actions = new BrachyActionInitialization();
0093   pRunManager->SetUserInitialization(actions);
0094 
0095   //Initialize G4 kernel
0096  // pRunManager -> Initialize();
0097 
0098   // Visualization manager
0099   G4VisManager* visManager = new G4VisExecutive;
0100   visManager->Initialize();
0101 
0102   // get the pointer to the User Interface manager
0103   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0104   if (argc == 1)   // Define UI session for interactive mode.
0105     {
0106       auto ui = new G4UIExecutive(argc, argv);
0107       G4cout << " UI session starts ..." << G4endl;
0108       UImanager -> ApplyCommand("/control/execute VisualisationMacro.mac");
0109       ui -> SessionStart();
0110       delete ui;
0111     }
0112   else           // Batch mode
0113     {
0114       G4String command = "/control/execute ";
0115       G4String fileName = argv[1];
0116       UImanager -> ApplyCommand(command+fileName);
0117     }
0118 
0119   // Job termination
0120  // Close the root file
0121 
0122   delete visManager;
0123   delete pRunManager;
0124 
0125   return 0;
0126 }