ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
doiPET.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file doiPET.cc
1 // ********************************************************************
2 // * License and Disclaimer *
3 // * *
4 // * The Geant4 software is copyright of the Copyright Holders of *
5 // * the Geant4 Collaboration. It is provided under the terms and *
6 // * conditions of the Geant4 Software License, included in the file *
7 // * LICENSE and available at http://cern.ch/geant4/license . These *
8 // * include a list of copyright holders. *
9 // * *
10 // * Neither the authors of this software system, nor their employing *
11 // * institutes,nor the agencies providing financial support for this *
12 // * work make any representation or warranty, express or implied, *
13 // * regarding this software system or assume any liability for its *
14 // * use. Please see the license in the file LICENSE and URL above *
15 // * for the full disclaimer and the limitation of liability. *
16 // * *
17 // * This code implementation is the result of the scientific and *
18 // * technical work of the GEANT4 collaboration. *
19 // * By using, copying, modifying or distributing the software (or *
20 // * any work based on the software) you agree to acknowledge its *
21 // * use in resulting scientific publications, and indicate your *
22 // * acceptance of all terms of the Geant4 Software license. *
23 // ********************************************************************
24 
25 //GEANT4 - Depth-of-Interaction enabled Positron emission tomography (PET) advanced example
26 
27 //Authors and contributors
28 
29 // Author list to be updated, with names of co-authors and contributors from National Institute of Radiological Sciences (NIRS)
30 
31 // Abdella M. Ahmed (1, 2), Andrew Chacon (1, 2), Harley Rutherford (1, 2),
32 // Hideaki Tashima (3), Go Akamatsu (3), Akram Mohammadi (3), Eiji Yoshida (3), Taiga Yamaya (3)
33 // Susanna Guatelli (2), and Mitra Safavi-Naeini (1, 2)
34 
35 // (1) Australian Nuclear Science and Technology Organisation, Australia
36 // (2) University of Wollongong, Australia
37 // (3) National Institute of Radiological Sciences, Japan
38 
39 
40 
41 //#include "doiPETGlobalParameters.hh"
43 #include "doiPETPhysicsList.hh"
44 #include "doiPETAnalysis.hh"
46 
47 #include "Randomize.hh"
48 #include "G4UImanager.hh"
49 #include "G4VisExecutive.hh"
50 #include "G4UIExecutive.hh"
51 #include "G4SystemOfUnits.hh"
52 
53 #ifdef G4MULTITHREADED
54 #include "G4MTRunManager.hh"
55 #else
56 #include "G4RunManager.hh"
57 #endif
58 
60 
61 int main(int argc,char** argv)
62 {
63  // Choose the Random engine
64  G4Random::setTheEngine(new CLHEP::RanecuEngine);
65 
66 #ifdef G4MULTITHREADED
67 
68  G4MTRunManager* runManager = new G4MTRunManager;
69  runManager->SetNumberOfThreads(4); // Is equal to 2 by default
70 #else
71 
72  G4RunManager* runManager = new G4RunManager;
73 #endif
74 
76 
78 
79  // Set user action initialization
81 
82  //Initialize analysis
84 
85 
86  G4double act = 1000000 * becquerel;//Activity is set via run.mac file
87  ptrAnalysis->SetActivity(act);
88 
89  G4double halfLife = 109.771 * 60 * s; //Halflife of F-18 as a default
90  ptrAnalysis -> SetIsotopeHalfLife(halfLife);
91 
92  //Blurring specification of the scanner. see inputParameter.txt
93  ptrAnalysis -> BlurringParameters();
94 
95  //Open file to write the output of the simulation
96  ptrAnalysis->Open("result"); //file extention is affixed based on the type of the output (.root for root or .data for ascii)
97 
98 
99  //
100  ptrAnalysis -> PMTPosition();
101  //Read reflector pattern from the inputParameter.txt file
102  ptrAnalysis->ReadReflectorPattern();
103 
104  // Get the pointer to the User Interface manager
106 
107 
108 
109  // Process macro or start UI session
110  if (argc!=1) // batch mode
111  {
112  G4String command = "/control/execute ";
113  G4String fileName = argv[1];
114  UI->ApplyCommand(command+fileName);
115  }
116 
117  else //define visualization and UI terminal for interactive mode
118  {
119  G4VisManager* visManager = new G4VisExecutive;
120  visManager->Initialize();
121 
122  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
123  ui->SessionStart();
124  delete ui;
125 
126  //
127  delete visManager;
128  }
129 
130  //close the file
131  ptrAnalysis->Close();
132  ptrAnalysis->Delete();
133 
134  delete runManager;
135  return 0;
136 
137 }
138 
140