11 #include <beast/claw/geometry/ClawCreator.h>
12 #include <beast/claw/simulation/SensitiveDetector.h>
14 #include <geometry/Materials.h>
15 #include <geometry/CreatorFactory.h>
16 #include <framework/gearbox/GearDir.h>
17 #include <framework/logging/Logger.h>
19 #include <boost/format.hpp>
20 #include <boost/foreach.hpp>
21 #include <boost/algorithm/string.hpp>
23 #include <G4LogicalVolume.hh>
24 #include <G4PVPlacement.hh>
28 #include "G4SubtractionSolid.hh"
29 #include <G4UserLimits.hh>
32 #include <G4VisAttributes.hh>
35 using namespace boost;
48 geometry::CreatorFactory<ClawCreator>
ClawFactory(
"CLAWCreator");
50 ClawCreator::ClawCreator(): m_sensitive(0)
55 ClawCreator::~ClawCreator()
63 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
65 G4VisAttributes* red =
new G4VisAttributes(G4Colour(1, 0, 0));
66 red->SetForceAuxEdgeVisible(
true);
67 G4VisAttributes* green =
new G4VisAttributes(G4Colour(0, 1, 0));
68 green->SetForceAuxEdgeVisible(
true);
69 G4VisAttributes* gray =
new G4VisAttributes(G4Colour(.5, .5, .5));
70 gray->SetForceAuxEdgeVisible(
true);
72 G4VisAttributes* coppercolor =
new G4VisAttributes(G4Colour(218. / 255., 138. / 255., 103. / 255.));
73 coppercolor->SetForceAuxEdgeVisible(
true);
77 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
138 int Nscint = activeParams.
getInt(
"Nscint");
139 G4double x = activeParams.
getLength(
"x") * CLHEP::cm;
140 G4double y = activeParams.
getLength(
"y") * CLHEP::cm;
141 G4double z = activeParams.
getLength(
"z_claw") * CLHEP::cm;
149 G4double dx_board = activeParams.
getLength(
"dx_board") / 2.*CLHEP::cm;
150 G4double dy_board = activeParams.
getLength(
"dy_board") / 2.*CLHEP::cm;
151 G4double dz_board = activeParams.
getLength(
"dz_board") / 2.*CLHEP::cm;
152 G4double dz_Culayer = activeParams.
getLength(
"dz_Culayer") / 2.*CLHEP::cm;
153 G4double dx_scint = activeParams.
getLength(
"dx_scint") / 2.*CLHEP::cm;
154 G4double dy_scint = activeParams.
getLength(
"dy_scint") / 2.*CLHEP::cm;
155 G4double dz_scint = activeParams.
getLength(
"dz_scint") / 2.*CLHEP::cm;
156 G4double Al_width = activeParams.
getLength(
"Al_width") / 2.*CLHEP::cm;
157 G4double dx_Al = dx_scint + Al_width;
158 G4double dy_Al = dy_scint + Al_width;
159 G4double dz_Al = dz_scint + Al_width;
160 G4double dx_air = dx_Al;
161 G4double dy_air = dy_Al * Nscint;
162 G4double dz_air = dz_board + 2. * dz_Culayer + dz_Al;
167 G4Box* s_air =
new G4Box(
"s_air", dx_air, dy_air, dz_air);
172 G4Box* s_board =
new G4Box(
"s_board", dx_board, dy_board, dz_board);
174 l_board->SetVisAttributes(green);
176 G4double r_board = dz_air - 2. * dz_Culayer - dz_board;
179 G4Box* s_Culayer =
new G4Box(
"s_Culayer", dx_board, dy_board, dz_Culayer);
181 l_Culayer->SetVisAttributes(coppercolor);
183 G4double r_Culayer_bot = r_board - dz_board - dz_Culayer;
184 G4double r_Culayer_top = r_board + dz_board + dz_Culayer;
188 G4VSolid* s_scint =
new G4Box(
"s_scint", dx_scint, dy_scint, dz_scint);
189 G4VSolid* s_Al =
new G4Box(
"s_Al", dx_Al, dy_Al, dz_Al);
190 s_Al =
new G4SubtractionSolid(
"s_Al", s_Al, s_scint, 0, G4ThreeVector(0, 0, 0));
192 l_Al->SetVisAttributes(gray);
195 l_scint->SetVisAttributes(red);
197 l_scint->SetUserLimits(
new G4UserLimits(stepSize));
199 G4double r_Al = r_Culayer_bot - dz_Culayer - dz_Al;
201 double z_0 = -dy_air + dy_Al;
207 G4Transform3D transform = G4Translate3D(x, y, z);
208 new G4PVPlacement(transform, l_air,
"p_air", &topVolume,
false, 1);
209 new G4PVPlacement(0, G4ThreeVector(0, 0, r_board), l_board,
"p_board", l_air,
false, 1);
210 new G4PVPlacement(0, G4ThreeVector(0, 0, r_Culayer_bot), l_Culayer,
"p_Culayer_bot", l_air,
false, 1);
211 new G4PVPlacement(0, G4ThreeVector(0, 0, r_Culayer_top), l_Culayer,
"p_Culayer_top", l_air,
false, 1);
213 for (
int j = 0; j < Nscint; j++) {
214 double i_z = z_0 + j * 2. * dy_Al;
216 new G4PVPlacement(0, G4ThreeVector(0, i_z, r_Al), l_Al,
"p_Al", l_air,
false, 1);
217 new G4PVPlacement(0, G4ThreeVector(0, i_z, r_Al), l_scint,
"p_scint", l_air,
false, detID);
218 B2INFO(
"Phase1-CLAWS-" << detID <<
" placed at: " << transform.getTranslation() <<
" mm");