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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/optical/OpNovice2/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/optical/OpNovice2/src/DetectorConstruction.cc (Version 2.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 /// \file optical/OpNovice2/src/DetectorConstr    
 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                                                   
 38 #include "G4Box.hh"                               
 39 #include "G4Element.hh"                           
 40 #include "G4LogicalBorderSurface.hh"              
 41 #include "G4LogicalSkinSurface.hh"                
 42 #include "G4LogicalVolume.hh"                     
 43 #include "G4Material.hh"                          
 44 #include "G4NistManager.hh"                       
 45 #include "G4OpticalSurface.hh"                    
 46 #include "G4PVPlacement.hh"                       
 47 #include "G4SystemOfUnits.hh"                     
 48 #include "G4ThreeVector.hh"                       
 49                                                   
 50 //....oooOO0OOooo........oooOO0OOooo........oo    
 51                                                   
 52 DetectorConstruction::DetectorConstruction()      
 53   : G4VUserDetectorConstruction(), fDetectorMe    
 54 {                                                 
 55   fTankMPT = new G4MaterialPropertiesTable();     
 56   fWorldMPT = new G4MaterialPropertiesTable();    
 57   fSurfaceMPT = new G4MaterialPropertiesTable(    
 58                                                   
 59   fSurface = new G4OpticalSurface("Surface");     
 60   fSurface->SetType(dielectric_dielectric);       
 61   fSurface->SetFinish(ground);                    
 62   fSurface->SetModel(unified);                    
 63   fSurface->SetMaterialPropertiesTable(fSurfac    
 64                                                   
 65   fTankMaterial = G4NistManager::Instance()->F    
 66   fWorldMaterial = G4NistManager::Instance()->    
 67                                                   
 68   fDetectorMessenger = new DetectorMessenger(t    
 69 }                                                 
 70                                                   
 71 //....oooOO0OOooo........oooOO0OOooo........oo    
 72                                                   
 73 DetectorConstruction::~DetectorConstruction()     
 74 {                                                 
 75   delete fTankMPT;                                
 76   delete fWorldMPT;                               
 77   delete fSurfaceMPT;                             
 78   delete fSurface;                                
 79   delete fDetectorMessenger;                      
 80 }                                                 
 81                                                   
 82 //....oooOO0OOooo........oooOO0OOooo........oo    
 83                                                   
 84 G4VPhysicalVolume* DetectorConstruction::Const    
 85 {                                                 
 86   fTankMaterial->SetMaterialPropertiesTable(fT    
 87   fTankMaterial->GetIonisation()->SetBirksCons    
 88                                                   
 89   fWorldMaterial->SetMaterialPropertiesTable(f    
 90                                                   
 91   // ------------- Volumes --------------         
 92   // The experimental Hall                        
 93   auto world_box = new G4Box("World", fExpHall    
 94                                                   
 95   fWorld_LV = new G4LogicalVolume(world_box, f    
 96                                                   
 97   G4VPhysicalVolume* world_PV =                   
 98     new G4PVPlacement(nullptr, G4ThreeVector()    
 99                                                   
100   // The tank                                     
101   auto tank_box = new G4Box("Tank", fTank_x, f    
102                                                   
103   fTank_LV = new G4LogicalVolume(tank_box, fTa    
104                                                   
105   fTank = new G4PVPlacement(nullptr, G4ThreeVe    
106                                                   
107   // ------------- Surface --------------         
108                                                   
109   auto surface = new G4LogicalBorderSurface("S    
110                                                   
111   auto opticalSurface =                           
112     dynamic_cast<G4OpticalSurface*>(surface->G    
113   G4cout << "******  opticalSurface->DumpInfo:    
114   if (opticalSurface) {                           
115     opticalSurface->DumpInfo();                   
116   }                                               
117   G4cout << "******  end of opticalSurface->Du    
118                                                   
119   return world_PV;                                
120 }                                                 
121                                                   
122 //....oooOO0OOooo........oooOO0OOooo........oo    
123 void DetectorConstruction::SetSurfaceSigmaAlph    
124 {                                                 
125   fSurface->SetSigmaAlpha(v);                     
126   G4RunManager::GetRunManager()->GeometryHasBe    
127                                                   
128   G4cout << "Surface sigma alpha set to: " <<     
129 }                                                 
130                                                   
131 //....oooOO0OOooo........oooOO0OOooo........oo    
132 void DetectorConstruction::SetSurfacePolish(G4    
133 {                                                 
134   fSurface->SetPolish(v);                         
135   G4RunManager::GetRunManager()->GeometryHasBe    
136                                                   
137   G4cout << "Surface polish set to: " << fSurf    
138 }                                                 
139                                                   
140 //....oooOO0OOooo........oooOO0OOooo........oo    
141 void DetectorConstruction::AddTankMPV(const G4    
142 {                                                 
143   fTankMPT->AddProperty(prop, mpv);               
144   G4cout << "The MPT for the box is now: " <<     
145   fTankMPT->DumpTable();                          
146   G4cout << "............." << G4endl;            
147 }                                                 
148                                                   
149 //....oooOO0OOooo........oooOO0OOooo........oo    
150 void DetectorConstruction::AddWorldMPV(const G    
151 {                                                 
152   fWorldMPT->AddProperty(prop, mpv);              
153   G4cout << "The MPT for the world is now: " <    
154   fWorldMPT->DumpTable();                         
155   G4cout << "............." << G4endl;            
156 }                                                 
157                                                   
158 //....oooOO0OOooo........oooOO0OOooo........oo    
159 void DetectorConstruction::AddSurfaceMPV(const    
160 {                                                 
161   fSurfaceMPT->AddProperty(prop, mpv);            
162   G4cout << "The MPT for the surface is now: "    
163   fSurfaceMPT->DumpTable();                       
164   G4cout << "............." << G4endl;            
165 }                                                 
166                                                   
167 //....oooOO0OOooo........oooOO0OOooo........oo    
168 void DetectorConstruction::AddTankMPC(const G4    
169 {                                                 
170   fTankMPT->AddConstProperty(prop, v);            
171   G4cout << "The MPT for the box is now: " <<     
172   fTankMPT->DumpTable();                          
173   G4cout << "............." << G4endl;            
174 }                                                 
175                                                   
176 //....oooOO0OOooo........oooOO0OOooo........oo    
177 void DetectorConstruction::AddWorldMPC(const G    
178 {                                                 
179   fWorldMPT->AddConstProperty(prop, v);           
180   G4cout << "The MPT for the world is now: " <    
181   fWorldMPT->DumpTable();                         
182   G4cout << "............." << G4endl;            
183 }                                                 
184 //....oooOO0OOooo........oooOO0OOooo........oo    
185 void DetectorConstruction::AddSurfaceMPC(const    
186 {                                                 
187   fSurfaceMPT->AddConstProperty(prop, v);         
188   G4cout << "The MPT for the surface is now: "    
189   fSurfaceMPT->DumpTable();                       
190   G4cout << "............." << G4endl;            
191 }                                                 
192                                                   
193 //....oooOO0OOooo........oooOO0OOooo........oo    
194 void DetectorConstruction::SetWorldMaterial(co    
195 {                                                 
196   G4Material* pmat = G4NistManager::Instance()    
197   if (pmat && fWorldMaterial != pmat) {           
198     fWorldMaterial = pmat;                        
199     if (fWorld_LV) {                              
200       fWorld_LV->SetMaterial(fWorldMaterial);     
201       fWorldMaterial->SetMaterialPropertiesTab    
202     }                                             
203     G4RunManager::GetRunManager()->PhysicsHasB    
204     G4cout << "World material set to " << fWor    
205   }                                               
206 }                                                 
207                                                   
208 //....oooOO0OOooo........oooOO0OOooo........oo    
209 void DetectorConstruction::SetTankMaterial(con    
210 {                                                 
211   G4Material* pmat = G4NistManager::Instance()    
212   if (pmat && fTankMaterial != pmat) {            
213     fTankMaterial = pmat;                         
214     if (fTank_LV) {                               
215       fTank_LV->SetMaterial(fTankMaterial);       
216       fTankMaterial->SetMaterialPropertiesTabl    
217       fTankMaterial->GetIonisation()->SetBirks    
218     }                                             
219     G4RunManager::GetRunManager()->PhysicsHasB    
220     G4cout << "Tank material set to " << fTank    
221   }                                               
222 }                                                 
223