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.7.p4)


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