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] [ 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/hadronic/Hadr06/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/hadronic/Hadr06/src/DetectorConstruction.cc (Version 9.2)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 /// \file DetectorConstruction.cc                 
 27 /// \brief Implementation of the DetectorConst    
 28 //                                                
 29 //                                                
 30 //....oooOO0OOooo........oooOO0OOooo........oo    
 31 //....oooOO0OOooo........oooOO0OOooo........oo    
 32                                                   
 33 #include "DetectorConstruction.hh"                
 34                                                   
 35 #include "DetectorMessenger.hh"                   
 36                                                   
 37 #include "G4Box.hh"                               
 38 #include "G4GeometryManager.hh"                   
 39 #include "G4LogicalVolume.hh"                     
 40 #include "G4LogicalVolumeStore.hh"                
 41 #include "G4Material.hh"                          
 42 #include "G4NistManager.hh"                       
 43 #include "G4PVPlacement.hh"                       
 44 #include "G4PhysicalConstants.hh"                 
 45 #include "G4PhysicalVolumeStore.hh"               
 46 #include "G4RunManager.hh"                        
 47 #include "G4SolidStore.hh"                        
 48 #include "G4Sphere.hh"                            
 49 #include "G4SystemOfUnits.hh"                     
 50 #include "G4UnitsTable.hh"                        
 51                                                   
 52 //....oooOO0OOooo........oooOO0OOooo........oo    
 53                                                   
 54 DetectorConstruction::DetectorConstruction()      
 55 {                                                 
 56   fRadius = 30 * cm;                              
 57   fWorldSize = 1.1 * fRadius;                     
 58   DefineMaterials();                              
 59   SetMaterial("Water_ts");                        
 60   fDetectorMessenger = new DetectorMessenger(t    
 61 }                                                 
 62                                                   
 63 //....oooOO0OOooo........oooOO0OOooo........oo    
 64                                                   
 65 DetectorConstruction::~DetectorConstruction()     
 66 {                                                 
 67   delete fDetectorMessenger;                      
 68 }                                                 
 69                                                   
 70 //....oooOO0OOooo........oooOO0OOooo........oo    
 71                                                   
 72 G4VPhysicalVolume* DetectorConstruction::Const    
 73 {                                                 
 74   return ConstructVolumes();                      
 75 }                                                 
 76                                                   
 77 //....oooOO0OOooo........oooOO0OOooo........oo    
 78                                                   
 79 void DetectorConstruction::DefineMaterials()      
 80 {                                                 
 81   // specific element name for thermal neutron    
 82   // (see G4ParticleHPThermalScatteringNames.c    
 83                                                   
 84   G4int ncomponents, natoms;                      
 85                                                   
 86   // pressurized water                            
 87   G4Element* H = new G4Element("TS_H_of_Water"    
 88   G4Element* O = new G4Element("Oxygen", "O",     
 89   G4Material* H2O = new G4Material("Water_ts",    
 90                                    593 * kelvi    
 91   H2O->AddElement(H, natoms = 2);                 
 92   H2O->AddElement(O, natoms = 1);                 
 93   H2O->GetIonisation()->SetMeanExcitationEnerg    
 94                                                   
 95   // heavy water                                  
 96   G4Isotope* H2 = new G4Isotope("H2", 1, 2);      
 97   G4Element* D = new G4Element("TS_D_of_Heavy_    
 98   D->AddIsotope(H2, 100 * perCent);               
 99   G4Material* D2O = new G4Material("HeavyWater    
100                                    293.15 * ke    
101   D2O->AddElement(D, natoms = 2);                 
102   D2O->AddElement(O, natoms = 1);                 
103                                                   
104   // graphite                                     
105   G4Isotope* C12 = new G4Isotope("C12", 6, 12)    
106   G4Element* C = new G4Element("TS_C_of_Graphi    
107   C->AddIsotope(C12, 100. * perCent);             
108   G4Material* graphite = new G4Material("graph    
109                                         293 *     
110   graphite->AddElement(C, natoms = 1);            
111                                                   
112   // NE213                                        
113   G4Material* ne213 = new G4Material("NE213",     
114   ne213->AddElement(H, 9.2 * perCent);            
115   ne213->AddElement(C, 90.8 * perCent);           
116                                                   
117   // example of vacuum                            
118   fWorldMat = new G4Material("Galactic", 1, 1.    
119                              2.73 * kelvin, 3.    
120                                                   
121   /// G4cout << *(G4Material::GetMaterialTable    
122 }                                                 
123                                                   
124 //....oooOO0OOooo........oooOO0OOooo........oo    
125                                                   
126 G4Material* DetectorConstruction::MaterialWith    
127                                                   
128 {                                                 
129   // define a material from an isotope            
130   //                                              
131   G4int ncomponents;                              
132   G4double abundance, massfraction;               
133                                                   
134   G4Isotope* isotope = new G4Isotope(symbol, Z    
135                                                   
136   G4Element* element = new G4Element(name, sym    
137   element->AddIsotope(isotope, abundance = 100    
138                                                   
139   G4Material* material = new G4Material(name,     
140   material->AddElement(element, massfraction =    
141                                                   
142   return material;                                
143 }                                                 
144                                                   
145 //....oooOO0OOooo........oooOO0OOooo........oo    
146                                                   
147 G4VPhysicalVolume* DetectorConstruction::Const    
148 {                                                 
149   // Cleanup old geometry                         
150   G4GeometryManager::GetInstance()->OpenGeomet    
151   G4PhysicalVolumeStore::GetInstance()->Clean(    
152   G4LogicalVolumeStore::GetInstance()->Clean()    
153   G4SolidStore::GetInstance()->Clean();           
154                                                   
155   // World                                        
156   //                                              
157   G4Box* sWorld = new G4Box("World",  // name     
158                             fWorldSize, fWorld    
159                                                   
160   G4LogicalVolume* lWorld = new G4LogicalVolum    
161                                                   
162                                                   
163                                                   
164   fPWorld = new G4PVPlacement(0,  // no rotati    
165                               G4ThreeVector(),    
166                               lWorld,  // logi    
167                               "World",  // nam    
168                               0,  // mother vo    
169                               false,  // no bo    
170                               0);  // copy num    
171                                                   
172   // Absorber                                     
173   //                                              
174   G4Sphere* sAbsor = new G4Sphere("Absorber",     
175                                   0., fRadius,    
176                                                   
177   fLAbsor = new G4LogicalVolume(sAbsor,  // sh    
178                                 fMaterial,  //    
179                                 fMaterial->Get    
180                                                   
181   new G4PVPlacement(0,  // no rotation            
182                     G4ThreeVector(),  // at (0    
183                     fLAbsor,  // logical volum    
184                     fMaterial->GetName(),  //     
185                     lWorld,  // mother  volume    
186                     false,  // no boolean oper    
187                     0);  // copy number           
188   PrintParameters();                              
189                                                   
190   // always return the root volume                
191   //                                              
192   return fPWorld;                                 
193 }                                                 
194                                                   
195 //....oooOO0OOooo........oooOO0OOooo........oo    
196                                                   
197 void DetectorConstruction::PrintParameters()      
198 {                                                 
199   G4cout << "\n The Absorber is " << G4BestUni    
200          << "\n \n"                               
201          << fMaterial << G4endl;                  
202 }                                                 
203                                                   
204 //....oooOO0OOooo........oooOO0OOooo........oo    
205                                                   
206 void DetectorConstruction::SetMaterial(G4Strin    
207 {                                                 
208   // search the material by its name              
209   G4Material* pttoMaterial = G4NistManager::In    
210                                                   
211   if (pttoMaterial) {                             
212     fMaterial = pttoMaterial;                     
213     if (fLAbsor) {                                
214       fLAbsor->SetMaterial(fMaterial);            
215     }                                             
216     G4RunManager::GetRunManager()->PhysicsHasB    
217   }                                               
218   else {                                          
219     G4cout << "\n--> warning from DetectorCons    
220            << " not found" << G4endl;             
221   }                                               
222 }                                                 
223                                                   
224 //....oooOO0OOooo........oooOO0OOooo........oo    
225                                                   
226 void DetectorConstruction::SetRadius(G4double     
227 {                                                 
228   fRadius = value;                                
229   fWorldSize = 1.1 * fRadius;                     
230   G4RunManager::GetRunManager()->ReinitializeG    
231 }                                                 
232                                                   
233 //....oooOO0OOooo........oooOO0OOooo........oo    
234