Geant4 Cross Reference |
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 exoticphysics/ucn/src/ExUCNDetectorC 28 /// \brief Implementation of the ExUCNDetector 29 // 30 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 34 #include "ExUCNDetectorConstruction.hh" 35 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" 43 #include "G4NistManager.hh" 44 #include "G4PVPlacement.hh" 45 #include "G4PhysicalConstants.hh" 46 #include "G4PhysicalVolumeStore.hh" 47 #include "G4RepleteEofM.hh" 48 #include "G4SolidStore.hh" 49 #include "G4SystemOfUnits.hh" 50 #include "G4TransportationManager.hh" 51 #include "G4Tubs.hh" 52 #include "G4UCNMaterialPropertiesTable.hh" 53 #include "G4UniformGravityField.hh" 54 #include "G4UserLimits.hh" 55 #include "G4VPhysicalVolume.hh" 56 #include "G4VisAttributes.hh" 57 // #include "G4EqGravityField.hh" 58 59 #include "G4ChordFinder.hh" 60 #include "G4ClassicalRK4.hh" 61 #include "G4MagIntegratorStepper.hh" 62 #include "G4PropagatorInField.hh" 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 65 66 ExUCNDetectorConstruction::ExUCNDetectorConstr 67 { 68 // materials 69 DefineMaterials(); 70 } 71 72 //....oooOO0OOooo........oooOO0OOooo........oo 73 74 ExUCNDetectorConstruction::~ExUCNDetectorConst 75 { 76 if (fField) delete fField; 77 } 78 79 //....oooOO0OOooo........oooOO0OOooo........oo 80 81 void ExUCNDetectorConstruction::DefineMaterial 82 { 83 G4NistManager* nistMan = G4NistManager::Inst 84 85 fVacuum = nistMan->FindOrBuildMaterial("G4_G 86 fGuideMaterial = nistMan->FindOrBuildMateria 87 88 // --- Ni diffuse 10% 89 90 G4UCNMaterialPropertiesTable* MPT = new G4UC 91 92 // MPT->AddConstProperty("REFLECTIVITY",1.) 93 // Commented out above line as REFLECTIVITY 94 // G4OpBoundaryProcess. Also use AddProper 95 MPT->AddConstProperty("DIFFUSION", 0.1); 96 MPT->AddConstProperty("FERMIPOT", 252.0); / 97 MPT->AddConstProperty("SPINFLIP", 0.); 98 MPT->AddConstProperty("LOSS", 12.5e-5); // 99 MPT->AddConstProperty("LOSSCS", 0.); 100 MPT->AddConstProperty("ABSCS", 4.49); // 1/ 101 MPT->AddConstProperty("SCATCS", 18.5); // ( 102 103 G4double neV = 1.e-9 * eV; 104 105 MPT->SetMicroRoughnessParameters(30 * nm, 1 106 1000 * neV, 107 108 fGuideMaterial->SetMaterialPropertiesTable(M 109 110 G4cout << *(G4Material::GetMaterialTable()) 111 } 112 113 //....oooOO0OOooo........oooOO0OOooo........oo 114 115 G4VPhysicalVolume* ExUCNDetectorConstruction:: 116 { 117 // 118 // World 119 // 120 121 G4double worldSizeX = 1. * m; 122 G4double worldSizeY = 1. * m; 123 G4double worldSizeZ = 100. * m; 124 125 G4Box* solidWorld = new G4Box("World", world 126 127 G4LogicalVolume* logicWorld = new G4LogicalV 128 129 G4VPhysicalVolume* physiWorld = 130 new G4PVPlacement(0, G4ThreeVector(), "Wor 131 132 // --------------------------------- Guide - 133 134 G4double GuideR = 35. * mm; 135 G4double GuideW = 2. * mm; 136 G4double GuideL = 6. * m; 137 138 G4Tubs* solidGuide = new G4Tubs("SolidGuide" 139 140 G4LogicalVolume* logicGuide = new G4LogicalV 141 142 new G4PVPlacement(0, G4ThreeVector(), "Guide 143 144 // ------------------------------ End Plate 145 146 G4Tubs* solidEndPlate = new G4Tubs("EndPlate 147 148 G4LogicalVolume* logicEndPlate = new G4Logic 149 150 G4ThreeVector endPlatePos = G4ThreeVector(0. 151 152 new G4PVPlacement(0, endPlatePos, "EndPlate" 153 154 G4double maxStep = 1.0 * mm; 155 G4double maxTime = 100. * s; 156 157 G4UserLimits* stepLimit = new G4UserLimits(m 158 159 logicWorld->SetUserLimits(stepLimit); 160 161 // 162 // Visualization attributes 163 // 164 165 G4VisAttributes* guideColor = new G4VisAttri 166 guideColor->SetVisibility(true); 167 guideColor->SetForceWireframe(true); 168 169 G4VisAttributes* endPlateColor = new G4VisAt 170 endPlateColor->SetVisibility(true); 171 endPlateColor->SetForceSolid(true); 172 173 logicWorld->SetVisAttributes(G4VisAttributes 174 logicGuide->SetVisAttributes(guideColor); 175 logicEndPlate->SetVisAttributes(endPlateColo 176 177 // 178 // always return the physical World 179 // 180 return physiWorld; 181 } 182 183 //....oooOO0OOooo........oooOO0OOooo........oo 184 185 G4ThreadLocal G4UniformGravityField* ExUCNDete 186 187 void ExUCNDetectorConstruction::ConstructSDand 188 { 189 if (!fField) { 190 fField = new G4UniformGravityField(); 191 192 G4RepleteEofM* equation = new G4RepleteEof 193 // G4RepleteEofM* equation = new G4Rep 194 // G4EqGravityField* equation = new G4 195 196 G4FieldManager* fieldManager = 197 G4TransportationManager::GetTransportati 198 fieldManager->SetDetectorField(fField); 199 200 G4MagIntegratorStepper* stepper = new G4Cl 201 // G4MagIntegratorStepper* stepper = n 202 203 G4double minStep = 0.01 * mm; 204 205 G4ChordFinder* chordFinder = new G4ChordFi 206 207 // Set accuracy parameters 208 G4double deltaChord = 3.0 * mm; 209 chordFinder->SetDeltaChord(deltaChord); 210 211 G4double deltaOneStep = 0.01 * mm; 212 fieldManager->SetAccuraciesWithDeltaOneSte 213 214 G4double deltaIntersection = 0.1 * mm; 215 fieldManager->SetDeltaIntersection(deltaIn 216 217 G4TransportationManager* transportManager 218 219 G4PropagatorInField* fieldPropagator = tra 220 221 // Dimensionless limits for relative accur 222 G4double epsMin = 2.5e-7; 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 229 fieldPropagator->SetMinimumEpsilonStep(eps 230 fieldPropagator->SetMaximumEpsilonStep(eps 231 232 fieldManager->SetChordFinder(chordFinder); 233 } 234 } 235 236 //....oooOO0OOooo........oooOO0OOooo........oo 237