File indexing completed on 2025-02-23 09:21:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #include "ExUCNDetectorConstruction.hh"
0035
0036 #include "G4Box.hh"
0037 #include "G4Colour.hh"
0038 #include "G4FieldManager.hh"
0039 #include "G4GeometryManager.hh"
0040 #include "G4LogicalVolume.hh"
0041 #include "G4LogicalVolumeStore.hh"
0042 #include "G4Material.hh"
0043 #include "G4NistManager.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4PhysicalConstants.hh"
0046 #include "G4PhysicalVolumeStore.hh"
0047 #include "G4RepleteEofM.hh"
0048 #include "G4SolidStore.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4TransportationManager.hh"
0051 #include "G4Tubs.hh"
0052 #include "G4UCNMaterialPropertiesTable.hh"
0053 #include "G4UniformGravityField.hh"
0054 #include "G4UserLimits.hh"
0055 #include "G4VPhysicalVolume.hh"
0056 #include "G4VisAttributes.hh"
0057
0058
0059 #include "G4ChordFinder.hh"
0060 #include "G4ClassicalRK4.hh"
0061 #include "G4MagIntegratorStepper.hh"
0062 #include "G4PropagatorInField.hh"
0063
0064
0065
0066 ExUCNDetectorConstruction::ExUCNDetectorConstruction() : fVacuum(0), fGuideMaterial(0)
0067 {
0068
0069 DefineMaterials();
0070 }
0071
0072
0073
0074 ExUCNDetectorConstruction::~ExUCNDetectorConstruction()
0075 {
0076 if (fField) delete fField;
0077 }
0078
0079
0080
0081 void ExUCNDetectorConstruction::DefineMaterials()
0082 {
0083 G4NistManager* nistMan = G4NistManager::Instance();
0084
0085 fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
0086 fGuideMaterial = nistMan->FindOrBuildMaterial("G4_Ni");
0087
0088
0089
0090 G4UCNMaterialPropertiesTable* MPT = new G4UCNMaterialPropertiesTable();
0091
0092
0093
0094
0095 MPT->AddConstProperty("DIFFUSION", 0.1);
0096 MPT->AddConstProperty("FERMIPOT", 252.0);
0097 MPT->AddConstProperty("SPINFLIP", 0.);
0098 MPT->AddConstProperty("LOSS", 12.5e-5);
0099 MPT->AddConstProperty("LOSSCS", 0.);
0100 MPT->AddConstProperty("ABSCS", 4.49);
0101 MPT->AddConstProperty("SCATCS", 18.5);
0102
0103 G4double neV = 1.e-9 * eV;
0104
0105 MPT->SetMicroRoughnessParameters(30 * nm, 1 * nm, 180, 1000, 0 * degree, 90 * degree, 1 * neV,
0106 1000 * neV, 15, 15, 0.01 * degree);
0107
0108 fGuideMaterial->SetMaterialPropertiesTable(MPT);
0109
0110 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0111 }
0112
0113
0114
0115 G4VPhysicalVolume* ExUCNDetectorConstruction::Construct()
0116 {
0117
0118
0119
0120
0121 G4double worldSizeX = 1. * m;
0122 G4double worldSizeY = 1. * m;
0123 G4double worldSizeZ = 100. * m;
0124
0125 G4Box* solidWorld = new G4Box("World", worldSizeX / 2., worldSizeY / 2., worldSizeZ / 2.);
0126
0127 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, fVacuum, "World");
0128
0129 G4VPhysicalVolume* physiWorld =
0130 new G4PVPlacement(0, G4ThreeVector(), "World", logicWorld, 0, false, 0);
0131
0132
0133
0134 G4double GuideR = 35. * mm;
0135 G4double GuideW = 2. * mm;
0136 G4double GuideL = 6. * m;
0137
0138 G4Tubs* solidGuide = new G4Tubs("SolidGuide", GuideR, GuideR + GuideW, GuideL / 2., 0., twopi);
0139
0140 G4LogicalVolume* logicGuide = new G4LogicalVolume(solidGuide, fGuideMaterial, "Guide");
0141
0142 new G4PVPlacement(0, G4ThreeVector(), "Guide", logicGuide, physiWorld, false, 0);
0143
0144
0145
0146 G4Tubs* solidEndPlate = new G4Tubs("EndPlate", 0., GuideR, GuideW / 2., 0., twopi);
0147
0148 G4LogicalVolume* logicEndPlate = new G4LogicalVolume(solidEndPlate, fVacuum, "EndPlate");
0149
0150 G4ThreeVector endPlatePos = G4ThreeVector(0., 0., GuideL / 2. + GuideW / 2.);
0151
0152 new G4PVPlacement(0, endPlatePos, "EndPlate", logicEndPlate, physiWorld, false, 0);
0153
0154 G4double maxStep = 1.0 * mm;
0155 G4double maxTime = 100. * s;
0156
0157 G4UserLimits* stepLimit = new G4UserLimits(maxStep, DBL_MAX, maxTime);
0158
0159 logicWorld->SetUserLimits(stepLimit);
0160
0161
0162
0163
0164
0165 G4VisAttributes* guideColor = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
0166 guideColor->SetVisibility(true);
0167 guideColor->SetForceWireframe(true);
0168
0169 G4VisAttributes* endPlateColor = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0));
0170 endPlateColor->SetVisibility(true);
0171 endPlateColor->SetForceSolid(true);
0172
0173 logicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
0174 logicGuide->SetVisAttributes(guideColor);
0175 logicEndPlate->SetVisAttributes(endPlateColor);
0176
0177
0178
0179
0180 return physiWorld;
0181 }
0182
0183
0184
0185 G4ThreadLocal G4UniformGravityField* ExUCNDetectorConstruction::fField = 0;
0186
0187 void ExUCNDetectorConstruction::ConstructSDandField()
0188 {
0189 if (!fField) {
0190 fField = new G4UniformGravityField();
0191
0192 G4RepleteEofM* equation = new G4RepleteEofM(fField);
0193
0194
0195
0196 G4FieldManager* fieldManager =
0197 G4TransportationManager::GetTransportationManager()->GetFieldManager();
0198 fieldManager->SetDetectorField(fField);
0199
0200 G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation, 8);
0201
0202
0203 G4double minStep = 0.01 * mm;
0204
0205 G4ChordFinder* chordFinder = new G4ChordFinder((G4MagneticField*)fField, minStep, stepper);
0206
0207
0208 G4double deltaChord = 3.0 * mm;
0209 chordFinder->SetDeltaChord(deltaChord);
0210
0211 G4double deltaOneStep = 0.01 * mm;
0212 fieldManager->SetAccuraciesWithDeltaOneStep(deltaOneStep);
0213
0214 G4double deltaIntersection = 0.1 * mm;
0215 fieldManager->SetDeltaIntersection(deltaIntersection);
0216
0217 G4TransportationManager* transportManager = G4TransportationManager::GetTransportationManager();
0218
0219 G4PropagatorInField* fieldPropagator = transportManager->GetPropagatorInField();
0220
0221
0222 G4double epsMin = 2.5e-7;
0223 G4double epsMax = 0.001;
0224
0225
0226
0227
0228
0229 fieldPropagator->SetMinimumEpsilonStep(epsMin);
0230 fieldPropagator->SetMaximumEpsilonStep(epsMax);
0231
0232 fieldManager->SetChordFinder(chordFinder);
0233 }
0234 }
0235
0236