Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/medical/dna/wholeNuclearDNA/src/DetectorConstruction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // This example is provided by the Geant4-DNA collaboration
 27 // Any report or published results obtained using the Geant4-DNA software
 28 // and the DNA geometry given in the Geom_DNA example
 29 // shall cite the following Geant4-DNA collaboration publications:
 30 // [1] NIM B 298 (2013) 47-54
 31 // [2] Med. Phys. 37 (2010) 4692-4708
 32 // The Geant4-DNA web site is available at http://geant4-dna.org
 33 //
 34 /// \file DetectorConstruction.cc
 35 /// \brief Implementation of the DetectorConstruction class
 36 
 37 #include "DetectorConstruction.hh"
 38 
 39 // Geant4
 40 #include "CLHEP/Units/SystemOfUnits.h"
 41 #include "ChromosomeParameterisation.hh"
 42 
 43 #include "G4Box.hh"
 44 #include "G4Ellipsoid.hh"
 45 #include "G4LogicalVolume.hh"
 46 #include "G4NistManager.hh"
 47 #include "G4Orb.hh"
 48 #include "G4PVParameterised.hh"
 49 #include "G4PVPlacement.hh"
 50 #include "G4RotationMatrix.hh"
 51 #include "G4Tubs.hh"
 52 #include "G4UnionSolid.hh"
 53 #include "G4VisAttributes.hh"
 54 #include "globals.hh"
 55 
 56 #define countof(x) (sizeof(x) / sizeof(x[0]))
 57 
 58 using namespace std;
 59 using CLHEP::degree;
 60 using CLHEP::micrometer;
 61 using CLHEP::mm;
 62 using CLHEP::nanometer;
 63 
 64 static G4VisAttributes visInvBlue(false, G4Colour(0.0, 0.0, 1.0));
 65 static G4VisAttributes visInvWhite(false, G4Colour(1.0, 1.0, 1.0));
 66 static G4VisAttributes visInvPink(false, G4Colour(1.0, 0.0, 1.0));
 67 static G4VisAttributes visInvCyan(false, G4Colour(0.0, 1.0, 1.0));
 68 static G4VisAttributes visInvRed(false, G4Colour(1.0, 0.0, 0.0));
 69 static G4VisAttributes visInvGreen(false, G4Colour(0.0, 1.0, 0.0));
 70 static G4VisAttributes visBlue(true, G4Colour(0.0, 0.0, 1.0));
 71 static G4VisAttributes visWhite(true, G4Colour(1.0, 1.0, 1.0));
 72 static G4VisAttributes visPink(true, G4Colour(1.0, 0.0, 1.0));
 73 static G4VisAttributes visCyan(true, G4Colour(0.0, 1.0, 1.0));
 74 static G4VisAttributes visRed(true, G4Colour(1.0, 0.0, 0.0));
 75 static G4VisAttributes visGreen(true, G4Colour(0.0, 1.0, 0.0));
 76 
 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 78 
 79 DetectorConstruction::DetectorConstruction()
 80   : G4VUserDetectorConstruction(), fBuildChromatineFiber(true), fBuildBases(false)
 81 {}
 82 
 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 84 
 85 DetectorConstruction::~DetectorConstruction() {}
 86 
 87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 88 
 89 G4VPhysicalVolume* DetectorConstruction::Construct()
 90 {
 91   DefineMaterials();
 92   return ConstructDetector();
 93 }
 94 
 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 96 
 97 void DetectorConstruction::DefineMaterials()
 98 {
 99   // Water is defined from NIST material database
100   G4NistManager* man = G4NistManager::Instance();
101   man->FindOrBuildMaterial("G4_WATER");
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105 
106 void DetectorConstruction::LoadChromosome(const char* filename, G4VPhysicalVolume* chromBox,
107                                           G4LogicalVolume* logicBoxros)
108 {
109   ChromosomeParameterisation* cp = new ChromosomeParameterisation(filename);
110   new G4PVParameterised("box ros", logicBoxros, chromBox, kUndefined, cp->GetNumRosettes(), cp);
111 
112   G4cout << filename << " done" << G4endl;
113 }
114 
115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116 
117 G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
118 {
119   if (fBuildBases == false && fBuildChromatineFiber == false) {
120     G4cout << "======================================================" << G4endl;
121     G4cout << "WARNING from DetectorConstruction::ConstructDetector:" << G4endl;
122     G4cout << "As long as the flags fBuildBases and fBuildChromatineFiber are "
123               "false, the output root file will be empty"
124            << G4endl;
125     G4cout << "This is intended for fast computation, display, testing ..." << G4endl;
126     G4cout << "======================================================" << G4endl;
127   }
128 
129   G4String name;
130 
131   /***************************************************************************/
132   //                               World
133   /***************************************************************************/
134 
135   DefineMaterials();
136   G4Material* waterMaterial = G4Material::GetMaterial("G4_WATER");
137 
138   G4Box* solidWorld = new G4Box("world", 10.0 * mm, 10.0 * mm, 10.0 * mm);
139   G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, waterMaterial, "world");
140   G4PVPlacement* physiWorld =
141     new G4PVPlacement(0, G4ThreeVector(), "world", logicWorld, 0, false, 0);
142   logicWorld->SetVisAttributes(&visInvWhite);
143 
144   /****************************************************************************/
145   //                             Box nucleus
146   /****************************************************************************/
147 
148   G4Box* solidTin = new G4Box("tin", 13 * micrometer, 10 * micrometer, 5 * micrometer);
149   G4LogicalVolume* logicTin = new G4LogicalVolume(solidTin, waterMaterial, "tin");
150   G4VPhysicalVolume* physiTin =
151     new G4PVPlacement(0, G4ThreeVector(), "tin", logicTin, physiWorld, false, 0);
152   logicTin->SetVisAttributes(&visInvWhite);
153 
154   /****************************************************************************/
155   //                            Cell nucleus
156   /****************************************************************************/
157 
158   G4Ellipsoid* solidNucleus =
159     new G4Ellipsoid("nucleus", 11.82 * micrometer, 8.52 * micrometer, 3 * micrometer, 0, 0);
160   G4LogicalVolume* logicNucleus = new G4LogicalVolume(solidNucleus, waterMaterial, "logic nucleus");
161   G4VPhysicalVolume* physiNucleus =
162     new G4PVPlacement(0, G4ThreeVector(), "physi nucleus", logicNucleus, physiTin, false, 0);
163   logicNucleus->SetVisAttributes(&visPink);
164 
165   /****************************************************************************/
166   //                        Chromosomes territories
167   /****************************************************************************/
168   // NOTE: The only supported values for the rotation are
169   // 0 and 90 degrees on the Y axis.
170   G4double chromosomePositionSizeRotation[][7] = {
171     {4.467, 2.835, 0, 1.557, 1.557, 1.557, 90},
172     {-4.467, 2.835, 0, 1.557, 1.557, 1.557, 0},
173     {4.423, -2.831, 0, 1.553, 1.553, 1.553, 90},
174     {-4.423, -2.831, 0, 1.553, 1.553, 1.553, 0},
175     {1.455, 5.63, 0, 1.455, 1.455, 1.455, 0},
176     {-1.455, 5.63, 0, 1.455, 1.455, 1.455, 90},
177     {1.435, 0, 1.392, 1.435, 1.435, 1.435, 0},
178     {-1.435, 0, 1.392, 1.435, 1.435, 1.435, 90},
179     {1.407, 0, -1.450, 1.407, 1.407, 1.407, 90},  // 5 right
180     {-1.407, 0, -1.450, 1.407, 1.407, 1.407, 0},  // 5 left
181     {1.380, -5.437, 0, 1.380, 1.380, 1.380, 0},
182     {-1.380, -5.437, 0, 1.380, 1.380, 1.380, 90},
183     {1.347, 2.782, -1.150, 1.347, 1.347, 1.347, 90},
184     {-1.347, 2.782, -1.150, 1.347, 1.347, 1.347, 0},
185     {1.311, -2.746, -1.220, 1.311, 1.311, 1.311, 90},
186     {-1.311, -2.746, -1.220, 1.311, 1.311, 1.311, 0},
187     {7.251, -2.541, 0, 1.275, 1.275, 1.275, 0},
188     {-6.701, 0, -0.85, 1.275, 1.275, 1.275, 90},
189     {4.148, 0, 1.278, 1.278, 1.278, 1.278, 90},  // 10 right
190     {-4.148, 0, 1.278, 1.278, 1.278, 1.278, 0},  // 10 left
191     {4.147, 0, -1.277, 1.277, 1.277, 1.277, 0},
192     {-4.147, 0, -1.277, 1.277, 1.277, 1.277, 90},
193     {8.930, 0.006, 0, 1.272, 1.272, 1.272, 90},
194     {-7.296, 2.547, 0, 1.272, 1.272, 1.272, 90},
195     {1.207, -2.642, 1.298, 1.207, 1.207, 1.207, 0},
196     {-1.207, -2.642, 1.298, 1.207, 1.207, 1.207, 90},
197     {1.176, 2.611, 1.368, 1.176, 1.176, 1.176, 0},
198     {-1.176, 2.611, 1.368, 1.176, 1.176, 1.176, 90},
199     {4.065, 5.547, 0, 1.155, 1.155, 1.155, 90},  // 15 right
200     {-4.065, 5.547, 0, 1.155, 1.155, 1.155, 0},  // 15 left
201     {6.542, 0.159, 1.116, 1.116, 1.116, 1.116, 0},
202     {-9.092, 0, 0, 1.116, 1.116, 1.116, 0},
203     {6.507, 0.159, -1.081, 1.081, 1.081, 1.081, 90},
204     {-7.057, -2.356, 0, 1.081, 1.081, 1.081, 90},
205     {3.824, -5.448, 0, 1.064, 1.064, 1.064, 90},
206     {-3.824, -5.448, 0, 1.064, 1.064, 1.064, 0},
207     {5.883, -5.379, 0, 0.995, 0.995, 0.995, 0},
208     {-9.133, -2.111, 0, 0.995, 0.995, 0.995, 0},
209     {6.215, 5.387, 0, 0.995, 0.995, 0.995, 0},  // 20 right
210     {-6.971, -4.432, 0, 0.995, 0.995, 0.995, 90},  // 20 left
211     {9.583, 2.177, 0, 0.899, 0.899, 0.899, 90},
212     {-9.467, 2.03, 0, 0.899, 0.899, 0.899, 0},
213     {9.440, -2.180, 0, 0.914, 0.914, 0.914, 90},
214     {-6.34, 0, 1.339, 0.914, 0.914, 0.914, 0},
215     {-6.947, 4.742, 0, 0.923, 0.923, 0.923, 90},  // Y
216     {7.354, 2.605, 0, 1.330, 1.330, 1.330, 0}  // X
217   };
218 
219   G4RotationMatrix* rotch = new G4RotationMatrix;
220   rotch->rotateY(90 * degree);
221 
222   vector<G4VPhysicalVolume*> physiBox(48);
223 
224   for (unsigned int i = 0; i < countof(chromosomePositionSizeRotation); i++) {
225     G4double* p = &chromosomePositionSizeRotation[i][0];
226     G4double* size = &chromosomePositionSizeRotation[i][3];
227     G4double rotation = chromosomePositionSizeRotation[i][6];
228     G4ThreeVector pos(p[0] * micrometer, p[1] * micrometer, p[2] * micrometer);
229     G4RotationMatrix* rot = rotation == 0 ? 0 : rotch;
230 
231     ostringstream ss;
232     ss << "box" << (i / 2) + 1 << (i % 2 ? 'l' : 'r');
233     name = ss.str();
234     ss.str("");
235     ss.clear();
236 
237     /*
238      snprintf(name, countof(name), "box%d%c",
239      (i / 2) + 1, i % 2 ? 'l' : 'r');
240      */
241     G4Box* solidBox =
242       new G4Box(name, size[0] * micrometer, size[1] * micrometer, size[2] * micrometer);
243     G4LogicalVolume* logicBox = new G4LogicalVolume(solidBox, waterMaterial, name);
244     physiBox[i] = new G4PVPlacement(rot, pos, "chromo", logicBox, physiNucleus, false, 0);
245     logicBox->SetVisAttributes(&visBlue);
246   }
247 
248   /**************************************************************************/
249   //                 Box containing the chromatin flowers
250   /**************************************************************************/
251 
252   G4Tubs* solidBoxros = new G4Tubs("solid box ros", 0 * nanometer, 399 * nanometer, 20 * nanometer,
253                                    0 * degree, 360 * degree);
254   G4LogicalVolume* logicBoxros = new G4LogicalVolume(solidBoxros, waterMaterial, "box ros");
255   logicBoxros->SetVisAttributes(&visInvBlue);
256 
257   // Loading flower box position for each chromosome territory
258 
259   for (int k = 0; k < 22; k++) {
260     ostringstream oss;
261     oss << "chromo" << k + 1 << ".dat";
262     name = oss.str();
263     oss.str("");
264     oss.clear();
265     // snprintf(name, countof(name), "chromo%d.dat", k + 1);
266     LoadChromosome(name.c_str(), physiBox[k * 2], logicBoxros);
267     LoadChromosome(name.c_str(), physiBox[k * 2 + 1], logicBoxros);
268   }
269 
270   LoadChromosome("chromoY.dat", physiBox[44], logicBoxros);
271   LoadChromosome("chromoX.dat", physiBox[45], logicBoxros);
272 
273   /****************************************************************************/
274   if (fBuildChromatineFiber) {
275     // chromatin fiber envelope
276     G4Tubs* solidEnv = new G4Tubs("chromatin fiber", 0, 15.4 * nanometer, 80.5 * nanometer,
277                                   0 * degree, 360 * degree);
278     G4LogicalVolume* logicEnv = new G4LogicalVolume(solidEnv, waterMaterial, "LV chromatin fiber");
279     logicEnv->SetVisAttributes(&visInvPink);
280 
281     // Chromatin fiber position
282     for (G4int i = 0; i < 7; i++) {
283       G4RotationMatrix* rotFiber = new G4RotationMatrix;
284       rotFiber->rotateX(90 * degree);
285       rotFiber->rotateY(i * 25.72 * degree);
286       G4ThreeVector posFiber = G4ThreeVector(0, 152 * nanometer, 0);
287       posFiber.rotateZ(i * 25.72 * degree);
288       new G4PVPlacement(rotFiber, posFiber, logicEnv, "physi env", logicBoxros, false, 0);
289 
290       rotFiber = new G4RotationMatrix;
291       rotFiber->rotateX(90 * degree);
292       rotFiber->rotateY((7 + i) * 25.72 * degree);
293       posFiber = G4ThreeVector(0, 152 * nanometer, 0);
294       posFiber.rotateZ((7 + i) * 25.72 * degree);
295       new G4PVPlacement(rotFiber, posFiber, logicEnv, "physi env", logicBoxros, false, 0);
296 
297       rotFiber = new G4RotationMatrix;
298       rotFiber->rotateX(90 * degree);
299       rotFiber->rotateY((25.72 + (i - 14) * 51.43) * degree);
300       posFiber = G4ThreeVector(-36.5 * nanometer, 312 * nanometer, 0);
301       posFiber.rotateZ((i - 14) * 51.43 * degree);
302       new G4PVPlacement(rotFiber, posFiber, logicEnv, "physi env", logicBoxros, false, 0);
303 
304       rotFiber = new G4RotationMatrix;
305       rotFiber->rotateX(90 * degree);
306       rotFiber->rotateY(180 * degree);
307       rotFiber->rotateY((i - 21) * 51.43 * degree);
308       posFiber = G4ThreeVector(-103 * nanometer, 297 * nanometer, 0);
309       posFiber.rotateZ((i - 21) * 51.43 * degree);
310       new G4PVPlacement(rotFiber, posFiber, logicEnv, "physi env", logicBoxros, false, 0);
311     }
312 
313     if (fBuildBases) {
314       // Histones
315       G4Tubs* solidHistone = new G4Tubs("solid histone", 0, 3.25 * nanometer, 2.85 * nanometer,
316                                         0 * degree, 360 * degree);
317       G4LogicalVolume* logicHistone =
318         new G4LogicalVolume(solidHistone, waterMaterial, "logic histone");
319 
320       // Base pair
321       G4Orb* solidBp1 = new G4Orb("blue sphere", 0.17 * nanometer);
322       G4LogicalVolume* logicBp1 = new G4LogicalVolume(solidBp1, waterMaterial, "logic blue sphere");
323       G4Orb* solidBp2 = new G4Orb("pink sphere", 0.17 * nanometer);
324       G4LogicalVolume* logicBp2 = new G4LogicalVolume(solidBp2, waterMaterial, "logic pink sphere");
325 
326       // Phosphodiester group
327 
328       G4Orb* solidSugar_48em1_nm = new G4Orb("sugar", 0.48 * nanometer);
329 
330       G4ThreeVector posi(0.180248 * nanometer, 0.32422 * nanometer, 0.00784 * nanometer);
331       G4UnionSolid* uniDNA =
332         new G4UnionSolid("move", solidSugar_48em1_nm, solidSugar_48em1_nm, 0, posi);
333 
334       G4ThreeVector posi2(-0.128248 * nanometer, 0.41227 * nanometer, 0.03584 * nanometer);
335       G4UnionSolid* uniDNA2 =
336         new G4UnionSolid("move2", solidSugar_48em1_nm, solidSugar_48em1_nm, 0, posi2);
337 
338       /************************************************************************
339        Phosphodiester group Position
340        ************************************************************************/
341 
342       for (G4int n = 2; n < 200; n++) {
343         G4double SP1[2][3] = {
344           {(-0.6 * nanometer) * cos(n * 0.26), 0, (0.6 * nanometer) * sin(n * 0.26)},
345           {(0.6 * nanometer) * cos(n * 0.26), 0, (-0.6 * nanometer) * sin(0.26 * n)}};
346         G4double matriceSP1[3][3] = {
347           {cos(n * 0.076), -sin(n * 0.076), 0}, {sin(n * 0.076), cos(n * 0.076), 0}, {0, 0, 1}};
348         G4double matriceSP2[2][3];
349 
350         for (G4int i = 0; i < 3; i++) {
351           G4double sumSP1 = 0;
352           G4double sumSP2 = 0;
353           for (G4int j = 0; j < 3; j++) {
354             sumSP1 += matriceSP1[i][j] * SP1[0][j];
355             sumSP2 += matriceSP1[i][j] * SP1[1][j];
356           }
357           matriceSP2[0][i] = sumSP1;
358           matriceSP2[1][i] = sumSP2;
359         }
360 
361         G4double heliceSP[3] = {(4.85 * nanometer) * cos(n * 0.076),
362                                 (4.85 * nanometer) * sin(n * 0.076), (n * 0.026 * nanometer)};
363 
364         for (G4int i = 0; i < 3; i++) {
365           matriceSP2[0][i] += heliceSP[i];
366           matriceSP2[1][i] += heliceSP[i];
367         }
368         G4ThreeVector posSugar1(matriceSP2[0][2], matriceSP2[0][1],
369                                 (matriceSP2[0][0]) - (4.25 * nanometer));
370         G4ThreeVector posSugar2(matriceSP2[1][2], matriceSP2[1][1],
371                                 (matriceSP2[1][0]) - (5.45 * nanometer));
372 
373         ostringstream ss;
374         ss << "sugar_" << n;
375         name = ss.str().c_str();
376         ss.str("");
377         ss.clear();
378 
379         //  snprintf(name, countof(name), "sugar %d", n);
380         uniDNA = new G4UnionSolid(name, uniDNA, solidSugar_48em1_nm, 0, posSugar1);
381 
382         ss << "sugar_" << n;
383         name = ss.str().c_str();
384         ss.str("");
385         ss.clear();
386 
387         //  snprintf(name, countof(name), "sugar %d", n);
388         uniDNA2 = new G4UnionSolid(name, uniDNA2, solidSugar_48em1_nm, 0, posSugar2);
389       }
390       G4LogicalVolume* logicSphere3 = new G4LogicalVolume(uniDNA, waterMaterial, "logic sugar 2");
391       G4LogicalVolume* logicSphere4 = new G4LogicalVolume(uniDNA2, waterMaterial, "logic sugar 4");
392 
393       /**************************************************************************
394        Base pair Position
395        **************************************************************************/
396       for (G4int n = 0; n < 200; n++) {
397         G4double bp1[2][3] = {
398           {(-0.34 * nanometer) * cos(n * 0.26), 0, (0.34 * nanometer) * sin(n * 0.26)},
399           {(0.34 * nanometer) * cos(n * 0.26), 0, (-0.34 * nanometer) * sin(0.26 * n)}};
400         G4double matriceBP1[3][3] = {
401           {cos(n * 0.076), -sin(n * 0.076), 0}, {sin(n * 0.076), cos(n * 0.076), 0}, {0, 0, 1}};
402         G4double matriceBP2[2][3];
403 
404         for (G4int i = 0; i < 3; i++) {
405           G4double sumBP1 = 0;
406           G4double sumBP2 = 0;
407           for (G4int j = 0; j < 3; j++) {
408             sumBP1 += matriceBP1[i][j] * bp1[0][j];
409             sumBP2 += matriceBP1[i][j] * bp1[1][j];
410           }
411           matriceBP2[0][i] = sumBP1;
412           matriceBP2[1][i] = sumBP2;
413         }
414         G4double heliceBP[3] = {(4.8 * nanometer) * cos(n * 0.076),
415                                 (4.8 * nanometer) * sin(n * 0.076), n * 0.026 * nanometer};
416 
417         for (G4int i = 0; i < 3; i++) {
418           matriceBP2[0][i] += heliceBP[i];
419           matriceBP2[1][i] += heliceBP[i];
420         }
421         G4ThreeVector position1(matriceBP2[0][2], matriceBP2[0][1],
422                                 matriceBP2[0][0] - (4.25 * nanometer));
423         G4ThreeVector position2(matriceBP2[1][2], matriceBP2[1][1],
424                                 matriceBP2[1][0] - (5.45 * nanometer));
425 
426         new G4PVPlacement(0, position1, logicBp1, "physi blue sphere", logicSphere3, false, 0);
427         new G4PVPlacement(0, position2, logicBp2, "physi pink sphere", logicSphere4, false, 0);
428       }
429 
430       /****************************************************************************/
431       //                 Initial position of different elements
432       /****************************************************************************/
433       // DNA and histone positions
434       for (int j = 0; j < 90; j++) {
435         // DNA (bp-SP)
436         G4RotationMatrix* rotStrand1 = new G4RotationMatrix;
437         rotStrand1->rotateZ(j * -51.43 * degree);
438         G4ThreeVector posStrand1(-2.7 * nanometer, 9.35 * nanometer,
439                                  (-69.9 * nanometer) + (j * 1.67 * nanometer));
440         posStrand1.rotateZ(j * 51.43 * degree);
441         new G4PVPlacement(rotStrand1, posStrand1, logicSphere3, "physi sugar 2", logicEnv, false,
442                           0);
443 
444         G4RotationMatrix* rotStrand2 = new G4RotationMatrix;
445         rotStrand2->rotateZ(j * -51.43 * degree);
446         G4ThreeVector posStrand2(-2.7 * nanometer, 9.35 * nanometer,
447                                  (-68.7 * nanometer) + (j * 1.67 * nanometer));
448         posStrand2.rotateZ(j * 51.43 * degree);
449         new G4PVPlacement(rotStrand2, posStrand2, logicSphere4, "physi sugar 4", logicEnv, false,
450                           0);
451 
452         // histones
453         G4RotationMatrix* rotHistone = new G4RotationMatrix;
454         rotHistone->rotateY(90 * degree);
455         rotHistone->rotateX(j * (-51.43 * degree));
456         G4ThreeVector posHistone(0.0, 9.35 * nanometer, (-74.15 + j * 1.67) * nanometer);
457         posHistone.rotateZ(j * 51.43 * degree);
458         new G4PVPlacement(rotHistone, posHistone, logicHistone, "PV histone", logicEnv, false, 0);
459       }
460       /************************************************************************/
461       //                        Visualisation colors
462       /************************************************************************/
463 
464       logicBp1->SetVisAttributes(&visInvCyan);
465       logicBp2->SetVisAttributes(&visInvPink);
466 
467       logicSphere3->SetVisAttributes(&visInvWhite);
468       logicSphere4->SetVisAttributes(&visInvRed);
469 
470       logicHistone->SetVisAttributes(&visInvBlue);
471     }
472   }
473 
474   G4cout << "Geometry has been loaded" << G4endl;
475   return physiWorld;
476 }
477