Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
DICOM.cc File Reference

Main program of the medical/DICOM example. More...

#include "G4RunManager.hh"
#include "globals.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DicomPhysicsList.hh"
#include "DicomRegularDetectorConstruction.hh"
#include "DicomNestedParamDetectorConstruction.hh"
#include "DicomPartialDetectorConstruction.hh"
#include "DicomActionInitialization.hh"
#include "DicomHandler.hh"
#include "DicomIntersectVolume.hh"
#include "QGSP_BIC.hh"
#include "G4tgrMessenger.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the medical/DICOM example.

Definition in file DICOM.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 80 of file DICOM.cc.

References G4UImanager::ApplyCommand(), DicomHandler::CheckFileFormat(), G4UIcommand::ConvertToDouble(), FALSE, G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4MTRunManager::SetNumberOfThreads(), CLHEP::HepRandom::setTheEngine(), CLHEP::HepRandom::setTheSeed(), CLHEP::HepRandom::setTheSeeds(), G4RunManager::SetUserInitialization(), G4VUserPhysicsList::SetVerboseLevel(), and TRUE.

81 {
82 
83  new G4tgrMessenger;
84  char* part = getenv( "DICOM_PARTIAL_PARAM" );
85  G4bool bPartial = FALSE;
86  if( part && G4String(part) == "1" ) {
87  bPartial = TRUE;
88  }
89 
91  CLHEP::HepRandom::setTheSeed(24534575684783);
92  long seeds[2];
93  seeds[0] = 534524575674523;
94  seeds[1] = 526345623452457;
96 
97  // Construct the default run manager
98 #ifdef G4MULTITHREADED
99  char* nthread_c = getenv("DICOM_NTHREADS");
100 
101  unsigned nthreads = 4;
102  unsigned env_threads = 0;
103 
104  if(nthread_c) { env_threads = G4UIcommand::ConvertToDouble(nthread_c); }
105  if(env_threads > 0) { nthreads = env_threads; }
106 
107  G4MTRunManager* runManager = new G4MTRunManager;
108  runManager->SetNumberOfThreads(nthreads);
109 
110  std::cout << "\n\n\tDICOM running in multithreaded mode with " << nthreads
111  << " threads\n\n" << std::endl;
112 
113 
114 #else
115  G4RunManager* runManager = new G4RunManager;
116  std::cout << "\n\n\tDICOM running in serial mode\n\n" << std::endl;
117 
118 #endif
119 
120  DicomDetectorConstruction* theGeometry = 0;
121  DicomHandler* dcmHandler = 0;
122 
123  if( !bPartial ){
124  // Treatment of DICOM images before creating the G4runManager
125  dcmHandler = new DicomHandler;
126  dcmHandler->CheckFileFormat();
127 
128  // Initialisation of physics, geometry, primary particles ...
129  char* nest = getenv( "DICOM_NESTED_PARAM" );
130  if( nest && G4String(nest) == "1" ) {
131  theGeometry = new DicomNestedParamDetectorConstruction();
132  } else {
133  theGeometry = new DicomRegularDetectorConstruction();
134  }
135  } else {
136  theGeometry = new DicomPartialDetectorConstruction();
137  }
138 
139  // runManager->SetUserInitialization(new DicomPhysicsList);
140  G4VUserPhysicsList* phys = 0;
141  runManager->SetUserInitialization(phys = new QGSP_BIC);
142  phys->SetVerboseLevel(0);
143  runManager->SetUserInitialization(theGeometry);
144 
145  // Set user action classes
147 
148  runManager->Initialize();
149 
150  new DicomIntersectVolume();
151 
152 #ifdef G4VIS_USE
153  // visualisation manager
154  G4VisManager* visManager = new G4VisExecutive;
155  visManager->Initialize();
156 #endif
157 
158 
159  G4UImanager* UImanager = G4UImanager::GetUIpointer();
160 
161 
162  if (argc==1)
163  {
164 #ifdef G4UI_USE
165  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
166 #ifdef G4VIS_USE
167  UImanager->ApplyCommand("/control/execute vis.mac");
168 #endif
169  ui->SessionStart();
170  delete ui;
171 #endif
172  }
173  else
174  {
175  G4String command = "/control/execute ";
176  G4String fileName = argv[1];
177  UImanager->ApplyCommand(command+fileName);
178  }
179 
180  delete runManager;
181 
182 #ifdef G4VIS_USE
183  delete visManager;
184 #endif
185 
186  if( !bPartial ) { delete dcmHandler; }
187 
188  return 0;
189 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
static void setTheSeeds(const long *seeds, int aux=-1)
Definition: Random.cc:141
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:131
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Manages intersections of DICOM files with volumes.
bool G4bool
Definition: G4Types.hh:79
void SetVerboseLevel(G4int value)
#define FALSE
Definition: globals.hh:52
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:429
#define TRUE
Definition: globals.hh:55
void Initialize()
virtual void Initialize()
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:170
void CheckFileFormat()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419