Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/field/field02/src/F02DetectorConstruction.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/field/field02/src/F02DetectorConstruction.cc (Version 11.3.0) and /examples/extended/field/field02/src/F02DetectorConstruction.cc (Version 10.4.p3)


  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 field/field02/src/F02DetectorConstru     26 /// \file field/field02/src/F02DetectorConstruction.cc
 27 /// \brief Implementation of the F02DetectorCo     27 /// \brief Implementation of the F02DetectorConstruction class
 28 //                                                 28 //
 29 //                                                 29 //
                                                   >>  30 // $Id$
 30 //                                                 31 //
 31 //                                                 32 //
 32 //....oooOO0OOooo........oooOO0OOooo........oo     33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 33 //....oooOO0OOooo........oooOO0OOooo........oo     34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 34                                                    35 
 35 #include "F02DetectorConstruction.hh"              36 #include "F02DetectorConstruction.hh"
                                                   >>  37 #include "F02DetectorMessenger.hh"
 36                                                    38 
 37 #include "F02CalorimeterSD.hh"                     39 #include "F02CalorimeterSD.hh"
 38 #include "F02DetectorMessenger.hh"             <<  40 #include "F02ElectricFieldSetup.hh"
 39                                                    41 
 40 #include "G4AutoDelete.hh"                     << 
 41 #include "G4GeometryManager.hh"                    42 #include "G4GeometryManager.hh"
 42 #include "G4FieldBuilder.hh"                   <<  43 #include "G4PhysicalVolumeStore.hh"
 43 #include "G4LogicalVolume.hh"                  << 
 44 #include "G4LogicalVolumeStore.hh"                 44 #include "G4LogicalVolumeStore.hh"
                                                   >>  45 #include "G4SolidStore.hh"
                                                   >>  46 
 45 #include "G4Material.hh"                           47 #include "G4Material.hh"
                                                   >>  48 #include "G4Tubs.hh"
                                                   >>  49 #include "G4LogicalVolume.hh"
 46 #include "G4PVPlacement.hh"                        50 #include "G4PVPlacement.hh"
 47 #include "G4PhysicalConstants.hh"              << 
 48 #include "G4PhysicalVolumeStore.hh"            << 
 49 #include "G4RunManager.hh"                         51 #include "G4RunManager.hh"
                                                   >>  52 #include "G4AutoDelete.hh"
 50 #include "G4SDManager.hh"                          53 #include "G4SDManager.hh"
 51 #include "G4SolidStore.hh"                     <<  54 
                                                   >>  55 #include "G4PhysicalConstants.hh"
 52 #include "G4SystemOfUnits.hh"                      56 #include "G4SystemOfUnits.hh"
 53 #include "G4Tubs.hh"                           << 
 54 #include "G4UniformElectricField.hh"           << 
 55                                                    57 
 56 //....oooOO0OOooo........oooOO0OOooo........oo     58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 57                                                    59 
 58 F02DetectorConstruction::F02DetectorConstructi     60 F02DetectorConstruction::F02DetectorConstruction()
 59 {                                              <<  61  : G4VUserDetectorConstruction(),
                                                   >>  62    fDetectorMessenger(0),
                                                   >>  63    fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
                                                   >>  64    fSolidAbsorber(0),fLogicAbsorber(0), fPhysiAbsorber(0),
                                                   >>  65    fAbsorberMaterial(0), fAbsorberThickness(0.), fAbsorberRadius(0.),
                                                   >>  66    fWorldChanged(false), fZAbsorber(0.), fZStartAbs(0.), fZEndAbs(0.),
                                                   >>  67    fWorldMaterial(0), fWorldSizeR(0.), fWorldSizeZ(0.)
                                                   >>  68 {
                                                   >>  69   // default parameter values of the calorimeter
                                                   >>  70 
                                                   >>  71   fWorldSizeZ = 80.*cm;
                                                   >>  72   fWorldSizeR = 20.*cm;
                                                   >>  73 
                                                   >>  74   fAbsorberThickness = 40.0*mm;
                                                   >>  75 
                                                   >>  76   fAbsorberRadius   = 10.*cm;
                                                   >>  77   fZAbsorber = 36.*cm;
                                                   >>  78 
 60   // create commands for interactive definitio     79   // create commands for interactive definition of the calorimeter
 61                                                    80 
 62   fDetectorMessenger = new F02DetectorMessenge     81   fDetectorMessenger = new F02DetectorMessenger(this);
 63                                                    82 
 64   // create field builder                      << 
 65   // this will create commands for field confi << 
 66   G4FieldBuilder::Instance();                  << 
 67   // G4FieldBuilder::Instance()->SetVerboseLev << 
 68                                                << 
 69   // create materials                              83   // create materials
                                                   >>  84 
 70   DefineMaterials();                               85   DefineMaterials();
                                                   >>  86 
 71 }                                                  87 }
 72                                                    88 
 73 //....oooOO0OOooo........oooOO0OOooo........oo     89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 74                                                    90 
 75 F02DetectorConstruction::~F02DetectorConstruct     91 F02DetectorConstruction::~F02DetectorConstruction()
 76 {                                                  92 {
 77   delete fDetectorMessenger;                       93   delete fDetectorMessenger;
 78 }                                                  94 }
 79                                                    95 
 80 //....oooOO0OOooo........oooOO0OOooo........oo     96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 81                                                    97 
 82 G4VPhysicalVolume* F02DetectorConstruction::Co     98 G4VPhysicalVolume* F02DetectorConstruction::Construct()
 83 {                                                  99 {
 84   return ConstructCalorimeter();                  100   return ConstructCalorimeter();
 85 }                                                 101 }
 86                                                   102 
 87 //....oooOO0OOooo........oooOO0OOooo........oo    103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 88                                                   104 
 89 void F02DetectorConstruction::DefineMaterials(    105 void F02DetectorConstruction::DefineMaterials()
 90 {                                                 106 {
 91   // This function illustrates the possible wa << 107   //This function illustrates the possible ways to define materials
 92                                                << 108  
 93   G4String name, symbol;  // a=mass of a mole; << 109   G4String name, symbol;             // a=mass of a mole;
 94   G4double a, z, density;  // z=mean number of << 110   G4double a, z, density;            // z=mean number of protons;
 95   G4int nel;                                      111   G4int nel;
 96   G4int ncomponents;                              112   G4int ncomponents;
 97   G4double fractionmass, pressure, temperature    113   G4double fractionmass, pressure, temperature;
 98                                                   114 
 99   //                                              115   //
100   // define Elements                              116   // define Elements
101   //                                              117   //
102                                                   118 
103   a = 1.01 * g / mole;                         << 119   a = 1.01*g/mole;
104   auto elH = new G4Element(name = "Hydrogen",  << 120   G4Element* elH  = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
105                                                   121 
106   a = 12.01 * g / mole;                        << 122   a = 12.01*g/mole;
107   auto elC = new G4Element(name = "Carbon", sy << 123   G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
108                                                   124 
109   a = 14.01 * g / mole;                        << 125   a = 14.01*g/mole;
110   auto elN = new G4Element(name = "Nitrogen",  << 126   G4Element* elN  = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
111                                                   127 
112   a = 16.00 * g / mole;                        << 128   a = 16.00*g/mole;
113   auto elO = new G4Element(name = "Oxygen", sy << 129   G4Element* elO  = new G4Element(name="Oxygen"  ,symbol="O" , z= 8., a);
114                                                   130 
115   a = 39.948 * g / mole;                       << 131   a = 39.948*g/mole;
116   auto elAr = new G4Element(name = "Argon", sy << 132   G4Element* elAr = new G4Element(name="Argon", symbol="Ar", z=18., a);
117                                                   133 
118   //                                              134   //
119   // define simple materials                      135   // define simple materials
120   //                                              136   //
121                                                   137 
122   // Mylar                                        138   // Mylar
123                                                   139 
124   density = 1.39 * g / cm3;                    << 140   density = 1.39*g/cm3;
125   auto mylar = new G4Material(name = "Mylar",  << 141   G4Material* mylar = new G4Material(name="Mylar", density, nel=3);
126   mylar->AddElement(elO, 2);                   << 142   mylar->AddElement(elO,2);
127   mylar->AddElement(elC, 5);                   << 143   mylar->AddElement(elC,5);
128   mylar->AddElement(elH, 4);                   << 144   mylar->AddElement(elH,4);
129                                                   145 
130   // Polypropelene                                146   // Polypropelene
131                                                   147 
132   auto CH2 = new G4Material("Polypropelene", 0 << 148   G4Material* CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2);
133   CH2->AddElement(elH, 2);                     << 149   CH2->AddElement(elH,2);
134   CH2->AddElement(elC, 1);                     << 150   CH2->AddElement(elC,1);
135                                                   151 
136   // Krypton as detector gas, STP                 152   // Krypton as detector gas, STP
137                                                   153 
138   density = 3.700 * mg / cm3;                  << 154   density = 3.700*mg/cm3;
139   a = 83.80 * g / mole;                        << 155   a = 83.80*g/mole;
140   auto Kr = new G4Material(name = "Kr", z = 36 << 156   G4Material* Kr  = new G4Material(name="Kr",z=36., a, density );
141                                                   157 
142   // Dry air (average composition)                158   // Dry air (average composition)
143                                                   159 
144   density = 1.7836 * mg / cm3;  // STP         << 160   density = 1.7836*mg/cm3;        // STP
145   auto argon = new G4Material(name = "Argon",  << 161   G4Material* argon = new G4Material(name="Argon"  , density, ncomponents=1);
146   argon->AddElement(elAr, 1);                     162   argon->AddElement(elAr, 1);
147                                                   163 
148   density = 1.25053 * mg / cm3;  // STP        << 164   density = 1.25053*mg/cm3;       // STP
149   auto nitrogen = new G4Material(name = "N2",  << 165   G4Material* nitrogen = new G4Material(name="N2"  , density, ncomponents=1);
150   nitrogen->AddElement(elN, 2);                   166   nitrogen->AddElement(elN, 2);
151                                                   167 
152   density = 1.4289 * mg / cm3;  // STP         << 168   density = 1.4289*mg/cm3;        // STP
153   auto oxygen = new G4Material(name = "O2", de << 169   G4Material* oxygen = new G4Material(name="O2"  , density, ncomponents=1);
154   oxygen->AddElement(elO, 2);                     170   oxygen->AddElement(elO, 2);
155                                                   171 
156   density = 1.2928 * mg / cm3;  // STP         << 172   density  = 1.2928*mg/cm3;       // STP
157                                                   173 
158   temperature = STP_Temperature;                  174   temperature = STP_Temperature;
159   pressure = 1.0e-0 * STP_Pressure;            << 175   pressure = 1.0e-0*STP_Pressure;
160                                                   176 
161   auto air =                                   << 177   G4Material* air = new G4Material(name="Air"  , density, ncomponents=3,
162     new G4Material(name = "Air", density, ncom << 178                                    kStateGas,temperature,pressure);
163   air->AddMaterial(nitrogen, fractionmass = 0. << 179   air->AddMaterial( nitrogen, fractionmass = 0.7557 );
164   air->AddMaterial(oxygen, fractionmass = 0.23 << 180   air->AddMaterial( oxygen,   fractionmass = 0.2315 );
165   air->AddMaterial(argon, fractionmass = 0.012 << 181   air->AddMaterial( argon,    fractionmass = 0.0128 );
166                                                   182 
167   // Xenon as detector gas, STP                   183   // Xenon as detector gas, STP
168                                                   184 
169   density = 5.858 * mg / cm3;                  << 185   density = 5.858*mg/cm3;
170   a = 131.29 * g / mole;                       << 186   a = 131.29*g/mole;
171   auto Xe = new G4Material(name = "Xenon", z = << 187   G4Material* Xe  = new G4Material(name="Xenon",z=54., a, density );
172                                                   188 
173   // Carbon dioxide, STP                          189   // Carbon dioxide, STP
174                                                   190 
175   density = 1.842 * mg / cm3;                  << 191   density = 1.842*mg/cm3;
176   auto CarbonDioxide = new G4Material(name = " << 192   G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2);
177   CarbonDioxide->AddElement(elC, 1);           << 193   CarbonDioxide->AddElement(elC,1);
178   CarbonDioxide->AddElement(elO, 2);           << 194   CarbonDioxide->AddElement(elO,2);
179                                                   195 
180   // 80% Xe + 20% CO2, STP                        196   // 80% Xe + 20% CO2, STP
181                                                   197 
182   density = 5.0818 * mg / cm3;                 << 198   density = 5.0818*mg/cm3;
183   auto Xe20CO2 = new G4Material(name = "Xe20CO << 199   G4Material* Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2);
184   Xe20CO2->AddMaterial(Xe, fractionmass = 0.92 << 200   Xe20CO2->AddMaterial( Xe,              fractionmass = 0.922 );
185   Xe20CO2->AddMaterial(CarbonDioxide, fraction << 201   Xe20CO2->AddMaterial( CarbonDioxide,   fractionmass = 0.078 );
186                                                   202 
187   // 80% Kr + 20% CO2, STP                        203   // 80% Kr + 20% CO2, STP
188                                                   204 
189   density = 3.601 * mg / cm3;                  << 205   density = 3.601*mg/cm3;
190   auto Kr20CO2 = new G4Material(name = "Kr20CO << 206   G4Material* Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2);
191   Kr20CO2->AddMaterial(Kr, fractionmass = 0.89 << 207   Kr20CO2->AddMaterial( Kr,              fractionmass = 0.89 );
192   Kr20CO2->AddMaterial(CarbonDioxide, fraction << 208   Kr20CO2->AddMaterial( CarbonDioxide,   fractionmass = 0.11 );
193                                                   209 
194   G4cout << *(G4Material::GetMaterialTable())     210   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
195                                                   211 
196   // default materials of the calorimeter         212   // default materials of the calorimeter
197                                                   213 
198   fAbsorberMaterial = Kr20CO2;  // XeCO2CF4;   << 214   fAbsorberMaterial = Kr20CO2;   // XeCO2CF4;
199                                                   215 
200   fWorldMaterial = air;                        << 216   fWorldMaterial    = air;
201 }                                                 217 }
202                                                   218 
203 //....oooOO0OOooo........oooOO0OOooo........oo    219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
204                                                << 220   
205 G4VPhysicalVolume* F02DetectorConstruction::Co    221 G4VPhysicalVolume* F02DetectorConstruction::ConstructCalorimeter()
206 {                                                 222 {
207   // Cleanup old geometry                         223   // Cleanup old geometry
208                                                   224 
209   if (fPhysiWorld) {                           << 225   if (fPhysiWorld)
                                                   >> 226   {
210     G4GeometryManager::GetInstance()->OpenGeom    227     G4GeometryManager::GetInstance()->OpenGeometry();
211     G4PhysicalVolumeStore::GetInstance()->Clea    228     G4PhysicalVolumeStore::GetInstance()->Clean();
212     G4LogicalVolumeStore::GetInstance()->Clean    229     G4LogicalVolumeStore::GetInstance()->Clean();
213     G4SolidStore::GetInstance()->Clean();         230     G4SolidStore::GetInstance()->Clean();
214   }                                               231   }
215                                                   232 
216   // complete the Calor parameters definition     233   // complete the Calor parameters definition and Print
217                                                   234 
218   ComputeCalorParameters();                       235   ComputeCalorParameters();
219   PrintCalorParameters();                         236   PrintCalorParameters();
220                                                << 237  
221   // World                                        238   // World
222                                                   239 
223   fSolidWorld = new G4Tubs("World",  // its na << 240   fSolidWorld = new G4Tubs("World",                        // its name
224                            0., fWorldSizeR, fW << 241                    0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size
225                                                   242 
226   fLogicWorld = new G4LogicalVolume(fSolidWorl << 243   fLogicWorld = new G4LogicalVolume(fSolidWorld,           // its solid
227                                     fWorldMate << 244                                    fWorldMaterial,         // its material
228                                     "World");  << 245                                    "World");               // its name
229                                                << 246 
230   fPhysiWorld = new G4PVPlacement(nullptr,  // << 247   fPhysiWorld = new G4PVPlacement(0,                       // no rotation
231                                   G4ThreeVecto << 248                                   G4ThreeVector(),         // at (0,0,0)
232                                   "World",  // << 249                                   "World",                 // its name
233                                   fLogicWorld, << 250                                   fLogicWorld,             // its logical volume
234                                   nullptr,  // << 251                                   0,                       // its mother  volume
235                                   false,  // n << 252                                   false,                   // no boolean op.
236                                   0);  // copy << 253                                   0);                      // copy number
237   // Absorber                                     254   // Absorber
238                                                   255 
239   fSolidAbsorber = new G4Tubs("Absorber", 0.,  << 256   fSolidAbsorber = new G4Tubs("Absorber",0.,
240                                                << 257                               fAbsorberRadius,
241   fLogicAbsorber = new G4LogicalVolume(fSolidA << 258                               fAbsorberThickness/2.,
242                                                << 259                               0.0,twopi);
243   fPhysiAbsorber = new G4PVPlacement(nullptr,  << 260 
244                                      fLogicAbs << 261   fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,
                                                   >> 262                                        fAbsorberMaterial,
                                                   >> 263                                        "Absorber");
                                                   >> 264 
                                                   >> 265   fPhysiAbsorber = new G4PVPlacement(0,
                                                   >> 266                                      G4ThreeVector(0.,0.,fZAbsorber),
                                                   >> 267                                      "Absorber",
                                                   >> 268                                      fLogicAbsorber,
                                                   >> 269                                      fPhysiWorld,
                                                   >> 270                                      false,
                                                   >> 271                                      0);
245                                                   272 
246   return fPhysiWorld;                             273   return fPhysiWorld;
247 }                                                 274 }
248                                                   275 
249 //....oooOO0OOooo........oooOO0OOooo........oo    276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
250                                                   277 
251 void F02DetectorConstruction::PrintCalorParame    278 void F02DetectorConstruction::PrintCalorParameters()
252 {                                                 279 {
253   G4cout << "\n The  WORLD   is made of " << f << 280   G4cout << "\n The  WORLD   is made of "
254          << fWorldMaterial->GetName();         << 281          << fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName();
255   G4cout << ", the transverse size (R) of the  << 282   G4cout << ", the transverse size (R) of the world is "
256   G4cout << " The ABSORBER is made of " << fAb << 283          << fWorldSizeR/mm << " mm. " << G4endl;
257          << fAbsorberMaterial->GetName();      << 284   G4cout << " The ABSORBER is made of "
258   G4cout << ", the transverse size (R) is " << << 285          << fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName();
259   G4cout << " Z position of the (middle of the << 286   G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm
                                                   >> 287          << " mm. " << G4endl;
                                                   >> 288   G4cout << " Z position of the (middle of the) absorber "
                                                   >> 289          << fZAbsorber/mm << "  mm." << G4endl;
260   G4cout << G4endl;                               290   G4cout << G4endl;
261 }                                                 291 }
262                                                   292 
263 //....oooOO0OOooo........oooOO0OOooo........oo    293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
264                                                   294 
265 void F02DetectorConstruction::SetAbsorberMater    295 void F02DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
266 {                                                 296 {
267   // get the pointer to the material table        297   // get the pointer to the material table
268   const G4MaterialTable* theMaterialTable = G4    298   const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
269                                                   299 
270   // search the material by its name              300   // search the material by its name
271   G4Material* material;                           301   G4Material* material;
272   for (size_t j = 0; j < theMaterialTable->siz << 302   for (size_t j=0 ; j<theMaterialTable->size() ; j++)
273     material = (*theMaterialTable)[j];         << 303    { material = (*theMaterialTable)[j];
274     if (material->GetName() == materialChoice) << 304      if (material->GetName() == materialChoice)
275       fAbsorberMaterial = material;            << 305         {
276       fLogicAbsorber->SetMaterial(material);   << 306           fAbsorberMaterial = material;
277       G4RunManager::GetRunManager()->PhysicsHa << 307           fLogicAbsorber->SetMaterial(material);
278     }                                          << 308           G4RunManager::GetRunManager()->PhysicsHasBeenModified();
279   }                                            << 309         }
                                                   >> 310    }
280 }                                                 311 }
281                                                   312 
282 //....oooOO0OOooo........oooOO0OOooo........oo    313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
283                                                   314 
284 void F02DetectorConstruction::SetWorldMaterial    315 void F02DetectorConstruction::SetWorldMaterial(G4String materialChoice)
285 {                                                 316 {
286   // get the pointer to the material table        317   // get the pointer to the material table
287   const G4MaterialTable* theMaterialTable = G4    318   const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
288                                                   319 
289   // search the material by its name              320   // search the material by its name
290   G4Material* material;                           321   G4Material* material;
291   for (size_t j = 0; j < theMaterialTable->siz << 322   for (size_t j=0 ; j<theMaterialTable->size() ; j++)
292     material = (*theMaterialTable)[j];         << 323    { material = (*theMaterialTable)[j];
293     if (material->GetName() == materialChoice) << 324      if(material->GetName() == materialChoice)
294       fWorldMaterial = material;               << 325         {
295       fLogicWorld->SetMaterial(material);      << 326           fWorldMaterial = material;
296       G4RunManager::GetRunManager()->PhysicsHa << 327           fLogicWorld->SetMaterial(material);
297     }                                          << 328           G4RunManager::GetRunManager()->PhysicsHasBeenModified();
298   }                                            << 329         }
                                                   >> 330    }
299 }                                                 331 }
300                                                   332 
301 //....oooOO0OOooo........oooOO0OOooo........oo    333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
302                                                   334 
303 void F02DetectorConstruction::SetAbsorberThick    335 void F02DetectorConstruction::SetAbsorberThickness(G4double val)
304 {                                                 336 {
305   // change Absorber thickness and recompute t    337   // change Absorber thickness and recompute the calorimeter parameters
306   fAbsorberThickness = val;                       338   fAbsorberThickness = val;
307   ComputeCalorParameters();                       339   ComputeCalorParameters();
308   G4RunManager::GetRunManager()->GeometryHasBe << 340   G4RunManager::GetRunManager()->ReinitializeGeometry();
309 }                                                 341 }
310                                                   342 
311 //....oooOO0OOooo........oooOO0OOooo........oo    343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
312                                                   344 
313 void F02DetectorConstruction::SetAbsorberRadiu    345 void F02DetectorConstruction::SetAbsorberRadius(G4double val)
314 {                                                 346 {
315   // change the transverse size and recompute     347   // change the transverse size and recompute the calorimeter parameters
316   fAbsorberRadius = val;                          348   fAbsorberRadius = val;
317   ComputeCalorParameters();                       349   ComputeCalorParameters();
318   G4RunManager::GetRunManager()->GeometryHasBe << 350   G4RunManager::GetRunManager()->ReinitializeGeometry();
319 }                                                 351 }
320                                                   352 
321 //....oooOO0OOooo........oooOO0OOooo........oo    353 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
322                                                   354 
323 void F02DetectorConstruction::SetWorldSizeZ(G4    355 void F02DetectorConstruction::SetWorldSizeZ(G4double val)
324 {                                                 356 {
325   fWorldChanged = true;                           357   fWorldChanged = true;
326   fWorldSizeZ = val;                              358   fWorldSizeZ = val;
327   ComputeCalorParameters();                       359   ComputeCalorParameters();
328   G4RunManager::GetRunManager()->GeometryHasBe << 360   G4RunManager::GetRunManager()->ReinitializeGeometry();
329 }                                                 361 }
330                                                   362 
331 //....oooOO0OOooo........oooOO0OOooo........oo    363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
332                                                   364 
333 void F02DetectorConstruction::SetWorldSizeR(G4    365 void F02DetectorConstruction::SetWorldSizeR(G4double val)
334 {                                                 366 {
335   fWorldChanged = true;                           367   fWorldChanged = true;
336   fWorldSizeR = val;                              368   fWorldSizeR = val;
337   ComputeCalorParameters();                       369   ComputeCalorParameters();
338   G4RunManager::GetRunManager()->GeometryHasBe << 370   G4RunManager::GetRunManager()->ReinitializeGeometry();
339 }                                                 371 }
340                                                   372 
341 //....oooOO0OOooo........oooOO0OOooo........oo    373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
342                                                   374 
343 void F02DetectorConstruction::SetAbsorberZpos(    375 void F02DetectorConstruction::SetAbsorberZpos(G4double val)
344 {                                                 376 {
345   fZAbsorber = val;                               377   fZAbsorber = val;
346   ComputeCalorParameters();                       378   ComputeCalorParameters();
347   G4RunManager::GetRunManager()->GeometryHasBe << 379   G4RunManager::GetRunManager()->ReinitializeGeometry();
348 }                                              << 
349                                                << 
350 //....oooOO0OOooo........oooOO0OOooo........oo << 
351                                                << 
352 void F02DetectorConstruction::SetFieldValue(G4 << 
353 {                                              << 
354   fFieldVector = value;                        << 
355                                                << 
356   G4UniformElectricField* elField = nullptr;   << 
357   if (fFieldVector != G4ThreeVector(0.,0.,0.)) << 
358     elField = new G4UniformElectricField(fFiel << 
359   }                                            << 
360                                                << 
361   // Set field to the field builder            << 
362   auto fieldBuilder = G4FieldBuilder::Instance << 
363   fieldBuilder->SetGlobalField(elField);       << 
364 }                                                 380 }
365                                                   381 
366 //....oooOO0OOooo........oooOO0OOooo........oo    382 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
367                                                   383 
368 void F02DetectorConstruction::ConstructSDandFi    384 void F02DetectorConstruction::ConstructSDandField()
369 {                                                 385 {
370   // Sensitive Detectors: Absorber                386   // Sensitive Detectors: Absorber
371                                                   387 
372   if (!fCalorimeterSD.Get()) {                    388   if (!fCalorimeterSD.Get()) {
373     auto calorimeterSD = new F02CalorimeterSD( << 389     F02CalorimeterSD* calorimeterSD = new F02CalorimeterSD("CalorSD",this);
374     fCalorimeterSD.Put(calorimeterSD);            390     fCalorimeterSD.Put(calorimeterSD);
375   }                                            << 391   }  
376   G4SDManager::GetSDMpointer()->AddNewDetector    392   G4SDManager::GetSDMpointer()->AddNewDetector(fCalorimeterSD.Get());
377   SetSensitiveDetector(fLogicAbsorber, fCalori    393   SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get());
378                                                   394 
379   // Create detector field                     << 395   // Construct the field creator - this will register the field it creates
380   SetFieldValue(fFieldVector);                 << 
381                                                   396 
382   // Construct all Geant4 field objects        << 397   if (!fEmFieldSetup.Get()) { 
383   auto fieldBuilder = G4FieldBuilder::Instance << 398     F02ElectricFieldSetup* fieldSetup = new F02ElectricFieldSetup();
384   fieldBuilder->SetFieldType(kElectroMagnetic) << 399     G4AutoDelete::Register(fieldSetup); //Kernel will delete the messenger
385   fieldBuilder->ConstructFieldSetup();         << 400     fEmFieldSetup.Put(fieldSetup);
                                                   >> 401   }  
386 }                                                 402 }
387                                                   403 
388 //....oooOO0OOooo........oooOO0OOooo........oo    404 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
389                                                   405