Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/electromagnetic/TestEm5/src/DetectorConstruction.cc

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

Diff markup

Differences between /examples/extended/electromagnetic/TestEm5/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/electromagnetic/TestEm5/src/DetectorConstruction.cc (Version 10.6)


  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 /// \file electromagnetic/TestEm5/src/Detector     26 /// \file electromagnetic/TestEm5/src/DetectorConstruction.cc
 27 /// \brief Implementation of the DetectorConst     27 /// \brief Implementation of the DetectorConstruction class
 28 //                                                 28 //
 29 //                                                 29 //
 30 //....oooOO0OOooo........oooOO0OOooo........oo     30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    32 
 33 #include "DetectorConstruction.hh"                 33 #include "DetectorConstruction.hh"
 34                                                << 
 35 #include "DetectorMessenger.hh"                    34 #include "DetectorMessenger.hh"
 36                                                    35 
 37 #include "G4AutoDelete.hh"                     <<  36 #include "G4Material.hh"
 38 #include "G4Box.hh"                                37 #include "G4Box.hh"
 39 #include "G4GeometryManager.hh"                << 
 40 #include "G4GlobalMagFieldMessenger.hh"        << 
 41 #include "G4LogicalVolume.hh"                      38 #include "G4LogicalVolume.hh"
 42 #include "G4LogicalVolumeStore.hh"             << 
 43 #include "G4Material.hh"                       << 
 44 #include "G4NistManager.hh"                    << 
 45 #include "G4PVPlacement.hh"                        39 #include "G4PVPlacement.hh"
 46 #include "G4PhysicalConstants.hh"              <<  40 #include "G4UniformMagField.hh"
                                                   >>  41 
                                                   >>  42 #include "G4GeometryManager.hh"
 47 #include "G4PhysicalVolumeStore.hh"                43 #include "G4PhysicalVolumeStore.hh"
 48 #include "G4RunManager.hh"                     <<  44 #include "G4LogicalVolumeStore.hh"
 49 #include "G4SolidStore.hh"                         45 #include "G4SolidStore.hh"
 50 #include "G4SystemOfUnits.hh"                  <<  46 
 51 #include "G4UniformMagField.hh"                << 
 52 #include "G4UnitsTable.hh"                         47 #include "G4UnitsTable.hh"
                                                   >>  48 #include "G4NistManager.hh"
                                                   >>  49 #include "G4RunManager.hh"
                                                   >>  50 
                                                   >>  51 #include "G4PhysicalConstants.hh"
                                                   >>  52 #include "G4SystemOfUnits.hh"
                                                   >>  53 
                                                   >>  54 #include "G4GlobalMagFieldMessenger.hh"
                                                   >>  55 #include "G4AutoDelete.hh"
 53                                                    56 
 54 //....oooOO0OOooo........oooOO0OOooo........oo     57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 55                                                    58 
 56 DetectorConstruction::DetectorConstruction()       59 DetectorConstruction::DetectorConstruction()
                                                   >>  60  : G4VUserDetectorConstruction(),
                                                   >>  61  fAbsorberMaterial(nullptr),fWorldMaterial(nullptr),fDefaultWorld(true),
                                                   >>  62  fSolidWorld(nullptr),fLogicWorld(nullptr),fPhysiWorld(nullptr),
                                                   >>  63  fSolidAbsorber(nullptr),fLogicAbsorber(nullptr),fPhysiAbsorber(nullptr),
                                                   >>  64  fDetectorMessenger(nullptr)
 57 {                                                  65 {
 58   // default parameter values of the calorimet     66   // default parameter values of the calorimeter
 59   fAbsorberThickness = 1. * cm;                <<  67   fAbsorberThickness = 1.*cm;
 60   fAbsorberSizeYZ = 2. * cm;                   <<  68   fAbsorberSizeYZ    = 2.*cm;
 61   fXposAbs = 0. * cm;                          <<  69   fXposAbs           = 0.*cm;
 62   ComputeGeomParameters();                         70   ComputeGeomParameters();
 63                                                <<  71   
 64   // materials                                 <<  72   // materials  
 65   DefineMaterials();                               73   DefineMaterials();
 66   SetWorldMaterial("G4_Galactic");             <<  74   SetWorldMaterial   ("G4_Galactic");
 67   SetAbsorberMaterial("G4_Si");                    75   SetAbsorberMaterial("G4_Si");
 68                                                <<  76  
 69   // create commands for interactive definitio <<  77   // create commands for interactive definition of the calorimeter  
 70   fDetectorMessenger = new DetectorMessenger(t     78   fDetectorMessenger = new DetectorMessenger(this);
 71 }                                                  79 }
 72                                                    80 
 73 //....oooOO0OOooo........oooOO0OOooo........oo     81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 74                                                    82 
 75 DetectorConstruction::~DetectorConstruction()      83 DetectorConstruction::~DetectorConstruction()
 76 {                                              <<  84 { 
 77   delete fDetectorMessenger;                       85   delete fDetectorMessenger;
 78 }                                                  86 }
 79                                                    87 
 80 //....oooOO0OOooo........oooOO0OOooo........oo     88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 81                                                    89 
 82 void DetectorConstruction::DefineMaterials()       90 void DetectorConstruction::DefineMaterials()
 83 {                                              <<  91 { 
 84   // This function illustrates the possible wa <<  92   //This function illustrates the possible ways to define materials
 85                                                <<  93  
 86   G4String symbol;  // a=mass of a mole;       <<  94   G4String symbol;             //a=mass of a mole;
 87   G4double a, z, density;  // z=mean number of <<  95   G4double a, z, density;      //z=mean number of protons;  
 88                                                    96 
 89   G4int ncomponents, natoms;                       97   G4int ncomponents, natoms;
 90   G4double fractionmass;                           98   G4double fractionmass;
 91   G4double temperature, pressure;                  99   G4double temperature, pressure;
 92                                                << 100   
 93   //                                              101   //
 94   // define Elements                              102   // define Elements
 95   //                                              103   //
 96                                                   104 
 97   G4Element* H = new G4Element("Hydrogen", sym << 105   G4Element* H  = new G4Element("Hydrogen",symbol="H",  z= 1, a=   1.01*g/mole);
 98   G4Element* C = new G4Element("Carbon", symbo << 106   G4Element* C  = new G4Element("Carbon",  symbol="C",  z= 6, a=  12.01*g/mole);
 99   G4Element* N = new G4Element("Nitrogen", sym << 107   G4Element* N  = new G4Element("Nitrogen",symbol="N",  z= 7, a=  14.01*g/mole);
100   G4Element* O = new G4Element("Oxygen", symbo << 108   G4Element* O  = new G4Element("Oxygen",  symbol="O",  z= 8, a=  16.00*g/mole);
101   G4Element* Na = new G4Element("Sodium", symb << 109   G4Element* Na = new G4Element("Sodium",  symbol="Na", z=11, a=  22.99*g/mole);
102   G4Element* Ar = new G4Element("Argon", symbo << 110   G4Element* Ar = new G4Element("Argon",   symbol="Ar", z=18, a=  39.95*g/mole);
103   G4Element* I = new G4Element("Iodine", symbo << 111   G4Element* I  = new G4Element("Iodine",  symbol="I" , z=53, a= 126.90*g/mole);
104   G4Element* Xe = new G4Element("Xenon", symbo << 112   G4Element* Xe = new G4Element("Xenon",   symbol="Xe", z=54, a= 131.29*g/mole);
105                                                   113 
106   //                                              114   //
107   // define simple materials                      115   // define simple materials
108   //                                              116   //
109                                                   117 
110   new G4Material("H2Liq", z = 1, a = 1.01 * g  << 118   new G4Material("H2Liq"    , z= 1, a= 1.01*g/mole, density= 70.8*mg/cm3);
111   new G4Material("Beryllium", z = 4, a = 9.01  << 119   new G4Material("Beryllium", z= 4, a= 9.01*g/mole, density= 1.848*g/cm3);
112   new G4Material("Aluminium", z = 13, a = 26.9 << 120   new G4Material("Aluminium", z=13, a=26.98*g/mole, density= 2.700*g/cm3);
113   new G4Material("Silicon", z = 14, a = 28.09  << 121   new G4Material("Silicon"  , z=14, a=28.09*g/mole, density= 2.330*g/cm3);
114                                                << 122 
115   G4Material* lAr = new G4Material("liquidArgo << 123   G4Material* lAr = 
116   lAr->AddElement(Ar, natoms = 1);             << 124     new G4Material("liquidArgon", density= 1.390*g/cm3, ncomponents=1);
117                                                << 125   lAr->AddElement(Ar, natoms=1);
118   new G4Material("Iron", z = 26, a = 55.85 * g << 126 
119   new G4Material("Copper", z = 29, a = 63.55 * << 127   new G4Material("Iron",     z=26, a= 55.85*g/mole, density= 7.870*g/cm3);
120   new G4Material("Germanium", z = 32, a = 72.6 << 128   new G4Material("Copper",   z=29, a= 63.55*g/mole, density= 8.960*g/cm3);
121   new G4Material("Silver", z = 47, a = 107.87  << 129   new G4Material("Germanium",z=32, a= 72.61*g/mole, density= 5.323*g/cm3);
122   new G4Material("Tungsten", z = 74, a = 183.8 << 130   new G4Material("Silver",   z=47, a=107.87*g/mole, density= 10.50*g/cm3);
123   new G4Material("Gold", z = 79, a = 196.97 *  << 131   new G4Material("Tungsten", z=74, a=183.85*g/mole, density= 19.30*g/cm3);
124   new G4Material("Lead", z = 82, a = 207.19 *  << 132   new G4Material("Gold",     z=79, a=196.97*g/mole, density= 19.32*g/cm3);
                                                   >> 133   new G4Material("Lead",     z=82, a=207.19*g/mole, density= 11.35*g/cm3);
125                                                   134 
126   //                                              135   //
127   // define a material from elements.   case 1    136   // define a material from elements.   case 1: chemical molecule
128   //                                              137   //
129                                                   138 
130   G4Material* H2O = new G4Material("Water", de << 139   G4Material* H2O = new G4Material("Water",density= 1.000*g/cm3,ncomponents=2);
131   H2O->AddElement(H, natoms = 2);              << 140   H2O->AddElement(H, natoms=2);
132   H2O->AddElement(O, natoms = 1);              << 141   H2O->AddElement(O, natoms=1);
133   H2O->GetIonisation()->SetMeanExcitationEnerg << 142   H2O->GetIonisation()->SetMeanExcitationEnergy(78*eV);
134                                                << 143 
135   G4Material* CH = new G4Material("Plastic", d << 144   G4Material* CH = new G4Material("Plastic",density= 1.04*g/cm3,ncomponents=2);
136   CH->AddElement(C, natoms = 1);               << 145   CH->AddElement(C, natoms=1);
137   CH->AddElement(H, natoms = 1);               << 146   CH->AddElement(H, natoms=1);
138                                                << 147 
139   G4Material* NaI = new G4Material("NaI", dens << 148   G4Material* NaI = new G4Material("NaI", density= 3.67*g/cm3, ncomponents=2);
140   NaI->AddElement(Na, natoms = 1);             << 149   NaI->AddElement(Na, natoms=1);
141   NaI->AddElement(I, natoms = 1);              << 150   NaI->AddElement(I , natoms=1);
142   NaI->GetIonisation()->SetMeanExcitationEnerg << 151   NaI->GetIonisation()->SetMeanExcitationEnergy(452*eV);
143                                                   152 
144   //                                              153   //
145   // define a material from elements.   case 2    154   // define a material from elements.   case 2: mixture by fractional mass
146   //                                              155   //
147                                                   156 
148   G4Material* Air = new G4Material("Air", dens << 157   G4Material* Air = new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
149   Air->AddElement(N, fractionmass = 0.7);      << 158   Air->AddElement(N, fractionmass=0.7);
150   Air->AddElement(O, fractionmass = 0.3);      << 159   Air->AddElement(O, fractionmass=0.3);
151                                                << 160 
152   G4Material* Air20 = new G4Material("Air20",  << 161   G4Material* Air20 = 
153                                      kStateGas << 162     new G4Material("Air20", density= 1.205*mg/cm3, ncomponents=2,
154   Air20->AddElement(N, fractionmass = 0.7);    << 163                    kStateGas, 293.*kelvin, 1.*atmosphere);
155   Air20->AddElement(O, fractionmass = 0.3);    << 164   Air20->AddElement(N, fractionmass=0.7);
156                                                << 165   Air20->AddElement(O, fractionmass=0.3);
157   // Graphite                                  << 166 
158   //                                           << 167   //Graphite
159   G4Material* Graphite = new G4Material("Graph << 168   //
160   Graphite->AddElement(C, fractionmass = 1.);  << 169   G4Material* Graphite = 
161                                                << 170     new G4Material("Graphite", density= 1.7*g/cm3, ncomponents=1);
162   // Havar                                     << 171   Graphite->AddElement(C, fractionmass=1.);
163   //                                           << 172 
164   G4Element* Cr = new G4Element("Chrome", "Cr" << 173   //Havar
165   G4Element* Fe = new G4Element("Iron", "Fe",  << 174   //
166   G4Element* Co = new G4Element("Cobalt", "Co" << 175   G4Element* Cr = new G4Element("Chrome", "Cr", z=24, a=  51.996*g/mole);
167   G4Element* Ni = new G4Element("Nickel", "Ni" << 176   G4Element* Fe = new G4Element("Iron"  , "Fe", z=26, a=  55.845*g/mole);
168   G4Element* W = new G4Element("Tungsten", "W" << 177   G4Element* Co = new G4Element("Cobalt", "Co", z=27, a=  58.933*g/mole);
169                                                << 178   G4Element* Ni = new G4Element("Nickel", "Ni", z=28, a=  58.693*g/mole);
170   G4Material* Havar = new G4Material("Havar",  << 179   G4Element* W  = new G4Element("Tungsten","W", z=74, a= 183.850*g/mole);
171   Havar->AddElement(Cr, fractionmass = 0.1785) << 180 
172   Havar->AddElement(Fe, fractionmass = 0.1822) << 181   G4Material* Havar = 
173   Havar->AddElement(Co, fractionmass = 0.4452) << 182     new G4Material("Havar", density= 8.3*g/cm3, ncomponents=5);
174   Havar->AddElement(Ni, fractionmass = 0.1310) << 183   Havar->AddElement(Cr, fractionmass=0.1785);
175   Havar->AddElement(W, fractionmass = 0.0631); << 184   Havar->AddElement(Fe, fractionmass=0.1822);
                                                   >> 185   Havar->AddElement(Co, fractionmass=0.4452);
                                                   >> 186   Havar->AddElement(Ni, fractionmass=0.1310);
                                                   >> 187   Havar->AddElement(W , fractionmass=0.0631);
176                                                   188 
177   //                                              189   //
178   // examples of gas                              190   // examples of gas
179   //                                           << 191   //  
180   new G4Material("ArgonGas", z = 18, a = 39.94 << 192   new G4Material("ArgonGas", z=18, a=39.948*g/mole, density= 1.782*mg/cm3,
181                  273.15 * kelvin, 1 * atmosphe << 193                  kStateGas, 273.15*kelvin, 1*atmosphere);
                                                   >> 194                            
                                                   >> 195   new G4Material("XenonGas", z=54, a=131.29*g/mole, density= 5.458*mg/cm3,
                                                   >> 196                  kStateGas, 293.15*kelvin, 1*atmosphere);
                                                   >> 197                            
                                                   >> 198   G4Material* CO2 =
                                                   >> 199     new G4Material("CarbonicGas", density= 1.977*mg/cm3, ncomponents=2);
                                                   >> 200   CO2->AddElement(C, natoms=1);
                                                   >> 201   CO2->AddElement(O, natoms=2);
                                                   >> 202 
                                                   >> 203   G4Material* ArCO2 =
                                                   >> 204     new G4Material("ArgonCO2",   density= 1.8223*mg/cm3, ncomponents=2);
                                                   >> 205   ArCO2->AddElement (Ar,  fractionmass=0.7844);
                                                   >> 206   ArCO2->AddMaterial(CO2, fractionmass=0.2156);
182                                                   207 
183   new G4Material("XenonGas", z = 54, a = 131.2 << 208   //another way to define mixture of gas per volume
184                  293.15 * kelvin, 1 * atmosphe << 
185                                                << 
186   G4Material* CO2 = new G4Material("CarbonicGa << 
187   CO2->AddElement(C, natoms = 1);              << 
188   CO2->AddElement(O, natoms = 2);              << 
189                                                << 
190   G4Material* ArCO2 = new G4Material("ArgonCO2 << 
191   ArCO2->AddElement(Ar, fractionmass = 0.7844) << 
192   ArCO2->AddMaterial(CO2, fractionmass = 0.215 << 
193                                                << 
194   // another way to define mixture of gas per  << 
195   G4Material* NewArCO2 =                          209   G4Material* NewArCO2 =
196     new G4Material("NewArgonCO2", density = 1. << 210     new G4Material("NewArgonCO2", density= 1.8223*mg/cm3, ncomponents=3);
197   NewArCO2->AddElement(Ar, natoms = 8);        << 211   NewArCO2->AddElement (Ar, natoms=8);
198   NewArCO2->AddElement(C, natoms = 2);         << 212   NewArCO2->AddElement (C,  natoms=2);
199   NewArCO2->AddElement(O, natoms = 4);         << 213   NewArCO2->AddElement (O,  natoms=4);
200                                                << 214 
201   G4Material* ArCH4 = new G4Material("ArgonCH4 << 215   G4Material* ArCH4 = 
202   ArCH4->AddElement(Ar, natoms = 93);          << 216     new G4Material("ArgonCH4",    density= 1.709*mg/cm3,  ncomponents=3);
203   ArCH4->AddElement(C, natoms = 7);            << 217   ArCH4->AddElement (Ar, natoms=93);
204   ArCH4->AddElement(H, natoms = 28);           << 218   ArCH4->AddElement (C,  natoms=7);
205                                                << 219   ArCH4->AddElement (H,  natoms=28);
206   G4Material* XeCH = new G4Material("XenonMeth << 220 
207                                     ncomponent << 221   G4Material* XeCH = 
208   XeCH->AddElement(Xe, natoms = 875);          << 222     new G4Material("XenonMethanePropane", density= 4.9196*mg/cm3, ncomponents=3,
209   XeCH->AddElement(C, natoms = 225);           << 223                    kStateGas, 293.15*kelvin, 1*atmosphere);
210   XeCH->AddElement(H, natoms = 700);           << 224   XeCH->AddElement (Xe, natoms=875);
211                                                << 225   XeCH->AddElement (C,  natoms=225);
212   G4Material* steam = new G4Material("WaterSte << 226   XeCH->AddElement (H,  natoms=700);
213   steam->AddMaterial(H2O, fractionmass = 1.);  << 227 
214   steam->GetIonisation()->SetMeanExcitationEne << 228   G4Material* steam = 
                                                   >> 229     new G4Material("WaterSteam", density= 1.0*mg/cm3, ncomponents=1);
                                                   >> 230   steam->AddMaterial(H2O, fractionmass=1.);
                                                   >> 231   steam->GetIonisation()->SetMeanExcitationEnergy(71.6*eV);  
215                                                   232 
216   G4Material* rock1 = new G4Material("Standard << 233   G4Material* rock1 = new G4Material("StandardRock",
                                                   >> 234                                      2.65*CLHEP::g/CLHEP::cm3, 1, kStateSolid);
217   rock1->AddElement(Na, 1);                       235   rock1->AddElement(Na, 1);
218                                                   236 
219   //                                              237   //
220   // example of vacuum                            238   // example of vacuum
221   //                                              239   //
222   density = universe_mean_density;  // from Ph << 240   density     = universe_mean_density;    //from PhysicalConstants.h
223   pressure = 3.e-18 * pascal;                  << 241   pressure    = 3.e-18*pascal;
224   temperature = 2.73 * kelvin;                 << 242   temperature = 2.73*kelvin;
225   new G4Material("Galactic", z = 1, a = 1.01 * << 243   new G4Material("Galactic", z=1, a=1.01*g/mole,density,
                                                   >> 244                  kStateGas,temperature,pressure);
226 }                                                 245 }
227                                                   246 
228 //....oooOO0OOooo........oooOO0OOooo........oo    247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
229                                                   248 
230 void DetectorConstruction::ComputeGeomParamete    249 void DetectorConstruction::ComputeGeomParameters()
231 {                                                 250 {
232   // Compute derived parameters of the calorim    251   // Compute derived parameters of the calorimeter
233   fXstartAbs = fXposAbs - 0.5 * fAbsorberThick << 252   fXstartAbs = fXposAbs-0.5*fAbsorberThickness; 
234   fXendAbs = fXposAbs + 0.5 * fAbsorberThickne << 253   fXendAbs   = fXposAbs+0.5*fAbsorberThickness;
235                                                   254 
236   G4double xmax = std::max(std::abs(fXstartAbs    255   G4double xmax = std::max(std::abs(fXstartAbs), std::abs(fXendAbs));
237   fWorldSizeX = 2.4 * xmax;                    << 256      
238   fWorldSizeYZ = 1.2 * fAbsorberSizeYZ;        << 257   // change world size by the flag or if the absorber is large 
239   if (nullptr != fPhysiWorld) {                << 258   if (fDefaultWorld || 2*xmax >=  fWorldSizeX ||
240     ChangeGeometry();                          << 259       fAbsorberSizeYZ >= fWorldSizeYZ) 
241   }                                            << 260     {
                                                   >> 261       fWorldSizeX = 3*xmax; 
                                                   >> 262       fWorldSizeYZ= 1.2*fAbsorberSizeYZ;
                                                   >> 263     }         
242 }                                                 264 }
243                                                   265 
244 //....oooOO0OOooo........oooOO0OOooo........oo    266 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
245                                                << 267   
246 G4VPhysicalVolume* DetectorConstruction::Const    268 G4VPhysicalVolume* DetectorConstruction::Construct()
247 {                                              << 269 { 
248   if (nullptr != fPhysiWorld) {                << 270   if(fPhysiWorld) { return fPhysiWorld; }
249     return fPhysiWorld;                        << 
250   }                                            << 
251   // World                                        271   // World
252   //                                              272   //
253   fSolidWorld = new G4Box("World",  // its nam << 273   fSolidWorld = new G4Box("World",                                //its name
254                           fWorldSizeX / 2, fWo << 274                    fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2);  //its size
255                                                << 275                          
256   fLogicWorld = new G4LogicalVolume(fSolidWorl << 276   fLogicWorld = new G4LogicalVolume(fSolidWorld,          //its solid
257                                     fWorldMate << 277                                    fWorldMaterial,        //its material
258                                     "World");  << 278                                    "World");              //its name
259                                                << 279                                    
260   fPhysiWorld = new G4PVPlacement(0,  // no ro << 280   fPhysiWorld = new G4PVPlacement(0,                      //no rotation
261                                   G4ThreeVecto << 281                                  G4ThreeVector(0.,0.,0.), //at (0,0,0)
262                                   fLogicWorld, << 282                                  fLogicWorld,             //its logical volume
263                                   "World",  // << 283                                  "World",                 //its name
264                                   0,  // its m << 284                                  0,                       //its mother  volume
265                                   false,  // n << 285                                  false,                   //no boolean operation
266                                   0);  // copy << 286                                  0);                      //copy number
267                                                << 287                                  
268   // Absorber                                     288   // Absorber
269   //                                           << 289   // 
270   fSolidAbsorber =                             << 290   fSolidAbsorber = new G4Box("Absorber",        
271     new G4Box("Absorber", fAbsorberThickness / << 291                       fAbsorberThickness/2,fAbsorberSizeYZ/2,fAbsorberSizeYZ/2);
272                                                << 292                           
273   fLogicAbsorber = new G4LogicalVolume(fSolidA << 293   fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,    //its solid
274                                        fAbsorb << 294                                        fAbsorberMaterial, //its material
275                                        "Absorb << 295                                        "Absorber");       //its name
276                                                << 296                                                 
277   fPhysiAbsorber = new G4PVPlacement(0,  // no << 297   fPhysiAbsorber = new G4PVPlacement(0,                   //no rotation
278                                      G4ThreeVe << 298                         G4ThreeVector(fXposAbs,0.,0.),    //its position
279                                      fLogicAbs << 299                                 fLogicAbsorber,     //its logical volume
280                                      "Absorber << 300                                 "Absorber",         //its name
281                                      fLogicWor << 301                                 fLogicWorld,        //its mother
282                                      false,  / << 302                                 false,              //no boulean operat
283                                      0);  // c << 303                                 0);                 //copy number
284                                                << 304                                         
285   PrintGeomParameters();                       << 305   PrintGeomParameters();         
286                                                << 306   
287   // always return the physical World          << 307   //always return the physical World
288   //                                              308   //
289   return fPhysiWorld;                             309   return fPhysiWorld;
290 }                                                 310 }
291                                                   311 
292 //....oooOO0OOooo........oooOO0OOooo........oo    312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
293                                                   313 
294 void DetectorConstruction::PrintGeomParameters    314 void DetectorConstruction::PrintGeomParameters()
295 {                                                 315 {
296   G4cout << "\n" << fWorldMaterial << G4endl;  << 316   G4cout << "\n" << fWorldMaterial    << G4endl;
297   G4cout << "\n" << fAbsorberMaterial << G4end    317   G4cout << "\n" << fAbsorberMaterial << G4endl;
298                                                << 318     
299   G4cout << "\n The  WORLD   is made of " << G << 319   G4cout << "\n The  WORLD   is made of "  << G4BestUnit(fWorldSizeX,"Length")
300          << fWorldMaterial->GetName();         << 320          << " of " << fWorldMaterial->GetName();
301   G4cout << ". The transverse size (YZ) of the << 321   G4cout << ". The transverse size (YZ) of the world is " 
302          << G4endl;                            << 322          << G4BestUnit(fWorldSizeYZ,"Length") << G4endl;
303   G4cout << " The ABSORBER is made of " << G4B << 323   G4cout << " The ABSORBER is made of " 
304          << fAbsorberMaterial->GetName();      << 324          <<G4BestUnit(fAbsorberThickness,"Length")
305   G4cout << ". The transverse size (YZ) is " < << 325          << " of " << fAbsorberMaterial->GetName();
306   G4cout << " X position of the middle of the  << 326   G4cout << ". The transverse size (YZ) is " 
                                                   >> 327          << G4BestUnit(fAbsorberSizeYZ,"Length") << G4endl;
                                                   >> 328   G4cout << " X position of the middle of the absorber "
                                                   >> 329          << G4BestUnit(fXposAbs,"Length");
307   G4cout << G4endl;                               330   G4cout << G4endl;
308 }                                                 331 }
309                                                   332 
310 //....oooOO0OOooo........oooOO0OOooo........oo    333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
311                                                   334 
312 void DetectorConstruction::SetAbsorberMaterial    335 void DetectorConstruction::SetAbsorberMaterial(const G4String& materialChoice)
313 {                                                 336 {
314   // search the material by its name              337   // search the material by its name
315   G4Material* pttoMaterial = G4NistManager::In << 338   G4Material* pttoMaterial =
                                                   >> 339     G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
316                                                   340 
317   if (pttoMaterial && fAbsorberMaterial != ptt    341   if (pttoMaterial && fAbsorberMaterial != pttoMaterial) {
318     fAbsorberMaterial = pttoMaterial;          << 342     fAbsorberMaterial = pttoMaterial;                  
319     if (fLogicAbsorber) {                      << 343     if(fLogicAbsorber) { fLogicAbsorber->SetMaterial(fAbsorberMaterial); }
320       fLogicAbsorber->SetMaterial(fAbsorberMat << 
321     }                                          << 
322     G4RunManager::GetRunManager()->PhysicsHasB    344     G4RunManager::GetRunManager()->PhysicsHasBeenModified();
323   }                                               345   }
324 }                                                 346 }
325                                                   347 
326 //....oooOO0OOooo........oooOO0OOooo........oo    348 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
327                                                   349 
328 void DetectorConstruction::SetWorldMaterial(co    350 void DetectorConstruction::SetWorldMaterial(const G4String& materialChoice)
329 {                                                 351 {
330   // search the material by its name              352   // search the material by its name
331   G4Material* pttoMaterial = G4NistManager::In << 353   G4Material* pttoMaterial =
                                                   >> 354     G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
332                                                   355 
333   if (pttoMaterial && fWorldMaterial != pttoMa    356   if (pttoMaterial && fWorldMaterial != pttoMaterial) {
334     fWorldMaterial = pttoMaterial;             << 357     fWorldMaterial = pttoMaterial; 
335     if (fLogicWorld) {                         << 358     if(fLogicWorld) { fLogicWorld->SetMaterial(fWorldMaterial); }
336       fLogicWorld->SetMaterial(fWorldMaterial) << 
337     }                                          << 
338     G4RunManager::GetRunManager()->PhysicsHasB    359     G4RunManager::GetRunManager()->PhysicsHasBeenModified();
339   }                                               360   }
340 }                                                 361 }
341                                                << 362     
342 //....oooOO0OOooo........oooOO0OOooo........oo    363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
343                                                   364 
344 void DetectorConstruction::SetAbsorberThicknes    365 void DetectorConstruction::SetAbsorberThickness(G4double val)
345 {                                                 366 {
346   fAbsorberThickness = val;                       367   fAbsorberThickness = val;
347   ComputeGeomParameters();                        368   ComputeGeomParameters();
                                                   >> 369   if(fPhysiWorld) { ChangeGeometry(); }
348 }                                                 370 }
349                                                   371 
350 //....oooOO0OOooo........oooOO0OOooo........oo    372 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
351                                                   373 
352 void DetectorConstruction::SetAbsorberSizeYZ(G    374 void DetectorConstruction::SetAbsorberSizeYZ(G4double val)
353 {                                                 375 {
354   fAbsorberSizeYZ = val;                          376   fAbsorberSizeYZ = val;
355   ComputeGeomParameters();                        377   ComputeGeomParameters();
                                                   >> 378   if(fPhysiWorld) { ChangeGeometry(); }
356 }                                                 379 }
357                                                   380 
358 //....oooOO0OOooo........oooOO0OOooo........oo    381 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
359                                                   382 
360 void DetectorConstruction::SetWorldSizeX(G4dou    383 void DetectorConstruction::SetWorldSizeX(G4double val)
361 {                                                 384 {
362   fWorldSizeX = val;                              385   fWorldSizeX = val;
                                                   >> 386   fDefaultWorld = false;
363   ComputeGeomParameters();                        387   ComputeGeomParameters();
                                                   >> 388   if(fPhysiWorld) { ChangeGeometry(); }
364 }                                                 389 }
365                                                   390 
366 //....oooOO0OOooo........oooOO0OOooo........oo    391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
367                                                   392 
368 void DetectorConstruction::SetWorldSizeYZ(G4do    393 void DetectorConstruction::SetWorldSizeYZ(G4double val)
369 {                                                 394 {
370   fWorldSizeYZ = val;                             395   fWorldSizeYZ = val;
                                                   >> 396   fDefaultWorld = false;
371   ComputeGeomParameters();                        397   ComputeGeomParameters();
                                                   >> 398   if(fPhysiWorld) { ChangeGeometry(); }
372 }                                                 399 }
373                                                   400 
374 //....oooOO0OOooo........oooOO0OOooo........oo    401 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
375                                                   402 
376 void DetectorConstruction::SetAbsorberXpos(G4d    403 void DetectorConstruction::SetAbsorberXpos(G4double val)
377 {                                                 404 {
378   fXposAbs = val;                              << 405   if(!fPhysiWorld) { fXposAbs = val; }
379   ComputeGeomParameters();                     << 406 }  
380 }                                              << 
381                                                   407 
382 //....oooOO0OOooo........oooOO0OOooo........oo    408 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
383                                                   409 
384 void DetectorConstruction::ConstructSDandField    410 void DetectorConstruction::ConstructSDandField()
385 {                                                 411 {
386   if (fFieldMessenger.Get() == 0) {            << 412   if ( fFieldMessenger.Get() == 0 ) {
387     // Create global magnetic field messenger.    413     // Create global magnetic field messenger.
388     // Uniform magnetic field is then created     414     // Uniform magnetic field is then created automatically if
389     // the field value is not zero.               415     // the field value is not zero.
390     G4ThreeVector fieldValue = G4ThreeVector()    416     G4ThreeVector fieldValue = G4ThreeVector();
391     G4GlobalMagFieldMessenger* msg = new G4Glo << 417     G4GlobalMagFieldMessenger* msg =
392     // msg->SetVerboseLevel(1);                << 418       new G4GlobalMagFieldMessenger(fieldValue);
                                                   >> 419     //msg->SetVerboseLevel(1);
393     G4AutoDelete::Register(msg);                  420     G4AutoDelete::Register(msg);
394     fFieldMessenger.Put(msg);                  << 421     fFieldMessenger.Put( msg );        
395   }                                               422   }
396 }                                                 423 }
397                                                   424 
398 //....oooOO0OOooo........oooOO0OOooo........oo    425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
399                                                   426 
400 void DetectorConstruction::ChangeGeometry()       427 void DetectorConstruction::ChangeGeometry()
401 {                                                 428 {
402   fSolidWorld->SetXHalfLength(fWorldSizeX * 0. << 429   fSolidWorld->SetXHalfLength(fWorldSizeX*0.5);
403   fSolidWorld->SetYHalfLength(fWorldSizeYZ * 0 << 430   fSolidWorld->SetYHalfLength(fWorldSizeYZ*0.5);
404   fSolidWorld->SetZHalfLength(fWorldSizeYZ * 0 << 431   fSolidWorld->SetZHalfLength(fWorldSizeYZ*0.5);
405                                                << 432 
406   fSolidAbsorber->SetXHalfLength(fAbsorberThic << 433   fSolidAbsorber->SetXHalfLength(fAbsorberThickness*0.5);
407   fSolidAbsorber->SetYHalfLength(fAbsorberSize << 434   fSolidAbsorber->SetYHalfLength(fAbsorberSizeYZ*0.5);
408   fSolidAbsorber->SetZHalfLength(fAbsorberSize << 435   fSolidAbsorber->SetZHalfLength(fAbsorberSizeYZ*0.5);
409 }                                                 436 }
410                                                   437 
411 //....oooOO0OOooo........oooOO0OOooo........oo    438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 439 
412                                                   440