Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:58

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 //GEANT4 - Depth-of-Interaction enabled Positron emission tomography (PET) advanced example 
0027 
0028 //Authors and contributors
0029 
0030 // Author list to be updated, with names of co-authors and contributors from National Institute of Radiological Sciences (NIRS)
0031 
0032 // Abdella M. Ahmed (1, 2), Andrew Chacon (1, 2), Harley Rutherford (1, 2),
0033 // Hideaki Tashima (3), Go Akamatsu (3), Akram Mohammadi (3), Eiji Yoshida (3), Taiga Yamaya (3)
0034 // Susanna Guatelli (2), and Mitra Safavi-Naeini (1, 2)
0035 
0036 // (1) Australian Nuclear Science and Technology Organisation, Australia
0037 // (2) University of Wollongong, Australia
0038 // (3) National Institute of Radiological Sciences, Japan
0039 
0040 
0041 
0042 //
0043 #include "doiPETRunAction.hh"
0044 #include "doiPETRun.hh"
0045 #include "doiPETDetectorConstruction.hh"
0046 #include "doiPETPrimaryGeneratorAction.hh"
0047 #include "doiPETAnalysis.hh"
0048 
0049 #include "G4RunManager.hh"
0050 #include "G4Run.hh"
0051 #include "G4UnitsTable.hh"
0052 #include "G4SystemOfUnits.hh"
0053 
0054 #include "Randomize.hh"
0055 #include <sstream>
0056 #include <vector>
0057 #include <fstream>
0058 
0059 //
0060 #ifdef ANALYSIS_USE
0061 doiPETRunAction::doiPETRunAction(doiPETAnalysis* analysis) : G4UserRunAction()
0062 {
0063     analysisMan = analysis;
0064 }
0065 #else
0066 doiPETRunAction::doiPETRunAction()
0067 { }
0068 #endif
0069 //
0070 
0071 
0072 doiPETRunAction::~doiPETRunAction()
0073 {}
0074 
0075 //
0076 G4Run* doiPETRunAction::GenerateRun()
0077 { 
0078     fRun = new doiPETRun();
0079     return fRun;
0080 }
0081 
0082 //
0083 
0084 void doiPETRunAction::BeginOfRunAction(const G4Run* aRun)
0085 { 
0086     //pass file name without fname extention
0087     //inform the runManager to save random number seed
0088     G4RunManager::GetRunManager()->SetRandomNumberStore(false);
0089     G4cout << "### Begin of Run " << aRun->GetRunID() << " start." << G4endl;
0090 #ifdef ANALYSIS_USE
0091   // Create ROOT file, histograms and ntuple
0092   analysisMan -> book();
0093 #endif 
0094     if (isMaster) {
0095         G4Random::showEngineStatus();
0096     }   
0097 }
0098 
0099 
0100 void doiPETRunAction::EndOfRunAction(const G4Run*)
0101 {
0102     G4int nofEvents = fRun->GetNumberOfEvent();
0103     if (nofEvents == 0) return;
0104     G4cout<<G4endl<<"### End of Run ("<<nofEvents<<" events)"<<G4endl;
0105 #ifdef ANALYSIS_USE
0106 // Close the output ROOT file with the results
0107    analysisMan -> finish(); 
0108 #endif
0109 }
0110 
0111