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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/parallel/TBB/B2b/src/B2bDetectorConstruction.cc (Version 11.3.0) and /examples/extended/parallel/TBB/B2b/src/B2bDetectorConstruction.cc (Version 6.0)


  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 //                                                
 27 /// \file B2bDetectorConstruction.cc              
 28 /// \brief Implementation of the B2bDetectorCo    
 29                                                   
 30 #include "B2bDetectorConstruction.hh"             
 31                                                   
 32 #include "B2TrackerSD.hh"                         
 33 #include "B2bChamberParameterisation.hh"          
 34 #include "B2bDetectorMessenger.hh"                
 35                                                   
 36 #include "G4Box.hh"                               
 37 #include "G4Colour.hh"                            
 38 #include "G4GeometryManager.hh"                   
 39 #include "G4GeometryTolerance.hh"                 
 40 #include "G4GlobalMagFieldMessenger.hh"           
 41 #include "G4LogicalVolume.hh"                     
 42 #include "G4Material.hh"                          
 43 #include "G4NistManager.hh"                       
 44 #include "G4PVParameterised.hh"                   
 45 #include "G4PVPlacement.hh"                       
 46 #include "G4SDManager.hh"                         
 47 #include "G4SystemOfUnits.hh"                     
 48 #include "G4Tubs.hh"                              
 49 #include "G4UserLimits.hh"                        
 50 #include "G4VisAttributes.hh"                     
 51                                                   
 52 // #include "G4ios.hh"                            
 53                                                   
 54 //....oooOO0OOooo........oooOO0OOooo........oo    
 55                                                   
 56 G4ThreadLocal G4GlobalMagFieldMessenger* B2bDe    
 57                                                   
 58 B2bDetectorConstruction::B2bDetectorConstructi    
 59   : G4VUserDetectorConstruction(),                
 60     fLogicTarget(NULL),                           
 61     fLogicChamber(NULL),                          
 62     fTargetMaterial(NULL),                        
 63     fChamberMaterial(NULL),                       
 64     fStepLimit(NULL),                             
 65     fCheckOverlaps(true)                          
 66 {                                                 
 67   fMessenger = new B2bDetectorMessenger(this);    
 68 }                                                 
 69                                                   
 70 //....oooOO0OOooo........oooOO0OOooo........oo    
 71                                                   
 72 B2bDetectorConstruction::~B2bDetectorConstruct    
 73 {                                                 
 74   delete fStepLimit;                              
 75   delete fMessenger;                              
 76   delete fMagFieldMessenger;                      
 77   fMagFieldMessenger = 0;                         
 78 }                                                 
 79                                                   
 80 //....oooOO0OOooo........oooOO0OOooo........oo    
 81                                                   
 82 G4VPhysicalVolume* B2bDetectorConstruction::Co    
 83 {                                                 
 84   // Define materials                             
 85   DefineMaterials();                              
 86                                                   
 87   // Define volumes                               
 88   return DefineVolumes();                         
 89 }                                                 
 90                                                   
 91 //....oooOO0OOooo........oooOO0OOooo........oo    
 92                                                   
 93 void B2bDetectorConstruction::DefineMaterials(    
 94 {                                                 
 95   // Material definition                          
 96                                                   
 97   G4NistManager* nistManager = G4NistManager::    
 98                                                   
 99   // Air defined using NIST Manager               
100   nistManager->FindOrBuildMaterial("G4_AIR");     
101                                                   
102   // Lead defined using NIST Manager              
103   fTargetMaterial = nistManager->FindOrBuildMa    
104                                                   
105   // Xenon gas defined using NIST Manager         
106   fChamberMaterial = nistManager->FindOrBuildM    
107                                                   
108   // Print materials                              
109   G4cout << *(G4Material::GetMaterialTable())     
110 }                                                 
111                                                   
112 //....oooOO0OOooo........oooOO0OOooo........oo    
113                                                   
114 G4VPhysicalVolume* B2bDetectorConstruction::De    
115 {                                                 
116   G4Material* air = G4Material::GetMaterial("G    
117                                                   
118   // Sizes of the principal geometrical compon    
119                                                   
120   G4int NbOfChambers = 5;                         
121   G4double chamberSpacing = 80 * cm;  // from     
122                                                   
123   G4double chamberWidth = 20.0 * cm;  // width    
124   G4double targetLength = 5.0 * cm;  // full l    
125                                                   
126   G4double trackerLength = (NbOfChambers + 1)     
127                                                   
128   G4double worldLength = 1.2 * (2 * targetLeng    
129                                                   
130   G4double targetRadius = 0.5 * targetLength;     
131   targetLength = 0.5 * targetLength;  // Half     
132   G4double trackerSize = 0.5 * trackerLength;     
133                                                   
134   // Definitions of Solids, Logical Volumes, P    
135                                                   
136   // World                                        
137                                                   
138   G4GeometryManager::GetInstance()->SetWorldMa    
139                                                   
140   G4cout << "Computed tolerance = "               
141          << G4GeometryTolerance::GetInstance()    
142                                                   
143   G4Box* worldS = new G4Box("world",  // its n    
144                             worldLength / 2, w    
145   G4LogicalVolume* worldLV = new G4LogicalVolu    
146                                                   
147                                                   
148                                                   
149   //  Must place the World Physical volume unr    
150   //                                              
151   G4VPhysicalVolume* worldPV = new G4PVPlaceme    
152                                                   
153                                                   
154                                                   
155                                                   
156                                                   
157                                                   
158                                                   
159                                                   
160   // Target                                       
161                                                   
162   G4ThreeVector positionTarget = G4ThreeVector    
163                                                   
164   G4Tubs* targetS = new G4Tubs("target", 0., t    
165   fLogicTarget = new G4LogicalVolume(targetS,     
166   new G4PVPlacement(0,  // no rotation            
167                     positionTarget,  // at (x,    
168                     fLogicTarget,  // its logi    
169                     "Target",  // its name        
170                     worldLV,  // its mother vo    
171                     false,  // no boolean oper    
172                     0,  // copy number            
173                     fCheckOverlaps);  // check    
174                                                   
175   G4cout << "Target is " << 2 * targetLength /    
176          << G4endl;                               
177                                                   
178   // Tracker                                      
179                                                   
180   G4ThreeVector positionTracker = G4ThreeVecto    
181                                                   
182   G4Tubs* trackerS = new G4Tubs("tracker", 0,     
183   G4LogicalVolume* trackerLV = new G4LogicalVo    
184   new G4PVPlacement(0,  // no rotation            
185                     positionTracker,  // at (x    
186                     trackerLV,  // its logical    
187                     "Tracker",  // its name       
188                     worldLV,  // its mother  v    
189                     false,  // no boolean oper    
190                     0,  // copy number            
191                     fCheckOverlaps);  // check    
192                                                   
193   // Tracker segments                             
194                                                   
195   // An example of Parameterised volumes          
196   // Dummy values for G4Tubs -- modified by pa    
197                                                   
198   G4Tubs* chamberS = new G4Tubs("tracker", 0,     
199   fLogicChamber = new G4LogicalVolume(chamberS    
200                                                   
201   G4double firstPosition = -trackerSize + cham    
202   G4double firstLength = trackerLength / 10;      
203   G4double lastLength = trackerLength;            
204                                                   
205   G4VPVParameterisation* chamberParam =           
206     new B2bChamberParameterisation(NbOfChamber    
207                                    firstPositi    
208                                    chamberSpac    
209                                    chamberWidt    
210                                    firstLength    
211                                    lastLength)    
212                                                   
213   // dummy value : kZAxis -- modified by param    
214                                                   
215   new G4PVParameterised("Chamber",  // their n    
216                         fLogicChamber,  // the    
217                         trackerLV,  // Mother     
218                         kZAxis,  // Are placed    
219                         NbOfChambers,  // Numb    
220                         chamberParam,  // The     
221                         fCheckOverlaps);  // c    
222                                                   
223   G4cout << "There are " << NbOfChambers << "     
224          << "\nThe chambers are " << chamberWi    
225          << "\nThe distance between chamber is    
226                                                   
227   // Visualization attributes                     
228                                                   
229   G4VisAttributes* boxVisAtt = new G4VisAttrib    
230   worldLV->SetVisAttributes(boxVisAtt);           
231   fLogicTarget->SetVisAttributes(boxVisAtt);      
232   trackerLV->SetVisAttributes(boxVisAtt);         
233                                                   
234   G4VisAttributes* chamberVisAtt = new G4VisAt    
235   fLogicChamber->SetVisAttributes(chamberVisAt    
236                                                   
237   // Example of User Limits                       
238   //                                              
239   // Below is an example of how to set trackin    
240   // logical volume                               
241   //                                              
242   // Sets a max step length in the tracker reg    
243                                                   
244   G4double maxStep = 0.5 * chamberWidth;          
245   fStepLimit = new G4UserLimits(maxStep);         
246   trackerLV->SetUserLimits(fStepLimit);           
247                                                   
248   /// Set additional contraints on the track,     
249   ///                                             
250   /// G4double maxLength = 2*trackerLength, ma    
251   /// trackerLV->SetUserLimits(new G4UserLimit    
252   ///                                             
253   ///                                             
254   ///                                             
255                                                   
256   // Always return the physical world             
257                                                   
258   return worldPV;                                 
259 }                                                 
260                                                   
261 //....oooOO0OOooo........oooOO0OOooo........oo    
262                                                   
263 void B2bDetectorConstruction::ConstructSDandFi    
264 {                                                 
265   // Sensitive detectors                          
266                                                   
267   G4String trackerChamberSDname = "B2/TrackerC    
268   B2TrackerSD* aTrackerSD = new B2TrackerSD(tr    
269   G4SDManager::GetSDMpointer()->AddNewDetector    
270   SetSensitiveDetector(fLogicChamber, aTracker    
271                                                   
272   // Create global magnetic field messenger.      
273   // Uniform magnetic field is then created au    
274   // the field value is not zero.                 
275   G4ThreeVector fieldValue = G4ThreeVector();     
276   fMagFieldMessenger = new G4GlobalMagFieldMes    
277   fMagFieldMessenger->SetVerboseLevel(1);         
278 }                                                 
279                                                   
280 //....oooOO0OOooo........oooOO0OOooo........oo    
281                                                   
282 void B2bDetectorConstruction::SetTargetMateria    
283 {                                                 
284   G4NistManager* nistManager = G4NistManager::    
285                                                   
286   G4Material* pttoMaterial = nistManager->Find    
287                                                   
288   if (fTargetMaterial != pttoMaterial) {          
289     if (pttoMaterial) {                           
290       fTargetMaterial = pttoMaterial;             
291       if (fLogicTarget) fLogicTarget->SetMater    
292       G4cout << "\n----> The target is made of    
293     }                                             
294     else {                                        
295       G4cout << "\n-->  WARNING from SetTarget    
296              << G4endl;                           
297     }                                             
298   }                                               
299 }                                                 
300                                                   
301 //....oooOO0OOooo........oooOO0OOooo........oo    
302                                                   
303 void B2bDetectorConstruction::SetChamberMateri    
304 {                                                 
305   G4NistManager* nistManager = G4NistManager::    
306                                                   
307   G4Material* pttoMaterial = nistManager->Find    
308                                                   
309   if (fChamberMaterial != pttoMaterial) {         
310     if (pttoMaterial) {                           
311       fChamberMaterial = pttoMaterial;            
312       if (fLogicChamber) fLogicChamber->SetMat    
313       G4cout << "\n----> The chambers are made    
314     }                                             
315     else {                                        
316       G4cout << "\n-->  WARNING from SetChambe    
317              << G4endl;                           
318     }                                             
319   }                                               
320 }                                                 
321                                                   
322 //....oooOO0OOooo........oooOO0OOooo........oo    
323                                                   
324 void B2bDetectorConstruction::SetMaxStep(G4dou    
325 {                                                 
326   if ((fStepLimit) && (maxStep > 0.)) fStepLim    
327 }                                                 
328                                                   
329 //....oooOO0OOooo........oooOO0OOooo........oo    
330