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 7.0.p1)


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