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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/persistency/P01/src/ExP01DetectorConstruction.cc (Version 11.3.0) and /examples/extended/persistency/P01/src/ExP01DetectorConstruction.cc (Version 6.1)


  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 persistency/P01/src/ExP01DetectorCon    
 27 /// \brief Implementation of the ExP01Detector    
 28 //                                                
 29 //                                                
 30 //                                                
 31 //....oooOO0OOooo........oooOO0OOooo........oo    
 32 //....oooOO0OOooo........oooOO0OOooo........oo    
 33                                                   
 34 #include "ExP01DetectorConstruction.hh"           
 35                                                   
 36 #include "ExP01ChamberParameterisation.hh"        
 37 #include "ExP01DetectorMessenger.hh"              
 38 #include "ExP01MagneticField.hh"                  
 39 #include "ExP01TrackerSD.hh"                      
 40                                                   
 41 #include "G4Box.hh"                               
 42 #include "G4Colour.hh"                            
 43 #include "G4LogicalVolume.hh"                     
 44 #include "G4Material.hh"                          
 45 #include "G4PVParameterised.hh"                   
 46 #include "G4PVPlacement.hh"                       
 47 #include "G4SDManager.hh"                         
 48 #include "G4SystemOfUnits.hh"                     
 49 #include "G4UserLimits.hh"                        
 50 #include "G4VisAttributes.hh"                     
 51 #include "G4ios.hh"                               
 52                                                   
 53 //....oooOO0OOooo........oooOO0OOooo........oo    
 54                                                   
 55 ExP01DetectorConstruction::ExP01DetectorConstr    
 56   : G4VUserDetectorConstruction(),                
 57     fSolidWorld(0),                               
 58     fLogicWorld(0),                               
 59     fPhysiWorld(0),                               
 60     fSolidTarget(0),                              
 61     fLogicTarget(0),                              
 62     fPhysiTarget(0),                              
 63     fSolidTracker(0),                             
 64     fLogicTracker(0),                             
 65     fPhysiTracker(0),                             
 66     fSolidChamber(0),                             
 67     fLogicChamber(0),                             
 68     fPhysiChamber(0),                             
 69     fTargetMater(0),                              
 70     fChamberMater(0),                             
 71     fPMagField(0),                                
 72     fDetectorMessenger(0),                        
 73     fWorldLength(0.),                             
 74     fTargetLength(0.),                            
 75     fTrackerLength(0.),                           
 76     fNbOfChambers(0),                             
 77     fChamberWidth(0.),                            
 78     fChamberSpacing(0.)                           
 79 {                                                 
 80   fPMagField = new ExP01MagneticField();          
 81   fDetectorMessenger = new ExP01DetectorMessen    
 82 }                                                 
 83                                                   
 84 //....oooOO0OOooo........oooOO0OOooo........oo    
 85                                                   
 86 ExP01DetectorConstruction::~ExP01DetectorConst    
 87 {                                                 
 88   delete fPMagField;                              
 89   delete fDetectorMessenger;                      
 90 }                                                 
 91                                                   
 92 //....oooOO0OOooo........oooOO0OOooo........oo    
 93                                                   
 94 G4VPhysicalVolume* ExP01DetectorConstruction::    
 95 {                                                 
 96   //--------- Material definition ---------       
 97                                                   
 98   G4double a, z;                                  
 99   G4double density, temperature, pressure;        
100   G4int nel;                                      
101                                                   
102   // Air                                          
103   G4Element* N = new G4Element("Nitrogen", "N"    
104   G4Element* O = new G4Element("Oxygen", "O",     
105                                                   
106   G4Material* Air = new G4Material("Air", dens    
107   Air->AddElement(N, 70 * perCent);               
108   Air->AddElement(O, 30 * perCent);               
109                                                   
110   // Lead                                         
111   G4Material* Pb =                                
112     new G4Material("Lead", z = 82., a = 207.19    
113                                                   
114   // Xenon gas                                    
115   G4Material* Xenon =                             
116     new G4Material("XenonGas", z = 54., a = 13    
117                    kStateGas, temperature = 29    
118                                                   
119   // Print all the materials defined.             
120   //                                              
121   G4cout << G4endl << "The materials defined a    
122   G4cout << *(G4Material::GetMaterialTable())     
123                                                   
124   //--------- Sizes of the principal geometric    
125                                                   
126   fNbOfChambers = 5;                              
127   fChamberWidth = 20 * cm;                        
128   fChamberSpacing = 80 * cm;                      
129                                                   
130   fTrackerLength = (fNbOfChambers + 1) * fCham    
131   fTargetLength = 5.0 * cm;  // Full length of    
132                                                   
133   fTargetMater = Pb;                              
134   fChamberMater = Xenon;                          
135                                                   
136   fWorldLength = 1.2 * (fTargetLength + fTrack    
137                                                   
138   G4double targetSize = 0.5 * fTargetLength;      
139   G4double trackerSize = 0.5 * fTrackerLength;    
140                                                   
141   //--------- Definitions of Solids, Logical V    
142                                                   
143   //------------------------------                
144   // World                                        
145   //------------------------------                
146                                                   
147   G4double HalfWorldLength = 0.5 * fWorldLengt    
148                                                   
149   fSolidWorld = new G4Box("world", HalfWorldLe    
150   fLogicWorld = new G4LogicalVolume(fSolidWorl    
151                                                   
152   //  Must place the World Physical volume unr    
153   //                                              
154   fPhysiWorld = new G4PVPlacement(0,  // no ro    
155                                   G4ThreeVecto    
156                                   fLogicWorld,    
157                                   "World",  //    
158                                   0,  // its m    
159                                   false,  // n    
160                                   0);  // copy    
161                                                   
162   //------------------------------                
163   // Target                                       
164   //------------------------------                
165                                                   
166   G4ThreeVector positionTarget = G4ThreeVector    
167                                                   
168   fSolidTarget = new G4Box("target", targetSiz    
169   fLogicTarget = new G4LogicalVolume(fSolidTar    
170   fPhysiTarget = new G4PVPlacement(0,  // no r    
171                                    positionTar    
172                                    fLogicTarge    
173                                    "Target",      
174                                    fLogicWorld    
175                                    false,  //     
176                                    0);  // cop    
177                                                   
178   G4cout << "Target is " << fTargetLength / cm    
179                                                   
180   //------------------------------                
181   // Tracker                                      
182   //------------------------------                
183                                                   
184   G4ThreeVector positionTracker = G4ThreeVecto    
185                                                   
186   fSolidTracker = new G4Box("tracker", tracker    
187   fLogicTracker = new G4LogicalVolume(fSolidTr    
188   fPhysiTracker = new G4PVPlacement(0,  // no     
189                                     positionTr    
190                                     fLogicTrac    
191                                     "Tracker",    
192                                     fLogicWorl    
193                                     false,  //    
194                                     0);  // co    
195                                                   
196   //------------------------------                
197   // Tracker segments                             
198   //------------------------------                
199   //                                              
200   // An example of Parameterised volumes          
201   // dummy values for G4Box -- modified by par    
202                                                   
203   fSolidChamber = new G4Box("chamber", 100 * c    
204   fLogicChamber = new G4LogicalVolume(fSolidCh    
205                                                   
206   G4double firstPosition = -trackerSize + 0.5     
207   G4double firstLength = fTrackerLength / 10;     
208   G4double lastLength = fTrackerLength;           
209                                                   
210   G4VPVParameterisation* chamberParam =           
211     new ExP01ChamberParameterisation(fNbOfCham    
212                                      firstPosi    
213                                      fChamberS    
214                                      fChamberW    
215                                      firstLeng    
216                                      lastLengt    
217                                                   
218   // dummy value : kZAxis -- modified by param    
219   //                                              
220   fPhysiChamber = new G4PVParameterised("Chamb    
221                                         fLogic    
222                                         fLogic    
223                                         kZAxis    
224                                         fNbOfC    
225                                         chambe    
226                                                   
227   G4cout << "There are " << fNbOfChambers << "    
228          << "The chambers are " << fChamberWid    
229          << "\n The distance between chamber i    
230                                                   
231   //------------------------------------------    
232   // Sensitive detectors                          
233   //------------------------------------------    
234                                                   
235   G4SDManager* SDman = G4SDManager::GetSDMpoin    
236                                                   
237   G4String trackerChamberSDname = "ExP01/Track    
238   ExP01TrackerSD* aTrackerSD = new ExP01Tracke    
239   SDman->AddNewDetector(aTrackerSD);              
240   fLogicChamber->SetSensitiveDetector(aTracker    
241                                                   
242   //--------- Visualization attributes -------    
243                                                   
244   G4VisAttributes* BoxVisAtt = new G4VisAttrib    
245   fLogicWorld->SetVisAttributes(BoxVisAtt);       
246   fLogicTarget->SetVisAttributes(BoxVisAtt);      
247   fLogicTracker->SetVisAttributes(BoxVisAtt);     
248                                                   
249   G4VisAttributes* ChamberVisAtt = new G4VisAt    
250   fLogicChamber->SetVisAttributes(ChamberVisAt    
251                                                   
252   //--------- example of User Limits ---------    
253                                                   
254   // below is an example of how to set trackin    
255   // logical volume(see also in N02PhysicsList    
256   // G4StepLimiter or G4UserSpecialCuts).         
257                                                   
258   // Sets a max Step length in the tracker reg    
259   //                                              
260   G4double maxStep = 0.5 * fChamberWidth;         
261   fLogicTracker->SetUserLimits(new G4UserLimit    
262                                                   
263   // Set additional contraints on the track, w    
264   //                                              
265   // G4double maxLength = 2*fTrackerLength, ma    
266   // logicTracker->SetUserLimits(new G4UserLim    
267   //                                              
268                                                   
269   return fPhysiWorld;                             
270 }                                                 
271                                                   
272 //....oooOO0OOooo........oooOO0OOooo........oo    
273                                                   
274 void ExP01DetectorConstruction::SetTargetMater    
275 {                                                 
276   // search the material by its name              
277   G4Material* pttoMaterial = G4Material::GetMa    
278   if (pttoMaterial) {                             
279     fTargetMater = pttoMaterial;                  
280     fLogicTarget->SetMaterial(pttoMaterial);      
281     G4cout << "\n----> The target is " << fTar    
282   }                                               
283 }                                                 
284                                                   
285 //....oooOO0OOooo........oooOO0OOooo........oo    
286                                                   
287 void ExP01DetectorConstruction::SetChamberMate    
288 {                                                 
289   // search the material by its name              
290   G4Material* pttoMaterial = G4Material::GetMa    
291   if (pttoMaterial) {                             
292     fChamberMater = pttoMaterial;                 
293     fLogicChamber->SetMaterial(pttoMaterial);     
294     G4cout << "\n----> The chambers are " << f    
295            << G4endl;                             
296   }                                               
297 }                                                 
298                                                   
299 //....oooOO0OOooo........oooOO0OOooo........oo    
300                                                   
301 void ExP01DetectorConstruction::SetMagField(G4    
302 {                                                 
303   fPMagField->SetFieldValue(fieldValue);          
304 }                                                 
305                                                   
306 //....oooOO0OOooo........oooOO0OOooo........oo    
307