15 #include <Geant4/G4Colour.hh>
16 #include <Geant4/G4Cons.hh>
17 #include <Geant4/G4ExtrudedSolid.hh>
18 #include <Geant4/G4LogicalVolume.hh>
19 #include <Geant4/G4Material.hh>
20 #include <Geant4/G4PVPlacement.hh>
21 #include <Geant4/G4PhysicalConstants.hh>
22 #include <Geant4/G4RotationMatrix.hh>
23 #include <Geant4/G4String.hh>
24 #include <Geant4/G4SubtractionSolid.hh>
25 #include <Geant4/G4SystemOfUnits.hh>
26 #include <Geant4/G4ThreeVector.hh>
27 #include <Geant4/G4Transform3D.hh>
28 #include <Geant4/G4Tubs.hh>
29 #include <Geant4/G4TwoVector.hh>
30 #include <Geant4/G4VisAttributes.hh>
52 , TrackerMaterial(nullptr)
53 , TrackerThickness(100 *
cm)
54 , cylinder_logic(nullptr)
55 , cylinder_physi(nullptr)
79 return box_vol.find(volume)->second;
93 G4Tubs* _cylinder_solid =
new G4Tubs(G4String(
GetName()),
98 double deltalen = (
length - innerlength) / 2.;
99 double cone_size_multiplier = 1.01;
102 double cone_length = deltalen * cone_size_multiplier;
103 G4Cons* cone2 =
new G4Cons(
"conehead2",
104 inner_cone_radius, inner_cone_radius,
105 inner_cone_radius, inner_cone_radius + cone_thickness,
106 cone_length / 2.0, 0,
twopi);
107 G4Cons* cone1 =
new G4Cons(
"conehead",
108 inner_cone_radius, inner_cone_radius + cone_thickness,
109 inner_cone_radius, inner_cone_radius,
110 cone_length / 2.0, 0,
twopi);
111 double delta_len = cone_length - deltalen;
112 G4ThreeVector zTransneg(0, 0, -(
length - cone_length + delta_len) / 2.0);
113 G4ThreeVector zTranspos(0, 0, (
length - cone_length + delta_len) / 2.0);
114 G4SubtractionSolid* subtraction_tmp =
115 new G4SubtractionSolid(
"Cylinder-Cone", _cylinder_solid, cone1,
nullptr, zTransneg);
116 G4SubtractionSolid* subtraction =
117 new G4SubtractionSolid(
"Cylinder-Cone-Cone", subtraction_tmp, cone2,
nullptr, zTranspos);
121 nullptr,
nullptr,
nullptr);
122 G4VisAttributes* VisAtt =
new G4VisAttributes();
123 VisAtt->SetColour(G4Colour::Grey());
124 VisAtt->SetVisibility(
true);
125 VisAtt->SetForceSolid(
true);
150 double B = 2 * (x1 * cos(a) + y1 * sin(a));
151 double C = x1 * x1 + y1 * y1 - r2 *
r2;
152 double D = B * B - 4 * A *
C;
155 double u = (-B + sqrt(D)) / 2 * A;
158 double x2 = x1 + u * cos(a);
159 double y2 = y1 + u * sin(a);
163 B = 2 * (x4 * cos(a) + y4 * sin(a));
164 C = x4 * x4 + y4 * y4 - r2 *
r2;
165 D = B * B - 4 * A *
C;
166 u = (-B + sqrt(D)) / 2 * A;
168 double x3 = x4 + u * cos(a);
169 double y3 = y4 + u * sin(a);
172 G4TwoVector
v1(x1, y1);
173 G4TwoVector
v2(x2, y2);
174 G4TwoVector
v3(x3, y3);
175 G4TwoVector
v4(x4, y4);
177 std::vector<G4TwoVector> vertexes;
178 vertexes.push_back(v1);
179 vertexes.push_back(v2);
180 vertexes.push_back(v3);
181 vertexes.push_back(v4);
183 G4TwoVector
zero(0, 0);
187 double blength =
length + 20;
191 G4ExtrudedSolid* _box_solid =
new G4ExtrudedSolid(
"_BOX",
201 G4SubtractionSolid* subtractionbox_tmp =
202 new G4SubtractionSolid(
"Box-Cone", _box_solid, cone1,
nullptr, zTransneg);
203 G4SubtractionSolid* subtractionbox =
204 new G4SubtractionSolid(
"Box-Cone-Cone", subtractionbox_tmp, cone2,
nullptr, zTranspos);
205 G4LogicalVolume* box_logic =
new G4LogicalVolume(subtractionbox,
206 boxmat, G4String(
"BOX"),
207 nullptr,
nullptr,
nullptr);
208 VisAtt =
new G4VisAttributes();
210 VisAtt->SetVisibility(
true);
211 VisAtt->SetForceSolid(
true);
212 box_logic->SetVisAttributes(VisAtt);
214 double phi_increment = 360. /
_sciNum;
215 std::ostringstream slatname;
219 G4ThreeVector myTrans = G4ThreeVector(0, 0, 0);
220 G4RotationMatrix Rot(0, 0, 0);
221 Rot.rotateZ(phi *
deg);
223 slatname <<
"SLAT_" <<
i;
224 G4VPhysicalVolume* box_vol_tmp =
new G4PVPlacement(G4Transform3D(Rot, G4ThreeVector(myTrans)),
226 G4String(slatname.str()),
232 std::ostringstream geonode;
263 double singamma = sin(phi) * c /
b;
264 double gamma = M_PI - asin(singamma);
266 double a = c * sin(alpha) / singamma;
272 std::cout <<
"radius: " <<
radius << std::endl;