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 9.4.p2)


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