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


  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                                                   
 31 //....oooOO0OOooo........oooOO0OOooo........oo    
 32 //....oooOO0OOooo........oooOO0OOooo........oo    
 33                                                   
 34 #include "DetectorConstruction.hh"                
 35                                                   
 36 #include "DetectorMessenger.hh"                   
 37 #include "PrimaryGeneratorAction.hh"              
 38                                                   
 39 #include "G4Box.hh"                               
 40 #include "G4FieldManager.hh"                      
 41 #include "G4GeometryManager.hh"                   
 42 #include "G4LogicalVolume.hh"                     
 43 #include "G4LogicalVolumeStore.hh"                
 44 #include "G4Material.hh"                          
 45 #include "G4NistManager.hh"                       
 46 #include "G4PVPlacement.hh"                       
 47 #include "G4PhysicalConstants.hh"                 
 48 #include "G4PhysicalVolumeStore.hh"               
 49 #include "G4RunManager.hh"                        
 50 #include "G4SolidStore.hh"                        
 51 #include "G4SystemOfUnits.hh"                     
 52 #include "G4ThreeVector.hh"                       
 53 #include "G4TransportationManager.hh"             
 54 #include "G4Tubs.hh"                              
 55 #include "G4UniformMagField.hh"                   
 56 #include "globals.hh"                             
 57                                                   
 58 //....oooOO0OOooo........oooOO0OOooo........oo    
 59                                                   
 60 DetectorConstruction::DetectorConstruction()      
 61   : G4VUserDetectorConstruction(),                
 62     fTargetMaterial(nullptr),                     
 63     fLogicExperimentalHall(nullptr),              
 64     fPhysExperimentalHall(nullptr),               
 65     fLogicTargetLayer(nullptr),                   
 66     fPhysTargetLayer(nullptr),                    
 67     fFieldMgr(nullptr),                           
 68     fUniformMagField(nullptr),                    
 69     fDetectorMessenger(nullptr),                  
 70     fTargetInnerRadius(9.0 * mm),                 
 71     fTargetOuterRadius(11.0 * mm)  //***LOOKHE    
 72 {                                                 
 73   fFieldMgr = G4TransportationManager::GetTran    
 74   //***LOOKHERE*** Default material               
 75   fTargetMaterial = G4NistManager::Instance()-    
 76   fDetectorMessenger = new DetectorMessenger(t    
 77 }                                                 
 78                                                   
 79 //....oooOO0OOooo........oooOO0OOooo........oo    
 80                                                   
 81 DetectorConstruction::~DetectorConstruction()     
 82 {                                                 
 83   delete fUniformMagField;                        
 84   delete fDetectorMessenger;                      
 85 }                                                 
 86                                                   
 87 //....oooOO0OOooo........oooOO0OOooo........oo    
 88                                                   
 89 G4VPhysicalVolume* DetectorConstruction::Const    
 90 {                                                 
 91   return ConstructLayer();                        
 92 }                                                 
 93                                                   
 94 //....oooOO0OOooo........oooOO0OOooo........oo    
 95                                                   
 96 G4VPhysicalVolume* DetectorConstruction::Const    
 97 {                                                 
 98   // Clean old geometry, if any                   
 99   G4GeometryManager::GetInstance()->OpenGeomet    
100   G4PhysicalVolumeStore::GetInstance()->Clean(    
101   G4LogicalVolumeStore::GetInstance()->Clean()    
102   G4SolidStore::GetInstance()->Clean();           
103   // The geometry consists of a cylinder with     
104   // positioned at the center, (0.0, 0.0, 0.0)    
105   // its material can be set via UI commands.     
106   // The world volume (experimental hall) is a    
107   // and it is filled of "G4_Galactic" materia    
108   const G4double halfLength = 1.0 * m;  //***L    
109   const G4double expHall_x = 1.01 * halfLength    
110   const G4double expHall_y = 1.01 * halfLength    
111   const G4double expHall_z = 1.01 * halfLength    
112   G4Material* vacuum = G4NistManager::Instance    
113   G4Box* experimentalHallBox = new G4Box("expH    
114   fLogicExperimentalHall = new G4LogicalVolume    
115                                                   
116                                                   
117                                                   
118                                                   
119                                                   
120   fPhysExperimentalHall = new G4PVPlacement(0,    
121                                             G4    
122                                             "e    
123                                             fL    
124                                             0,    
125                                             fa    
126                                             0)    
127   // Cylinder along the z-axis, with inner and    
128   G4Tubs* solidTargetLayer = new G4Tubs("solid    
129                                         fTarge    
130                                         fTarge    
131                                         halfLe    
132                                         0.0,      
133                                         2.0 *     
134   fLogicTargetLayer = new G4LogicalVolume(soli    
135                                           fTar    
136                                           "log    
137                                           0,      
138                                           0,      
139                                           0);     
140   fPhysTargetLayer = new G4PVPlacement(0,  //     
141                                        G4Three    
142                                        "physTa    
143                                        fLogicT    
144                                        fPhysEx    
145                                        false,     
146                                        0);  //    
147   PrintParameters();                              
148   G4cout << G4endl << "DetectorConstruction::C    
149          << "\t World (box) size: " << G4endl     
150          << "\t y : -/+ " << expHall_y << " mm    
151          << "\t z : -/+ " << expHall_z << " mm    
152          << "\t Layer (cylinder) size : " << G    
153          << " , " << fTargetOuterRadius << " m    
154          << "\t \t length (along z) : " << 2.0    
155          << G4endl;                               
156   return fPhysExperimentalHall;                   
157 }                                                 
158                                                   
159 //....oooOO0OOooo........oooOO0OOooo........oo    
160                                                   
161 void DetectorConstruction::SetTargetMaterial(c    
162 {                                                 
163   fTargetMaterial = G4NistManager::Instance()-    
164   if (!fTargetMaterial) {                         
165     G4cout << G4endl << G4endl << "WARNING: th    
166            << G4endl << "     ===> the default    
167     //***LOOKHERE*** Default material             
168     fTargetMaterial = G4NistManager::Instance(    
169   }                                               
170   if (fLogicTargetLayer) fLogicTargetLayer->Se    
171 }                                                 
172                                                   
173 //....oooOO0OOooo........oooOO0OOooo........oo    
174                                                   
175 void DetectorConstruction::UpdateGeometry()       
176 {                                                 
177   G4RunManager::GetRunManager()->ReinitializeG    
178   PrintParameters();                              
179   // Update also the position of the gun          
180   const PrimaryGeneratorAction* pPrimaryAction    
181     G4RunManager::GetRunManager()->GetUserPrim    
182   if (pPrimaryAction) pPrimaryAction->SetGunPo    
183 }                                                 
184                                                   
185 //....oooOO0OOooo........oooOO0OOooo........oo    
186                                                   
187 void DetectorConstruction::PrintParameters()      
188 {                                                 
189   G4cout << G4endl << G4endl << " ------  Dete    
190          << " Material            = " << fTarg    
191          << " Target Inner Radius = " << fTarg    
192          << " Target Outer Radius = " << fTarg    
193          << " B [T]               = "             
194          << (fUniformMagField ? fUniformMagFie    
195                               : G4ThreeVector(    
196          << G4endl << " ----------------------    
197          << G4endl;                               
198 }                                                 
199                                                   
200 //....oooOO0OOooo........oooOO0OOooo........oo    
201                                                   
202 void DetectorConstruction::SetMagField(const G    
203 {                                                 
204   if (fUniformMagField) delete fUniformMagFiel    
205   if (std::abs(fieldValue) > 0.0) {               
206     // Apply a global uniform magnetic field a    
207     fUniformMagField = new G4UniformMagField(G    
208     fFieldMgr->SetDetectorField(fUniformMagFie    
209     fFieldMgr->CreateChordFinder(fUniformMagFi    
210   }                                               
211 }                                                 
212                                                   
213 //....oooOO0OOooo........oooOO0OOooo........oo    
214