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>
54 , TrackerMaterial(nullptr)
55 , TrackerThickness(100 *
cm)
56 , cylinder_logic(nullptr)
57 , cylinder_physi(nullptr)
81 return box_vol.find(volume)->second;
95 G4Tubs* _cylinder_solid =
new G4Tubs(G4String(
GetName().c_str()),
100 double deltalen = (
length - innerlength) / 2.;
101 double cone_size_multiplier = 1.01;
104 double cone_length = deltalen * cone_size_multiplier;
105 G4Cons* cone2 =
new G4Cons(
"conehead2",
106 inner_cone_radius, inner_cone_radius,
107 inner_cone_radius, inner_cone_radius + cone_thickness,
108 cone_length / 2.0, 0,
twopi);
109 G4Cons* cone1 =
new G4Cons(
"conehead",
110 inner_cone_radius, inner_cone_radius + cone_thickness,
111 inner_cone_radius, inner_cone_radius,
112 cone_length / 2.0, 0,
twopi);
113 double delta_len = cone_length - deltalen;
114 G4ThreeVector zTransneg(0, 0, -(
length - cone_length + delta_len) / 2.0);
115 G4ThreeVector zTranspos(0, 0, (
length - cone_length + delta_len) / 2.0);
116 G4SubtractionSolid* subtraction_tmp =
117 new G4SubtractionSolid(
"Cylinder-Cone", _cylinder_solid, cone1, 0, zTransneg);
118 G4SubtractionSolid* subtraction =
119 new G4SubtractionSolid(
"Cylinder-Cone-Cone", subtraction_tmp, cone2, 0, zTranspos);
124 G4VisAttributes* VisAtt =
new G4VisAttributes();
125 VisAtt->SetColour(G4Colour::Grey());
126 VisAtt->SetVisibility(
true);
127 VisAtt->SetForceSolid(
true);
152 double B = 2 * (x1 *
cos(a) + y1 * sin(a));
153 double C = x1 * x1 + y1 * y1 - r2 *
r2;
154 double D = B * B - 4 * A *
C;
157 double u = (-B + sqrt(D)) / 2 * A;
160 double x2 = x1 + u *
cos(a);
161 double y2 = y1 + u * sin(a);
165 B = 2 * (x4 *
cos(a) + y4 * sin(a));
166 C = x4 * x4 + y4 * y4 - r2 *
r2;
167 D = B * B - 4 * A *
C;
168 u = (-B + sqrt(D)) / 2 * A;
170 double x3 = x4 + u *
cos(a);
171 double y3 = y4 + u * sin(a);
174 G4TwoVector
v1(x1, y1);
175 G4TwoVector
v2(x2, y2);
176 G4TwoVector
v3(x3, y3);
177 G4TwoVector
v4(x4, y4);
179 std::vector<G4TwoVector> vertexes;
180 vertexes.push_back(v1);
181 vertexes.push_back(v2);
182 vertexes.push_back(v3);
183 vertexes.push_back(v4);
185 G4TwoVector
zero(0, 0);
189 double blength =
length + 20;
193 G4ExtrudedSolid* _box_solid =
new G4ExtrudedSolid(
"_BOX",
203 G4SubtractionSolid* subtractionbox_tmp =
204 new G4SubtractionSolid(
"Box-Cone", _box_solid, cone1, 0, zTransneg);
205 G4SubtractionSolid* subtractionbox =
206 new G4SubtractionSolid(
"Box-Cone-Cone", subtractionbox_tmp, cone2, 0, zTranspos);
207 G4LogicalVolume* box_logic =
new G4LogicalVolume(subtractionbox,
208 boxmat, G4String(
"BOX"),
210 VisAtt =
new G4VisAttributes();
212 VisAtt->SetVisibility(
true);
213 VisAtt->SetForceSolid(
true);
214 box_logic->SetVisAttributes(VisAtt);
216 double phi_increment = 360. /
_sciNum;
217 ostringstream slatname;
218 for (
int i = 0; i <
_sciNum; i++)
221 G4ThreeVector myTrans = G4ThreeVector(0, 0, 0);
222 G4RotationMatrix Rot(0, 0, 0);
223 Rot.rotateZ(phi * deg);
225 slatname <<
"SLAT_" << i;
226 G4VPhysicalVolume* box_vol_tmp =
new G4PVPlacement(G4Transform3D(Rot, G4ThreeVector(myTrans)),
228 G4String(slatname.str()),
234 ostringstream geonode;
265 double singamma = sin(phi) * c / b;
268 double a = c * sin(alpha) / singamma;
274 cout <<
"radius: " <<
radius << endl;