Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/electromagnetic/TestEm11/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/TestEm11/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/electromagnetic/TestEm11/src/DetectorConstruction.cc (Version 10.1.p3)


  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/TestEm11/src/Detecto     26 /// \file electromagnetic/TestEm11/src/DetectorConstruction.cc
 27 /// \brief Implementation of the DetectorConst     27 /// \brief Implementation of the DetectorConstruction class
 28 //                                                 28 //
                                                   >>  29 // $Id: DetectorConstruction.cc 77288 2013-11-22 10:52:58Z gcosmo $
 29 //                                                 30 //
 30 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    33 
 33 #include "DetectorConstruction.hh"                 34 #include "DetectorConstruction.hh"
 34                                                << 
 35 #include "DetectorMessenger.hh"                    35 #include "DetectorMessenger.hh"
 36                                                    36 
 37 #include "G4AutoDelete.hh"                     <<  37 #include "G4NistManager.hh"
                                                   >>  38 #include "G4Material.hh"
 38 #include "G4Box.hh"                                39 #include "G4Box.hh"
 39 #include "G4GeometryManager.hh"                << 
 40 #include "G4GlobalMagFieldMessenger.hh"        << 
 41 #include "G4LogicalVolume.hh"                      40 #include "G4LogicalVolume.hh"
 42 #include "G4LogicalVolumeStore.hh"             << 
 43 #include "G4Material.hh"                       << 
 44 #include "G4NistManager.hh"                    << 
 45 #include "G4PVPlacement.hh"                        41 #include "G4PVPlacement.hh"
 46 #include "G4PVReplica.hh"                          42 #include "G4PVReplica.hh"
 47 #include "G4PhysicalConstants.hh"              <<  43 #include "G4UniformMagField.hh"
                                                   >>  44 
                                                   >>  45 #include "G4GeometryManager.hh"
 48 #include "G4PhysicalVolumeStore.hh"                46 #include "G4PhysicalVolumeStore.hh"
 49 #include "G4RunManager.hh"                     <<  47 #include "G4LogicalVolumeStore.hh"
 50 #include "G4SolidStore.hh"                         48 #include "G4SolidStore.hh"
 51 #include "G4SystemOfUnits.hh"                  <<  49 
 52 #include "G4UImanager.hh"                          50 #include "G4UImanager.hh"
 53 #include "G4UniformMagField.hh"                << 
 54 #include "G4UnitsTable.hh"                         51 #include "G4UnitsTable.hh"
 55                                                <<  52 #include "G4PhysicalConstants.hh"
                                                   >>  53 #include "G4SystemOfUnits.hh"
                                                   >>  54 #include "G4GlobalMagFieldMessenger.hh"
                                                   >>  55 #include "G4AutoDelete.hh"
                                                   >>  56 #include "G4RunManager.hh"
 56 #include <iomanip>                                 57 #include <iomanip>
 57                                                    58 
 58 //....oooOO0OOooo........oooOO0OOooo........oo     59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 59                                                    60 
 60 DetectorConstruction::DetectorConstruction()       61 DetectorConstruction::DetectorConstruction()
                                                   >>  62 :G4VUserDetectorConstruction(),fDefaultMaterial(0),fPhysiWorld(0),
                                                   >>  63  fDetectorMessenger(0)
 61 {                                                  64 {
 62   // default parameter values of the absorbers     65   // default parameter values of the absorbers
 63   fNbOfAbsor = 1;                                  66   fNbOfAbsor = 1;
 64   fAbsorThickness[0] = 0. * mm;  // dummy, for <<  67   fAbsorThickness[0] = 0*mm;        //dummy, for initialization   
 65   fAbsorThickness[1] = 1. * mm;                <<  68   fAbsorThickness[1] = 1*mm;  
 66   fAbsorSizeYZ = 1. * mm;                      <<  69   fAbsorSizeYZ       = 1.*mm;
 67   for (G4int iAbs = 0; iAbs < kMaxAbsor; iAbs+ <<  70   for (G4int iAbs=0; iAbs<MaxAbsor; iAbs++) {
 68     fNbOfDivisions[iAbs] = 1;                  <<  71     fNbOfDivisions[iAbs]  = 1;
 69   }                                            <<  72   }  
 70   ComputeParameters();                             73   ComputeParameters();
 71                                                    74 
 72   // materials                                     75   // materials
 73   DefineMaterials();                               76   DefineMaterials();
 74   SetAbsorMaterial(1, "G4_Si");                <<  77   SetAbsorMaterial(1,"G4_Si");
 75                                                    78 
 76   // create commands for interactive definitio     79   // create commands for interactive definition of the calorimeter
 77   fDetectorMessenger = new DetectorMessenger(t     80   fDetectorMessenger = new DetectorMessenger(this);
 78 }                                                  81 }
 79                                                    82 
 80 //....oooOO0OOooo........oooOO0OOooo........oo     83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 81                                                    84 
 82 DetectorConstruction::~DetectorConstruction()      85 DetectorConstruction::~DetectorConstruction()
 83 {                                                  86 {
 84   delete fDetectorMessenger;                       87   delete fDetectorMessenger;
 85 }                                                  88 }
 86                                                    89 
 87 //....oooOO0OOooo........oooOO0OOooo........oo     90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 88                                                    91 
 89 G4VPhysicalVolume* DetectorConstruction::Const     92 G4VPhysicalVolume* DetectorConstruction::Construct()
 90 {                                                  93 {
 91   return ConstructVolumes();                       94   return ConstructVolumes();
 92 }                                                  95 }
 93                                                    96 
 94 //....oooOO0OOooo........oooOO0OOooo........oo     97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 95                                                    98 
 96 void DetectorConstruction::DefineMaterials()       99 void DetectorConstruction::DefineMaterials()
 97 {                                                 100 {
 98   G4NistManager* man = G4NistManager::Instance    101   G4NistManager* man = G4NistManager::Instance();
 99                                                << 102   
100   man->FindOrBuildMaterial("G4_Al");              103   man->FindOrBuildMaterial("G4_Al");
101   man->FindOrBuildMaterial("G4_Si");              104   man->FindOrBuildMaterial("G4_Si");
102   man->FindOrBuildMaterial("G4_Fe");              105   man->FindOrBuildMaterial("G4_Fe");
103   man->FindOrBuildMaterial("G4_Cu");           << 106   man->FindOrBuildMaterial("G4_Cu");  
104   man->FindOrBuildMaterial("G4_Ge");              107   man->FindOrBuildMaterial("G4_Ge");
105   man->FindOrBuildMaterial("G4_Mo");              108   man->FindOrBuildMaterial("G4_Mo");
106   man->FindOrBuildMaterial("G4_Ta");              109   man->FindOrBuildMaterial("G4_Ta");
107   man->FindOrBuildMaterial("G4_W");               110   man->FindOrBuildMaterial("G4_W");
108   man->FindOrBuildMaterial("G4_Au");              111   man->FindOrBuildMaterial("G4_Au");
109   man->FindOrBuildMaterial("G4_Pb");           << 112   man->FindOrBuildMaterial("G4_Pb");  
110   man->FindOrBuildMaterial("G4_PbWO4");           113   man->FindOrBuildMaterial("G4_PbWO4");
111   man->FindOrBuildMaterial("G4_SODIUM_IODIDE")    114   man->FindOrBuildMaterial("G4_SODIUM_IODIDE");
112                                                << 115   
113   man->FindOrBuildMaterial("G4_AIR");             116   man->FindOrBuildMaterial("G4_AIR");
114   man->FindOrBuildMaterial("G4_WATER");           117   man->FindOrBuildMaterial("G4_WATER");
115                                                << 118   
116   G4Element* H = man->FindOrBuildElement("H"); << 119   G4Element* H = man->FindOrBuildElement("H"); 
117   G4Element* O = man->FindOrBuildElement("O");    120   G4Element* O = man->FindOrBuildElement("O");
118                                                << 121   
119   G4Material* H2O = new G4Material("Water", 1. << 122   G4Material* H2O = 
                                                   >> 123   new G4Material("Water", 1.000*g/cm3, 2);
120   H2O->AddElement(H, 2);                          124   H2O->AddElement(H, 2);
121   H2O->AddElement(O, 1);                          125   H2O->AddElement(O, 1);
122   H2O->GetIonisation()->SetMeanExcitationEnerg << 126   H2O->GetIonisation()->SetMeanExcitationEnergy(78.0*eV);
123                                                << 
124   G4double density = universe_mean_density;  / << 
125   G4double pressure = 3.e-18 * pascal;         << 
126   G4double temperature = 2.73 * kelvin;        << 
127   G4Material* Galactic =                       << 
128     new G4Material("Galactic", 1., 1.008 * g / << 
129                                                   127 
                                                   >> 128   G4double density     = universe_mean_density;    //from PhysicalConstants.h
                                                   >> 129   G4double pressure    = 3.e-18*pascal;
                                                   >> 130   G4double temperature = 2.73*kelvin;
                                                   >> 131   G4Material* Galactic =   
                                                   >> 132   new G4Material("Galactic", 1., 1.008*g/mole, density,
                                                   >> 133                              kStateGas,temperature,pressure);
                                                   >> 134                              
130   fDefaultMaterial = Galactic;                    135   fDefaultMaterial = Galactic;
131                                                << 136   
132   //  G4cout << *(G4Material::GetMaterialTable    137   //  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
133 }                                                 138 }
134                                                   139 
135 //....oooOO0OOooo........oooOO0OOooo........oo    140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136                                                   141 
137 void DetectorConstruction::ComputeParameters()    142 void DetectorConstruction::ComputeParameters()
138 {                                                 143 {
139   // Compute total thickness of absorbers         144   // Compute total thickness of absorbers
140   fAbsorSizeX = 0.;                               145   fAbsorSizeX = 0.;
141   for (G4int iAbs = 1; iAbs <= fNbOfAbsor; iAb << 146   for (G4int iAbs=1; iAbs<=fNbOfAbsor; iAbs++) {
142     fAbsorSizeX += fAbsorThickness[iAbs];         147     fAbsorSizeX += fAbsorThickness[iAbs];
143   }                                               148   }
144 }                                                 149 }
145                                                   150 
146 //....oooOO0OOooo........oooOO0OOooo........oo    151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147                                                   152 
148 G4VPhysicalVolume* DetectorConstruction::Const    153 G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
149 {                                                 154 {
150   // complete the Calor parameters definition     155   // complete the Calor parameters definition
151   ComputeParameters();                            156   ComputeParameters();
152                                                   157 
153   // Cleanup old geometry                         158   // Cleanup old geometry
154   G4GeometryManager::GetInstance()->OpenGeomet    159   G4GeometryManager::GetInstance()->OpenGeometry();
155   G4PhysicalVolumeStore::GetInstance()->Clean(    160   G4PhysicalVolumeStore::GetInstance()->Clean();
156   G4LogicalVolumeStore::GetInstance()->Clean()    161   G4LogicalVolumeStore::GetInstance()->Clean();
157   G4SolidStore::GetInstance()->Clean();           162   G4SolidStore::GetInstance()->Clean();
158                                                   163 
159   //                                              164   //
160   // World                                        165   // World
161   //                                              166   //
162   G4Box* solidWorld = new G4Box("World",  // n << 167   G4Box* solidWorld =
163                                 fAbsorSizeX /  << 168     new G4Box("World",                                             //name
164                                                << 169                fAbsorSizeX/2,fAbsorSizeYZ/2,fAbsorSizeYZ/2);       //size
165   G4LogicalVolume* logicWorld = new G4LogicalV << 170 
166                                                << 171   G4LogicalVolume* logicWorld =
167                                                << 172     new G4LogicalVolume(solidWorld,              //solid
168                                                << 173                         fDefaultMaterial,        //material
169   fPhysiWorld = new G4PVPlacement(0,  // no ro << 174                         "World");                //name
170                                   G4ThreeVecto << 175 
171                                   logicWorld,  << 176   fPhysiWorld = 
172                                   "World",  // << 177     new G4PVPlacement(0,                        //no rotation
173                                   0,  // mothe << 178                         G4ThreeVector(),        //at (0,0,0)
174                                   false,  // n << 179                       logicWorld,               //logical volume
175                                   0);  // copy << 180                       "World",                  //name
176                                                << 181                        0,                       //mother volume
                                                   >> 182                        false,                   //no boolean operation
                                                   >> 183                        0);                      //copy number
                                                   >> 184                                  
177   //                                              185   //
178   // Absorbers                                    186   // Absorbers
179   //                                              187   //
180   fXfront[0] = -0.5 * fAbsorSizeX;             << 188   fXfront[0] = -0.5*fAbsorSizeX;
181   //                                              189   //
182   for (G4int k = 1; k <= fNbOfAbsor; k++) {    << 190   for (G4int k=1; k<=fNbOfAbsor; k++) {
183     G4Material* material = fAbsorMaterial[k];     191     G4Material* material = fAbsorMaterial[k];
184     G4String matname = material->GetName();       192     G4String matname = material->GetName();
185                                                << 193       
186     G4Box* solidAbsor =                           194     G4Box* solidAbsor =
187       new G4Box(matname, fAbsorThickness[k] /  << 195       new G4Box(matname,fAbsorThickness[k]/2,fAbsorSizeYZ/2,fAbsorSizeYZ/2);
188                                                << 
189     G4LogicalVolume* logicAbsor = new G4Logica << 
190                                                << 
191                                                << 
192                                                << 
193     fXfront[k] = fXfront[k - 1] + fAbsorThickn << 
194     G4double xcenter = fXfront[k] + 0.5 * fAbs << 
195     G4ThreeVector position = G4ThreeVector(xce << 
196                                                << 
197     new G4PVPlacement(0,  // no rotation       << 
198                       position,  // position   << 
199                       logicAbsor,  // logical  << 
200                       matname,  // name        << 
201                       logicWorld,  // mother   << 
202                       false,  // no boulean op << 
203                       k);  // copy number      << 
204                                                   196 
                                                   >> 197     G4LogicalVolume* logicAbsor =
                                                   >> 198       new G4LogicalVolume(solidAbsor,           // solid
                                                   >> 199                           material,             // material
                                                   >> 200                           matname);             // name
                                                   >> 201                                      
                                                   >> 202     fXfront[k] = fXfront[k-1] + fAbsorThickness[k-1];    
                                                   >> 203     G4double xcenter = fXfront[k]+0.5*fAbsorThickness[k];
                                                   >> 204     G4ThreeVector position = G4ThreeVector(xcenter,0.,0.);
                                                   >> 205   
                                                   >> 206       new G4PVPlacement(0,                     //no rotation
                                                   >> 207                               position,        //position
                                                   >> 208                         logicAbsor,            //logical volume        
                                                   >> 209                         matname,               //name
                                                   >> 210                         logicWorld,            //mother
                                                   >> 211                         false,                 //no boulean operat
                                                   >> 212                         k);                    //copy number
                                                   >> 213     
205     // divisions, if any                          214     // divisions, if any
206     //                                            215     //
207     G4double LayerThickness = fAbsorThickness[ << 216     G4double LayerThickness = fAbsorThickness[k]/fNbOfDivisions[k];
208     G4Box* solidLayer = new G4Box(matname, Lay << 217     G4Box* solidLayer =   
209                                                << 218       new G4Box(matname,LayerThickness/2,fAbsorSizeYZ/2,fAbsorSizeYZ/2);
210     G4LogicalVolume* logicLayer = new G4Logica << 219                        
211                                                << 220     G4LogicalVolume* logicLayer =
212                                                << 221       new G4LogicalVolume(solidLayer,      //solid
213                                                << 222                           material,        //material
214     new G4PVReplica(matname,  // name          << 223                           matname);        //name
215                     logicLayer,  // logical vo << 224                                        
216                     logicAbsor,  // mother     << 225       new G4PVReplica(matname,             //name
217                     kXAxis,  // axis of replic << 226                             logicLayer,    //logical volume
218                     fNbOfDivisions[k],  // num << 227                             logicAbsor,    //mother
219                     LayerThickness);  // witdt << 228                       kXAxis,              //axis of replication
                                                   >> 229                       fNbOfDivisions[k],   //number of replica
                                                   >> 230                       LayerThickness);     //witdth of replica    
220   }                                               231   }
221                                                   232 
                                                   >> 233 
222   PrintParameters();                              234   PrintParameters();
223                                                   235 
224   // always return the physical World          << 236   //always return the physical World
225   //                                              237   //
226   return fPhysiWorld;                             238   return fPhysiWorld;
227 }                                                 239 }
228                                                   240 
229 //....oooOO0OOooo........oooOO0OOooo........oo    241 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
230                                                   242 
231 void DetectorConstruction::PrintParameters()      243 void DetectorConstruction::PrintParameters()
232 {                                                 244 {
233   G4cout << "\n-------------------------------    245   G4cout << "\n-------------------------------------------------------------"
234          << "\n ---> The Absorber is " << fNbO    246          << "\n ---> The Absorber is " << fNbOfAbsor << " layers of:";
235   for (G4int i = 1; i <= fNbOfAbsor; i++) {    << 247   for (G4int i=1; i<=fNbOfAbsor; i++)
236     G4cout << "\n \t" << std::setw(16) << fAbs << 248      {
237            << G4BestUnit(fAbsorThickness[i], " << 249       G4cout << "\n \t" << std::setw(12) << fAbsorMaterial[i]->GetName() <<": "
238            << " slices";                       << 250               << std::setw(6) << G4BestUnit(fAbsorThickness[i],"Length")
239   }                                            << 251               << "  divided in " << fNbOfDivisions[i] << " slices";
240   G4cout << "\n------------------------------- << 252      }
                                                   >> 253   G4cout << "\n-------------------------------------------------------------\n"
                                                   >> 254          << G4endl;
241 }                                                 255 }
242                                                   256 
243 //....oooOO0OOooo........oooOO0OOooo........oo    257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
244                                                   258 
245 void DetectorConstruction::SetNbOfAbsor(G4int     259 void DetectorConstruction::SetNbOfAbsor(G4int ival)
246 {                                                 260 {
247   // set the number of Absorbers                  261   // set the number of Absorbers
248   //                                              262   //
249   if (ival < 1 || ival > (kMaxAbsor - 1)) {    << 263   if (ival < 1 || ival > (MaxAbsor-1))
250     G4cout << "\n ---> warning from SetfNbOfAb << 264     { G4cout << "\n ---> warning from SetfNbOfAbsor: "
251            << kMaxAbsor - 1 << ". Command refu << 265              << ival << " must be at least 1 and and most " << MaxAbsor-1
252     return;                                    << 266              << ". Command refused" << G4endl;
253   }                                            << 267       return;
                                                   >> 268     }
254   fNbOfAbsor = ival;                              269   fNbOfAbsor = ival;
255   G4RunManager::GetRunManager()->ReinitializeG    270   G4RunManager::GetRunManager()->ReinitializeGeometry();
256 }                                                 271 }
257                                                   272 
258 //....oooOO0OOooo........oooOO0OOooo........oo    273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
259                                                   274 
260 void DetectorConstruction::SetAbsorMaterial(G4 << 275 void DetectorConstruction::SetAbsorMaterial(G4int iabs,const G4String& material)
261 {                                                 276 {
262   // search the material by its name              277   // search the material by its name
263   //                                              278   //
264   if (iabs > fNbOfAbsor || iabs <= 0) {        << 279   if (iabs > fNbOfAbsor || iabs <= 0)
265     G4cout << "\n --->warning from SetfAbsorMa << 280     { G4cout << "\n --->warning from SetfAbsorMaterial: absor number "
266            << " out of range. Command refused" << 281              << iabs << " out of range. Command refused" << G4endl;
267     return;                                    << 282       return;
268   }                                            << 283     }
269                                                   284 
270   G4Material* pttoMaterial = G4NistManager::In << 285   G4Material* pttoMaterial = 
                                                   >> 286     G4NistManager::Instance()->FindOrBuildMaterial(material);
271   if (pttoMaterial) {                             287   if (pttoMaterial) {
272     fAbsorMaterial[iabs] = pttoMaterial;       << 288       fAbsorMaterial[iabs] = pttoMaterial;
273     G4RunManager::GetRunManager()->PhysicsHasB << 289       G4RunManager::GetRunManager()->PhysicsHasBeenModified();
274     G4cout << "\n " << pttoMaterial << G4endl; << 
275   }                                               290   }
276 }                                                 291 }
277                                                   292 
278 //....oooOO0OOooo........oooOO0OOooo........oo    293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
279                                                   294 
280 void DetectorConstruction::SetAbsorThickness(G << 295 void DetectorConstruction::SetAbsorThickness(G4int iabs,G4double val)
281 {                                                 296 {
282   // change Absorber thickness                    297   // change Absorber thickness
283   //                                              298   //
284   if (iabs > fNbOfAbsor || iabs <= 0) {        << 299   if (iabs > fNbOfAbsor || iabs <= 0)
285     G4cout << "\n --->warning from SetfAbsorTh << 300     { G4cout << "\n --->warning from SetfAbsorThickness: absor number "
286            << " out of range. Command refused" << 301              << iabs << " out of range. Command refused" << G4endl;
287     return;                                    << 302       return;
288   }                                            << 303     }
289   if (val <= DBL_MIN) {                        << 304   if (val <= DBL_MIN)
290     G4cout << "\n --->warning from SetfAbsorTh << 305     { G4cout << "\n --->warning from SetfAbsorThickness: thickness "
291            << " out of range. Command refused" << 306              << val  << " out of range. Command refused" << G4endl;
292     return;                                    << 307       return;
293   }                                            << 308     }
294   fAbsorThickness[iabs] = val;                    309   fAbsorThickness[iabs] = val;
295   G4RunManager::GetRunManager()->ReinitializeG    310   G4RunManager::GetRunManager()->ReinitializeGeometry();
296 }                                                 311 }
297                                                   312 
298 //....oooOO0OOooo........oooOO0OOooo........oo    313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
299                                                   314 
300 void DetectorConstruction::SetAbsorSizeYZ(G4do    315 void DetectorConstruction::SetAbsorSizeYZ(G4double val)
301 {                                                 316 {
302   // change the transverse size                   317   // change the transverse size
303   //                                              318   //
304   if (val <= DBL_MIN) {                        << 319   if (val <= DBL_MIN)
305     G4cout << "\n --->warning from SetfAbsorSi << 320     { G4cout << "\n --->warning from SetfAbsorSizeYZ: thickness "
306            << " out of range. Command refused" << 321              << val  << " out of range. Command refused" << G4endl;
307     return;                                    << 322       return;
308   }                                            << 323     }
309   fAbsorSizeYZ = val;                             324   fAbsorSizeYZ = val;
310   G4RunManager::GetRunManager()->ReinitializeG    325   G4RunManager::GetRunManager()->ReinitializeGeometry();
311 }                                                 326 }
312                                                   327 
313 //....oooOO0OOooo........oooOO0OOooo........oo    328 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
314                                                   329 
315 void DetectorConstruction::SetNbOfDivisions(G4    330 void DetectorConstruction::SetNbOfDivisions(G4int iabs, G4int ival)
316 {                                                 331 {
317   // set the number of divisions                  332   // set the number of divisions
318   //                                              333   //
319   if (iabs > fNbOfAbsor || iabs < 1) {         << 334   if (iabs > fNbOfAbsor || iabs < 1)
320     G4cout << "\n --->warning from SetNbOfDivi << 335     { G4cout << "\n --->warning from SetNbOfDivisions: absor number "
321            << " out of range. Command refused" << 336              << iabs << " out of range. Command refused" << G4endl;
322     return;                                    << 337       return;
323   }                                            << 338     }
324                                                << 339       
325   if (ival < 1) {                              << 340   if (ival < 1)
326     G4cout << "\n --->warning from SetNbOfDivi << 341     { G4cout << "\n --->warning from SetNbOfDivisions: "
327            << " must be at least 1. Command re << 342              << ival << " must be at least 1. Command refused" << G4endl;
328     return;                                    << 343       return;
329   }                                            << 344     }
330   fNbOfDivisions[iabs] = ival;                    345   fNbOfDivisions[iabs] = ival;
331   G4RunManager::GetRunManager()->ReinitializeG    346   G4RunManager::GetRunManager()->ReinitializeGeometry();
332 }                                                 347 }
333                                                   348 
                                                   >> 349 
334 //....oooOO0OOooo........oooOO0OOooo........oo    350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
335                                                   351 
336 void DetectorConstruction::ConstructSDandField    352 void DetectorConstruction::ConstructSDandField()
337 {                                                 353 {
338   if (fFieldMessenger.Get() == 0) {            << 354     if ( fFieldMessenger.Get() == 0 ) {
339     // Create global magnetic field messenger. << 355         // Create global magnetic field messenger.
340     // Uniform magnetic field is then created  << 356         // Uniform magnetic field is then created automatically if
341     // the field value is not zero.            << 357         // the field value is not zero.
342     G4ThreeVector fieldValue = G4ThreeVector() << 358         G4ThreeVector fieldValue = G4ThreeVector();
343     G4GlobalMagFieldMessenger* msg = new G4Glo << 359         G4GlobalMagFieldMessenger* msg =
344     // msg->SetVerboseLevel(1);                << 360         new G4GlobalMagFieldMessenger(fieldValue);
345     G4AutoDelete::Register(msg);               << 361         //msg->SetVerboseLevel(1);
346     fFieldMessenger.Put(msg);                  << 362         G4AutoDelete::Register(msg);
347   }                                            << 363         fFieldMessenger.Put( msg );
                                                   >> 364     }
348 }                                                 365 }
349                                                   366 
350 //....oooOO0OOooo........oooOO0OOooo........oo    367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 368 
351                                                   369