Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: ExUCNDetectorConstruction.cc 75572 2013-11-04 11:46:08Z gcosmo $ 26 // 27 // 27 /// \file exoticphysics/ucn/src/ExUCNDetectorC 28 /// \file exoticphysics/ucn/src/ExUCNDetectorConstruction.cc 28 /// \brief Implementation of the ExUCNDetector 29 /// \brief Implementation of the ExUCNDetectorConstruction class 29 // 30 // 30 31 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 34 34 #include "ExUCNDetectorConstruction.hh" 35 #include "ExUCNDetectorConstruction.hh" 35 36 36 #include "G4Box.hh" << 37 #include "G4Colour.hh" << 38 #include "G4FieldManager.hh" << 39 #include "G4GeometryManager.hh" << 40 #include "G4LogicalVolume.hh" << 41 #include "G4LogicalVolumeStore.hh" << 42 #include "G4Material.hh" 37 #include "G4Material.hh" 43 #include "G4NistManager.hh" 38 #include "G4NistManager.hh" >> 39 #include "G4UCNMaterialPropertiesTable.hh" >> 40 >> 41 #include "G4Box.hh" >> 42 #include "G4Tubs.hh" >> 43 #include "G4VPhysicalVolume.hh" >> 44 #include "G4LogicalVolume.hh" 44 #include "G4PVPlacement.hh" 45 #include "G4PVPlacement.hh" 45 #include "G4PhysicalConstants.hh" << 46 >> 47 #include "G4GeometryManager.hh" 46 #include "G4PhysicalVolumeStore.hh" 48 #include "G4PhysicalVolumeStore.hh" 47 #include "G4RepleteEofM.hh" << 49 #include "G4LogicalVolumeStore.hh" 48 #include "G4SolidStore.hh" 50 #include "G4SolidStore.hh" >> 51 >> 52 #include "G4VisAttributes.hh" >> 53 #include "G4Colour.hh" >> 54 >> 55 #include "G4UserLimits.hh" 49 #include "G4SystemOfUnits.hh" 56 #include "G4SystemOfUnits.hh" 50 #include "G4TransportationManager.hh" << 57 #include "G4PhysicalConstants.hh" 51 #include "G4Tubs.hh" << 58 52 #include "G4UCNMaterialPropertiesTable.hh" << 53 #include "G4UniformGravityField.hh" 59 #include "G4UniformGravityField.hh" 54 #include "G4UserLimits.hh" << 55 #include "G4VPhysicalVolume.hh" << 56 #include "G4VisAttributes.hh" << 57 // #include "G4EqGravityField.hh" << 58 60 59 #include "G4ChordFinder.hh" << 61 #include "G4FieldManager.hh" >> 62 #include "G4TransportationManager.hh" >> 63 >> 64 #include "G4RepleteEofM.hh" >> 65 //#include "G4EqGravityField.hh" >> 66 60 #include "G4ClassicalRK4.hh" 67 #include "G4ClassicalRK4.hh" 61 #include "G4MagIntegratorStepper.hh" 68 #include "G4MagIntegratorStepper.hh" >> 69 #include "G4ChordFinder.hh" 62 #include "G4PropagatorInField.hh" 70 #include "G4PropagatorInField.hh" 63 71 64 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 73 66 ExUCNDetectorConstruction::ExUCNDetectorConstr << 74 ExUCNDetectorConstruction::ExUCNDetectorConstruction() >> 75 : fVacuum(0), fGuideMaterial(0) 67 { 76 { 68 // materials 77 // materials 69 DefineMaterials(); 78 DefineMaterials(); 70 } 79 } 71 80 72 //....oooOO0OOooo........oooOO0OOooo........oo 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 82 74 ExUCNDetectorConstruction::~ExUCNDetectorConst 83 ExUCNDetectorConstruction::~ExUCNDetectorConstruction() 75 { 84 { 76 if (fField) delete fField; 85 if (fField) delete fField; 77 } 86 } 78 87 79 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 89 81 void ExUCNDetectorConstruction::DefineMaterial 90 void ExUCNDetectorConstruction::DefineMaterials() 82 { 91 { 83 G4NistManager* nistMan = G4NistManager::Inst 92 G4NistManager* nistMan = G4NistManager::Instance(); 84 93 85 fVacuum = nistMan->FindOrBuildMaterial("G4_G 94 fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic"); 86 fGuideMaterial = nistMan->FindOrBuildMateria 95 fGuideMaterial = nistMan->FindOrBuildMaterial("G4_Ni"); 87 96 88 // --- Ni diffuse 10% 97 // --- Ni diffuse 10% 89 98 90 G4UCNMaterialPropertiesTable* MPT = new G4UC 99 G4UCNMaterialPropertiesTable* MPT = new G4UCNMaterialPropertiesTable(); 91 100 92 // MPT->AddConstProperty("REFLECTIVITY",1.) << 101 // MPT->AddConstProperty("REFLECTIVITY",1.); 93 // Commented out above line as REFLECTIVITY 102 // Commented out above line as REFLECTIVITY=1 by default in 94 // G4OpBoundaryProcess. Also use AddProper 103 // G4OpBoundaryProcess. Also use AddProperty to set REFLECTIVITY if needed 95 MPT->AddConstProperty("DIFFUSION", 0.1); << 104 MPT->AddConstProperty("DIFFUSION",0.1); 96 MPT->AddConstProperty("FERMIPOT", 252.0); / << 105 MPT->AddConstProperty("FERMIPOT",252.0); // Gollub, Table 2.1 in neV 97 MPT->AddConstProperty("SPINFLIP", 0.); << 106 MPT->AddConstProperty("SPINFLIP",0.); 98 MPT->AddConstProperty("LOSS", 12.5e-5); // << 107 MPT->AddConstProperty("LOSS", 12.5e-5); // Gollub, Table 2.1 99 MPT->AddConstProperty("LOSSCS", 0.); << 108 MPT->AddConstProperty("LOSSCS",0.); 100 MPT->AddConstProperty("ABSCS", 4.49); // 1/ << 109 MPT->AddConstProperty("ABSCS",4.49); // 1/v loss cross-section at room temp. 101 MPT->AddConstProperty("SCATCS", 18.5); // ( << 110 MPT->AddConstProperty("SCATCS",18.5); // (incoherent) "elastic" scattering cs 102 << 111 103 G4double neV = 1.e-9 * eV; << 112 G4double neV = 1.e-9*eV; 104 << 113 105 MPT->SetMicroRoughnessParameters(30 * nm, 1 << 114 MPT->SetMicroRoughnessParameters(30*nm, 1*nm, 106 1000 * neV, << 115 180, 1000, >> 116 0*degree, 90*degree, >> 117 1*neV, 1000*neV, >> 118 15, 15, >> 119 0.01*degree); 107 120 108 fGuideMaterial->SetMaterialPropertiesTable(M 121 fGuideMaterial->SetMaterialPropertiesTable(MPT); 109 122 110 G4cout << *(G4Material::GetMaterialTable()) 123 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 111 } 124 } 112 125 113 //....oooOO0OOooo........oooOO0OOooo........oo 126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 127 115 G4VPhysicalVolume* ExUCNDetectorConstruction:: 128 G4VPhysicalVolume* ExUCNDetectorConstruction::Construct() 116 { 129 { 117 // 130 // 118 // World 131 // World 119 // 132 // 120 133 121 G4double worldSizeX = 1. * m; << 134 G4double worldSizeX = 1.*m; 122 G4double worldSizeY = 1. * m; << 135 G4double worldSizeY = 1.*m; 123 G4double worldSizeZ = 100. * m; << 136 G4double worldSizeZ = 100.*m; 124 137 125 G4Box* solidWorld = new G4Box("World", world << 138 G4Box* solidWorld = new G4Box("World", >> 139 worldSizeX/2.,worldSizeY/2.,worldSizeZ/2.); 126 140 127 G4LogicalVolume* logicWorld = new G4LogicalV << 141 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, >> 142 fVacuum, >> 143 "World"); 128 144 129 G4VPhysicalVolume* physiWorld = << 145 G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, 130 new G4PVPlacement(0, G4ThreeVector(), "Wor << 146 G4ThreeVector(), >> 147 "World", >> 148 logicWorld, >> 149 0, >> 150 false, >> 151 0); 131 152 132 // --------------------------------- Guide - << 153 // --------------------------------- Guide ------------------------------------- 133 154 134 G4double GuideR = 35. * mm; << 155 G4double GuideR = 35.*mm; 135 G4double GuideW = 2. * mm; << 156 G4double GuideW = 2.*mm; 136 G4double GuideL = 6. * m; << 157 G4double GuideL = 6.*m; 137 158 138 G4Tubs* solidGuide = new G4Tubs("SolidGuide" << 159 G4Tubs* solidGuide = new G4Tubs("SolidGuide", >> 160 GuideR,GuideR+GuideW,GuideL/2.,0.,twopi); 139 161 140 G4LogicalVolume* logicGuide = new G4LogicalV << 162 G4LogicalVolume* logicGuide = new G4LogicalVolume(solidGuide, >> 163 fGuideMaterial, >> 164 "Guide"); 141 165 142 new G4PVPlacement(0, G4ThreeVector(), "Guide << 166 new G4PVPlacement(0,G4ThreeVector(),"Guide",logicGuide,physiWorld,false,0); 143 167 144 // ------------------------------ End Plate << 168 // ------------------------------ End Plate ----------------------------------- 145 169 146 G4Tubs* solidEndPlate = new G4Tubs("EndPlate << 170 G4Tubs* solidEndPlate = new G4Tubs("EndPlate",0.,GuideR,GuideW/2.,0.,twopi); 147 171 148 G4LogicalVolume* logicEndPlate = new G4Logic << 172 G4LogicalVolume* logicEndPlate = new G4LogicalVolume(solidEndPlate, >> 173 fVacuum, >> 174 "EndPlate"); 149 175 150 G4ThreeVector endPlatePos = G4ThreeVector(0. << 176 G4ThreeVector endPlatePos = G4ThreeVector(0.,0.,GuideL/2.+GuideW/2.); 151 177 152 new G4PVPlacement(0, endPlatePos, "EndPlate" << 178 new G4PVPlacement(0,endPlatePos,"EndPlate",logicEndPlate,physiWorld,false,0); 153 179 154 G4double maxStep = 1.0 * mm; << 180 G4double maxStep = 1.0*mm; 155 G4double maxTime = 100. * s; << 181 G4double maxTime = 100.*s; 156 182 157 G4UserLimits* stepLimit = new G4UserLimits(m << 183 G4UserLimits* stepLimit = new G4UserLimits(maxStep,DBL_MAX,maxTime); 158 184 159 logicWorld->SetUserLimits(stepLimit); 185 logicWorld->SetUserLimits(stepLimit); 160 << 186 161 // 187 // 162 // Visualization attributes 188 // Visualization attributes 163 // 189 // 164 190 165 G4VisAttributes* guideColor = new G4VisAttri << 191 G4VisAttributes* guideColor = new G4VisAttributes(G4Colour(0.0,0.0,1.0)); 166 guideColor->SetVisibility(true); 192 guideColor->SetVisibility(true); 167 guideColor->SetForceWireframe(true); 193 guideColor->SetForceWireframe(true); 168 194 169 G4VisAttributes* endPlateColor = new G4VisAt << 195 G4VisAttributes* endPlateColor = new G4VisAttributes(G4Colour(1.0,0.0,0.0)); 170 endPlateColor->SetVisibility(true); 196 endPlateColor->SetVisibility(true); 171 endPlateColor->SetForceSolid(true); 197 endPlateColor->SetForceSolid(true); 172 198 173 logicWorld->SetVisAttributes(G4VisAttributes 199 logicWorld->SetVisAttributes(G4VisAttributes::GetInvisible()); 174 logicGuide->SetVisAttributes(guideColor); 200 logicGuide->SetVisAttributes(guideColor); 175 logicEndPlate->SetVisAttributes(endPlateColo 201 logicEndPlate->SetVisAttributes(endPlateColor); 176 202 177 // 203 // 178 // always return the physical World << 204 //always return the physical World 179 // 205 // 180 return physiWorld; 206 return physiWorld; 181 } 207 } 182 208 183 //....oooOO0OOooo........oooOO0OOooo........oo 209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 184 210 185 G4ThreadLocal G4UniformGravityField* ExUCNDete 211 G4ThreadLocal G4UniformGravityField* ExUCNDetectorConstruction::fField = 0; 186 212 187 void ExUCNDetectorConstruction::ConstructSDand 213 void ExUCNDetectorConstruction::ConstructSDandField() 188 { 214 { 189 if (!fField) { 215 if (!fField) { 190 fField = new G4UniformGravityField(); << 191 216 192 G4RepleteEofM* equation = new G4RepleteEof << 217 fField = new G4UniformGravityField(); 193 // G4RepleteEofM* equation = new G4Rep << 218 194 // G4EqGravityField* equation = new G4 << 219 G4RepleteEofM* equation = new G4RepleteEofM(fField); >> 220 // G4RepleteEofM* equation = new G4RepleteEofM(fField,12); >> 221 // G4EqGravityField* equation = new G4EqGravityField(fField); 195 222 196 G4FieldManager* fieldManager = << 223 G4FieldManager* fieldManager 197 G4TransportationManager::GetTransportati << 224 = G4TransportationManager::GetTransportationManager()->GetFieldManager(); 198 fieldManager->SetDetectorField(fField); << 225 fieldManager->SetDetectorField(fField); 199 226 200 G4MagIntegratorStepper* stepper = new G4Cl << 227 G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,8); 201 // G4MagIntegratorStepper* stepper = n << 228 // G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,12); 202 229 203 G4double minStep = 0.01 * mm; << 230 G4double minStep = 0.01*mm; 204 231 205 G4ChordFinder* chordFinder = new G4ChordFi << 232 G4ChordFinder* chordFinder = >> 233 new G4ChordFinder((G4MagneticField*)fField,minStep,stepper); 206 234 207 // Set accuracy parameters << 235 // Set accuracy parameters 208 G4double deltaChord = 3.0 * mm; << 236 G4double deltaChord = 3.0*mm; 209 chordFinder->SetDeltaChord(deltaChord); << 237 chordFinder->SetDeltaChord( deltaChord ); 210 238 211 G4double deltaOneStep = 0.01 * mm; << 239 G4double deltaOneStep = 0.01*mm; 212 fieldManager->SetAccuraciesWithDeltaOneSte << 240 fieldManager->SetAccuraciesWithDeltaOneStep(deltaOneStep); 213 241 214 G4double deltaIntersection = 0.1 * mm; << 242 G4double deltaIntersection = 0.1*mm; 215 fieldManager->SetDeltaIntersection(deltaIn << 243 fieldManager->SetDeltaIntersection(deltaIntersection); 216 244 217 G4TransportationManager* transportManager << 245 G4TransportationManager* transportManager = >> 246 G4TransportationManager::GetTransportationManager(); 218 247 219 G4PropagatorInField* fieldPropagator = tra << 248 G4PropagatorInField* fieldPropagator = >> 249 transportManager->GetPropagatorInField(); 220 250 221 // Dimensionless limits for relative accur << 251 G4double epsMin = 2.5e-7*mm; 222 G4double epsMin = 2.5e-7; << 252 G4double epsMax = 0.05*mm; 223 G4double epsMax = 0.001; // Will soon be << 224 // The relative accuracy used for a step o << 225 // a.) epsMin << 226 // epsilon_step = b.) epsMax << 227 // c.) deltaOneStep / << 228 253 229 fieldPropagator->SetMinimumEpsilonStep(eps << 254 fieldPropagator->SetMinimumEpsilonStep(epsMin); 230 fieldPropagator->SetMaximumEpsilonStep(eps << 255 fieldPropagator->SetMaximumEpsilonStep(epsMax); 231 256 232 fieldManager->SetChordFinder(chordFinder); << 257 fieldManager->SetChordFinder(chordFinder); 233 } 258 } 234 } 259 } 235 260 236 //....oooOO0OOooo........oooOO0OOooo........oo 261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 237 262