LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
doiPET.cc File Reference
#include "doiPETDetectorConstruction.hh"
#include "doiPETPhysicsList.hh"
#include "doiPETAnalysis.hh"
#include "doiPETActionInitialization.hh"
#include "Randomize.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file doiPET.cc.

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 
75  runManager->SetUserInitialization(new doiPETDetectorConstruction);
76 
77  runManager->SetUserInitialization(new doiPETPhysicsList);
78 
79  // Set user action initialization
80  runManager->SetUserInitialization(new doiPETActionInitialization());
81 
82  //Initialize analysis
83  doiPETAnalysis* ptrAnalysis = doiPETAnalysis::GetInstance();
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
105  G4UImanager* UI = G4UImanager::GetUIpointer();
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 }