Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/medical/electronScattering/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/medical/electronScattering/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/medical/electronScattering/src/DetectorConstruction.cc (Version 10.3.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 /// \file medical/electronScattering/src/Detec     26 /// \file medical/electronScattering/src/DetectorConstruction.cc
 27 /// \brief Implementation of the DetectorConst     27 /// \brief Implementation of the DetectorConstruction class
 28 //                                                 28 //
                                                   >>  29 // $Id: DetectorConstruction.cc 86064 2014-11-07 08:49:32Z gcosmo $
 29 //                                                 30 //
 30 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    33 
 33 #include "DetectorConstruction.hh"                 34 #include "DetectorConstruction.hh"
 34                                                << 
 35 #include "DetectorMessenger.hh"                    35 #include "DetectorMessenger.hh"
 36                                                    36 
 37 #include "G4GeometryManager.hh"                << 
 38 #include "G4LogicalVolume.hh"                  << 
 39 #include "G4LogicalVolumeStore.hh"             << 
 40 #include "G4Material.hh"                           37 #include "G4Material.hh"
                                                   >>  38 #include "G4Tubs.hh"
                                                   >>  39 #include "G4LogicalVolume.hh"
 41 #include "G4PVPlacement.hh"                        40 #include "G4PVPlacement.hh"
 42 #include "G4PhysicalConstants.hh"              <<  41 
                                                   >>  42 #include "G4GeometryManager.hh"
 43 #include "G4PhysicalVolumeStore.hh"                43 #include "G4PhysicalVolumeStore.hh"
                                                   >>  44 #include "G4LogicalVolumeStore.hh"
 44 #include "G4SolidStore.hh"                         45 #include "G4SolidStore.hh"
 45 #include "G4SystemOfUnits.hh"                  <<  46 
 46 #include "G4Tubs.hh"                           << 
 47 #include "G4UnitsTable.hh"                         47 #include "G4UnitsTable.hh"
                                                   >>  48 #include "G4PhysicalConstants.hh"
                                                   >>  49 #include "G4SystemOfUnits.hh"
 48                                                    50 
 49 //....oooOO0OOooo........oooOO0OOooo........oo     51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 50                                                    52 
 51 DetectorConstruction::DetectorConstruction()       53 DetectorConstruction::DetectorConstruction()
 52   : fMaterial_World(0),                        <<  54 :fMaterial_World(0), fMaterial_Frame(0),
 53     fMaterial_Frame(0),                        <<  55  fMaterial_ExitWindow(0), fMaterial_ScatterFoil(0), fMaterial_MonitorChbr(0),
 54     fMaterial_ExitWindow(0),                   <<  56  fMaterial_Bag(0), fMaterial_Gas(0), fMaterial_Ring(0),
 55     fMaterial_ScatterFoil(0),                  <<  57  fPvol_World(0), fPvol_Frame(0), fDetectorMessenger(0)
 56     fMaterial_MonitorChbr(0),                  <<  58 {              
 57     fMaterial_Bag(0),                          <<  59   // materials  
 58     fMaterial_Gas(0),                          << 
 59     fMaterial_Ring(0),                         << 
 60     fPvol_World(0),                            << 
 61     fPvol_Frame(0),                            << 
 62     fDetectorMessenger(0)                      << 
 63 {                                              << 
 64   // materials                                 << 
 65   DefineMaterials();                               60   DefineMaterials();
 66                                                <<  61   
 67   // geometry                                      62   // geometry
 68   GeometryParameters();                            63   GeometryParameters();
 69                                                <<  64  
 70   // create commands for interactive definitio <<  65   // create commands for interactive definition of the calorimeter  
 71   fDetectorMessenger = new DetectorMessenger(t     66   fDetectorMessenger = new DetectorMessenger(this);
 72 }                                                  67 }
 73                                                    68 
 74 //....oooOO0OOooo........oooOO0OOooo........oo     69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 75                                                    70 
 76 DetectorConstruction::~DetectorConstruction()      71 DetectorConstruction::~DetectorConstruction()
 77 {                                              <<  72 { 
 78   delete fDetectorMessenger;                       73   delete fDetectorMessenger;
 79 }                                                  74 }
 80                                                    75 
 81 //....oooOO0OOooo........oooOO0OOooo........oo     76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 82                                                    77 
 83 G4VPhysicalVolume* DetectorConstruction::Const     78 G4VPhysicalVolume* DetectorConstruction::Construct()
 84 {                                                  79 {
 85   return ConstructVolumes();                       80   return ConstructVolumes();
 86 }                                                  81 }
 87                                                    82 
 88 //....oooOO0OOooo........oooOO0OOooo........oo     83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 89                                                    84 
 90 void DetectorConstruction::DefineMaterials()       85 void DetectorConstruction::DefineMaterials()
 91 {                                              <<  86 {  
 92   G4double a, z, density;                      <<  87 G4double a, z, density;
 93   G4int ncomponents, natoms;                   <<  88 G4int ncomponents, natoms;
 94   G4double fractionmass;                       <<  89 G4double fractionmass;
 95   G4double temperature, pressure;              <<  90 G4double temperature, pressure;
 96                                                    91 
 97   // define Elements                           <<  92 // define Elements
 98   //                                           <<  93 //
 99   G4Element* H = new G4Element("Hydrogen", "H" <<  94 G4Element* H  = new G4Element("Hydrogen", "H",  z= 1, a=   1.0079*g/mole);
100   G4Element* He = new G4Element("Helium", "He" <<  95 G4Element* He = new G4Element("Helium",   "He", z= 2, a=   4.0026*g/mole);
101   G4Element* Be = new G4Element("Beryllium", " <<  96 G4Element* Be = new G4Element("Beryllium","Be", z= 4, a=   9.1218*g/mole);
102   G4Element* C = new G4Element("Carbon", "C",  <<  97 G4Element* C  = new G4Element("Carbon",   "C",  z= 6, a=  12.0107*g/mole);
103   G4Element* N = new G4Element("Nitrogen", "N" <<  98 G4Element* N  = new G4Element("Nitrogen", "N",  z= 7, a=  14.0067*g/mole);
104   G4Element* O = new G4Element("Oxygen", "O",  <<  99 G4Element* O  = new G4Element("Oxygen",   "O",  z= 8, a=  15.9994*g/mole);
105   G4Element* Al = new G4Element("Aluminium", " << 100 G4Element* Al = new G4Element("Aluminium","Al", z=13, a=  26.9815*g/mole);
106   G4Element* Ar = new G4Element("Argon", "Ar", << 101 G4Element* Ar = new G4Element("Argon",    "Ar", z=18, a=  39.9480*g/mole);
107   G4Element* Ti = new G4Element("Titanium", "T << 102 G4Element* Ti = new G4Element("Titanium", "Ti", z=22, a=  47.8670*g/mole);
108   G4Element* Va = new G4Element("Vanadium", "V << 103 G4Element* Va = new G4Element("Vanadium", "Va", z=23, a=  50.9415*g/mole);
109   G4Element* Cu = new G4Element("Copper", "Cu" << 104 G4Element* Cu = new G4Element("Copper",   "Cu", z=29, a=  63.5460*g/mole);
110   G4Element* Ta = new G4Element("Tantalum", "T << 105 G4Element* Ta = new G4Element("Tantalum", "Ta", z=73, a= 180.9479*g/mole);
111   G4Element* Au = new G4Element("Gold", "Au",  << 106 G4Element* Au = new G4Element("Gold",     "Au", z=79, a= 196.9666*g/mole);
112                                                << 
113   // Air                                       << 
114   //                                           << 
115   G4Material* Air = new G4Material("Air", dens << 
116                                    293. * kelv << 
117   Air->AddElement(C, fractionmass = 0.000124); << 
118   Air->AddElement(N, fractionmass = 0.755267); << 
119   Air->AddElement(O, fractionmass = 0.231782); << 
120   Air->AddElement(Ar, fractionmass = 0.012827) << 
121                                                << 
122   // Titanium                                  << 
123   //                                           << 
124   G4Material* Titanium = new G4Material("Titan << 
125   Titanium->AddElement(Ti, fractionmass = 0.90 << 
126   Titanium->AddElement(Al, fractionmass = 0.06 << 
127   Titanium->AddElement(Va, fractionmass = 0.04 << 
128                                                   107 
129   // Mylar                                     << 108 // Air
130   //                                           << 109 //
131   G4Material* Mylar = new G4Material("Mylar",  << 110 G4Material* Air = 
132   Mylar->AddElement(H, natoms = 4);            << 111 new G4Material("Air", density= 1.205*mg/cm3, ncomponents=4,
133   Mylar->AddElement(C, natoms = 5);            << 112                       kStateGas, 293.*kelvin, 1.*atmosphere);
134   Mylar->AddElement(O, natoms = 2);            << 113 Air->AddElement(C, fractionmass=0.000124);                      
                                                   >> 114 Air->AddElement(N, fractionmass=0.755267);
                                                   >> 115 Air->AddElement(O, fractionmass=0.231782);
                                                   >> 116 Air->AddElement(Ar,fractionmass=0.012827);
135                                                   117 
136   // Helium                                    << 118 // Titanium
137   //                                           << 119 //
138   G4Material* Helium = new G4Material("Helium" << 120 G4Material* Titanium = 
139                                       kStateGa << 121 new G4Material("Titanium", density= 4.42*g/cm3, ncomponents=3);
140   Helium->AddElement(He, fractionmass = 1.0);  << 122 Titanium->AddElement(Ti, fractionmass=0.90);
                                                   >> 123 Titanium->AddElement(Al, fractionmass=0.06);
                                                   >> 124 Titanium->AddElement(Va, fractionmass=0.04);
141                                                   125 
142   // Aluminium                                 << 126 // Mylar
143   //                                           << 127 //
144   G4Material* Aluminium = new G4Material("Alum << 128 G4Material* Mylar = 
145   Aluminium->AddElement(Al, fractionmass = 1.0 << 129 new G4Material("Mylar", density= 1.40*g/cm3, ncomponents=3);
                                                   >> 130 Mylar->AddElement(H, natoms=4);
                                                   >> 131 Mylar->AddElement(C, natoms=5);
                                                   >> 132 Mylar->AddElement(O, natoms=2);
146                                                   133 
147   // Beryllium                                 << 134 // Helium
148   //                                           << 135 //
149   G4Material* Beryllium = new G4Material("Bery << 136 G4Material* Helium = 
150   Beryllium->AddElement(Be, fractionmass = 1.0 << 137 new G4Material("Helium", density= 0.166*mg/cm3, ncomponents=1,
                                                   >> 138                       kStateGas, 293.*kelvin, 1.*atmosphere);
                                                   >> 139 Helium->AddElement(He, fractionmass=1.0);                      
151                                                   140 
152   // Graphite                                  << 141 // Aluminium
153   //                                           << 142 //
154   G4Material* Graphite = new G4Material("Graph << 143 G4Material* Aluminium = 
155   Graphite->AddElement(C, fractionmass = 1.0); << 144 new G4Material("Aluminium", density= 2.7*g/cm3, ncomponents=1);
                                                   >> 145 Aluminium->AddElement(Al, fractionmass=1.0);
156                                                   146 
157   // Copper                                    << 147 // Beryllium
158   //                                           << 148 //
159   G4Material* Copper = new G4Material("Copper" << 149 G4Material* Beryllium = 
160   Copper->AddElement(Cu, fractionmass = 1.0);  << 150 new G4Material("Beryllium", density= 1.85*g/cm3, ncomponents=1);
                                                   >> 151 Beryllium->AddElement(Be, fractionmass=1.0);
161                                                   152 
162   // Tantalum                                  << 153 //Graphite
163   //                                           << 154 //
164   G4Material* Tantalum = new G4Material("Tanta << 155 G4Material* Graphite = 
165   Tantalum->AddElement(Ta, fractionmass = 1.0) << 156 new G4Material("Graphite", density= 2.18*g/cm3, ncomponents=1);
                                                   >> 157 Graphite->AddElement(C, fractionmass=1.0);
166                                                   158 
167   // Gold                                      << 159 // Copper
168   //                                           << 160 //
169   G4Material* Gold = new G4Material("Gold", de << 161 G4Material* Copper = 
170   Gold->AddElement(Au, fractionmass = 1.0);    << 162 new G4Material("Copper", density= 8.92*g/cm3, ncomponents=1);
                                                   >> 163 Copper->AddElement(Cu, fractionmass=1.0);
171                                                   164 
172   // example of vacuum                         << 165 // Tantalum
173   //                                           << 166 //
174   density = universe_mean_density;  // from Ph << 167 G4Material* Tantalum = 
175   pressure = 3.e-18 * pascal;                  << 168 new G4Material("Tantalum", density= 16.65*g/cm3, ncomponents=1);
176   temperature = 2.73 * kelvin;                 << 169 Tantalum->AddElement(Ta, fractionmass=1.0);
177   G4Material* Vacuum = new G4Material("Galacti << 
178                                       temperat << 
179                                                   170 
180   // print                                     << 171 // Gold
181   //                                           << 172 //
182   G4cout << *(G4Material::GetMaterialTable())  << 173 G4Material* Gold = 
                                                   >> 174 new G4Material("Gold", density= 19.30*g/cm3, ncomponents=1);
                                                   >> 175 Gold->AddElement(Au, fractionmass=1.0);
183                                                   176 
184   // assign materials                          << 177 // example of vacuum
185   //                                           << 178 //
186   fMaterial_World = Vacuum;                    << 179 density     = universe_mean_density;    //from PhysicalConstants.h
187   fMaterial_Frame = Air;                       << 180 pressure    = 3.e-18*pascal;
188   fMaterial_ExitWindow = Titanium;             << 181 temperature = 2.73*kelvin;
189   fMaterial_ScatterFoil = fMaterial_Frame;     << 182 G4Material* Vacuum =
190   fMaterial_MonitorChbr = Mylar;               << 183 new G4Material("Galactic", z=1, a=1.01*g/mole,density,
191   fMaterial_Bag = Mylar;                       << 184                           kStateGas,temperature,pressure);
192   fMaterial_Gas = Helium;                      << 185                           
193   fMaterial_Ring = Aluminium;                  << 186 //print
                                                   >> 187 //
                                                   >> 188 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
                                                   >> 189   
                                                   >> 190                             
                                                   >> 191 // assign materials
                                                   >> 192 //
                                                   >> 193 fMaterial_World       = Vacuum;
                                                   >> 194 fMaterial_Frame       = Air;
                                                   >> 195 fMaterial_ExitWindow  = Titanium;
                                                   >> 196 fMaterial_ScatterFoil = fMaterial_Frame;
                                                   >> 197 fMaterial_MonitorChbr = Mylar;
                                                   >> 198 fMaterial_Bag         = Mylar;
                                                   >> 199 fMaterial_Gas         = Helium;
                                                   >> 200 fMaterial_Ring        = Aluminium;
194 }                                                 201 }
195                                                   202 
196 //....oooOO0OOooo........oooOO0OOooo........oo    203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
197                                                   204 
198 void DetectorConstruction::GeometryParameters(    205 void DetectorConstruction::GeometryParameters()
199 {                                                 206 {
200   fZfront_ExitWindow = 0.0 * um;               << 207   fZfront_ExitWindow = 0.0*um;  
201   fThickness_ExitWindow = 41.2 * um;           << 208   fThickness_ExitWindow = 41.2*um;
202                                                << 209   
203   fZfront_ScatterFoil = 2.65 * cm;             << 210   fZfront_ScatterFoil = 2.65*cm;  
204   fThickness_ScatterFoil = 0.0 * um;           << 211   fThickness_ScatterFoil = 0.0*um;
205                                                << 212   
206   fZfront_MonitorChbr = 50. * mm;              << 213   fZfront_MonitorChbr = 50.*mm;  
207   fThickness_MonitorChbr = 112.7 * um;         << 214   fThickness_MonitorChbr = 112.7*um;
208                                                << 215   
209   fZfront_Bag = 64.975 * mm;                   << 216   fZfront_Bag = 64.975*mm;  
210   fThickness_Bag = 110.0050 * cm;              << 217   fThickness_Bag = 110.0050*cm;
211                                                << 218   
212   fThickness_Gas = 110. * cm;                  << 219   fThickness_Gas = 110.*cm;
213                                                << 220   
214   fThickness_Ring = 14. * mm;                  << 221   fThickness_Ring = 14.*mm;
215   fInnerRadius_Ring = 20. * cm;                << 222   fInnerRadius_Ring = 20.*cm;
216                                                << 223   
217   fZfront_Frame = 2.0 * um;                    << 224   fZfront_Frame = 2.0*um;    
218   fThickness_Frame = 118.2 * cm;               << 225   fThickness_Frame = 118.2*cm;
219                                                << 226       
220   fThickness_World = fZfront_Frame + fThicknes    227   fThickness_World = fZfront_Frame + fThickness_Frame;
221   fRadius_World = 23.3 * cm;                   << 228   fRadius_World = 23.3*cm;
222 }                                                 229 }
223                                                   230 
224 //....oooOO0OOooo........oooOO0OOooo........oo    231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
225                                                << 232   
226 G4VPhysicalVolume* DetectorConstruction::Const    233 G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
227 {                                              << 234 { 
228   // Cleanup old geometry                         235   // Cleanup old geometry
229   //                                              236   //
230   G4GeometryManager::GetInstance()->OpenGeomet    237   G4GeometryManager::GetInstance()->OpenGeometry();
231   G4PhysicalVolumeStore::GetInstance()->Clean(    238   G4PhysicalVolumeStore::GetInstance()->Clean();
232   G4LogicalVolumeStore::GetInstance()->Clean()    239   G4LogicalVolumeStore::GetInstance()->Clean();
233   G4SolidStore::GetInstance()->Clean();           240   G4SolidStore::GetInstance()->Clean();
234                                                << 241         
235   // World                                        242   // World
236   //                                              243   //
237   G4Tubs* svol_World = new G4Tubs("World",  // << 244   G4Tubs*
238                                   0 * cm, fRad << 245   svol_World = new G4Tubs("World",                        //name
239                                   0.5 * fThick << 246                          0*cm, fRadius_World,             //r1, r2
240                                   0., twopi);  << 247                          0.5*fThickness_World,            //half-length 
241                                                << 248                          0., twopi);                      //theta1, theta2
242   G4LogicalVolume* lvol_World = new G4LogicalV << 249 
243                                                << 250   G4LogicalVolume*                           
244                                                << 251   lvol_World = new G4LogicalVolume(svol_World,            //its solid
245                                                << 252                                    fMaterial_World,       //its material
246   fPvol_World = new G4PVPlacement(0,  // no ro << 253                                    "World");              //its name
247                                   G4ThreeVecto << 254                                    
248                                   lvol_World,  << 255   fPvol_World = new G4PVPlacement(0,                      //no rotation
249                                   "World",  // << 256                                   G4ThreeVector(),        //no translation
250                                   0,  // its m << 257                                   lvol_World,             //its logical volume
251                                   false,  // n << 258                                   "World",                //its name
252                                   0);  // copy << 259                                   0,                      //its mother  volume
253                                                << 260                                   false,                  //no boolean operation
                                                   >> 261                                   0);                     //copy number
                                                   >> 262                                  
254   // Frame                                        263   // Frame
255   //                                              264   //
256   G4Tubs* svol_Frame = new G4Tubs("Frame",  // << 265   G4Tubs*
257                                   0 * cm, fRad << 266   svol_Frame = new G4Tubs("Frame",                        //name
258                                   0.5 * fThick << 267                          0*cm, fRadius_World,             //r1, r2
259                                   0., twopi);  << 268                          0.5*fThickness_Frame,            //half-length 
260                                                << 269                          0., twopi);                      //theta1, theta2
261   G4LogicalVolume* lvol_Frame = new G4LogicalV << 270                          
262                                                << 271   G4LogicalVolume*                            
263                                                << 272   lvol_Frame = new G4LogicalVolume(svol_Frame,            //its solid
264                                                << 273                                    fMaterial_Frame,       //its material
265   G4double zpos = fZfront_Frame;               << 274                                    "Frame");              //its name
266                                                << 275                                    
267   fPvol_Frame = new G4PVPlacement(0,  // no ro << 276   G4double 
268                                   G4ThreeVecto << 277   zpos = fZfront_Frame;
269                                   lvol_Frame,  << 278                                      
270                                   "Frame",  // << 279   fPvol_Frame = new G4PVPlacement(0,                      //no rotation
271                                   lvol_World,  << 280                         G4ThreeVector(0,0,zpos),          //translation
272                                   false,  // n << 281                                  lvol_Frame,              //its logical volume
273                                   0);  // copy << 282                                  "Frame",                 //its name
                                                   >> 283                                  lvol_World,              //its mother  volume
                                                   >> 284                                  false,                   //no boolean operation
                                                   >> 285                                  0);                      //copy number
274                                                   286 
                                                   >> 287                                                 
275   // ExitWindow                                   288   // ExitWindow
276   //                                              289   //
277   G4Tubs* svol_ExitWindow = new G4Tubs("ExitWi << 290   G4Tubs*
278                                        0 * cm, << 291   svol_ExitWindow = new G4Tubs("ExitWindow",              //name
279                                        0.5 * f << 292                          0*cm, fRadius_World,             //r1, r2
280                                        0., two << 293                          0.5*fThickness_ExitWindow,       //half-length 
281                                                << 294                          0., twopi);                      //theta1, theta2
282   G4LogicalVolume* lvol_ExitWindow = new G4Log << 295 
283                                                << 296   G4LogicalVolume*                         
284                                                << 297   lvol_ExitWindow = new G4LogicalVolume(svol_ExitWindow,  //solid
285                                                << 298                                    fMaterial_ExitWindow,  //material
286   zpos = fZfront_ExitWindow + 0.5 * fThickness << 299                                    "ExitWindow");         //name
287                                                << 300                                    
288   new G4PVPlacement(0,  // no rotation         << 301   zpos = fZfront_ExitWindow + 0.5*fThickness_ExitWindow - 0.5*fThickness_Frame;
289                     G4ThreeVector(0, 0, zpos), << 302   
290                     lvol_ExitWindow,  // logic << 303                    new G4PVPlacement(0,                   //no rotation
291                     "ExitWindow",  // name     << 304                             G4ThreeVector(0,0,zpos),      //translation
292                     lvol_Frame,  // mother vol << 305                                  lvol_ExitWindow,         //logical volume
293                     false,  // no boolean oper << 306                                  "ExitWindow",            //name
294                     0);  // copy number        << 307                                  lvol_Frame,              //mother volume
295                                                << 308                                  false,                   //no boolean operation
                                                   >> 309                                  0);                      //copy number
                                                   >> 310                                                 
296   // Monitor Chamber                              311   // Monitor Chamber
297   //                                              312   //
298   G4Tubs* svol_MonitorChbr = new G4Tubs("Monit << 313   G4Tubs*
299                                         0 * cm << 314   svol_MonitorChbr = new G4Tubs("MonitorChbr",            //name
300                                         0.5 *  << 315                          0*cm, fRadius_World,             //r1, r2
301                                         0., tw << 316                          0.5*fThickness_MonitorChbr,      //half-length 
302                                                << 317                          0., twopi);                      //theta1, theta2
303   G4LogicalVolume* lvol_MonitorChbr = new G4Lo << 318 
304                                                << 319   G4LogicalVolume*                         
305                                                << 320   lvol_MonitorChbr = new G4LogicalVolume(svol_MonitorChbr,//solid
306                                                << 321                                    fMaterial_MonitorChbr, //material
307   zpos = fZfront_MonitorChbr + 0.5 * fThicknes << 322                                    "MonitorChbr");        //name
308                                                << 323                                    
309   new G4PVPlacement(0,  // no rotation         << 324   zpos = fZfront_MonitorChbr + 0.5*fThickness_MonitorChbr - 0.5*fThickness_Frame;
310                     G4ThreeVector(0, 0, zpos), << 325   
311                     lvol_MonitorChbr,  // logi << 326                      new G4PVPlacement(0,                 //no rotation
312                     "MonitorChbr",  // name    << 327                             G4ThreeVector(0,0,zpos),      //translation
313                     lvol_Frame,  // mother vol << 328                                  lvol_MonitorChbr,        //logical volume
314                     false,  // no boolean oper << 329                                  "MonitorChbr",           //name
315                     0);  // copy number        << 330                                  lvol_Frame,              //mother volume
316                                                << 331                                  false,                   //no boolean operation
                                                   >> 332                                  0);                      //copy number
                                                   >> 333                                  
                                                   >> 334                                                 
317   // Bag                                          335   // Bag
318   //                                              336   //
319   G4Tubs* svol_Bag = new G4Tubs("Bag",  // nam << 337   G4Tubs*
320                                 0 * cm, fRadiu << 338   svol_Bag = new G4Tubs("Bag",                            //name
321                                 0.5 * fThickne << 339                          0*cm, fRadius_World,             //r1, r2
322                                 0., twopi);  / << 340                          0.5*fThickness_Bag,              //half-length 
323                                                << 341                          0., twopi);                      //theta1, theta2
324   G4LogicalVolume* lvol_Bag = new G4LogicalVol << 342 
325                                                << 343   G4LogicalVolume*                         
326                                                << 344   lvol_Bag = new G4LogicalVolume(svol_Bag,                //solid
327                                                << 345                                  fMaterial_Bag,           //material
328   zpos = fZfront_Bag + 0.5 * fThickness_Bag -  << 346                                  "Bag");                  //name
329                                                << 347                                    
330   new G4PVPlacement(0,  // no rotation         << 348   zpos = fZfront_Bag + 0.5*fThickness_Bag - 0.5*fThickness_Frame;
331                     G4ThreeVector(0, 0, zpos), << 349   
332                     lvol_Bag,  // logical volu << 350              new G4PVPlacement(0,                         //no rotation
333                     "Bag",  // name            << 351                             G4ThreeVector(0,0,zpos),      //translation
334                     lvol_Frame,  // mother vol << 352                                  lvol_Bag,                //logical volume
335                     false,  // no boolean oper << 353                                  "Bag",                   //name
336                     0);  // copy number        << 354                                  lvol_Frame,              //mother volume
337                                                << 355                                  false,                   //no boolean operation
                                                   >> 356                                  0);                      //copy number
                                                   >> 357                                  
                                                   >> 358                                                 
338   // Gas                                          359   // Gas
339   //                                              360   //
340   G4Tubs* svol_Gas = new G4Tubs("Gas",  // nam << 361   G4Tubs*
341                                 0 * cm, fRadiu << 362   svol_Gas = new G4Tubs("Gas",                            //name
342                                 0.5 * fThickne << 363                          0*cm, fRadius_World,             //r1, r2
343                                 0., twopi);  / << 364                          0.5*fThickness_Gas,              //half-length 
344                                                << 365                          0., twopi);                      //theta1, theta2
345   G4LogicalVolume* lvol_Gas = new G4LogicalVol << 366 
346                                                << 367   G4LogicalVolume*                         
347                                                << 368   lvol_Gas = new G4LogicalVolume(svol_Gas,                //solid
348                                                << 369                                  fMaterial_Gas,           //material
349   new G4PVPlacement(0,  // no rotation         << 370                                  "Gas");                  //name
350                     G4ThreeVector(),  // no tr << 371   
351                     lvol_Gas,  // logical volu << 372 
352                     "Gas",  // name            << 373              new G4PVPlacement(0,                         //no rotation
353                     lvol_Bag,  // mother volum << 374                             G4ThreeVector(),              //no translation
354                     false,  // no boolean oper << 375                                  lvol_Gas,                //logical volume
355                     0);  // copy number        << 376                                  "Gas",                   //name
                                                   >> 377                                  lvol_Bag,                //mother volume
                                                   >> 378                                  false,                   //no boolean operation
                                                   >> 379                                  0);                      //copy number
                                                   >> 380 
356                                                   381 
357   // Rings                                        382   // Rings
358   //                                              383   //
359   G4Tubs* svol_Ring = new G4Tubs("Ring",  // n << 384   G4Tubs*
360                                  fInnerRadius_ << 385   svol_Ring = new G4Tubs("Ring",                          //name
361                                  0.5 * fThickn << 386                        fInnerRadius_Ring, fRadius_World,  //r1, r2
362                                  0., twopi);   << 387                          0.5*fThickness_Ring,             //half-length 
363                                                << 388                          0., twopi);                      //theta1, theta2
364   G4LogicalVolume* lvol_Ring = new G4LogicalVo << 389 
365                                                << 390   G4LogicalVolume*                         
366                                                << 391   lvol_Ring = new G4LogicalVolume(svol_Ring,              //solid
367                                                << 392                                    fMaterial_Ring,        //material
368   zpos = 0.5 * (fThickness_Gas - fThickness_Ri << 393                                    "Ring");               //name
369                                                << 394                                    
370   new G4PVPlacement(0,  // no rotation         << 395   zpos = 0.5*(fThickness_Gas - fThickness_Ring);
371                     G4ThreeVector(0, 0, zpos), << 396   
372                     lvol_Ring,  // logical vol << 397               new G4PVPlacement(0,                        //no rotation
373                     "Ring",  // name           << 398                             G4ThreeVector(0,0,zpos),      //translation
374                     lvol_Gas,  // mother volum << 399                                  lvol_Ring,               //logical volume
375                     false,  // no boolean oper << 400                                  "Ring",                  //name
376                     1);  // copy number        << 401                                  lvol_Gas,                //mother volume
377                                                << 402                                  false,                   //no boolean operation
378   new G4PVPlacement(0,  // no rotation         << 403                                  1);                      //copy number
379                     G4ThreeVector(0, 0, -zpos) << 404 
380                     lvol_Ring,  // logical vol << 405               new G4PVPlacement(0,                        //no rotation
381                     "Ring",  // name           << 406                             G4ThreeVector(0,0,-zpos),     //translation
382                     lvol_Gas,  // mother volum << 407                                  lvol_Ring,               //logical volume
383                     false,  // no boolean oper << 408                                  "Ring",                  //name
384                     2);  // copy number        << 409                                  lvol_Gas,                //mother volume
                                                   >> 410                                  false,                   //no boolean operation
                                                   >> 411                                  2);                      //copy number
385                                                   412 
                                                   >> 413                                                 
386   // ScatterFoil (only if it is not Air)          414   // ScatterFoil (only if it is not Air)
387   //                                              415   //
388   if ((fMaterial_ScatterFoil != fMaterial_Fram << 416   if ((fMaterial_ScatterFoil != fMaterial_Frame) && (fThickness_ScatterFoil > 0.))
389     G4Tubs* svol_ScatterFoil = new G4Tubs("Sca << 417    {
390                                           0 *  << 418     G4Tubs*
391                                           0.5  << 419     svol_ScatterFoil = new G4Tubs("ScatterFoil",          //name
392                                           0.,  << 420                          0*cm, fRadius_World,             //r1, r2
393                                                << 421                          0.5*fThickness_ScatterFoil,      //half-length 
394     G4LogicalVolume* lvol_ScatterFoil = new G4 << 422                          0., twopi);                      //theta1, theta2
395                                                << 423 
396                                                << 424     G4LogicalVolume*                         
397                                                << 425     lvol_ScatterFoil = new G4LogicalVolume(svol_ScatterFoil,//solid
398     zpos = fZfront_ScatterFoil + 0.5 * fThickn << 426                                    fMaterial_ScatterFoil,   //material
399                                                << 427                                    "ScatterFoil");          //name
400     new G4PVPlacement(0,  // no rotation       << 428                                    
401                       G4ThreeVector(0, 0, zpos << 429     zpos = fZfront_ScatterFoil + 0.5*fThickness_ScatterFoil - 0.5*fThickness_Frame;
402                       lvol_ScatterFoil,  // lo << 430   
403                       "ScatterFoil",  // name  << 431                    new G4PVPlacement(0,                  //no rotation
404                       lvol_Frame,  // mother v << 432                             G4ThreeVector(0,0,zpos),     //translation
405                       false,  // no boolean op << 433                                  lvol_ScatterFoil,       //logical volume
406                       0);  // copy number      << 434                                  "ScatterFoil",          //name
407   }                                            << 435                                  lvol_Frame,             //mother volume
408                                                << 436                                  false,                  //no boolean operation
409   PrintGeometry();                             << 437                                  0);                     //copy number
410                                                << 438   }                                 
411   // always return the physical World          << 439                                         
                                                   >> 440    PrintGeometry();         
                                                   >> 441   
                                                   >> 442   //always return the physical World
412   //                                              443   //
413   return fPvol_World;                             444   return fPvol_World;
414 }                                                 445 }
415                                                   446 
416 //....oooOO0OOooo........oooOO0OOooo........oo    447 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
417                                                   448 
418 void DetectorConstruction::PrintGeometry()        449 void DetectorConstruction::PrintGeometry()
419 {                                                 450 {
                                                   >> 451    
420   // choose printing format                       452   // choose printing format
421   std::ios::fmtflags mode = G4cout.flags();       453   std::ios::fmtflags mode = G4cout.flags();
422   G4cout.setf(std::ios::fixed, std::ios::float << 454   G4cout.setf(std::ios::fixed,std::ios::floatfield);
423   G4int prec = G4cout.precision(6);               455   G4int prec = G4cout.precision(6);
424                                                << 456   
425   G4cout << "\n \t \t"                         << 457   G4cout << "\n \t \t" << "Material \t" << "Z_front \t" << "Thickness \n";  
426          << "Material \t"                      << 458      
427          << "Z_front \t"                       << 459   G4cout << "\n  ExitWindow \t" << fMaterial_ExitWindow->GetName()
428          << "Thickness \n";                    << 460          << "\t" << G4BestUnit(fZfront_ExitWindow,"Length")
429                                                << 461          << "\t" << G4BestUnit(fThickness_ExitWindow,"Length");
430   G4cout << "\n  ExitWindow \t" << fMaterial_E << 462          
431          << G4BestUnit(fZfront_ExitWindow, "Le << 463   if (fMaterial_ScatterFoil != fMaterial_Frame) {         
432          << G4BestUnit(fThickness_ExitWindow,  << 
433                                                << 
434   if (fMaterial_ScatterFoil != fMaterial_Frame << 
435     G4cout << "\n  ScatterFoil \t" << fMateria    464     G4cout << "\n  ScatterFoil \t" << fMaterial_ScatterFoil->GetName() << "\t"
436            << "\t" << G4BestUnit(fZfront_Scatt << 465            << "\t" << G4BestUnit(fZfront_ScatterFoil,"Length")
437            << G4BestUnit(fThickness_ScatterFoi << 466            << "\t" << G4BestUnit(fThickness_ScatterFoil,"Length");
438   }                                               467   }
439                                                << 468                     
440   G4cout << "\n  MonitorChbr \t" << fMaterial_    469   G4cout << "\n  MonitorChbr \t" << fMaterial_MonitorChbr->GetName() << "\t"
441          << "\t" << G4BestUnit(fZfront_Monitor << 470          << "\t" << G4BestUnit(fZfront_MonitorChbr,"Length")
442          << G4BestUnit(fThickness_MonitorChbr, << 471          << "\t" << G4BestUnit(fThickness_MonitorChbr,"Length");
443                                                   472 
444   G4double thickBagWindow = 0.5 * (fThickness_ << 473   G4double thickBagWindow = 0.5*(fThickness_Bag - fThickness_Gas);
445   G4double zfrontGas = fZfront_Bag + thickBagW    474   G4double zfrontGas = fZfront_Bag + thickBagWindow;
446   G4double zfrontBagWindow2 = zfrontGas + fThi    475   G4double zfrontBagWindow2 = zfrontGas + fThickness_Gas;
447                                                << 476             
448   G4cout << "\n  BagWindow1 \t" << fMaterial_B    477   G4cout << "\n  BagWindow1 \t" << fMaterial_Bag->GetName() << "\t"
449          << "\t" << G4BestUnit(fZfront_Bag, "L << 478          << "\t" << G4BestUnit(fZfront_Bag,"Length")
450          << G4BestUnit(thickBagWindow, "Length << 479          << "\t" << G4BestUnit(thickBagWindow,"Length");
451                                                << 480             
452   G4cout << "\n  Gas       \t" << fMaterial_Ga    481   G4cout << "\n  Gas       \t" << fMaterial_Gas->GetName() << "\t"
453          << "\t" << G4BestUnit(zfrontGas, "Len << 482          << "\t" << G4BestUnit(zfrontGas,"Length")
454                                                << 483          << "\t" << G4BestUnit(fThickness_Gas,"Length");
                                                   >> 484                      
455   G4cout << "\n  BagWindow2 \t" << fMaterial_B    485   G4cout << "\n  BagWindow2 \t" << fMaterial_Bag->GetName() << "\t"
456          << "\t" << G4BestUnit(zfrontBagWindow << 486          << "\t" << G4BestUnit(zfrontBagWindow2,"Length")
457          << G4BestUnit(thickBagWindow, "Length << 487          << "\t" << G4BestUnit(thickBagWindow,"Length");
458                                                << 488                      
459   G4cout << "\n  ScoringPlane \t" << fMaterial    489   G4cout << "\n  ScoringPlane \t" << fMaterial_Frame->GetName() << "\t"
460          << "\t" << G4BestUnit(fThickness_Fram << 490          << "\t" << G4BestUnit(fThickness_Frame,"Length") << "\n" << G4endl;
461          << G4endl;                            << 491          
462                                                << 
463   // restaure default formats                     492   // restaure default formats
464   G4cout.setf(mode, std::ios::floatfield);     << 493   G4cout.setf(mode,std::ios::floatfield);
465   G4cout.precision(prec);                      << 494   G4cout.precision(prec);             
466 }                                                 495 }
467                                                   496 
468 //....oooOO0OOooo........oooOO0OOooo........oo    497 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
469                                                   498 
470 void DetectorConstruction::SetMaterialScatter(    499 void DetectorConstruction::SetMaterialScatter(G4String material)
471 {                                                 500 {
472   // search the material by its name              501   // search the material by its name
473   G4Material* pMaterial = G4Material::GetMater    502   G4Material* pMaterial = G4Material::GetMaterial(material);
474                                                   503 
475   if (pMaterial) fMaterial_ScatterFoil = pMate << 504   if (pMaterial) fMaterial_ScatterFoil = pMaterial;                  
476 }                                                 505 }
477                                                << 506     
478 //....oooOO0OOooo........oooOO0OOooo........oo    507 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
479                                                   508 
480 void DetectorConstruction::SetThicknessScatter    509 void DetectorConstruction::SetThicknessScatter(G4double val)
481 {                                                 510 {
482   fThickness_ScatterFoil = val;                   511   fThickness_ScatterFoil = val;
483 }                                              << 512 }  
484                                                   513 
485 //....oooOO0OOooo........oooOO0OOooo........oo    514 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
486                                                   515 
487 #include "G4RunManager.hh"                     << 516 #include "G4RunManager.hh" 
488                                                << 517  
489 void DetectorConstruction::UpdateGeometry()       518 void DetectorConstruction::UpdateGeometry()
490 {                                                 519 {
491   G4RunManager::GetRunManager()->DefineWorldVo    520   G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
492 }                                                 521 }
493                                                   522 
494 //....oooOO0OOooo........oooOO0OOooo........oo    523 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 524 
495                                                   525