35 #include "DetectorConstruction.hh"
46 #define countof(x) (sizeof(x) / sizeof(x[0]))
66 :physiWorld(NULL), logicWorld(NULL), solidWorld(NULL)
79 return ConstructDetector();
84 void DetectorConstruction::DefineMaterials()
93 void DetectorConstruction::LoadChromosome(
const char* filename,
G4VPhysicalVolume* chromBox)
111 solidWorld =
new G4Box(
"world", 10.0*
mm, 10.0*
mm, 10.0*
mm);
130 logicNucleus =
new G4LogicalVolume(solidNucleus, waterMaterial,
"logic nucleus");
138 float chromosomePositionSizeRotation[][7] = {
139 {4.467, 2.835, 0, 1.557, 1.557, 1.557, 90},
140 {-4.467, 2.835, 0, 1.557, 1.557, 1.557, 0},
141 {4.423, -2.831, 0, 1.553, 1.553, 1.553, 90},
142 {-4.423, -2.831, 0, 1.553, 1.553, 1.553, 0},
143 {1.455, 5.63, 0, 1.455, 1.455, 1.455, 0},
144 {-1.455, 5.63, 0, 1.455, 1.455, 1.455, 90},
145 {1.435, 0, 1.392, 1.435, 1.435, 1.435, 0},
146 {-1.435, 0, 1.392, 1.435, 1.435, 1.435, 90},
147 {1.407, 0, -1.450, 1.407, 1.407, 1.407, 90},
148 {-1.407, 0, -1.450, 1.407, 1.407, 1.407, 0},
149 {1.380, -5.437, 0, 1.380, 1.380, 1.380, 0},
150 {-1.380, -5.437, 0, 1.380, 1.380, 1.380, 90},
151 {1.347, 2.782, -1.150, 1.347, 1.347, 1.347, 90},
152 {-1.347, 2.782, -1.150, 1.347, 1.347, 1.347, 0},
153 {1.311, -2.746, -1.220, 1.311, 1.311, 1.311, 90},
154 {-1.311, -2.746, -1.220, 1.311, 1.311, 1.311, 0},
155 {7.251, -2.541, 0, 1.275, 1.275, 1.275, 0},
156 {-6.701, 0, -0.85, 1.275, 1.275, 1.275, 90},
157 {4.148, 0, 1.278, 1.278, 1.278, 1.278, 90},
158 {-4.148, 0, 1.278, 1.278, 1.278, 1.278, 0},
159 {4.147, 0, -1.277, 1.277, 1.277, 1.277, 0},
160 {-4.147, 0, -1.277, 1.277, 1.277, 1.277, 90},
161 {8.930, 0.006, 0, 1.272, 1.272, 1.272, 90},
162 {-7.296, 2.547, 0, 1.272, 1.272, 1.272, 90},
163 {1.207, -2.642, 1.298, 1.207, 1.207, 1.207, 0},
164 {-1.207, -2.642, 1.298, 1.207, 1.207, 1.207, 90},
165 {1.176, 2.611, 1.368, 1.176, 1.176, 1.176, 0},
166 {-1.176, 2.611, 1.368, 1.176, 1.176, 1.176, 90},
167 {4.065, 5.547, 0, 1.155, 1.155, 1.155, 90},
168 {-4.065, 5.547, 0, 1.155, 1.155, 1.155, 0},
169 {6.542, 0.159, 1.116, 1.116, 1.116, 1.116, 0},
170 {-9.092, 0, 0, 1.116, 1.116, 1.116, 0},
171 {6.507, 0.159, -1.081, 1.081, 1.081, 1.081, 90},
172 {-7.057, -2.356, 0, 1.081, 1.081, 1.081, 90},
173 {3.824, -5.448, 0, 1.064, 1.064, 1.064, 90},
174 {-3.824, -5.448, 0, 1.064, 1.064, 1.064, 0},
175 {5.883, -5.379, 0, 0.995, 0.995, 0.995, 0},
176 {-9.133, -2.111, 0, 0.995, 0.995, 0.995, 0},
177 {6.215, 5.387, 0, 0.995, 0.995, 0.995, 0},
178 {-6.971, -4.432, 0, 0.995, 0.995, 0.995, 90},
179 {9.583, 2.177, 0, 0.899, 0.899, 0.899, 90},
180 {-9.467, 2.03, 0, 0.899, 0.899, 0.899, 0},
181 {9.440, -2.180, 0, 0.914, 0.914, 0.914, 90},
182 {-6.34, 0, 1.339, 0.914, 0.914, 0.914, 0},
183 {-6.947, 4.742, 0, 0.923, 0.923, 0.923, 90},
184 {7.354, 2.605, 0, 1.330, 1.330, 1.330, 0}
189 for (
unsigned int i = 0; i <
countof(chromosomePositionSizeRotation); i++)
191 float*
p = &chromosomePositionSizeRotation[i][0];
192 float* size = &chromosomePositionSizeRotation[i][3];
193 float rotation = chromosomePositionSizeRotation[i][6];
197 snprintf(name,
countof(name),
"box%d%c", (i / 2) + 1, i % 2 ?
'l' :
'r');
198 G4Box* solidBox =
new G4Box(name, size[0] *
micrometer, size[1] * micrometer, size[2] * micrometer);
200 physiBox[i] =
new G4PVPlacement(rot, pos,
"chromo", logicBox, physiNucleus,
false, 0);
208 logicEnv =
new G4LogicalVolume(solidEnv, waterMaterial,
"LV chromatin fiber");
214 logicHistone =
new G4LogicalVolume(solidHistone,waterMaterial,
"logic histone");
219 logicBp1 =
new G4LogicalVolume(solidBp1,waterMaterial,
"logic blue sphere");
221 logicBp2 =
new G4LogicalVolume(solidBp2,waterMaterial,
"logic pink sphere");
228 uniDNA =
new G4UnionSolid(
"move", solidSugar1, solidSugar2, 0, posi);
233 uniDNA2 =
new G4UnionSolid(
"move2", solidSugar3, solidSugar4, 0, posi2);
243 G4float matriceSP1[3][3]={{cos(
n*0.076),-sin(
n*0.076),0},{sin(
n*0.076),cos(
n*0.076),0},{0,0,1}};
246 for(
G4int i=0;i<3;i++)
250 for(
G4int j=0;j<3;j++)
252 sumSP1+=matriceSP1[i][j]*SP1[0][j];
253 sumSP2+=matriceSP1[i][j]*SP1[1][j];
255 matriceSP2[0][i] = sumSP1;
256 matriceSP2[1][i] = sumSP2;
259 for(
G4int i=0;i<3;i++)
261 matriceSP2[0][i]+=heliceSP[i];
262 matriceSP2[1][i]+=heliceSP[i];
267 snprintf(name,
countof(name),
"sugar %d",
n);
269 uniDNA =
new G4UnionSolid(
"move", uniDNA, solidSphere3, 0, posSugar1);
271 snprintf(name,
countof(name),
"sugar %d",
n);
273 uniDNA2 =
new G4UnionSolid(
"move2", uniDNA2, solidSphere4, 0, posSugar2);
275 logicSphere3 =
new G4LogicalVolume(uniDNA,waterMaterial,
"logic sugar 2");
276 logicSphere4 =
new G4LogicalVolume(uniDNA2,waterMaterial,
"logic sugar 4");
284 G4float matriceBP1[3][3]={{cos(
n*0.076),-sin(
n*0.076),0},{sin(
n*0.076),cos(
n*0.076),0},{0,0,1}};
287 for(
G4int i=0;i<3;i++)
291 for(
G4int j=0;j<3;j++)
293 sumBP1+=matriceBP1[i][j]*bp1[0][j];
294 sumBP2+=matriceBP1[i][j]*bp1[1][j];
296 matriceBP2[0][i] = sumBP1;
297 matriceBP2[1][i] = sumBP2;
301 for(
G4int i=0;i<3;i++)
303 matriceBP2[0][i]+=heliceBP[i];
304 matriceBP2[1][i]+=heliceBP[i];
309 physiBp1[
n] =
new G4PVPlacement(0,position1,logicBp1,
"physi blue sphere",logicSphere3,
false,0);
310 physiBp2[
n] =
new G4PVPlacement(0,position2,logicBp2,
"physi pink sphere",logicSphere4,
false,0);
319 logicBoxros =
new G4LogicalVolume(solidBoxros, waterMaterial,
"box ros");
327 for (
G4int i = 0; i < 7; i++) {
332 posFiber.
rotateZ(i*25.72*degree);
333 new G4PVPlacement(rotFiber, posFiber, logicEnv,
"physi env", logicBoxros,
false, 0);
336 rotFiber->
rotateX(90 * degree);
337 rotFiber->
rotateY((7 + i) * 25.72 *degree);
339 posFiber.
rotateZ((7 + i) * 25.72*degree);
340 new G4PVPlacement(rotFiber, posFiber, logicEnv,
"physi env", logicBoxros,
false, 0);
343 rotFiber->
rotateX(90 * degree);
344 rotFiber->
rotateY((25.72 + (i - 14) * 51.43) * degree);
346 posFiber.
rotateZ((i - 14) * 51.43 * degree);
347 new G4PVPlacement(rotFiber, posFiber, logicEnv,
"physi env", logicBoxros,
false, 0);
350 rotFiber->
rotateX(90 * degree);
351 rotFiber->
rotateY(180 * degree);
352 rotFiber->
rotateY((i - 21) * 51.43 * degree);
354 posFiber.
rotateZ((i - 21) * 51.43 * degree);
355 new G4PVPlacement(rotFiber, posFiber, logicEnv,
"physi env", logicBoxros,
false, 0);
362 for (
int j = 0; j < 90; j++) {
365 rotStrand1->
rotateZ(j*-51.43*degree);
367 posStrand1.rotateZ(j*51.43*degree);
368 new G4PVPlacement(rotStrand1,posStrand1,logicSphere3,
"physi sugar 2",logicEnv,
false,0);
371 rotStrand2->
rotateZ(j* -51.43*degree);
373 posStrand2.rotateZ(j*51.43*degree);
374 new G4PVPlacement(rotStrand2,posStrand2,logicSphere4,
"physi sugar 4",logicEnv,
false,0);
378 rotHistone->
rotateY(90*degree);
379 rotHistone->
rotateX(j*(-51.43*degree));
381 posHistone.rotateZ(j*51.43*degree);
382 new G4PVPlacement(rotHistone, posHistone, logicHistone,
"PV histone", logicEnv,
false, 0);
387 for (
int k = 0; k < 22; k++)
389 snprintf(name,
countof(name),
"chromo%d.dat", k + 1);
390 LoadChromosome(name, physiBox[k * 2]);
391 LoadChromosome(name, physiBox[k * 2 + 1]);
394 LoadChromosome(
"chromoY.dat", physiBox[44]);
395 LoadChromosome(
"chromoX.dat", physiBox[45]);
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
HepRotation & rotateX(double delta)
CLHEP::HepRotation G4RotationMatrix
G4VPhysicalVolume * Construct()
HepRotation & rotateY(double delta)
static G4NistManager * Instance()
G4GLOB_DLL std::ostream G4cout
Hep3Vector & rotateZ(double)
HepRotation & rotateZ(double delta)
void SetVisAttributes(const G4VisAttributes *pVA)