Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/electromagnetic/TestEm7/src/DetectorConstruction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/electromagnetic/TestEm7/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/electromagnetic/TestEm7/src/DetectorConstruction.cc (Version 8.1.p1)


  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 electromagnetic/TestEm7/src/Detector <<  26 // $Id: DetectorConstruction.cc,v 1.6 2006/06/29 16:58:11 gunter Exp $
 27 /// \brief Implementation of the DetectorConst <<  27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
 28 //                                             << 
 29 //                                                 28 //
 30 //....oooOO0OOooo........oooOO0OOooo........oo     29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    31 
 33 #include "DetectorConstruction.hh"                 32 #include "DetectorConstruction.hh"
 34                                                << 
 35 #include "DetectorMessenger.hh"                    33 #include "DetectorMessenger.hh"
 36                                                    34 
                                                   >>  35 #include "G4Material.hh"
 37 #include "G4Box.hh"                                36 #include "G4Box.hh"
 38 #include "G4FieldManager.hh"                   << 
 39 #include "G4GeometryManager.hh"                << 
 40 #include "G4LogicalVolume.hh"                      37 #include "G4LogicalVolume.hh"
 41 #include "G4LogicalVolumeStore.hh"             << 
 42 #include "G4Material.hh"                       << 
 43 #include "G4NistManager.hh"                    << 
 44 #include "G4PVPlacement.hh"                        38 #include "G4PVPlacement.hh"
 45 #include "G4PhysicalConstants.hh"              <<  39 #include "G4UniformMagField.hh"
                                                   >>  40 
                                                   >>  41 #include "G4GeometryManager.hh"
 46 #include "G4PhysicalVolumeStore.hh"                42 #include "G4PhysicalVolumeStore.hh"
 47 #include "G4RunManager.hh"                     <<  43 #include "G4LogicalVolumeStore.hh"
 48 #include "G4SolidStore.hh"                         44 #include "G4SolidStore.hh"
 49 #include "G4SystemOfUnits.hh"                  <<  45 
 50 #include "G4TransportationManager.hh"          << 
 51 #include "G4UniformMagField.hh"                << 
 52 #include "G4UnitsTable.hh"                         46 #include "G4UnitsTable.hh"
 53                                                    47 
 54 //....oooOO0OOooo........oooOO0OOooo........oo     48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 55                                                    49 
 56 DetectorConstruction::DetectorConstruction()       50 DetectorConstruction::DetectorConstruction()
 57   : G4VUserDetectorConstruction(), fMagField(n << 
 58 {                                                  51 {
 59   // default parameter values                      52   // default parameter values
 60   fAbsorSizeX = fAbsorSizeYZ = 20 * cm;        <<  53   absorSizeX = absorSizeYZ = 20*cm;
 61   fWorldSizeX = fWorldSizeYZ = 1.2 * fAbsorSiz <<  54   worldSizeX = worldSizeYZ = 1.2*absorSizeX;
 62                                                <<  55   
 63   fTallyNumber = 0;                            <<  56   worldMaterial = absorMaterial = 0;
 64   for (G4int j = 0; j < kMaxTally; j++) {      <<  57   magField = 0;
 65     fTallySize[j] = fTallyPosition[j] = G4Thre <<  58   lAbsor   = 0;
 66     fTallyMass[j] = 0.;                        <<  59   
 67     fLTally[j] = nullptr;                      <<  60   tallySize     = G4ThreeVector();
 68   }                                            <<  61   tallyMaterial = 0;
 69                                                <<  62   tallyMass     = 0.; 
                                                   >>  63   tallyNumber   = 0;
                                                   >>  64   tallyPosition = new G4ThreeVector[MaxTally];
                                                   >>  65   lTally        = 0;
                                                   >>  66   
 70   DefineMaterials();                               67   DefineMaterials();
                                                   >>  68   SetMaterial("Water");
                                                   >>  69   SetTallyMaterial("Water");
 71                                                    70 
 72   // create commands for interactive definitio <<  71   // create commands for interactive definition of the detector  
 73   fDetectorMessenger = new DetectorMessenger(t <<  72   detectorMessenger = new DetectorMessenger(this);
 74 }                                                  73 }
 75                                                    74 
 76 //....oooOO0OOooo........oooOO0OOooo........oo     75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 77                                                    76 
 78 DetectorConstruction::~DetectorConstruction()      77 DetectorConstruction::~DetectorConstruction()
                                                   >>  78 { delete [] tallyPosition; delete detectorMessenger;}
                                                   >>  79 
                                                   >>  80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  81 
                                                   >>  82 G4VPhysicalVolume* DetectorConstruction::Construct()
 79 {                                                  83 {
 80   delete fDetectorMessenger;                   <<  84   return ConstructVolumes();
 81 }                                                  85 }
 82                                                    86 
 83 //....oooOO0OOooo........oooOO0OOooo........oo     87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 84                                                    88 
 85 void DetectorConstruction::DefineMaterials()       89 void DetectorConstruction::DefineMaterials()
 86 {                                              <<  90 { 
 87   //                                           <<  91 //
 88   // define Elements                           <<  92 // define Elements
 89   //                                           <<  93 //
 90   G4double z, a;                               <<  94 G4double z, a;
 91                                                    95 
 92   G4Element* H = new G4Element("Hydrogen", "H" <<  96 G4Element* H = new G4Element("Hydrogen", "H", z= 1, a= 1.008*g/mole);
 93   G4Element* N = new G4Element("Nitrogen", "N" <<  97 G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.01*g/mole);
 94   G4Element* O = new G4Element("Oxygen", "O",  <<  98 G4Element* O = new G4Element("Oxygen"  , "O", z= 8, a= 16.00*g/mole);
 95                                                    99 
 96   //                                           << 100 //
 97   // define Materials.                         << 101 // define Materials.
 98   //                                           << 102 //
 99   G4double density, temperature, pressure;     << 103 G4double density, temperature, pressure;
100   G4int ncomponents, natoms;                   << 104 G4int    ncomponents, natoms;
101   G4double fractionmass;                       << 105 G4double fractionmass;
102                                                << 106  
103   G4Material* H2O = new G4Material("Water", de << 107 G4Material* H2O = 
104   H2O->AddElement(H, natoms = 2);              << 108 new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
105   H2O->AddElement(O, natoms = 1);              << 109 H2O->AddElement(H, natoms=2);
106   H2O->GetIonisation()->SetMeanExcitationEnerg << 110 H2O->AddElement(O, natoms=1);
107                                                << 111 H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
108   // In this line both G4_WATER and Water_1.05 << 112 
109   G4NistManager::Instance()->BuildMaterialWith << 113 G4Material* Air = 
110                                                << 114 new G4Material("Air"  , density= 1.290*mg/cm3, ncomponents=2);
111   G4Material* Air = new G4Material("Air", dens << 115 Air->AddElement(N, fractionmass=0.7);
112   Air->AddElement(N, fractionmass = 0.7);      << 116 Air->AddElement(O, fractionmass=0.3);
113   Air->AddElement(O, fractionmass = 0.3);      << 117 
114                                                << 118 density     = universe_mean_density;    //from PhysicalConstants.h
115   density = 1.e-5 * g / cm3;                   << 119 pressure    = 3.e-18*pascal;
116   pressure = 2.e-2 * bar;                      << 120 temperature = 2.73*kelvin;
117   temperature = STP_Temperature;  // From Phys << 121 G4Material* vacuum = 
118   G4Material* vac = new G4Material("TechVacuum << 122 new G4Material("Galactic",z= 1,a= 1.008*g/mole,density,
119   vac->AddMaterial(Air, 1.);                   << 123                           kStateGas,temperature,pressure);
120                                                << 124 
121   density = universe_mean_density;  // from Ph << 125  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
122   pressure = 3.e-18 * pascal;                  << 126 
123   temperature = 2.73 * kelvin;                 << 127  //default materials
124   G4Material* vacuum = new G4Material("Galacti << 128  worldMaterial = vacuum;
125                                       temperat << 
126                                                << 
127   // default materials                         << 
128   fAbsorMaterial = H2O;                        << 
129   fWorldMaterial = vacuum;                     << 
130 }                                                 129 }
131                                                   130 
132 //....oooOO0OOooo........oooOO0OOooo........oo    131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 132   
                                                   >> 133 G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
                                                   >> 134 {
                                                   >> 135   G4GeometryManager::GetInstance()->OpenGeometry();
                                                   >> 136   G4PhysicalVolumeStore::GetInstance()->Clean();
                                                   >> 137   G4LogicalVolumeStore::GetInstance()->Clean();
                                                   >> 138   G4SolidStore::GetInstance()->Clean();
133                                                   139 
134 G4VPhysicalVolume* DetectorConstruction::Const << 
135 {                                              << 
136   // World                                        140   // World
137   //                                              141   //
138   G4Box* sWorld = new G4Box("World",  // name  << 142   G4Box*
139                             fWorldSizeX / 2, f << 143   sWorld = new G4Box("World",         //name
140                                                << 144                    worldSizeX/2,worldSizeYZ/2,worldSizeYZ/2); //dimensions
141   fLWorld = new G4LogicalVolume(sWorld,  // sh << 145 
142                                 fWorldMaterial << 146   G4LogicalVolume*                                  
143                                 "World");  //  << 147   lWorld = new G4LogicalVolume(sWorld,      //shape
144                                                << 148                                worldMaterial,   //material
145   G4VPhysicalVolume* pWorld = new G4PVPlacemen << 149                               "World");     //name
146                                                << 150 
147                                                << 151   G4VPhysicalVolume*                                   
148                                                << 152   pWorld = new G4PVPlacement(0,       //no rotation
149                                                << 153            G4ThreeVector(),   //at (0,0,0)
150                                                << 154                            lWorld,      //logical volume
151                                                << 155          "World",     //name
152   //                                           << 156                            0,                   //mother  volume
                                                   >> 157                            false,     //no boolean operation
                                                   >> 158                            0);        //copy number
                                                   >> 159   //         
153   // Absorber                                     160   // Absorber
154   //                                           << 161   //         
155   G4Box* sAbsor = new G4Box("Absorber",  // na << 162   G4Box*
156                             fAbsorSizeX / 2, f << 163   sAbsor = new G4Box("Absorber",        //name
157                                                << 164                    absorSizeX/2,absorSizeYZ/2,absorSizeYZ/2); //dimensions
158   fLAbsor = new G4LogicalVolume(sAbsor,  // sh << 165                                   
159                                 fAbsorMaterial << 166   lAbsor = new G4LogicalVolume(sAbsor,      //shape
160                                 "Absorber");   << 167                                absorMaterial,   //material
161                                                << 168                               "Absorber");    //name
162   new G4PVPlacement(0,  // no rotation         << 169   
163                     G4ThreeVector(0., 0., 0.), << 170                               
164                     fLAbsor,  // logical volum << 171            new G4PVPlacement(0,       //no rotation
165                     "Absorber",  // name       << 172            G4ThreeVector(),   //at (0,0,0)
166                     fLWorld,  // mother  volum << 173                            lAbsor,      //logical volume
167                     false,  // no boolean oper << 174          "Absorber",      //name
168                     0);  // copy number        << 175                            lWorld,            //mother  volume
                                                   >> 176                            false,     //no boolean operation
                                                   >> 177                            0);        //copy number
169   //                                              178   //
170   // Tallies (optional)                           179   // Tallies (optional)
171   //                                              180   //
172   if (fTallyNumber > 0) {                      << 181   if (tallyNumber > 0) {      
173     for (G4int j = 0; j < fTallyNumber; ++j) { << 182     G4Box*
174       G4Box* sTally =                          << 183     sTally = new G4Box("Tally",tallySize.x()/2,tallySize.y()/2,tallySize.z()/2);
175         new G4Box("Tally", fTallySize[j].x() / << 184     lTally = new G4LogicalVolume(sTally,tallyMaterial,"Tally");
176                                                << 185     
177       fLTally[j] = new G4LogicalVolume(sTally, << 186     for (G4int j=0; j<tallyNumber; j++)
178                                                << 187        {
179       new G4PVPlacement(0,  // no rotation     << 188         new G4PVPlacement(0,        //no rotation
180                         fTallyPosition[j],  // << 189           tallyPosition[j],   //position
181                         fLTally[j],  // logica << 190                           lTally,     //logical volume
182                         "Tally",  // name      << 191         "Tally",      //name
183                         fLAbsor,  // mother  v << 192                           lAbsor,           //mother  volume
184                         false,  // no boolean  << 193                           false,      //no boolean operation
185                         j + 1);  // copy numbe << 194                           j);       //copy number
186                                                << 195        }
187       fTallyMass[j] =                          << 196        
188         fTallySize[j].x() * fTallySize[j].y()  << 197     tallyMass = tallySize.x()*tallySize.y()*tallySize.z()
189     }                                          << 198                *(tallyMaterial->GetDensity());
190   }                                            << 199   } 
191                                                   200 
192   PrintParameters();                              201   PrintParameters();
193                                                << 202     
194   //                                           << 
195   // always return the World volume            << 
196   //                                              203   //
                                                   >> 204   //always return the World volume
                                                   >> 205   //  
197   return pWorld;                                  206   return pWorld;
198 }                                                 207 }
199                                                   208 
200 //....oooOO0OOooo........oooOO0OOooo........oo    209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
201                                                   210 
202 void DetectorConstruction::PrintParameters() c << 211 void DetectorConstruction::PrintParameters()
203 {                                                 212 {
204   G4cout << *(G4Material::GetMaterialTable())  << 
205   G4cout << "\n-------------------------------    213   G4cout << "\n---------------------------------------------------------\n";
206   G4cout << "---> The Absorber is " << G4BestU << 214   G4cout << "---> The Absorber is " << G4BestUnit(absorSizeX,"Length")
207          << fAbsorMaterial->GetName() << G4end << 215          << " of " << absorMaterial->GetName() << G4endl;
208   G4cout << "\n-------------------------------    216   G4cout << "\n---------------------------------------------------------\n";
209                                                << 217   
210   if (fTallyNumber > 0) {                      << 218   if (tallyNumber > 0) {
211     G4cout << "---> There are " << fTallyNumbe << 219     G4cout << "---> There are " << tallyNumber << " tallies : "
212     for (G4int j = 0; j < fTallyNumber; ++j) { << 220            << G4BestUnit(tallySize,"Length")
213       G4cout << "fTally " << j << ": " << fAbs << 221      << " of " << tallyMaterial->GetName()
214              << ",  mass = " << G4BestUnit(fTa << 222      << "  (mass : " << G4BestUnit(tallyMass,"Mass") << ")" << G4endl;
215              << " size = " << G4BestUnit(fTall << 223      
216              << " position = " << G4BestUnit(f << 224     for (G4int j=0; j<tallyNumber; j++)
217     }                                          << 225      G4cout << "tally " << j << ": "
                                                   >> 226             << "position = " << G4BestUnit(tallyPosition[j],"Length") << G4endl;
218     G4cout << "\n-----------------------------    227     G4cout << "\n---------------------------------------------------------\n";
219   }                                            << 228   }     
220 }                                                 229 }
221                                                   230 
222 //....oooOO0OOooo........oooOO0OOooo........oo    231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
223                                                   232 
224 void DetectorConstruction::SetSizeX(G4double v    233 void DetectorConstruction::SetSizeX(G4double value)
225 {                                                 234 {
226   fAbsorSizeX = value;                         << 235   absorSizeX = value; worldSizeX = 1.2*absorSizeX;
227   fWorldSizeX = 1.2 * fAbsorSizeX;             << 
228 }                                                 236 }
229                                                << 237   
230 //....oooOO0OOooo........oooOO0OOooo........oo    238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
231                                                   239 
232 void DetectorConstruction::SetSizeYZ(G4double     240 void DetectorConstruction::SetSizeYZ(G4double value)
233 {                                                 241 {
234   fAbsorSizeYZ = value;                        << 242   absorSizeYZ = value; 
235   fWorldSizeYZ = 1.2 * fAbsorSizeYZ;           << 243   worldSizeYZ = 1.2*absorSizeYZ;
236 }                                              << 244 }  
237                                                   245 
238 //....oooOO0OOooo........oooOO0OOooo........oo    246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
239                                                   247 
240 void DetectorConstruction::SetMaterial(const G << 248 void DetectorConstruction::SetMaterial(G4String materialChoice)
241 {                                                 249 {
242   // search the material by its name           << 250   // search the material by its name   
243   G4Material* pttoMaterial = G4NistManager::In << 251   G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);     
244   if (pttoMaterial && pttoMaterial != fAbsorMa << 252   if (pttoMaterial) absorMaterial = pttoMaterial;
245     // change target material everywhere       << 
246     fAbsorMaterial = pttoMaterial;             << 
247     for (G4int j = 0; j < fTallyNumber; ++j) { << 
248       if (fLTally[j]) {                        << 
249         fLTally[j]->SetMaterial(pttoMaterial); << 
250         fTallyMass[j] =                        << 
251           fTallySize[j].x() * fTallySize[j].y( << 
252       }                                        << 
253     }                                          << 
254     if (fLAbsor) {                             << 
255       fLAbsor->SetMaterial(fAbsorMaterial);    << 
256       G4RunManager::GetRunManager()->PhysicsHa << 
257     }                                          << 
258   }                                            << 
259 }                                                 253 }
260                                                   254 
261 //....oooOO0OOooo........oooOO0OOooo........oo    255 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
262                                                   256 
263 void DetectorConstruction::SetWorldMaterial(co << 257 #include "G4FieldManager.hh"
264 {                                              << 258 #include "G4TransportationManager.hh"
265   // search the material by its name           << 
266   G4Material* pttoMaterial = G4NistManager::In << 
267   if (pttoMaterial && pttoMaterial != fWorldMa << 
268     fWorldMaterial = pttoMaterial;             << 
269     if (fLWorld) {                             << 
270       fLWorld->SetMaterial(fAbsorMaterial);    << 
271       G4RunManager::GetRunManager()->PhysicsHa << 
272     }                                          << 
273   }                                            << 
274 }                                              << 
275                                                << 
276 //....oooOO0OOooo........oooOO0OOooo........oo << 
277                                                   259 
278 void DetectorConstruction::SetMagField(G4doubl    260 void DetectorConstruction::SetMagField(G4double fieldValue)
279 {                                                 261 {
280   // apply a global uniform magnetic field alo << 262   //apply a global uniform magnetic field along Z axis
281   G4FieldManager* fieldMgr = G4TransportationM << 263   G4FieldManager* fieldMgr 
282                                                << 264    = G4TransportationManager::GetTransportationManager()->GetFieldManager();
283   if (fMagField) delete fMagField;  // delete  << 265     
284                                                << 266   if (magField) delete magField;  //delete the existing magn field
285   if (fieldValue != 0.)  // create a new one i << 267   
286   {                                            << 268   if (fieldValue!=0.)     // create a new one if non nul
287     fMagField = new G4UniformMagField(G4ThreeV << 269     {
288     fieldMgr->SetDetectorField(fMagField);     << 270       magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));        
289     fieldMgr->CreateChordFinder(fMagField);    << 271       fieldMgr->SetDetectorField(magField);
290   }                                            << 272       fieldMgr->CreateChordFinder(magField);
291   else {                                       << 273     }
292     fMagField = nullptr;                       << 274    else
293     fieldMgr->SetDetectorField(fMagField);     << 275     {
294   }                                            << 276       magField = 0;
                                                   >> 277       fieldMgr->SetDetectorField(magField);
                                                   >> 278     }
295 }                                                 279 }
296 //....oooOO0OOooo........oooOO0OOooo........oo    280 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
297                                                   281 
298 void DetectorConstruction::SetTallyNumber(G4in << 282 void DetectorConstruction::SetTallySize(G4ThreeVector value)
299 {                                                 283 {
300   if (value >= 0 && value < kMaxTally) {       << 284   tallySize = value;
301     fTallyNumber = value;                      << 285 }  
302   }                                            << 
303   else {                                       << 
304     G4cout << "### DetectorConstruction::SetTa << 
305            << "number " << value << " is ignor << 
306   }                                            << 
307 }                                              << 
308                                                   286 
309 //....oooOO0OOooo........oooOO0OOooo........oo    287 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
310                                                   288 
311 void DetectorConstruction::SetTallySize(G4int  << 289 void DetectorConstruction::SetTallyMaterial(G4String materialChoice)
312 {                                                 290 {
313   if (j >= 0 && j < kMaxTally) {               << 291   // search the material by its name   
314     fTallySize[j] = value;                     << 292   G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);     
315   }                                            << 293   if (pttoMaterial) tallyMaterial = pttoMaterial;
316   else {                                       << 
317     G4cout << "### DetectorConstruction::SetTa << 
318            << "number " << j << " is ignored"  << 
319   }                                            << 
320 }                                                 294 }
321                                                   295 
322 //....oooOO0OOooo........oooOO0OOooo........oo    296 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
323                                                   297 
324 void DetectorConstruction::SetTallyPosition(G4 << 298 void DetectorConstruction::SetTallyPosition(G4ThreeVector value)
325 {                                                 299 {
326   if (j >= 0 && j < kMaxTally) {               << 300   if (tallyNumber < MaxTally) {
327     fTallyPosition[j] = value;                 << 301     tallyPosition[tallyNumber] = value; 
                                                   >> 302     tallyNumber++;
328   }                                               303   }
329   else {                                       << 304 }  
330     G4cout << "### DetectorConstruction::SetTa << 
331            << "number " << j << " is ignored"  << 
332   }                                            << 
333 }                                              << 
334                                                   305 
335 G4double DetectorConstruction::GetTallyMass(G4 << 306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
336 {                                              << 
337   if (j >= 0 && j < kMaxTally) {               << 
338     return fTallyMass[j];                      << 
339   }                                            << 
340   else {                                       << 
341     G4cout << "### DetectorConstruction::GetTa << 
342            << "number " << j << " is ignored"  << 
343     return 0.0;                                << 
344   }                                            << 
345 }                                              << 
346                                                   307 
347 const G4LogicalVolume* DetectorConstruction::G << 308 #include "G4RunManager.hh" 
                                                   >> 309  
                                                   >> 310 void DetectorConstruction::UpdateGeometry()
348 {                                                 311 {
349   if (j >= 0 && j < kMaxTally) {               << 312 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
350     return fLTally[j];                         << 
351   }                                            << 
352   else {                                       << 
353     G4cout << "### DetectorConstruction::GetLO << 
354            << "number " << j << " is ignored"  << 
355     return nullptr;                            << 
356   }                                            << 
357 }                                                 313 }
358                                                   314 
359 //....oooOO0OOooo........oooOO0OOooo........oo    315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360                                                   316