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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/runAndEvent/RE05/src/RE05DetectorConstruction.cc (Version 11.3.0) and /examples/extended/runAndEvent/RE05/src/RE05DetectorConstruction.cc (Version 4.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 RE05/src/RE05DetectorConstruction.cc    
 28 /// \brief Implementation of the RE05DetectorC    
 29 //                                                
 30                                                   
 31 #include "RE05DetectorConstruction.hh"            
 32                                                   
 33 #include "RE05CalorimeterParametrisation.hh"      
 34 #include "RE05CalorimeterSD.hh"                   
 35 #include "RE05Field.hh"                           
 36 #include "RE05MuonSD.hh"                          
 37 #include "RE05TrackerParametrisation.hh"          
 38 #include "RE05TrackerSD.hh"                       
 39                                                   
 40 #include "G4Box.hh"                               
 41 #include "G4Colour.hh"                            
 42 #include "G4Element.hh"                           
 43 #include "G4ElementTable.hh"                      
 44 #include "G4FieldManager.hh"                      
 45 #include "G4LogicalVolume.hh"                     
 46 #include "G4Material.hh"                          
 47 #include "G4MaterialTable.hh"                     
 48 #include "G4PVParameterised.hh"                   
 49 #include "G4PVPlacement.hh"                       
 50 #include "G4RotationMatrix.hh"                    
 51 #include "G4SDManager.hh"                         
 52 #include "G4SystemOfUnits.hh"                     
 53 #include "G4ThreeVector.hh"                       
 54 #include "G4Transform3D.hh"                       
 55 #include "G4TransportationManager.hh"             
 56 #include "G4Tubs.hh"                              
 57 #include "G4VisAttributes.hh"                     
 58                                                   
 59 //....oooOO0OOooo........oooOO0OOooo........oo    
 60                                                   
 61 RE05DetectorConstruction::RE05DetectorConstruc    
 62 {                                                 
 63 #include "RE05DetectorParameterDef.icc"           
 64 }                                                 
 65                                                   
 66 //....oooOO0OOooo........oooOO0OOooo........oo    
 67                                                   
 68 RE05DetectorConstruction::~RE05DetectorConstru    
 69                                                   
 70 //....oooOO0OOooo........oooOO0OOooo........oo    
 71                                                   
 72 void RE05DetectorConstruction::DefineMaterials    
 73 {                                                 
 74   //------------------------------------------    
 75   // Materials                                    
 76   //------------------------------------------    
 77                                                   
 78   G4double a, z, density;                         
 79   G4int nel;                                      
 80                                                   
 81   G4Element* H = new G4Element("Hydrogen", "H"    
 82   G4Element* C = new G4Element("Carbon", "C",     
 83   G4Element* N = new G4Element("Nitrogen", "N"    
 84   G4Element* O = new G4Element("Oxygen", "O",     
 85                                                   
 86   fAir = new G4Material("Air", density = 1.29     
 87   fAir->AddElement(N, 70. * perCent);             
 88   fAir->AddElement(O, 30. * perCent);             
 89                                                   
 90   fLead = new G4Material("Lead", z = 82., a =     
 91                                                   
 92   fAr = new G4Material("ArgonGas", z = 18., a     
 93                                                   
 94   fSilicon = new G4Material("Silicon", z = 14.    
 95                                                   
 96   fScinti = new G4Material("Scintillator", den    
 97   fScinti->AddElement(C, 9);                      
 98   fScinti->AddElement(H, 10);                     
 99 }                                                 
100                                                   
101 //....oooOO0OOooo........oooOO0OOooo........oo    
102                                                   
103 G4VPhysicalVolume* RE05DetectorConstruction::C    
104 {                                                 
105   DefineMaterials();                              
106                                                   
107   //------------------------------------------    
108   // Detector geometry                            
109   //------------------------------------------    
110                                                   
111   //------------------------------ experimenta    
112   G4Box* experimentalHall_box = new G4Box("exp    
113   G4LogicalVolume* experimentalHall_log =         
114     new G4LogicalVolume(experimentalHall_box,     
115   G4VPhysicalVolume* experimentalHall_phys =      
116     new G4PVPlacement(0, G4ThreeVector(), expe    
117   experimentalHall_log->SetVisAttributes(G4Vis    
118                                                   
119   //------------------------------ tracker        
120   G4VSolid* fTracker_tubs = new G4Tubs("trkTub    
121                                        fTrkTub    
122   G4LogicalVolume* fTracker_log = new G4Logica    
123   // G4VPhysicalVolume * fTracker_phys =          
124   new G4PVPlacement(0, G4ThreeVector(), fTrack    
125                     0);                           
126   G4VisAttributes* fTracker_logVisAtt = new G4    
127   fTracker_log->SetVisAttributes(fTracker_logV    
128                                                   
129   //------------------------------ tracker lay    
130   // As an example for Parameterised volume       
131   // dummy values for G4Tubs -- modified by pa    
132   G4VSolid* trackerLayer_tubs = new G4Tubs("tr    
133                                            fTr    
134   G4LogicalVolume* trackerLayer_log =             
135     new G4LogicalVolume(trackerLayer_tubs, fSi    
136   G4VPVParameterisation* trackerParam = new RE    
137   // dummy value : kXAxis -- modified by param    
138   // G4VPhysicalVolume *trackerLayer_phys =       
139   new G4PVParameterised("trackerLayer_phys", t    
140                         trackerParam);            
141   G4VisAttributes* trackerLayer_logVisAtt = ne    
142   trackerLayer_logVisAtt->SetForceWireframe(tr    
143   trackerLayer_log->SetVisAttributes(trackerLa    
144                                                   
145   //------------------------------ calorimeter    
146   G4VSolid* calorimeter_tubs = new G4Tubs("cal    
147                                           fCal    
148   G4LogicalVolume* calorimeter_log =              
149     new G4LogicalVolume(calorimeter_tubs, fSci    
150   // G4VPhysicalVolume * calorimeter_phys =       
151   new G4PVPlacement(0, G4ThreeVector(), calori    
152   G4VisAttributes* calorimeter_logVisATT = new    
153   calorimeter_logVisATT->SetForceWireframe(tru    
154   calorimeter_log->SetVisAttributes(calorimete    
155                                                   
156   //------------------------------- Lead layer    
157   // As an example for Parameterised volume       
158   // dummy values for G4Tubs -- modified by pa    
159   G4VSolid* caloLayer_tubs = new G4Tubs("caloL    
160                                         fCaloR    
161   G4LogicalVolume* caloLayer_log = new G4Logic    
162   G4VPVParameterisation* calorimeterParam = ne    
163   // dummy value : kXAxis -- modified by param    
164   // G4VPhysicalVolume * caloLayer_phys =         
165   new G4PVParameterised("caloLayer_phys", calo    
166                         calorimeterParam);        
167   G4VisAttributes* caloLayer_logVisAtt = new G    
168   caloLayer_log->SetVisAttributes(caloLayer_lo    
169                                                   
170   //------------------------------ muon counte    
171   // As an example of CSG volumes with rotatio    
172   G4VSolid* muoncounter_box =                     
173     new G4Box("muoncounter_box", fMuBox_width,    
174   G4LogicalVolume* muoncounter_log =              
175     new G4LogicalVolume(muoncounter_box, fScin    
176   for (int i = 0; i < fNomucounter; i++) {        
177     G4double phi, x, y, z;                        
178     phi = 360. * deg / fNomucounter * i;          
179     x = fMuBox_radius * std::sin(phi);            
180     y = fMuBox_radius * std::cos(phi);            
181     z = 0. * cm;                                  
182     G4RotationMatrix rm;                          
183     rm.rotateZ(phi);                              
184     new G4PVPlacement(G4Transform3D(rm, G4Thre    
185                       experimentalHall_log, fa    
186   }                                               
187   G4VisAttributes* muoncounter_logVisAtt = new    
188   muoncounter_logVisAtt->SetForceWireframe(tru    
189   muoncounter_log->SetVisAttributes(muoncounte    
190                                                   
191   return experimentalHall_phys;                   
192 }                                                 
193                                                   
194 //....oooOO0OOooo........oooOO0OOooo........oo    
195                                                   
196 void RE05DetectorConstruction::ConstructSDandF    
197 {                                                 
198   //------------------------------------------    
199   // Magnetic field                               
200   //------------------------------------------    
201   RE05Field* myField = new RE05Field;             
202   G4FieldManager* fieldMgr = G4TransportationM    
203   fieldMgr->SetDetectorField(myField);            
204   fieldMgr->CreateChordFinder(myField);           
205                                                   
206   //------------------------------------------    
207   // Sensitive Detectors                          
208   //------------------------------------------    
209   G4String trackerSDname = "/mydet/tracker";      
210   RE05TrackerSD* trackerSD = new RE05TrackerSD    
211   G4SDManager::GetSDMpointer()->AddNewDetector    
212   SetSensitiveDetector("trackerB_L", trackerSD    
213                                                   
214   G4String muonSDname = "/mydet/muon";            
215   RE05MuonSD* muonSD = new RE05MuonSD(muonSDna    
216   G4SDManager::GetSDMpointer()->AddNewDetector    
217   SetSensitiveDetector("mucounter_L", muonSD);    
218 }                                                 
219                                                   
220 //....oooOO0OOooo........oooOO0OOooo........oo    
221