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