Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:19:43

0001 // ********************************************************************
0002 // * License and Disclaimer                                           *
0003 // *                                                                  *
0004 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0005 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0006 // * conditions of the Geant4 Software License,  included in the file *
0007 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0008 // * include a list of copyright holders.                             *
0009 // *                                                                  *
0010 // * Neither the authors of this software system, nor their employing *
0011 // * institutes,nor the agencies providing financial support for this *
0012 // * work  make  any representation or  warranty, express or implied, *
0013 // * regarding  this  software system or assume any liability for its *
0014 // * use.  Please see the license in the file  LICENSE  and URL above *
0015 // * for the full disclaimer and the limitation of liability.         *
0016 // *                                                                  *
0017 // * This  code  implementation is the result of  the  scientific and *
0018 // * technical work of the GEANT4 collaboration.                      *
0019 // * By using,  copying,  modifying or  distributing the software (or *
0020 // * any work based  on the software)  you  agree  to acknowledge its *
0021 // * use  in  resulting  scientific  publications,  and indicate your *
0022 // * acceptance of all terms of the Geant4 Software license.          *
0023 // ********************************************************************
0024 
0025 //GEANT4 - Depth-of-Interaction enabled Positron emission tomography (PET) advanced example 
0026 
0027 //Authors and contributors
0028 
0029 // Author list to be updated, with names of co-authors and contributors from National Institute of Radiological Sciences (NIRS)
0030 
0031 // Abdella M. Ahmed (1, 2), Andrew Chacon (1, 2), Harley Rutherford (1, 2),
0032 // Hideaki Tashima (3), Go Akamatsu (3), Akram Mohammadi (3), Eiji Yoshida (3), Taiga Yamaya (3)
0033 // Susanna Guatelli (2), and Mitra Safavi-Naeini (1, 2)
0034 
0035 // (1) Australian Nuclear Science and Technology Organisation, Australia
0036 // (2) University of Wollongong, Australia
0037 // (3) National Institute of Radiological Sciences, Japan
0038 
0039 #include "doiPETDetectorConstruction.hh"
0040 #include "doiPETPhysicsList.hh"
0041 #include "doiPETAnalysis.hh"
0042 #include "doiPETActionInitialization.hh"
0043 #include "Randomize.hh"
0044 #include "G4UImanager.hh"
0045 #include "G4VisExecutive.hh"
0046 #include "G4UIExecutive.hh"
0047 #include "G4SystemOfUnits.hh"
0048 #include "G4RunManagerFactory.hh"
0049 //
0050 //////////////////////////////////////////////////////////////////////////////
0051 
0052 int main(int argc,char** argv)
0053 {
0054   auto* runManager = G4RunManagerFactory::CreateRunManager();
0055   G4int nThreads = 4;
0056   runManager->SetNumberOfThreads(nThreads);
0057    
0058     G4UIExecutive* ui = 0;
0059     if ( argc == 1 ) {
0060     ui = new G4UIExecutive(argc, argv);
0061     }
0062     
0063     //Initialize analysis
0064     doiPETAnalysis* ptrAnalysis = doiPETAnalysis::GetInstance();
0065 
0066     runManager->SetUserInitialization(new doiPETDetectorConstruction());
0067 
0068     runManager->SetUserInitialization(new doiPETPhysicsList());
0069 
0070     // Set user action initialization
0071     runManager->SetUserInitialization(new doiPETActionInitialization(ptrAnalysis));
0072 
0073     G4double act  = 1000000 * becquerel;//Activity is set via run.mac file
0074     ptrAnalysis->SetActivity(act);
0075 
0076     G4double halfLife = 109.771 * 60 * s; //Halflife of F-18 as a default
0077     ptrAnalysis -> SetIsotopeHalfLife(halfLife);
0078 
0079     //Blurring specification of the scanner. see inputParameter.txt
0080     ptrAnalysis -> BlurringParameters();
0081 
0082     //Open file to write the output of the simulation
0083     ptrAnalysis->Open("result"); //file extention is affixed based on the type of the output (.root for root or .data for ascii)
0084 
0085 
0086     //
0087     ptrAnalysis -> PMTPosition();
0088     //Read reflector pattern from the inputParameter.txt file
0089     ptrAnalysis->ReadReflectorPattern();
0090 
0091     // Get the pointer to the User Interface manager
0092   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0093 
0094   if ( ! ui ) { 
0095     // batch mode
0096     G4String command = "/control/execute ";
0097     G4String fileName = argv[1];
0098     UImanager->ApplyCommand(command+fileName);
0099   }
0100   else { 
0101     // interactive mode
0102     G4VisManager* visManager = new G4VisExecutive;
0103     visManager->Initialize();
0104     UImanager->ApplyCommand("/control/execute init_vis.mac");
0105     ui->SessionStart();
0106     delete ui;
0107     delete visManager;
0108   }
0109 
0110     //close the file
0111     ptrAnalysis->Close();
0112     ptrAnalysis->Delete();
0113     
0114     delete runManager;
0115     return 0;
0116 
0117 }
0118 
0119 //////////////////////////////////////////////////////////////////////////////
0120