Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // This example is provided by the Geant4-DNA 26 // This example is provided by the Geant4-DNA collaboration 27 // Any report or published results obtained us << 27 // Any report or published results obtained using the Geant4-DNA software 28 // and the DNA geometry given in the Geom_DNA << 28 // and the DNA geometry given in the Geom_DNA example 29 // shall cite the following Geant4-DNA collabo 29 // shall cite the following Geant4-DNA collaboration publications: 30 // [1] NIM B 298 (2013) 47-54 30 // [1] NIM B 298 (2013) 47-54 31 // [2] Med. Phys. 37 (2010) 4692-4708 31 // [2] Med. Phys. 37 (2010) 4692-4708 32 // The Geant4-DNA web site is available at htt 32 // The Geant4-DNA web site is available at http://geant4-dna.org 33 // 33 // >> 34 // $ID$ 34 /// \file DetectorConstruction.cc 35 /// \file DetectorConstruction.cc 35 /// \brief Implementation of the DetectorConst 36 /// \brief Implementation of the DetectorConstruction class 36 37 37 #include "DetectorConstruction.hh" 38 #include "DetectorConstruction.hh" 38 39 39 // Geant4 40 // Geant4 >> 41 #include "globals.hh" 40 #include "CLHEP/Units/SystemOfUnits.h" 42 #include "CLHEP/Units/SystemOfUnits.h" 41 #include "ChromosomeParameterisation.hh" << 42 << 43 #include "G4Box.hh" << 44 #include "G4Ellipsoid.hh" << 45 #include "G4LogicalVolume.hh" 43 #include "G4LogicalVolume.hh" 46 #include "G4NistManager.hh" << 44 #include "G4UnionSolid.hh" >> 45 #include "G4Box.hh" 47 #include "G4Orb.hh" 46 #include "G4Orb.hh" >> 47 #include "G4Tubs.hh" >> 48 #include "G4Ellipsoid.hh" 48 #include "G4PVParameterised.hh" 49 #include "G4PVParameterised.hh" 49 #include "G4PVPlacement.hh" 50 #include "G4PVPlacement.hh" 50 #include "G4RotationMatrix.hh" 51 #include "G4RotationMatrix.hh" 51 #include "G4Tubs.hh" << 52 #include "G4UnionSolid.hh" << 53 #include "G4VisAttributes.hh" 52 #include "G4VisAttributes.hh" 54 #include "globals.hh" << 53 #include "G4NistManager.hh" >> 54 #include "ChromosomeParameterisation.hh" 55 55 56 #define countof(x) (sizeof(x) / sizeof(x[0])) 56 #define countof(x) (sizeof(x) / sizeof(x[0])) 57 57 58 using namespace std; 58 using namespace std; 59 using CLHEP::degree; << 60 using CLHEP::micrometer; << 61 using CLHEP::mm; 59 using CLHEP::mm; >> 60 using CLHEP::degree; 62 using CLHEP::nanometer; 61 using CLHEP::nanometer; >> 62 using CLHEP::micrometer; 63 63 64 static G4VisAttributes visInvBlue(false, G4Col 64 static G4VisAttributes visInvBlue(false, G4Colour(0.0, 0.0, 1.0)); 65 static G4VisAttributes visInvWhite(false, G4Co 65 static G4VisAttributes visInvWhite(false, G4Colour(1.0, 1.0, 1.0)); 66 static G4VisAttributes visInvPink(false, G4Col 66 static G4VisAttributes visInvPink(false, G4Colour(1.0, 0.0, 1.0)); 67 static G4VisAttributes visInvCyan(false, G4Col 67 static G4VisAttributes visInvCyan(false, G4Colour(0.0, 1.0, 1.0)); 68 static G4VisAttributes visInvRed(false, G4Colo 68 static G4VisAttributes visInvRed(false, G4Colour(1.0, 0.0, 0.0)); 69 static G4VisAttributes visInvGreen(false, G4Co 69 static G4VisAttributes visInvGreen(false, G4Colour(0.0, 1.0, 0.0)); 70 static G4VisAttributes visBlue(true, G4Colour( 70 static G4VisAttributes visBlue(true, G4Colour(0.0, 0.0, 1.0)); 71 static G4VisAttributes visWhite(true, G4Colour 71 static G4VisAttributes visWhite(true, G4Colour(1.0, 1.0, 1.0)); 72 static G4VisAttributes visPink(true, G4Colour( 72 static G4VisAttributes visPink(true, G4Colour(1.0, 0.0, 1.0)); 73 static G4VisAttributes visCyan(true, G4Colour( 73 static G4VisAttributes visCyan(true, G4Colour(0.0, 1.0, 1.0)); 74 static G4VisAttributes visRed(true, G4Colour(1 74 static G4VisAttributes visRed(true, G4Colour(1.0, 0.0, 0.0)); 75 static G4VisAttributes visGreen(true, G4Colour 75 static G4VisAttributes visGreen(true, G4Colour(0.0, 1.0, 0.0)); 76 76 >> 77 77 //....oooOO0OOooo........oooOO0OOooo........oo 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 78 79 79 DetectorConstruction::DetectorConstruction() << 80 DetectorConstruction::DetectorConstruction() : 80 : G4VUserDetectorConstruction(), fBuildChrom << 81 G4VUserDetectorConstruction(), 81 {} << 82 fBuildChromatineFiber(true), >> 83 fBuildBases(false) >> 84 { >> 85 } 82 86 83 //....oooOO0OOooo........oooOO0OOooo........oo 87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 88 85 DetectorConstruction::~DetectorConstruction() << 89 DetectorConstruction::~DetectorConstruction() >> 90 { >> 91 } 86 92 87 //....oooOO0OOooo........oooOO0OOooo........oo 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 94 89 G4VPhysicalVolume* DetectorConstruction::Const 95 G4VPhysicalVolume* DetectorConstruction::Construct() 90 { 96 { 91 DefineMaterials(); 97 DefineMaterials(); 92 return ConstructDetector(); 98 return ConstructDetector(); 93 } 99 } 94 100 95 //....oooOO0OOooo........oooOO0OOooo........oo 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 96 102 97 void DetectorConstruction::DefineMaterials() 103 void DetectorConstruction::DefineMaterials() 98 { 104 { 99 // Water is defined from NIST material datab 105 // Water is defined from NIST material database 100 G4NistManager* man = G4NistManager::Instance << 106 G4NistManager *man = G4NistManager::Instance(); 101 man->FindOrBuildMaterial("G4_WATER"); 107 man->FindOrBuildMaterial("G4_WATER"); 102 } 108 } 103 109 104 //....oooOO0OOooo........oooOO0OOooo........oo 110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 105 111 106 void DetectorConstruction::LoadChromosome(cons << 112 void DetectorConstruction::LoadChromosome(const char* filename, >> 113 G4VPhysicalVolume* chromBox, 107 G4Lo 114 G4LogicalVolume* logicBoxros) 108 { 115 { 109 ChromosomeParameterisation* cp = new Chromos 116 ChromosomeParameterisation* cp = new ChromosomeParameterisation(filename); 110 new G4PVParameterised("box ros", logicBoxros << 117 new G4PVParameterised("box ros", >> 118 logicBoxros, >> 119 chromBox, >> 120 kUndefined, >> 121 cp->GetNumRosettes(), >> 122 cp); 111 123 112 G4cout << filename << " done" << G4endl; 124 G4cout << filename << " done" << G4endl; 113 } 125 } 114 126 115 //....oooOO0OOooo........oooOO0OOooo........oo 127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 116 128 117 G4VPhysicalVolume* DetectorConstruction::Const 129 G4VPhysicalVolume* DetectorConstruction::ConstructDetector() 118 { 130 { 119 if (fBuildBases == false && fBuildChromatine << 131 if(fBuildBases == false && fBuildChromatineFiber == false) 120 G4cout << "=============================== << 132 { 121 G4cout << "WARNING from DetectorConstructi << 133 G4cout <<"======================================================" << G4endl; 122 G4cout << "As long as the flags fBuildBase << 134 G4cout <<"WARNING from DetectorConstruction::ConstructDetector:" << G4endl; 123 "false, the output root file wil << 135 G4cout << "As long as the flags fBuildBases and fBuildChromatineFiber are " 124 << G4endl; << 136 "false, the output root file will be empty" << G4endl; 125 G4cout << "This is intended for fast compu << 137 G4cout << "This is intended for fast computation, display, testing ..." 126 G4cout << "=============================== << 138 << G4endl; >> 139 G4cout <<"======================================================" << G4endl; 127 } 140 } 128 141 129 G4String name; 142 G4String name; 130 143 131 /******************************************* 144 /***************************************************************************/ 132 // World 145 // World 133 /******************************************* 146 /***************************************************************************/ 134 147 135 DefineMaterials(); 148 DefineMaterials(); 136 G4Material* waterMaterial = G4Material::GetM 149 G4Material* waterMaterial = G4Material::GetMaterial("G4_WATER"); 137 150 138 G4Box* solidWorld = new G4Box("world", 10.0 151 G4Box* solidWorld = new G4Box("world", 10.0 * mm, 10.0 * mm, 10.0 * mm); 139 G4LogicalVolume* logicWorld = new G4LogicalV << 152 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, 140 G4PVPlacement* physiWorld = << 153 waterMaterial, 141 new G4PVPlacement(0, G4ThreeVector(), "wor << 154 "world"); >> 155 G4PVPlacement* physiWorld = new G4PVPlacement(0, >> 156 G4ThreeVector(), >> 157 "world", >> 158 logicWorld, >> 159 0, >> 160 false, >> 161 0); 142 logicWorld->SetVisAttributes(&visInvWhite); 162 logicWorld->SetVisAttributes(&visInvWhite); 143 163 144 /******************************************* 164 /****************************************************************************/ 145 // Box nucleus 165 // Box nucleus 146 /******************************************* 166 /****************************************************************************/ 147 167 148 G4Box* solidTin = new G4Box("tin", 13 * micr << 168 G4Box* solidTin = new G4Box("tin", 149 G4LogicalVolume* logicTin = new G4LogicalVol << 169 13 * micrometer, 150 G4VPhysicalVolume* physiTin = << 170 10 * micrometer, 151 new G4PVPlacement(0, G4ThreeVector(), "tin << 171 5 * micrometer); >> 172 G4LogicalVolume* logicTin = new G4LogicalVolume(solidTin, >> 173 waterMaterial, >> 174 "tin"); >> 175 G4VPhysicalVolume* physiTin = new G4PVPlacement(0, >> 176 G4ThreeVector(), >> 177 "tin", >> 178 logicTin, >> 179 physiWorld, >> 180 false, >> 181 0); 152 logicTin->SetVisAttributes(&visInvWhite); 182 logicTin->SetVisAttributes(&visInvWhite); 153 183 154 /******************************************* 184 /****************************************************************************/ 155 // Cell nucleus 185 // Cell nucleus 156 /******************************************* 186 /****************************************************************************/ 157 187 158 G4Ellipsoid* solidNucleus = << 188 G4Ellipsoid* solidNucleus = new G4Ellipsoid("nucleus", 159 new G4Ellipsoid("nucleus", 11.82 * microme << 189 11.82 * micrometer, 160 G4LogicalVolume* logicNucleus = new G4Logica << 190 8.52 * micrometer, 161 G4VPhysicalVolume* physiNucleus = << 191 3 * micrometer, 162 new G4PVPlacement(0, G4ThreeVector(), "phy << 192 0, >> 193 0); >> 194 G4LogicalVolume* logicNucleus = new G4LogicalVolume(solidNucleus, >> 195 waterMaterial, >> 196 "logic nucleus"); >> 197 G4VPhysicalVolume* physiNucleus = new G4PVPlacement(0, >> 198 G4ThreeVector(), >> 199 "physi nucleus", >> 200 logicNucleus, >> 201 physiTin, >> 202 false, >> 203 0); 163 logicNucleus->SetVisAttributes(&visPink); 204 logicNucleus->SetVisAttributes(&visPink); 164 205 165 /******************************************* 206 /****************************************************************************/ 166 // Chromosomes territ 207 // Chromosomes territories 167 /******************************************* 208 /****************************************************************************/ 168 // NOTE: The only supported values for the r 209 // NOTE: The only supported values for the rotation are 169 // 0 and 90 degrees on the Y axis. 210 // 0 and 90 degrees on the Y axis. 170 G4double chromosomePositionSizeRotation[][7] 211 G4double chromosomePositionSizeRotation[][7] = { 171 {4.467, 2.835, 0, 1.557, 1.557, 1.557, 90} << 212 {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} << 213 {-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 << 214 {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 << 215 {-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}, << 216 {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} << 217 {-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}, << 218 {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 << 219 {-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 << 220 {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 << 221 {-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} << 222 {1.380, -5.437, 0, 1.380, 1.380, 1.380, 0}, 182 {-1.380, -5.437, 0, 1.380, 1.380, 1.380, 9 << 223 {-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 << 224 {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.34 << 225 {-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.31 << 226 {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.3 << 227 {-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} << 228 {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 << 229 {-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} << 230 {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} << 231 {-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} << 232 {4.147, 0, -1.277, 1.277, 1.277, 1.277, 0}, 192 {-4.147, 0, -1.277, 1.277, 1.277, 1.277, 9 << 233 {-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} << 234 {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 << 235 {-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 << 236 {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.20 << 237 {-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, << 238 {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 << 239 {-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} << 240 {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} << 241 {-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, << 242 {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}, << 243 {-9.092, 0, 0, 1.116, 1.116, 1.116, 0}, 203 {6.507, 0.159, -1.081, 1.081, 1.081, 1.081 << 244 {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, 9 << 245 {-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 << 246 {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 << 247 {-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} << 248 {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 << 249 {-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}, << 250 {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, 9 << 251 {-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} << 252 {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}, << 253 {-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 << 254 {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}, << 255 {-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 << 256 {-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} << 257 {7.354, 2.605, 0, 1.330, 1.330, 1.330, 0} // X 217 }; 258 }; 218 259 219 G4RotationMatrix* rotch = new G4RotationMatr 260 G4RotationMatrix* rotch = new G4RotationMatrix; 220 rotch->rotateY(90 * degree); 261 rotch->rotateY(90 * degree); 221 262 222 vector<G4VPhysicalVolume*> physiBox(48); 263 vector<G4VPhysicalVolume*> physiBox(48); 223 264 224 for (unsigned int i = 0; i < countof(chromos << 265 for (unsigned int i = 0; i < countof(chromosomePositionSizeRotation); i++) >> 266 { 225 G4double* p = &chromosomePositionSizeRotat 267 G4double* p = &chromosomePositionSizeRotation[i][0]; 226 G4double* size = &chromosomePositionSizeRo 268 G4double* size = &chromosomePositionSizeRotation[i][3]; 227 G4double rotation = chromosomePositionSize 269 G4double rotation = chromosomePositionSizeRotation[i][6]; 228 G4ThreeVector pos(p[0] * micrometer, p[1] 270 G4ThreeVector pos(p[0] * micrometer, p[1] * micrometer, p[2] * micrometer); 229 G4RotationMatrix* rot = rotation == 0 ? 0 271 G4RotationMatrix* rot = rotation == 0 ? 0 : rotch; 230 272 231 ostringstream ss; 273 ostringstream ss; 232 ss << "box" << (i / 2) + 1 << (i % 2 ? 'l' 274 ss << "box" << (i / 2) + 1 << (i % 2 ? 'l' : 'r'); 233 name = ss.str(); 275 name = ss.str(); 234 ss.str(""); 276 ss.str(""); 235 ss.clear(); 277 ss.clear(); 236 278 237 /* 279 /* 238 snprintf(name, countof(name), "box%d%c", 280 snprintf(name, countof(name), "box%d%c", 239 (i / 2) + 1, i % 2 ? 'l' : 'r'); 281 (i / 2) + 1, i % 2 ? 'l' : 'r'); 240 */ 282 */ 241 G4Box* solidBox = << 283 G4Box* solidBox = new G4Box(name, 242 new G4Box(name, size[0] * micrometer, si << 284 size[0] * micrometer, 243 G4LogicalVolume* logicBox = new G4LogicalV << 285 size[1] * micrometer, 244 physiBox[i] = new G4PVPlacement(rot, pos, << 286 size[2] * micrometer); >> 287 G4LogicalVolume* logicBox = new G4LogicalVolume(solidBox, >> 288 waterMaterial, >> 289 name); >> 290 physiBox[i] = new G4PVPlacement(rot, >> 291 pos, >> 292 "chromo", >> 293 logicBox, >> 294 physiNucleus, >> 295 false, >> 296 0); 245 logicBox->SetVisAttributes(&visBlue); 297 logicBox->SetVisAttributes(&visBlue); 246 } 298 } 247 299 248 /******************************************* 300 /**************************************************************************/ 249 // Box containing the chroma 301 // Box containing the chromatin flowers 250 /******************************************* 302 /**************************************************************************/ 251 303 252 G4Tubs* solidBoxros = new G4Tubs("solid box << 304 G4Tubs* solidBoxros = new G4Tubs("solid box ros", 253 0 * degree, << 305 0 * nanometer, 254 G4LogicalVolume* logicBoxros = new G4Logical << 306 399 * nanometer, >> 307 20 * nanometer, >> 308 0 * degree, >> 309 360 * degree); >> 310 G4LogicalVolume* logicBoxros = new G4LogicalVolume(solidBoxros, >> 311 waterMaterial, >> 312 "box ros"); 255 logicBoxros->SetVisAttributes(&visInvBlue); 313 logicBoxros->SetVisAttributes(&visInvBlue); 256 314 257 // Loading flower box position for each chro << 315 //Loading flower box position for each chromosome territory 258 316 259 for (int k = 0; k < 22; k++) { << 317 for (int k = 0; k < 22; k++) >> 318 { 260 ostringstream oss; 319 ostringstream oss; 261 oss << "chromo" << k + 1 << ".dat"; 320 oss << "chromo" << k + 1 << ".dat"; 262 name = oss.str(); 321 name = oss.str(); 263 oss.str(""); 322 oss.str(""); 264 oss.clear(); 323 oss.clear(); 265 // snprintf(name, countof(name), "chromo%d << 324 //snprintf(name, countof(name), "chromo%d.dat", k + 1); 266 LoadChromosome(name.c_str(), physiBox[k * 325 LoadChromosome(name.c_str(), physiBox[k * 2], logicBoxros); 267 LoadChromosome(name.c_str(), physiBox[k * 326 LoadChromosome(name.c_str(), physiBox[k * 2 + 1], logicBoxros); 268 } 327 } 269 328 270 LoadChromosome("chromoY.dat", physiBox[44], 329 LoadChromosome("chromoY.dat", physiBox[44], logicBoxros); 271 LoadChromosome("chromoX.dat", physiBox[45], 330 LoadChromosome("chromoX.dat", physiBox[45], logicBoxros); 272 331 273 /******************************************* 332 /****************************************************************************/ 274 if (fBuildChromatineFiber) { << 333 if (fBuildChromatineFiber) >> 334 { 275 // chromatin fiber envelope 335 // chromatin fiber envelope 276 G4Tubs* solidEnv = new G4Tubs("chromatin f << 336 G4Tubs* solidEnv = new G4Tubs("chromatin fiber", 277 0 * degree, << 337 0, 278 G4LogicalVolume* logicEnv = new G4LogicalV << 338 15.4 * nanometer, >> 339 80.5 * nanometer, >> 340 0 * degree, >> 341 360 * degree); >> 342 G4LogicalVolume* logicEnv = new G4LogicalVolume(solidEnv, >> 343 waterMaterial, >> 344 "LV chromatin fiber"); 279 logicEnv->SetVisAttributes(&visInvPink); 345 logicEnv->SetVisAttributes(&visInvPink); 280 346 281 // Chromatin fiber position 347 // Chromatin fiber position 282 for (G4int i = 0; i < 7; i++) { << 348 for (G4int i = 0; i < 7; i++) >> 349 { 283 G4RotationMatrix* rotFiber = new G4Rotat 350 G4RotationMatrix* rotFiber = new G4RotationMatrix; 284 rotFiber->rotateX(90 * degree); 351 rotFiber->rotateX(90 * degree); 285 rotFiber->rotateY(i * 25.72 * degree); 352 rotFiber->rotateY(i * 25.72 * degree); 286 G4ThreeVector posFiber = G4ThreeVector(0 353 G4ThreeVector posFiber = G4ThreeVector(0, 152 * nanometer, 0); 287 posFiber.rotateZ(i * 25.72 * degree); 354 posFiber.rotateZ(i * 25.72 * degree); 288 new G4PVPlacement(rotFiber, posFiber, lo << 355 new G4PVPlacement(rotFiber, >> 356 posFiber, >> 357 logicEnv, >> 358 "physi env", >> 359 logicBoxros, >> 360 false, >> 361 0); 289 362 290 rotFiber = new G4RotationMatrix; 363 rotFiber = new G4RotationMatrix; 291 rotFiber->rotateX(90 * degree); 364 rotFiber->rotateX(90 * degree); 292 rotFiber->rotateY((7 + i) * 25.72 * degr 365 rotFiber->rotateY((7 + i) * 25.72 * degree); 293 posFiber = G4ThreeVector(0, 152 * nanome 366 posFiber = G4ThreeVector(0, 152 * nanometer, 0); 294 posFiber.rotateZ((7 + i) * 25.72 * degre 367 posFiber.rotateZ((7 + i) * 25.72 * degree); 295 new G4PVPlacement(rotFiber, posFiber, lo << 368 new G4PVPlacement(rotFiber, >> 369 posFiber, >> 370 logicEnv, >> 371 "physi env", >> 372 logicBoxros, >> 373 false, >> 374 0); 296 375 297 rotFiber = new G4RotationMatrix; 376 rotFiber = new G4RotationMatrix; 298 rotFiber->rotateX(90 * degree); 377 rotFiber->rotateX(90 * degree); 299 rotFiber->rotateY((25.72 + (i - 14) * 51 378 rotFiber->rotateY((25.72 + (i - 14) * 51.43) * degree); 300 posFiber = G4ThreeVector(-36.5 * nanomet 379 posFiber = G4ThreeVector(-36.5 * nanometer, 312 * nanometer, 0); 301 posFiber.rotateZ((i - 14) * 51.43 * degr 380 posFiber.rotateZ((i - 14) * 51.43 * degree); 302 new G4PVPlacement(rotFiber, posFiber, lo << 381 new G4PVPlacement(rotFiber, >> 382 posFiber, >> 383 logicEnv, >> 384 "physi env", >> 385 logicBoxros, >> 386 false, >> 387 0); 303 388 304 rotFiber = new G4RotationMatrix; 389 rotFiber = new G4RotationMatrix; 305 rotFiber->rotateX(90 * degree); 390 rotFiber->rotateX(90 * degree); 306 rotFiber->rotateY(180 * degree); 391 rotFiber->rotateY(180 * degree); 307 rotFiber->rotateY((i - 21) * 51.43 * deg 392 rotFiber->rotateY((i - 21) * 51.43 * degree); 308 posFiber = G4ThreeVector(-103 * nanomete 393 posFiber = G4ThreeVector(-103 * nanometer, 297 * nanometer, 0); 309 posFiber.rotateZ((i - 21) * 51.43 * degr 394 posFiber.rotateZ((i - 21) * 51.43 * degree); 310 new G4PVPlacement(rotFiber, posFiber, lo << 395 new G4PVPlacement(rotFiber, >> 396 posFiber, >> 397 logicEnv, >> 398 "physi env", >> 399 logicBoxros, >> 400 false, >> 401 0); >> 402 311 } 403 } 312 404 313 if (fBuildBases) { << 405 if (fBuildBases) >> 406 { 314 // Histones 407 // Histones 315 G4Tubs* solidHistone = new G4Tubs("solid << 408 G4Tubs* solidHistone = new G4Tubs("solid histone", 316 0 * de << 409 0, 317 G4LogicalVolume* logicHistone = << 410 3.25 * nanometer, 318 new G4LogicalVolume(solidHistone, wate << 411 2.85 * nanometer, >> 412 0 * degree, >> 413 360 * degree); >> 414 G4LogicalVolume* logicHistone = new G4LogicalVolume(solidHistone, >> 415 waterMaterial, >> 416 "logic histone"); 319 417 320 // Base pair << 418 //Base pair 321 G4Orb* solidBp1 = new G4Orb("blue sphere 419 G4Orb* solidBp1 = new G4Orb("blue sphere", 0.17 * nanometer); 322 G4LogicalVolume* logicBp1 = new G4Logica << 420 G4LogicalVolume* logicBp1 = new G4LogicalVolume(solidBp1, >> 421 waterMaterial, >> 422 "logic blue sphere"); 323 G4Orb* solidBp2 = new G4Orb("pink sphere 423 G4Orb* solidBp2 = new G4Orb("pink sphere", 0.17 * nanometer); 324 G4LogicalVolume* logicBp2 = new G4Logica << 424 G4LogicalVolume* logicBp2 = new G4LogicalVolume(solidBp2, >> 425 waterMaterial, >> 426 "logic pink sphere"); 325 427 326 // Phosphodiester group << 428 //Phosphodiester group 327 429 328 G4Orb* solidSugar_48em1_nm = new G4Orb(" 430 G4Orb* solidSugar_48em1_nm = new G4Orb("sugar", 0.48 * nanometer); 329 431 330 G4ThreeVector posi(0.180248 * nanometer, << 432 G4ThreeVector posi(0.180248 * nanometer, 331 G4UnionSolid* uniDNA = << 433 0.32422 * nanometer, 332 new G4UnionSolid("move", solidSugar_48 << 434 0.00784 * nanometer); 333 << 435 G4UnionSolid* uniDNA = new G4UnionSolid("move", 334 G4ThreeVector posi2(-0.128248 * nanomete << 436 solidSugar_48em1_nm, 335 G4UnionSolid* uniDNA2 = << 437 solidSugar_48em1_nm, 336 new G4UnionSolid("move2", solidSugar_4 << 438 0, >> 439 posi); >> 440 >> 441 G4ThreeVector posi2(-0.128248 * nanometer, >> 442 0.41227 * nanometer, >> 443 0.03584 * nanometer); >> 444 G4UnionSolid* uniDNA2 = new G4UnionSolid("move2", >> 445 solidSugar_48em1_nm, >> 446 solidSugar_48em1_nm, >> 447 0, >> 448 posi2); 337 449 338 /*************************************** 450 /************************************************************************ 339 Phosphodiester group Position 451 Phosphodiester group Position 340 *************************************** 452 ************************************************************************/ 341 453 342 for (G4int n = 2; n < 200; n++) { << 454 for (G4int n = 2; n < 200; n++) 343 G4double SP1[2][3] = { << 455 { 344 {(-0.6 * nanometer) * cos(n * 0.26), << 456 G4double SP1[2][3] = { 345 {(0.6 * nanometer) * cos(n * 0.26), << 457 { (-0.6 * nanometer) * cos(n * 0.26), 346 G4double matriceSP1[3][3] = { << 458 0, (0.6* nanometer) * sin(n * 0.26) }, 347 {cos(n * 0.076), -sin(n * 0.076), 0} << 459 { (0.6 * nanometer) * cos(n * 0.26), 348 G4double matriceSP2[2][3]; << 460 0, (-0.6 * nanometer) * sin(0.26 * n) } 349 << 461 }; 350 for (G4int i = 0; i < 3; i++) { << 462 G4double matriceSP1[3][3] = { 351 G4double sumSP1 = 0; << 463 { cos(n * 0.076), -sin(n * 0.076), 0 }, 352 G4double sumSP2 = 0; << 464 { sin(n * 0.076), cos(n * 0.076), 0 }, 353 for (G4int j = 0; j < 3; j++) { << 465 { 0, 0, 1 } 354 sumSP1 += matriceSP1[i][j] * SP1[0 << 466 }; 355 sumSP2 += matriceSP1[i][j] * SP1[1 << 467 G4double matriceSP2[2][3]; 356 } << 468 357 matriceSP2[0][i] = sumSP1; << 469 for (G4int i = 0; i < 3; i++) 358 matriceSP2[1][i] = sumSP2; << 470 { >> 471 G4double sumSP1 = 0; >> 472 G4double sumSP2 = 0; >> 473 for (G4int j = 0; j < 3; j++) >> 474 { >> 475 sumSP1 += matriceSP1[i][j] * SP1[0][j]; >> 476 sumSP2 += matriceSP1[i][j] * SP1[1][j]; 359 } 477 } 360 << 478 matriceSP2[0][i] = sumSP1; 361 G4double heliceSP[3] = {(4.85 * nanome << 479 matriceSP2[1][i] = sumSP2; 362 (4.85 * nanome << 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][ << 369 (matriceSP2[0] << 370 G4ThreeVector posSugar2(matriceSP2[1][ << 371 (matriceSP2[1] << 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), "sug << 380 uniDNA = new G4UnionSolid(name, uniDNA << 381 << 382 ss << "sugar_" << n; << 383 name = ss.str().c_str(); << 384 ss.str(""); << 385 ss.clear(); << 386 << 387 // snprintf(name, countof(name), "sug << 388 uniDNA2 = new G4UnionSolid(name, uniDN << 389 } 480 } 390 G4LogicalVolume* logicSphere3 = new G4Lo << 391 G4LogicalVolume* logicSphere4 = new G4Lo << 392 481 393 /*************************************** << 482 G4double heliceSP[3] = { 394 Base pair Position << 483 (4.85 * nanometer) * cos(n * 0.076), 395 *************************************** << 484 (4.85 * nanometer) * sin(n * 0.076), 396 for (G4int n = 0; n < 200; n++) { << 485 (n * 0.026 * nanometer) >> 486 }; >> 487 >> 488 for (G4int i = 0; i < 3; i++) >> 489 { >> 490 matriceSP2[0][i] += heliceSP[i]; >> 491 matriceSP2[1][i] += heliceSP[i]; >> 492 } >> 493 G4ThreeVector posSugar1(matriceSP2[0][2], >> 494 matriceSP2[0][1], >> 495 (matriceSP2[0][0]) - (4.25 * nanometer)); >> 496 G4ThreeVector posSugar2(matriceSP2[1][2], >> 497 matriceSP2[1][1], >> 498 (matriceSP2[1][0]) - (5.45 * nanometer)); >> 499 >> 500 ostringstream ss; >> 501 ss << "sugar_" << n; >> 502 name = ss.str().c_str(); >> 503 ss.str(""); >> 504 ss.clear(); >> 505 >> 506 // snprintf(name, countof(name), "sugar %d", n); >> 507 uniDNA = new G4UnionSolid(name, >> 508 uniDNA, >> 509 solidSugar_48em1_nm, >> 510 0, >> 511 posSugar1); >> 512 >> 513 ss << "sugar_" << n; >> 514 name = ss.str().c_str(); >> 515 ss.str(""); >> 516 ss.clear(); >> 517 >> 518 // snprintf(name, countof(name), "sugar %d", n); >> 519 uniDNA2 = new G4UnionSolid(name, >> 520 uniDNA2, >> 521 solidSugar_48em1_nm, >> 522 0, >> 523 posSugar2); >> 524 } >> 525 G4LogicalVolume* logicSphere3 = new G4LogicalVolume(uniDNA, >> 526 waterMaterial, >> 527 "logic sugar 2"); >> 528 G4LogicalVolume* logicSphere4 = new G4LogicalVolume(uniDNA2, >> 529 waterMaterial, >> 530 "logic sugar 4"); >> 531 >> 532 /************************************************************************** >> 533 Base pair Position >> 534 **************************************************************************/ >> 535 for (G4int n = 0; n < 200; n++) >> 536 { 397 G4double bp1[2][3] = { 537 G4double bp1[2][3] = { 398 {(-0.34 * nanometer) * cos(n * 0.26) << 538 { (-0.34 * nanometer) * cos(n * 0.26), 399 {(0.34 * nanometer) * cos(n * 0.26), << 539 0, (0.34* nanometer) * sin(n * 0.26) }, >> 540 { (0.34 * nanometer) * cos(n * 0.26), >> 541 0, (-0.34 * nanometer) * sin(0.26 * n) } >> 542 }; 400 G4double matriceBP1[3][3] = { 543 G4double matriceBP1[3][3] = { 401 {cos(n * 0.076), -sin(n * 0.076), 0} << 544 { cos(n * 0.076), -sin(n * 0.076), 0 }, >> 545 {sin(n * 0.076), cos(n * 0.076), 0 }, >> 546 { 0, 0, 1 } >> 547 }; 402 G4double matriceBP2[2][3]; 548 G4double matriceBP2[2][3]; 403 549 404 for (G4int i = 0; i < 3; i++) { << 550 for (G4int i = 0; i < 3; i++) >> 551 { 405 G4double sumBP1 = 0; 552 G4double sumBP1 = 0; 406 G4double sumBP2 = 0; 553 G4double sumBP2 = 0; 407 for (G4int j = 0; j < 3; j++) { << 554 for (G4int j = 0; j < 3; j++) >> 555 { 408 sumBP1 += matriceBP1[i][j] * bp1[0 556 sumBP1 += matriceBP1[i][j] * bp1[0][j]; 409 sumBP2 += matriceBP1[i][j] * bp1[1 557 sumBP2 += matriceBP1[i][j] * bp1[1][j]; 410 } 558 } 411 matriceBP2[0][i] = sumBP1; 559 matriceBP2[0][i] = sumBP1; 412 matriceBP2[1][i] = sumBP2; 560 matriceBP2[1][i] = sumBP2; 413 } 561 } 414 G4double heliceBP[3] = {(4.8 * nanomet << 562 G4double heliceBP[3] = { 415 (4.8 * nanomet << 563 (4.8 * nanometer) * cos(n * 0.076), >> 564 (4.8 * nanometer) * sin(n * 0.076), >> 565 n * 0.026 * nanometer >> 566 }; 416 567 417 for (G4int i = 0; i < 3; i++) { << 568 for (G4int i = 0; i < 3; i++) >> 569 { 418 matriceBP2[0][i] += heliceBP[i]; 570 matriceBP2[0][i] += heliceBP[i]; 419 matriceBP2[1][i] += heliceBP[i]; 571 matriceBP2[1][i] += heliceBP[i]; 420 } 572 } 421 G4ThreeVector position1(matriceBP2[0][ << 573 G4ThreeVector position1(matriceBP2[0][2], >> 574 matriceBP2[0][1], 422 matriceBP2[0][ 575 matriceBP2[0][0] - (4.25 * nanometer)); 423 G4ThreeVector position2(matriceBP2[1][ << 576 G4ThreeVector position2(matriceBP2[1][2], >> 577 matriceBP2[1][1], 424 matriceBP2[1][ 578 matriceBP2[1][0] - (5.45 * nanometer)); 425 579 426 new G4PVPlacement(0, position1, logicB << 580 new G4PVPlacement(0, 427 new G4PVPlacement(0, position2, logicB << 581 position1, 428 } << 582 logicBp1, >> 583 "physi blue sphere", >> 584 logicSphere3, >> 585 false, >> 586 0); >> 587 new G4PVPlacement(0, >> 588 position2, >> 589 logicBp2, >> 590 "physi pink sphere", >> 591 logicSphere4, >> 592 false, >> 593 0); >> 594 } 429 595 430 /*************************************** << 596 /****************************************************************************/ 431 // Initial position of d << 597 // Initial position of different elements 432 /*************************************** << 598 /****************************************************************************/ 433 // DNA and histone positions 599 // DNA and histone positions 434 for (int j = 0; j < 90; j++) { << 600 for (int j = 0; j < 90; j++) >> 601 { 435 // DNA (bp-SP) 602 // DNA (bp-SP) 436 G4RotationMatrix* rotStrand1 = new G4R 603 G4RotationMatrix* rotStrand1 = new G4RotationMatrix; 437 rotStrand1->rotateZ(j * -51.43 * degre 604 rotStrand1->rotateZ(j * -51.43 * degree); 438 G4ThreeVector posStrand1(-2.7 * nanome << 605 G4ThreeVector posStrand1(-2.7 * nanometer, >> 606 9.35 * nanometer, 439 (-69.9 * nano 607 (-69.9 * nanometer) + (j * 1.67 * nanometer)); 440 posStrand1.rotateZ(j * 51.43 * degree) 608 posStrand1.rotateZ(j * 51.43 * degree); 441 new G4PVPlacement(rotStrand1, posStran << 609 new G4PVPlacement(rotStrand1, >> 610 posStrand1, >> 611 logicSphere3, >> 612 "physi sugar 2", >> 613 logicEnv, >> 614 false, 442 0); 615 0); 443 616 444 G4RotationMatrix* rotStrand2 = new G4R 617 G4RotationMatrix* rotStrand2 = new G4RotationMatrix; 445 rotStrand2->rotateZ(j * -51.43 * degre 618 rotStrand2->rotateZ(j * -51.43 * degree); 446 G4ThreeVector posStrand2(-2.7 * nanome << 619 G4ThreeVector posStrand2(-2.7 * nanometer, >> 620 9.35 * nanometer, 447 (-68.7 * nano 621 (-68.7 * nanometer) + (j * 1.67 * nanometer)); 448 posStrand2.rotateZ(j * 51.43 * degree) 622 posStrand2.rotateZ(j * 51.43 * degree); 449 new G4PVPlacement(rotStrand2, posStran << 623 new G4PVPlacement(rotStrand2, >> 624 posStrand2, >> 625 logicSphere4, >> 626 "physi sugar 4", >> 627 logicEnv, >> 628 false, 450 0); 629 0); 451 630 452 // histones 631 // histones 453 G4RotationMatrix* rotHistone = new G4R 632 G4RotationMatrix* rotHistone = new G4RotationMatrix; 454 rotHistone->rotateY(90 * degree); 633 rotHistone->rotateY(90 * degree); 455 rotHistone->rotateX(j * (-51.43 * degr 634 rotHistone->rotateX(j * (-51.43 * degree)); 456 G4ThreeVector posHistone(0.0, 9.35 * n << 635 G4ThreeVector posHistone(0.0, >> 636 9.35 * nanometer, >> 637 (-74.15 + j * 1.67) * nanometer); 457 posHistone.rotateZ(j * 51.43 * degree) 638 posHistone.rotateZ(j * 51.43 * degree); 458 new G4PVPlacement(rotHistone, posHisto << 639 new G4PVPlacement(rotHistone, >> 640 posHistone, >> 641 logicHistone, >> 642 "PV histone", >> 643 logicEnv, >> 644 false, >> 645 0); 459 } 646 } 460 /*************************************** 647 /************************************************************************/ 461 // Visualisation 648 // Visualisation colors 462 /*************************************** 649 /************************************************************************/ 463 650 464 logicBp1->SetVisAttributes(&visInvCyan); 651 logicBp1->SetVisAttributes(&visInvCyan); 465 logicBp2->SetVisAttributes(&visInvPink); 652 logicBp2->SetVisAttributes(&visInvPink); 466 653 467 logicSphere3->SetVisAttributes(&visInvWh 654 logicSphere3->SetVisAttributes(&visInvWhite); 468 logicSphere4->SetVisAttributes(&visInvRe 655 logicSphere4->SetVisAttributes(&visInvRed); 469 656 470 logicHistone->SetVisAttributes(&visInvBl 657 logicHistone->SetVisAttributes(&visInvBlue); 471 } 658 } 472 } 659 } 473 660 474 G4cout << "Geometry has been loaded" << G4en 661 G4cout << "Geometry has been loaded" << G4endl; 475 return physiWorld; 662 return physiWorld; 476 } 663 } 477 664