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[ 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 ]

Diff markup

Differences between /examples/extended/medical/dna/icsd/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/medical/dna/icsd/src/DetectorConstruction.cc (Version 10.5.p1)


  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 // shall cite the following Geant4-DNA collabo     28 // shall cite the following Geant4-DNA collaboration publication:
 29 // Med. Phys. 37 (2010) 4692-4708                  29 // Med. Phys. 37 (2010) 4692-4708
 30 // J. Comput. Phys. 274 (2014) 841-882             30 // J. Comput. Phys. 274 (2014) 841-882
 31 // The Geant4-DNA web site is available at htt     31 // The Geant4-DNA web site is available at http://geant4-dna.org
 32 //                                                 32 //
 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                                                << 
 39 #include "DetectorMessenger.hh"                << 
 40                                                << 
 41 #include "G4ProductionCuts.hh"                 << 
 42 #include "G4RunManager.hh"                     << 
 43 #include "G4SystemOfUnits.hh"                      38 #include "G4SystemOfUnits.hh"
                                                   >>  39 #include "G4ProductionCuts.hh"
 44                                                    40 
 45 //....oooOO0OOooo........oooOO0OOooo........oo     41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 46                                                    42 
 47 DetectorConstruction::DetectorConstruction() : <<  43 DetectorConstruction::DetectorConstruction()
 48 {                                              <<  44 : G4VUserDetectorConstruction(),
 49   // create commands for interactive definitio <<  45   fpPhysiWorld(NULL), fpLogicWorld(NULL), fpSolidWorld(NULL)
 50   fDetectorMessenger = new DetectorMessenger(t <<  46 {}
 51 }                                              << 
 52                                                    47 
 53 //....oooOO0OOooo........oooOO0OOooo........oo     48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 54                                                    49 
 55 DetectorConstruction::~DetectorConstruction()      50 DetectorConstruction::~DetectorConstruction()
 56 {                                              <<  51 {}
 57   delete fDetectorMessenger;                   << 
 58 }                                              << 
 59                                                    52 
 60 //....oooOO0OOooo........oooOO0OOooo........oo     53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 61                                                    54 
 62 G4VPhysicalVolume* DetectorConstruction::Const     55 G4VPhysicalVolume* DetectorConstruction::Construct()
 63                                                    56 
 64 {                                                  57 {
 65   DefineMaterials();                           <<  58     DefineMaterials();
 66   return ConstructDetector();                  <<  59     return ConstructDetector();
 67 }                                                  60 }
 68                                                    61 
 69 //....oooOO0OOooo........oooOO0OOooo........oo     62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 70                                                    63 
 71 void DetectorConstruction::DefineMaterials()       64 void DetectorConstruction::DefineMaterials()
 72 {                                              <<  65 { 
 73   // Water is defined from NIST material datab <<  66 // Water is defined from NIST material database
 74   G4NistManager* man = G4NistManager::Instance <<  67     G4NistManager * man = G4NistManager::Instance();
 75   G4Material* H2O = man->FindOrBuildMaterial(" <<  68     G4Material * H2O = man->FindOrBuildMaterial("G4_WATER");
 76                                                    69 
 77   // Default materials in setup.               <<  70 // Default materials in setup.
 78   fpWaterMaterial = H2O;                       <<  71     fpWaterMaterial = H2O;
 79                                                    72 
 80   // needed variables                          <<  73 // needed variables
 81                                                    74 
 82   G4double z, a, density;                      <<  75     G4double z, a, density;
 83   G4String name, symbol;                       <<  76     G4String name, symbol;
 84   G4int nComponents, nAtoms;                   <<  77     G4int nComponents, nAtoms;
 85                                                    78 
 86   a = 12.0107 * g / mole;                      << 
 87   G4Element* elC = new G4Element(name = "Carbo << 
 88                                                    79 
 89   a = 1.00794 * g / mole;                      <<  80     a = 12.0107*g/mole;
 90   G4Element* elH = new G4Element(name = "Hydro <<  81     G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
 91                                                    82 
 92   a = 15.9994 * g / mole;                      <<  83     a = 1.00794*g/mole;
 93   G4Element* elO = new G4Element(name = "Oxyge <<  84     G4Element* elH  = new G4Element(name="Hydrogen",symbol="H" , z=1., a);
 94                                                    85 
 95   a = 14.0067 * g / mole;                      <<  86     a = 15.9994*g/mole;
 96   G4Element* elN = new G4Element(name = "Nitro <<  87     G4Element* elO  = new G4Element(name="Oxygen"  ,symbol="O" , z= 8., a);
 97                                                    88 
 98   // Definition of Tetrahydrofurane (THF)      <<  89 // Definition of Tetrahydrofurane (THF)
 99                                                    90 
100   density = 1.346 * g / cm3;                   <<  91     density=1.346*g/cm3;
101                                                    92 
102   fpTHFMaterial = new G4Material("THF", densit <<  93     fpTHFMaterial = new G4Material("THF", density, nComponents=3);
103   fpTHFMaterial->AddElement(elC, nAtoms = 4);  <<  94     fpTHFMaterial->AddElement(elC, nAtoms=4);
104   fpTHFMaterial->AddElement(elH, nAtoms = 8);  <<  95     fpTHFMaterial->AddElement(elH, nAtoms=8);
105   fpTHFMaterial->AddElement(elO, nAtoms = 1);  <<  96     fpTHFMaterial->AddElement(elO, nAtoms=1);
106                                                << 
107   // Definition of Nitrogen in nanodosimetry e << 
108                                                << 
109   density = 0.34e-6 * g / cm3;                 << 
110                                                << 
111   fpN2Material = new G4Material("N2", density, << 
112   fpN2Material->AddElement(elN, nAtoms = 2);   << 
113 }                                                  97 }
114                                                    98 
115 //....oooOO0OOooo........oooOO0OOooo........oo     99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
116                                                << 
117 G4VPhysicalVolume* DetectorConstruction::Const    100 G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
118 {                                                 101 {
119   G4double diameter;                           << 102 // WORLD VOLUME
120   G4double highz;                              << 
121   G4Material* targetMaterial;                  << 
122   G4Material* worldMaterial;                   << 
123                                                << 
124   if (fGeomType == "dna") {                    << 
125     // nanometric geometry                     << 
126     fWorldSize = 20. * nm;                     << 
127     diameter = 2.3 * nm;                       << 
128     highz = 3.4 * nm;                          << 
129     targetMaterial = fpTHFMaterial;            << 
130     worldMaterial = fpWaterMaterial;           << 
131   }                                            << 
132   else {                                       << 
133     // macrometric geometry (experimental targ << 
134     fWorldSize = 2 * cm;                       << 
135     diameter = 1 * cm;                         << 
136     highz = 1 * cm;                            << 
137     ;                                          << 
138     targetMaterial = fpN2Material;             << 
139     worldMaterial = fpN2Material;              << 
140   }                                            << 
141                                                << 
142   fpSolidWorld = new G4Box("World",  // its na << 
143                            fWorldSize / 2, fWo << 
144                                                << 
145   fpLogicWorld = new G4LogicalVolume(fpSolidWo << 
146                                      worldMate << 
147                                      "World"); << 
148                                                << 
149   fpPhysiWorld = new G4PVPlacement(0,  // no r << 
150                                    G4ThreeVect << 
151                                    "World",  / << 
152                                    fpLogicWorl << 
153                                    0,  // its  << 
154                                    false,  //  << 
155                                    0);  // cop << 
156                                                << 
157   G4Tubs* solidTarget =                        << 
158     new G4Tubs("Target", 0, diameter / 2., hig << 
159                                                << 
160   G4LogicalVolume* logicTarget = new G4Logical << 
161                                                << 
162                                                << 
163                                                << 
164   new G4PVPlacement(0,  // no rotation         << 
165                     G4ThreeVector(),  // at (0 << 
166                     "Target",  // its name     << 
167                     logicTarget,  // its logic << 
168                     fpPhysiWorld,  // its moth << 
169                     false,  // no boolean oper << 
170                     0);  // copy number        << 
171                                                << 
172   // Visualization attributes                  << 
173   G4VisAttributes* worldVisAtt = new G4VisAttr << 
174   worldVisAtt->SetVisibility(true);            << 
175   fpLogicWorld->SetVisAttributes(worldVisAtt); << 
176                                                << 
177   G4VisAttributes* worldVisAtt1 = new G4VisAtt << 
178   worldVisAtt1->SetVisibility(true);           << 
179   logicTarget->SetVisAttributes(worldVisAtt1); << 
180                                                   103 
181   return fpPhysiWorld;                         << 104     fWorldSizeX  = 10*nanometer;
182 }                                              << 105     fWorldSizeY  = 10*nanometer;
183                                                << 106     fWorldSizeZ  = 10*nanometer;
184 //....oooOO0OOooo........oooOO0OOooo........oo << 107 
185                                                << 108     fpSolidWorld = new G4Box("World", //its name
186 void DetectorConstruction::SetGeometry(const G << 109                              fWorldSizeX/2,fWorldSizeY/2,fWorldSizeZ/2);  //its size
187 {                                              << 110 
188   fGeomType = name;                            << 111     fpLogicWorld = new G4LogicalVolume(fpSolidWorld,        //its solid
                                                   >> 112                                        fpWaterMaterial,        //its material
                                                   >> 113                                        "World");                //its name
                                                   >> 114 
                                                   >> 115     fpPhysiWorld = new G4PVPlacement(0,                        //no rotation
                                                   >> 116                                      G4ThreeVector(),        //at (0,0,0)
                                                   >> 117                                      "World",                //its name
                                                   >> 118                                      fpLogicWorld,                //its logical volume
                                                   >> 119                                      0,                        //its mother  volume
                                                   >> 120                                      false,                        //no boolean operation
                                                   >> 121                                      0);                        //copy number
                                                   >> 122 
                                                   >> 123     G4double diameter=2.3*nanometer;
                                                   >> 124     G4double highz=3.4*nanometer;
                                                   >> 125 
                                                   >> 126     fpSolidTarget = new G4Tubs("Target",0, diameter/2., highz/2., 0*degree, 360*degree);
                                                   >> 127 
                                                   >> 128     G4LogicalVolume* logicTarget = new G4LogicalVolume(fpSolidTarget,   //its solid
                                                   >> 129                                                        fpTHFMaterial,  //its material
                                                   >> 130                                                        "Target");   //its name
                                                   >> 131 
                                                   >> 132     new G4PVPlacement(0,                             //no rotation
                                                   >> 133                       G4ThreeVector(),         //at (0,0,0)
                                                   >> 134                       "Target",                         //its name
                                                   >> 135                       logicTarget,                 //its logical volume
                                                   >> 136                       fpPhysiWorld,                 //its mother  volume
                                                   >> 137                       false,                         //no boolean operation
                                                   >> 138                       0);                             //copy number
                                                   >> 139 
                                                   >> 140 // Visualization attributes
                                                   >> 141     G4VisAttributes* worldVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
                                                   >> 142     worldVisAtt->SetVisibility(true);
                                                   >> 143     fpLogicWorld->SetVisAttributes(worldVisAtt);
                                                   >> 144 
                                                   >> 145     G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
                                                   >> 146     worldVisAtt1->SetVisibility(true);
                                                   >> 147     logicTarget->SetVisAttributes(worldVisAtt1);
189                                                   148 
190   // tell RunManager about changes             << 149     return fpPhysiWorld;
191   G4RunManager::GetRunManager()->GeometryHasBe << 
192 }                                                 150 }
193                                                   151