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: MicrobeamPhantomConfiguration.cc,v 1.6 2008/06/16 07:46:11 sincerti Exp $ |
---|
28 | // ------------------------------------------------------------------- |
---|
29 | |
---|
30 | #include "MicrobeamPhantomConfiguration.hh" |
---|
31 | |
---|
32 | G4int MicrobeamPhantomConfiguration::phantomTotalPixels = 0; |
---|
33 | G4int MicrobeamPhantomConfiguration::nucleusTotalPixels = 0; |
---|
34 | G4int MicrobeamPhantomConfiguration::cytoplasmTotalPixels = 0; |
---|
35 | G4float MicrobeamPhantomConfiguration::dx = 0; |
---|
36 | G4float MicrobeamPhantomConfiguration::dy = 0; |
---|
37 | G4float MicrobeamPhantomConfiguration::dz = 0; |
---|
38 | G4float MicrobeamPhantomConfiguration::nucleusMass = 0; |
---|
39 | G4float MicrobeamPhantomConfiguration::cytoplasmMass = 0; |
---|
40 | |
---|
41 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
42 | |
---|
43 | MicrobeamPhantomConfiguration::MicrobeamPhantomConfiguration() { |
---|
44 | Initialize(); |
---|
45 | } |
---|
46 | |
---|
47 | MicrobeamPhantomConfiguration::~MicrobeamPhantomConfiguration() |
---|
48 | { |
---|
49 | delete[] voxelThreeVector; |
---|
50 | } |
---|
51 | |
---|
52 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
53 | |
---|
54 | G4int MicrobeamPhantomConfiguration::Initialize() { |
---|
55 | |
---|
56 | G4int ncols; |
---|
57 | G4float vx, vy, vz, tmp, mat, den, density; |
---|
58 | G4float denCyto1, denCyto2, denCyto3, denNucl1, denNucl2, denNucl3; |
---|
59 | FILE* fMap; |
---|
60 | |
---|
61 | phantomTotalPixels=0; |
---|
62 | nucleusTotalPixels=0; |
---|
63 | cytoplasmTotalPixels=0; |
---|
64 | dx=0; |
---|
65 | dy=0; |
---|
66 | dz=0; |
---|
67 | nucleusMass=0; |
---|
68 | cytoplasmMass=0; |
---|
69 | |
---|
70 | // READ PHANTOM PARAMETERS |
---|
71 | fMap = fopen("phantom.dat","r"); |
---|
72 | |
---|
73 | ncols = fscanf(fMap,"%i %i %i",&phantomTotalPixels, &nucleusTotalPixels, &cytoplasmTotalPixels); |
---|
74 | ncols = fscanf(fMap,"%f %f %f",&dx, &dy, &dz); |
---|
75 | ncols = fscanf(fMap,"%f %f %f",&tmp, &tmp, &tmp); |
---|
76 | ncols = fscanf(fMap,"%f %f %f",&denCyto1, &denCyto2, &denCyto3); |
---|
77 | ncols = fscanf(fMap,"%f %f %f",&denNucl1, &denNucl2, &denNucl3); |
---|
78 | dx = dx * micrometer; |
---|
79 | dy = dy * micrometer; |
---|
80 | dz = dz * micrometer; |
---|
81 | voxelThreeVector = new G4ThreeVector [phantomTotalPixels]; |
---|
82 | |
---|
83 | for (G4int i=0; i<phantomTotalPixels; i++) |
---|
84 | { |
---|
85 | ncols = fscanf(fMap,"%f %f %f %f %f %f",&vx, &vy, &vz, &mat, &den, &tmp); |
---|
86 | |
---|
87 | if (mat==2) // NUCLEUS |
---|
88 | { |
---|
89 | if (den==1) density = denNucl1*(g/cm3); |
---|
90 | if (den==2) density = denNucl2*(g/cm3); |
---|
91 | if (den==3) density = denNucl3*(g/cm3); |
---|
92 | nucleusMass = nucleusMass + density * dx * dy * dz ; |
---|
93 | } |
---|
94 | |
---|
95 | if (mat==1) // CYTOPLASM |
---|
96 | { |
---|
97 | if (den==1) density = denCyto1*(g/cm3); |
---|
98 | if (den==2) density = denCyto2*(g/cm3); |
---|
99 | if (den==3) density = denCyto3*(g/cm3); |
---|
100 | cytoplasmMass = cytoplasmMass + density * dx * dy * dz ; |
---|
101 | } |
---|
102 | |
---|
103 | G4ThreeVector v(vx,vy,vz); |
---|
104 | voxelThreeVector[i] = v; |
---|
105 | } |
---|
106 | |
---|
107 | fclose(fMap); |
---|
108 | |
---|
109 | return 0; |
---|
110 | } |
---|
111 | |
---|
112 | |
---|