Geant4 Cross Reference

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


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