6 #include "G4UnitsTable.hh"
7 #include "G4PVPlacement.hh"
10 #include "G4UnionSolid.hh"
11 #include "G4SubtractionSolid.hh"
12 #include "G4OpticalSurface.hh"
13 #include "G4LogicalBorderSurface.hh"
14 #include "G4LogicalSkinSurface.hh"
15 #include "G4Material.hh"
16 #include "G4MaterialTable.hh"
17 #include "G4LogicalVolume.hh"
18 #include "G4ThreeVector.hh"
19 #include "G4VisAttributes.hh"
20 #include "G4RunManager.hh"
22 #include <utl/unconfig.h>
23 #include <utl/config.h>
26 using namespace TelescopeSimulatorLX;
29 FDsimG4Filter::FDsimG4Filter(G4VPhysicalVolume*
const mother)
36 fThickness = fDetector->fFilterThickness;
37 fRadius = 0.5 * fDetector->fFilterDiameter;
38 fMaterial = fDetector->fFilterMaterial;
40 fFrameSize = fDetector->fFilterFrameSize;
41 fFrameArmWidth = 5.0*
cm;
42 fFrameThickness = fDetector->fFilterFrameThickness;
44 fFilter_log =
nullptr;
50 FDsimG4Filter::DumpInfo()
52 G4cerr <<
" ================================================================\n"
53 " = Filter parameters\n"
55 " = Radius : " << fRadius/
mm <<
" mm\n"
57 " = Thickness : " << fThickness/
mm <<
" mm\n"
59 " = Material : " << fMaterial->GetName()
61 " ================================================================" << G4endl;
66 FDsimG4Filter::MakeFilter()
68 const G4double tolerance = 0.1*
mm;
72 G4Tubs*
const filterSolid =
73 new G4Tubs(
"Filter", 0, fRadius, 0.5*fThickness, 0, 2*pi);
75 fFilter_log =
new G4LogicalVolume(filterSolid, (G4Material*)fMaterial,
"Filter", 0,0,0);
76 fFilter_log->SetVisAttributes(
new G4VisAttributes(
magenta));
78 const G4ThreeVector filterPos =
80 G4ThreeVector(0, 0, 0.5*(fFrameThickness + fThickness) + tolerance);
83 new G4PVPlacement(0, filterPos,
"UVFilter", fFilter_log, fMother,
false, 0);
84 G4VPhysicalVolume*
const framePhys =
85 new G4PVPlacement(0, fPosition,
"Filter frame", fFrame_log, fMother,
false, 0);
87 new G4LogicalBorderSurface(
"Frame Surface", fMother, framePhys, fFrameOpticalSurface);
89 #if (G4VERSION_NUMBER >= 900)
90 const G4int verbosityLevel = fDetector->fVerbosityLevel;
91 if (verbosityLevel > 2) {
92 filterPhys->CheckOverlaps(10000);
93 framePhys->CheckOverlaps(10000);
100 FDsimG4Filter::MakeFrame()
102 const G4double tolerance = 0.1*
mm;
104 const G4double frameX = fFrameSize;
105 const G4double frameY = fFrameSize;
106 const G4double frameZ = fFrameThickness;
108 G4Box*
const frameBox =
new G4Box(
"Frame_tmp", 0.5*frameX, 0.5*frameY, 0.5*frameZ);
110 G4Tubs*
const frameHole =
new G4Tubs(
"Hole", 0, fRadius+tolerance, 10*frameZ, 0, 2*pi);
112 G4Box*
const frameArmBox =
new G4Box(
"FrameArm", 0.5*fFrameArmWidth, 0.5*frameY - 0.5*(0.5*frameY - fRadius), 0.5*frameZ);
114 const G4double yOffset = 0.5*frameY/3;
117 const G4double zOffset = fFrameThickness;
119 const G4ThreeVector frameArmPos_1 = G4ThreeVector(0, 0, zOffset);
120 const G4ThreeVector frameArmPos_2 = G4ThreeVector(0, yOffset, zOffset);
121 const G4ThreeVector frameArmPos_3 = G4ThreeVector(0, -yOffset, zOffset);
123 G4SubtractionSolid*
const frameTmp =
new G4SubtractionSolid(
"Frame", frameBox, frameHole);
125 G4RotationMatrix*
const zRot90 =
new G4RotationMatrix();
126 zRot90->rotateZ(90*
deg);
128 G4UnionSolid*
const frame_1 =
new G4UnionSolid(
"Frame_1", frameTmp, frameArmBox,
nullptr, frameArmPos_1);
129 G4UnionSolid*
const Frame_2 =
new G4UnionSolid(
"Frame_2", frame_1, frameArmBox, zRot90, frameArmPos_2);
130 G4UnionSolid*
const fFrameSolid =
new G4UnionSolid(
"Frame_3", frame_2, frameArmBox, zRot90, frameArmPos_3);
132 fFrame_log =
new G4LogicalVolume(fFrameSolid, G4Material::GetMaterial(
"Aluminum"),
"Filter Frame", 0,0,0);
133 fFrame_log->SetVisAttributes(
new G4VisAttributes(
gray));
137 const G4String& frameReflectionType = fDetector->fFilterFrameReflectionType;
138 const vector<G4double>& wavelength = fDetector->fFilterFrameWavelength;
139 const vector<G4double>& reflectivity = fDetector->fFilterFrameReflectivity;
141 fFrameOpticalSurface =
new G4OpticalSurface(
"Filter frame");
142 fFrameOpticalSurface->SetModel(unified);
143 fFrameOpticalSurface->SetType(dielectric_metal);
144 fFrameOpticalSurface->SetFinish(polished);
146 G4MaterialPropertiesTable*
const frameMPT =
new G4MaterialPropertiesTable();
147 frameMPT->AddProperty(
"REFLECTIVITY",
new G4MaterialPropertyVector());
149 for (
unsigned iwl = 0, n = wavelength.size(); iwl < n; ++iwl) {
150 const G4double energy = h_Planck * c_light / wavelength[iwl];
151 frameMPT->AddEntry(
"REFLECTIVITY", energy, reflectivity[iwl]);
154 const G4int VerbosityLevel = fDetector->fVerbosityLevel;
155 if (VerbosityLevel > 0) {
156 G4cerr <<
"==== Filter Frame Surface properties ====\n"
157 "==== Reflection type : " << FrameReflectionType <<
"====" << G4endl;
160 if (FrameReflectionType ==
"Diffusive") {
162 const G4double& sigma_alpha = frameRoughness.
Sigma_alpha;
163 const vector<G4double>& wavelengthRoughness = frameRoughness.
Wavelength;
164 const vector<G4double>& specularSpike = frameRoughness.
SpecularSpike;
165 const vector<G4double>& specularLobe = frameRoughness.
SpecularLobe;
166 const vector<G4double>& backscatter = frameRoughness.
Backscatter;
168 fFrameOpticalSurface->SetFinish(ground);
169 fFrameOpticalSurface->SetSigmaAlpha(sigma_alpha);
171 frameMPT->AddProperty(
"SPECULARSPIKECONSTANT",
new G4MaterialPropertyVector());
172 frameMPT->AddProperty(
"SPECULARLOBECONSTANT",
new G4MaterialPropertyVector());
173 frameMPT->AddProperty(
"BACKSCATTERCONSTANT",
new G4MaterialPropertyVector());
175 for (
unsigned iwl = 0, n = wavelengthRoughness.size(); iwl < n; ++iwl) {
176 const G4double energy = h_Planck * c_light / wavelengthRoughness[iwl];
177 frameMPT->AddEntry(
"SPECULARSPIKECONSTANT", energy, specularSpike[iwl]);
178 frameMPT->AddEntry(
"SPECULARLOBECONSTANT", energy, specularLobe[iwl]);
179 frameMPT->AddEntry(
"BACKSCATTERCONSTANT", energy, backscatter[iwl]);
182 if (VerbosityLevel > 0) {
183 G4cerr <<
"==== sigma_alpha = " << sigma_alpha/
deg <<
" deg. ====\n"
184 "==== Parameters vs wavelength (Wl (nm) \t Reflectivity \t SpecularSpike \t SpecularLobe \t Backscatter) ====" << G4endl;
186 for (
unsigned i = 0, n = wavelengthRoughness.size(); i < n; ++i) {
187 G4cerr << wavelengthRoughness[i]/nm <<
'\t'
188 << reflectivity[i] <<
'\t'
189 << specularSpike[i] <<
'\t'
190 << specularLobe[i] <<
'\t'
191 << backscatter[i] << G4endl;
197 fFrameOpticalSurface->SetMaterialPropertiesTable(FrameMPT);
std::vector< G4double > Backscatter
std::vector< G4double > SpecularSpike
static const G4Colour magenta(1.0, 0.5, 1.0)
std::vector< G4double > SpecularLobe
std::vector< G4double > Wavelength
G4ThreeVector fFilterPosition