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 9.0.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.8 2007/01/11 15:41:46 vnivanch Exp $
 27 /// \brief Implementation of the DetectorConst <<  27 // GEANT4 tag $Name: geant4-08-03-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"          <<  46 #include "G4NistManager.hh"
 51 #include "G4UniformMagField.hh"                <<  47 
 52 #include "G4UnitsTable.hh"                         48 #include "G4UnitsTable.hh"
 53                                                    49 
 54 //....oooOO0OOooo........oooOO0OOooo........oo     50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 55                                                    51 
 56 DetectorConstruction::DetectorConstruction()       52 DetectorConstruction::DetectorConstruction()
 57   : G4VUserDetectorConstruction(), fMagField(n << 
 58 {                                                  53 {
 59   // default parameter values                      54   // default parameter values
 60   fAbsorSizeX = fAbsorSizeYZ = 20 * cm;        <<  55   absorSizeX = absorSizeYZ = 20*cm;
 61   fWorldSizeX = fWorldSizeYZ = 1.2 * fAbsorSiz <<  56   worldSizeX = worldSizeYZ = 1.2*absorSizeX;
 62                                                <<  57   
 63   fTallyNumber = 0;                            <<  58   worldMaterial = absorMaterial = 0;
 64   for (G4int j = 0; j < kMaxTally; j++) {      <<  59   magField = 0;
 65     fTallySize[j] = fTallyPosition[j] = G4Thre <<  60   lAbsor   = 0;
 66     fTallyMass[j] = 0.;                        <<  61   
 67     fLTally[j] = nullptr;                      <<  62   tallySize     = G4ThreeVector();
 68   }                                            <<  63   tallyMaterial = 0;
 69                                                <<  64   tallyMass     = 0.; 
                                                   >>  65   tallyNumber   = 0;
                                                   >>  66   tallyPosition = new G4ThreeVector[MaxTally];
                                                   >>  67   lTally        = 0;
                                                   >>  68   
 70   DefineMaterials();                               69   DefineMaterials();
                                                   >>  70   SetMaterial("Water");
                                                   >>  71   SetTallyMaterial("Water");
 71                                                    72 
 72   // create commands for interactive definitio <<  73   // create commands for interactive definition of the detector  
 73   fDetectorMessenger = new DetectorMessenger(t <<  74   detectorMessenger = new DetectorMessenger(this);
 74 }                                                  75 }
 75                                                    76 
 76 //....oooOO0OOooo........oooOO0OOooo........oo     77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 77                                                    78 
 78 DetectorConstruction::~DetectorConstruction()      79 DetectorConstruction::~DetectorConstruction()
                                                   >>  80 { delete [] tallyPosition; delete detectorMessenger;}
                                                   >>  81 
                                                   >>  82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  83 
                                                   >>  84 G4VPhysicalVolume* DetectorConstruction::Construct()
 79 {                                                  85 {
 80   delete fDetectorMessenger;                   <<  86   return ConstructVolumes();
 81 }                                                  87 }
 82                                                    88 
 83 //....oooOO0OOooo........oooOO0OOooo........oo     89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 84                                                    90 
 85 void DetectorConstruction::DefineMaterials()       91 void DetectorConstruction::DefineMaterials()
 86 {                                              <<  92 { 
 87   //                                               93   //
 88   // define Elements                               94   // define Elements
 89   //                                               95   //
 90   G4double z, a;                                   96   G4double z, a;
 91                                                    97 
 92   G4Element* H = new G4Element("Hydrogen", "H" <<  98   G4Element* H = new G4Element("Hydrogen", "H", z= 1, a= 1.008*g/mole);
 93   G4Element* N = new G4Element("Nitrogen", "N" <<  99   G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.01*g/mole);
 94   G4Element* O = new G4Element("Oxygen", "O",  << 100   G4Element* O = new G4Element("Oxygen"  , "O", z= 8, a= 16.00*g/mole);
 95                                                   101 
 96   //                                              102   //
 97   // define Materials.                            103   // define Materials.
 98   //                                              104   //
 99   G4double density, temperature, pressure;        105   G4double density, temperature, pressure;
100   G4int ncomponents, natoms;                   << 106   G4int    ncomponents, natoms;
101   G4double fractionmass;                          107   G4double fractionmass;
102                                                << 108  
103   G4Material* H2O = new G4Material("Water", de << 109   G4Material* H2O = 
104   H2O->AddElement(H, natoms = 2);              << 110     new G4Material("Water", density= 1.0*g/cm3, ncomponents=2);
105   H2O->AddElement(O, natoms = 1);              << 111   H2O->AddElement(H, natoms=2);
106   H2O->GetIonisation()->SetMeanExcitationEnerg << 112   H2O->AddElement(O, natoms=1);
107                                                << 113   H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
108   // In this line both G4_WATER and Water_1.05 << 114 
109   G4NistManager::Instance()->BuildMaterialWith << 115   G4Material* Air = 
110                                                << 116     new G4Material("Air"  , density= 1.290*mg/cm3, ncomponents=2);
111   G4Material* Air = new G4Material("Air", dens << 117   Air->AddElement(N, fractionmass=0.7);
112   Air->AddElement(N, fractionmass = 0.7);      << 118   Air->AddElement(O, fractionmass=0.3);
113   Air->AddElement(O, fractionmass = 0.3);      << 119 
114                                                << 120   density     = universe_mean_density;    //from PhysicalConstants.h
115   density = 1.e-5 * g / cm3;                   << 121   pressure    = 3.e-18*pascal;
116   pressure = 2.e-2 * bar;                      << 122   temperature = 2.73*kelvin;
117   temperature = STP_Temperature;  // From Phys << 123   G4Material* vacuum = 
118   G4Material* vac = new G4Material("TechVacuum << 124     new G4Material("Galactic",z= 1,a= 1.008*g/mole,density,
119   vac->AddMaterial(Air, 1.);                   << 125        kStateGas,temperature,pressure);
120                                                << 126 
121   density = universe_mean_density;  // from Ph << 127   //default materials
122   pressure = 3.e-18 * pascal;                  << 128   worldMaterial = vacuum;
123   temperature = 2.73 * kelvin;                 << 
124   G4Material* vacuum = new G4Material("Galacti << 
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())     213   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
205   G4cout << "\n-------------------------------    214   G4cout << "\n---------------------------------------------------------\n";
206   G4cout << "---> The Absorber is " << G4BestU << 215   G4cout << "---> The Absorber is " << G4BestUnit(absorSizeX,"Length")
207          << fAbsorMaterial->GetName() << G4end << 216          << " of " << absorMaterial->GetName() << G4endl;
208   G4cout << "\n-------------------------------    217   G4cout << "\n---------------------------------------------------------\n";
209                                                << 218   
210   if (fTallyNumber > 0) {                      << 219   if (tallyNumber > 0) {
211     G4cout << "---> There are " << fTallyNumbe << 220     G4cout << "---> There are " << tallyNumber << " tallies : "
212     for (G4int j = 0; j < fTallyNumber; ++j) { << 221            << G4BestUnit(tallySize,"Length")
213       G4cout << "fTally " << j << ": " << fAbs << 222      << " of " << tallyMaterial->GetName()
214              << ",  mass = " << G4BestUnit(fTa << 223      << "  (mass : " << G4BestUnit(tallyMass,"Mass") << ")" << G4endl;
215              << " size = " << G4BestUnit(fTall << 224      
216              << " position = " << G4BestUnit(f << 225     for (G4int j=0; j<tallyNumber; j++)
217     }                                          << 226      G4cout << "tally " << j << ": "
                                                   >> 227             << "position = " << G4BestUnit(tallyPosition[j],"Length") << G4endl;
218     G4cout << "\n-----------------------------    228     G4cout << "\n---------------------------------------------------------\n";
219   }                                            << 229   }     
220 }                                                 230 }
221                                                   231 
222 //....oooOO0OOooo........oooOO0OOooo........oo    232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
223                                                   233 
224 void DetectorConstruction::SetSizeX(G4double v    234 void DetectorConstruction::SetSizeX(G4double value)
225 {                                                 235 {
226   fAbsorSizeX = value;                         << 236   absorSizeX = value; worldSizeX = 1.2*absorSizeX;
227   fWorldSizeX = 1.2 * fAbsorSizeX;             << 
228 }                                                 237 }
229                                                << 238   
230 //....oooOO0OOooo........oooOO0OOooo........oo    239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
231                                                   240 
232 void DetectorConstruction::SetSizeYZ(G4double     241 void DetectorConstruction::SetSizeYZ(G4double value)
233 {                                                 242 {
234   fAbsorSizeYZ = value;                        << 243   absorSizeYZ = value; 
235   fWorldSizeYZ = 1.2 * fAbsorSizeYZ;           << 244   worldSizeYZ = 1.2*absorSizeYZ;
236 }                                              << 245 }  
237                                                   246 
238 //....oooOO0OOooo........oooOO0OOooo........oo    247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
239                                                   248 
240 void DetectorConstruction::SetMaterial(const G << 249 void DetectorConstruction::SetMaterial(G4String materialChoice)
241 {                                                 250 {
242   // search the material by its name           << 251   // search the material by its name   
243   G4Material* pttoMaterial = G4NistManager::In << 252   G4Material* pttoMaterial =
244   if (pttoMaterial && pttoMaterial != fAbsorMa << 253     G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
245     // change target material everywhere       << 254   if (pttoMaterial) absorMaterial = pttoMaterial;
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 }                                                 255 }
260                                                   256 
261 //....oooOO0OOooo........oooOO0OOooo........oo    257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
262                                                   258 
263 void DetectorConstruction::SetWorldMaterial(co << 259 #include "G4FieldManager.hh"
264 {                                              << 260 #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                                                   261 
278 void DetectorConstruction::SetMagField(G4doubl    262 void DetectorConstruction::SetMagField(G4double fieldValue)
279 {                                                 263 {
280   // apply a global uniform magnetic field alo << 264   //apply a global uniform magnetic field along Z axis
281   G4FieldManager* fieldMgr = G4TransportationM << 265   G4FieldManager* fieldMgr 
282                                                << 266    = G4TransportationManager::GetTransportationManager()->GetFieldManager();
283   if (fMagField) delete fMagField;  // delete  << 267     
284                                                << 268   if (magField) delete magField;  //delete the existing magn field
285   if (fieldValue != 0.)  // create a new one i << 269   
286   {                                            << 270   if (fieldValue!=0.)     // create a new one if non nul
287     fMagField = new G4UniformMagField(G4ThreeV << 271     {
288     fieldMgr->SetDetectorField(fMagField);     << 272       magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));        
289     fieldMgr->CreateChordFinder(fMagField);    << 273       fieldMgr->SetDetectorField(magField);
290   }                                            << 274       fieldMgr->CreateChordFinder(magField);
291   else {                                       << 275     }
292     fMagField = nullptr;                       << 276    else
293     fieldMgr->SetDetectorField(fMagField);     << 277     {
294   }                                            << 278       magField = 0;
                                                   >> 279       fieldMgr->SetDetectorField(magField);
                                                   >> 280     }
295 }                                                 281 }
296 //....oooOO0OOooo........oooOO0OOooo........oo    282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
297                                                   283 
298 void DetectorConstruction::SetTallyNumber(G4in << 284 void DetectorConstruction::SetTallySize(G4ThreeVector value)
299 {                                                 285 {
300   if (value >= 0 && value < kMaxTally) {       << 286   tallySize = value;
301     fTallyNumber = value;                      << 287 }  
302   }                                            << 
303   else {                                       << 
304     G4cout << "### DetectorConstruction::SetTa << 
305            << "number " << value << " is ignor << 
306   }                                            << 
307 }                                              << 
308                                                   288 
309 //....oooOO0OOooo........oooOO0OOooo........oo    289 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
310                                                   290 
311 void DetectorConstruction::SetTallySize(G4int  << 291 void DetectorConstruction::SetTallyMaterial(G4String materialChoice)
312 {                                                 292 {
313   if (j >= 0 && j < kMaxTally) {               << 293   // search the material by its name   
314     fTallySize[j] = value;                     << 294   G4Material* pttoMaterial =
315   }                                            << 295     G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
316   else {                                       << 296   if (pttoMaterial) tallyMaterial = pttoMaterial;
317     G4cout << "### DetectorConstruction::SetTa << 
318            << "number " << j << " is ignored"  << 
319   }                                            << 
320 }                                                 297 }
321                                                   298 
322 //....oooOO0OOooo........oooOO0OOooo........oo    299 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
323                                                   300 
324 void DetectorConstruction::SetTallyPosition(G4 << 301 void DetectorConstruction::SetTallyPosition(G4ThreeVector value)
325 {                                                 302 {
326   if (j >= 0 && j < kMaxTally) {               << 303   if (tallyNumber < MaxTally) {
327     fTallyPosition[j] = value;                 << 304     tallyPosition[tallyNumber] = value; 
                                                   >> 305     tallyNumber++;
328   }                                               306   }
329   else {                                       << 307 }  
330     G4cout << "### DetectorConstruction::SetTa << 
331            << "number " << j << " is ignored"  << 
332   }                                            << 
333 }                                              << 
334                                                   308 
335 G4double DetectorConstruction::GetTallyMass(G4 << 309 //....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                                                   310 
347 const G4LogicalVolume* DetectorConstruction::G << 311 #include "G4RunManager.hh" 
                                                   >> 312  
                                                   >> 313 void DetectorConstruction::UpdateGeometry()
348 {                                                 314 {
349   if (j >= 0 && j < kMaxTally) {               << 315 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 }                                                 316 }
358                                                   317 
359 //....oooOO0OOooo........oooOO0OOooo........oo    318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360                                                   319