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3 ] [ 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/radioactivedecay/rdecay02/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/radioactivedecay/rdecay02/src/DetectorConstruction.cc (Version 4.0.p1)


  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 "G4GeometryManager.hh"                   
 38 #include "G4LogicalVolume.hh"                     
 39 #include "G4LogicalVolumeStore.hh"                
 40 #include "G4Material.hh"                          
 41 #include "G4NistManager.hh"                       
 42 #include "G4PVPlacement.hh"                       
 43 #include "G4PhysicalConstants.hh"                 
 44 #include "G4PhysicalVolumeStore.hh"               
 45 #include "G4RunManager.hh"                        
 46 #include "G4SolidStore.hh"                        
 47 #include "G4SystemOfUnits.hh"                     
 48 #include "G4Tubs.hh"                              
 49 #include "G4UnitsTable.hh"                        
 50                                                   
 51 //....oooOO0OOooo........oooOO0OOooo........oo    
 52                                                   
 53 DetectorConstruction::DetectorConstruction()      
 54 {                                                 
 55   fTargetLength = 1 * cm;                         
 56   fTargetRadius = 0.5 * cm;                       
 57   fDetectorLength = 5 * cm;                       
 58   fDetectorThickness = 2 * cm;                    
 59                                                   
 60   fWorldLength = std::max(fTargetLength, fDete    
 61   fWorldRadius = fTargetRadius + fDetectorThic    
 62                                                   
 63   DefineMaterials();                              
 64                                                   
 65   fDetectorMessenger = new DetectorMessenger(t    
 66 }                                                 
 67                                                   
 68 //....oooOO0OOooo........oooOO0OOooo........oo    
 69                                                   
 70 DetectorConstruction::~DetectorConstruction()     
 71 {                                                 
 72   delete fDetectorMessenger;                      
 73 }                                                 
 74                                                   
 75 //....oooOO0OOooo........oooOO0OOooo........oo    
 76                                                   
 77 G4VPhysicalVolume* DetectorConstruction::Const    
 78 {                                                 
 79   return ConstructVolumes();                      
 80 }                                                 
 81                                                   
 82 //....oooOO0OOooo........oooOO0OOooo........oo    
 83                                                   
 84 void DetectorConstruction::DefineMaterials()      
 85 {                                                 
 86   // build materials                              
 87   //                                              
 88   fDetectorMater = new G4Material("Germanium",    
 89                                                   
 90   G4Element* N = new G4Element("Nitrogen", "N"    
 91   G4Element* O = new G4Element("Oxygen", "O",     
 92   //                                              
 93   G4int ncomponents;                              
 94   G4double fractionmass;                          
 95   G4Material* Air20 = new G4Material("Air", 1.    
 96                                      293. * ke    
 97   Air20->AddElement(N, fractionmass = 0.7);       
 98   Air20->AddElement(O, fractionmass = 0.3);       
 99   //                                              
100   fWorldMater = Air20;                            
101                                                   
102   // or use G4 materials data base                
103   //                                              
104   G4NistManager* man = G4NistManager::Instance    
105   fTargetMater = man->FindOrBuildMaterial("G4_    
106                                                   
107   /// G4cout << *(G4Material::GetMaterialTable    
108 }                                                 
109                                                   
110 //....oooOO0OOooo........oooOO0OOooo........oo    
111                                                   
112 G4VPhysicalVolume* DetectorConstruction::Const    
113 {                                                 
114   // Cleanup old geometry                         
115   G4GeometryManager::GetInstance()->OpenGeomet    
116   G4PhysicalVolumeStore::GetInstance()->Clean(    
117   G4LogicalVolumeStore::GetInstance()->Clean()    
118   G4SolidStore::GetInstance()->Clean();           
119                                                   
120   // World                                        
121   //                                              
122   // (re) compute World dimensions if necessar    
123   fWorldLength = std::max(fTargetLength, fDete    
124   fWorldRadius = fTargetRadius + fDetectorThic    
125                                                   
126   G4Tubs* sWorld = new G4Tubs("World",  // nam    
127                               0., fWorldRadius    
128                                                   
129   G4LogicalVolume* lWorld = new G4LogicalVolum    
130                                                   
131                                                   
132                                                   
133   fPhysiWorld = new G4PVPlacement(0,  // no ro    
134                                   G4ThreeVecto    
135                                   lWorld,  //     
136                                   "World",  //    
137                                   0,  // mothe    
138                                   false,  // n    
139                                   0);  // copy    
140                                                   
141   // Target                                       
142   //                                              
143   G4Tubs* sTarget = new G4Tubs("Target",  // n    
144                                0., fTargetRadi    
145                                                   
146   fLogicTarget = new G4LogicalVolume(sTarget,     
147                                      fTargetMa    
148                                      "Target")    
149                                                   
150   new G4PVPlacement(0,  // no rotation            
151                     G4ThreeVector(),  // at (0    
152                     fLogicTarget,  // logical     
153                     "Target",  // name            
154                     lWorld,  // mother  volume    
155                     false,  // no boolean oper    
156                     0);  // copy number           
157                                                   
158   // Detector                                     
159   //                                              
160   G4Tubs* sDetector =                             
161     new G4Tubs("Detector", fTargetRadius, fWor    
162                                                   
163   fLogicDetector = new G4LogicalVolume(sDetect    
164                                        fDetect    
165                                        "Detect    
166                                                   
167   new G4PVPlacement(0,  // no rotation            
168                     G4ThreeVector(),  // at (0    
169                     fLogicDetector,  // logica    
170                     "Detector",  // name          
171                     lWorld,  // mother  volume    
172                     false,  // no boolean oper    
173                     0);  // copy number           
174                                                   
175   PrintParameters();                              
176                                                   
177   // always return the root volume                
178   //                                              
179   return fPhysiWorld;                             
180 }                                                 
181                                                   
182 //....oooOO0OOooo........oooOO0OOooo........oo    
183                                                   
184 void DetectorConstruction::PrintParameters()      
185 {                                                 
186   G4cout << "\n Target : Length = " << G4BestU    
187          << " Radius = " << G4BestUnit(fTarget    
188          << " Material = " << fTargetMater->Ge    
189   G4cout << "\n Detector : Length = " << G4Bes    
190          << " Tickness = " << G4BestUnit(fDete    
191          << " Material = " << fDetectorMater->    
192   G4cout << "\n" << fTargetMater << "\n" << fD    
193 }                                                 
194                                                   
195 //....oooOO0OOooo........oooOO0OOooo........oo    
196                                                   
197 void DetectorConstruction::SetTargetMaterial(G    
198 {                                                 
199   // search the material by its name              
200   G4Material* pttoMaterial = G4NistManager::In    
201                                                   
202   if (pttoMaterial) {                             
203     fTargetMater = pttoMaterial;                  
204     if (fLogicTarget) {                           
205       fLogicTarget->SetMaterial(fTargetMater);    
206     }                                             
207     G4RunManager::GetRunManager()->PhysicsHasB    
208   }                                               
209   else {                                          
210     G4cout << "\n--> warning from DetectorCons    
211            << " not found" << G4endl;             
212   }                                               
213 }                                                 
214                                                   
215 //....oooOO0OOooo........oooOO0OOooo........oo    
216                                                   
217 void DetectorConstruction::SetDetectorMaterial    
218 {                                                 
219   // search the material by its name              
220   G4Material* pttoMaterial = G4NistManager::In    
221                                                   
222   if (pttoMaterial) {                             
223     fDetectorMater = pttoMaterial;                
224     if (fLogicDetector) {                         
225       fLogicDetector->SetMaterial(fDetectorMat    
226     }                                             
227     G4RunManager::GetRunManager()->PhysicsHasB    
228   }                                               
229   else {                                          
230     G4cout << "\n--> warning from DetectorCons    
231            << " not found" << G4endl;             
232   }                                               
233 }                                                 
234                                                   
235 //....oooOO0OOooo........oooOO0OOooo........oo    
236                                                   
237 void DetectorConstruction::SetTargetRadius(G4d    
238 {                                                 
239   fTargetRadius = value;                          
240   G4RunManager::GetRunManager()->ReinitializeG    
241 }                                                 
242                                                   
243 //....oooOO0OOooo........oooOO0OOooo........oo    
244                                                   
245 void DetectorConstruction::SetTargetLength(G4d    
246 {                                                 
247   fTargetLength = value;                          
248   G4RunManager::GetRunManager()->ReinitializeG    
249 }                                                 
250                                                   
251 //....oooOO0OOooo........oooOO0OOooo........oo    
252                                                   
253 void DetectorConstruction::SetDetectorThicknes    
254 {                                                 
255   fDetectorThickness = value;                     
256   G4RunManager::GetRunManager()->ReinitializeG    
257 }                                                 
258                                                   
259 //....oooOO0OOooo........oooOO0OOooo........oo    
260                                                   
261 void DetectorConstruction::SetDetectorLength(G    
262 {                                                 
263   fDetectorLength = value;                        
264   G4RunManager::GetRunManager()->ReinitializeG    
265 }                                                 
266                                                   
267 //....oooOO0OOooo........oooOO0OOooo........oo    
268                                                   
269 G4double DetectorConstruction::GetTargetLength    
270 {                                                 
271   return fTargetLength;                           
272 }                                                 
273                                                   
274 //....oooOO0OOooo........oooOO0OOooo........oo    
275                                                   
276 G4double DetectorConstruction::GetTargetRadius    
277 {                                                 
278   return fTargetRadius;                           
279 }                                                 
280                                                   
281 //....oooOO0OOooo........oooOO0OOooo........oo    
282                                                   
283 G4Material* DetectorConstruction::GetTargetMat    
284 {                                                 
285   return fTargetMater;                            
286 }                                                 
287                                                   
288 //....oooOO0OOooo........oooOO0OOooo........oo    
289                                                   
290 G4LogicalVolume* DetectorConstruction::GetLogi    
291 {                                                 
292   return fLogicTarget;                            
293 }                                                 
294                                                   
295 //....oooOO0OOooo........oooOO0OOooo........oo    
296                                                   
297 G4double DetectorConstruction::GetDetectorLeng    
298 {                                                 
299   return fDetectorLength;                         
300 }                                                 
301                                                   
302 //....oooOO0OOooo........oooOO0OOooo........oo    
303                                                   
304 G4double DetectorConstruction::GetDetectorThic    
305 {                                                 
306   return fDetectorThickness;                      
307 }                                                 
308                                                   
309 //....oooOO0OOooo........oooOO0OOooo........oo    
310                                                   
311 G4Material* DetectorConstruction::GetDetectorM    
312 {                                                 
313   return fDetectorMater;                          
314 }                                                 
315                                                   
316 //....oooOO0OOooo........oooOO0OOooo........oo    
317                                                   
318 G4LogicalVolume* DetectorConstruction::GetLogi    
319 {                                                 
320   return fLogicDetector;                          
321 }                                                 
322                                                   
323 //....oooOO0OOooo........oooOO0OOooo........oo    
324