Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MicrobeamPhantomConfiguration.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // -------------------------------------------------------------------
27 // $Id$
28 // -------------------------------------------------------------------
29 
31 #include "G4SystemOfUnits.hh"
32 
33 G4int MicrobeamPhantomConfiguration::phantomTotalPixels = 0;
34 G4int MicrobeamPhantomConfiguration::nucleusTotalPixels = 0;
35 G4int MicrobeamPhantomConfiguration::cytoplasmTotalPixels = 0;
36 G4float MicrobeamPhantomConfiguration::dx = 0;
37 G4float MicrobeamPhantomConfiguration::dy = 0;
38 G4float MicrobeamPhantomConfiguration::dz = 0;
39 G4float MicrobeamPhantomConfiguration::nucleusMass = 0;
40 G4float MicrobeamPhantomConfiguration::cytoplasmMass = 0;
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45 Initialize();
46 }
47 
49 {
50  delete[] voxelThreeVector;
51 }
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 
57  G4float vx, vy, vz, tmp, density;
58  G4int den, mat;
59  G4float denCyto1, denCyto2, denCyto3, denNucl1, denNucl2, denNucl3;
60  FILE* fMap;
61 
62  phantomTotalPixels=0;
63  nucleusTotalPixels=0;
64  cytoplasmTotalPixels=0;
65  dx=0;
66  dy=0;
67  dz=0;
68  nucleusMass=0;
69  cytoplasmMass=0;
70  density=0;
71 
72  // READ PHANTOM PARAMETERS
73  fMap = fopen("phantom.dat","r");
74 
75  fscanf(fMap,"%i %i %i",&phantomTotalPixels, &nucleusTotalPixels, &cytoplasmTotalPixels);
76  fscanf(fMap,"%f %f %f",&dx, &dy, &dz);
77  fscanf(fMap,"%f %f %f",&tmp, &tmp, &tmp);
78  fscanf(fMap,"%f %f %f",&denCyto1, &denCyto2, &denCyto3);
79  fscanf(fMap,"%f %f %f",&denNucl1, &denNucl2, &denNucl3);
80  dx = dx * micrometer;
81  dy = dy * micrometer;
82  dz = dz * micrometer;
83  voxelThreeVector = new G4ThreeVector [phantomTotalPixels];
84 
85  for (G4int i=0; i<phantomTotalPixels; i++)
86  {
87  fscanf(fMap,"%f %f %f %i %i %f",&vx, &vy, &vz, &mat, &den, &tmp);
88 
89  if (std::abs(mat-2)<1.e-30) // NUCLEUS
90  {
91  if (std::abs(den-1)<1.e-30) density = denNucl1*(g/cm3);
92  if (std::abs(den-2)<1.e-30) density = denNucl2*(g/cm3);
93  if (std::abs(den-3)<1.e-30) density = denNucl3*(g/cm3);
94  nucleusMass = nucleusMass + density * dx * dy * dz ;
95  }
96 
97  if (std::abs(mat-1)<1.e-30) // CYTOPLASM
98  {
99  if (std::abs(den-1)<1e-30) density = denCyto1*(g/cm3);
100  if (std::abs(den-2)<1e-30) density = denCyto2*(g/cm3);
101  if (std::abs(den-3)<1e-30) density = denCyto3*(g/cm3);
102  cytoplasmMass = cytoplasmMass + density * dx * dy * dz ;
103  }
104 
105  G4ThreeVector v(vx,vy,vz);
106  voxelThreeVector[i] = v;
107  }
108 
109  fclose(fMap);
110 
111  return 0;
112 }
113