9#include <beast/claw/geometry/ClawCreator.h>
10#include <beast/claw/simulation/SensitiveDetector.h>
12#include <geometry/Materials.h>
13#include <geometry/CreatorFactory.h>
14#include <framework/gearbox/GearDir.h>
15#include <framework/logging/Logger.h>
17#include <boost/format.hpp>
18#include <boost/foreach.hpp>
19#include <boost/algorithm/string.hpp>
21#include <G4LogicalVolume.hh>
22#include <G4PVPlacement.hh>
26#include "G4SubtractionSolid.hh"
27#include <G4UserLimits.hh>
30#include <G4VisAttributes.hh>
64 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
66 G4VisAttributes* red =
new G4VisAttributes(G4Colour(1, 0, 0));
67 red->SetForceAuxEdgeVisible(
true);
68 G4VisAttributes* green =
new G4VisAttributes(G4Colour(0, 1, 0));
69 green->SetForceAuxEdgeVisible(
true);
70 G4VisAttributes* gray =
new G4VisAttributes(G4Colour(.5, .5, .5));
71 gray->SetForceAuxEdgeVisible(
true);
73 G4VisAttributes* coppercolor =
new G4VisAttributes(G4Colour(218. / 255., 138. / 255., 103. / 255.));
74 coppercolor->SetForceAuxEdgeVisible(
true);
78 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
139 int Nscint = activeParams.
getInt(
"Nscint");
140 G4double x = activeParams.
getLength(
"x") * CLHEP::cm;
141 G4double y = activeParams.
getLength(
"y") * CLHEP::cm;
142 G4double z = activeParams.
getLength(
"z_claw") * CLHEP::cm;
150 G4double dx_board = activeParams.
getLength(
"dx_board") / 2.*CLHEP::cm;
151 G4double dy_board = activeParams.
getLength(
"dy_board") / 2.*CLHEP::cm;
152 G4double dz_board = activeParams.
getLength(
"dz_board") / 2.*CLHEP::cm;
153 G4double dz_Culayer = activeParams.
getLength(
"dz_Culayer") / 2.*CLHEP::cm;
154 G4double dx_scint = activeParams.
getLength(
"dx_scint") / 2.*CLHEP::cm;
155 G4double dy_scint = activeParams.
getLength(
"dy_scint") / 2.*CLHEP::cm;
156 G4double dz_scint = activeParams.
getLength(
"dz_scint") / 2.*CLHEP::cm;
157 G4double Al_width = activeParams.
getLength(
"Al_width") / 2.*CLHEP::cm;
158 G4double dx_Al = dx_scint + Al_width;
159 G4double dy_Al = dy_scint + Al_width;
160 G4double dz_Al = dz_scint + Al_width;
161 G4double dx_air = dx_Al;
162 G4double dy_air = dy_Al * Nscint;
163 G4double dz_air = dz_board + 2. * dz_Culayer + dz_Al;
168 G4Box* s_air =
new G4Box(
"s_air", dx_air, dy_air, dz_air);
173 G4Box* s_board =
new G4Box(
"s_board", dx_board, dy_board, dz_board);
175 l_board->SetVisAttributes(green);
177 G4double r_board = dz_air - 2. * dz_Culayer - dz_board;
180 G4Box* s_Culayer =
new G4Box(
"s_Culayer", dx_board, dy_board, dz_Culayer);
182 l_Culayer->SetVisAttributes(coppercolor);
184 G4double r_Culayer_bot = r_board - dz_board - dz_Culayer;
185 G4double r_Culayer_top = r_board + dz_board + dz_Culayer;
189 G4VSolid* s_scint =
new G4Box(
"s_scint", dx_scint, dy_scint, dz_scint);
190 G4VSolid* s_Al =
new G4Box(
"s_Al", dx_Al, dy_Al, dz_Al);
191 s_Al =
new G4SubtractionSolid(
"s_Al", s_Al, s_scint, 0, G4ThreeVector(0, 0, 0));
193 l_Al->SetVisAttributes(gray);
196 l_scint->SetVisAttributes(red);
198 l_scint->SetUserLimits(
new G4UserLimits(stepSize));
200 G4double r_Al = r_Culayer_bot - dz_Culayer - dz_Al;
202 double z_0 = -dy_air + dy_Al;
208 G4Transform3D transform = G4Translate3D(x, y, z);
209 new G4PVPlacement(transform, l_air,
"p_air", &topVolume,
false, 1);
210 new G4PVPlacement(0, G4ThreeVector(0, 0, r_board), l_board,
"p_board", l_air,
false, 1);
211 new G4PVPlacement(0, G4ThreeVector(0, 0, r_Culayer_bot), l_Culayer,
"p_Culayer_bot", l_air,
false, 1);
212 new G4PVPlacement(0, G4ThreeVector(0, 0, r_Culayer_top), l_Culayer,
"p_Culayer_top", l_air,
false, 1);
214 for (
int j = 0; j < Nscint; j++) {
215 double i_z = z_0 + j * 2. * dy_Al;
217 new G4PVPlacement(0, G4ThreeVector(0, i_z, r_Al), l_Al,
"p_Al", l_air,
false, 1);
218 new G4PVPlacement(0, G4ThreeVector(0, i_z, r_Al), l_scint,
"p_scint", l_air,
false, detID);
219 B2INFO(
"Phase1-CLAWS-" << detID <<
" placed at: " << transform.getTranslation() <<
" mm");
GearDir is the basic class used for accessing the parameter store.
virtual ~ClawCreator()
Destructor.
ClawCreator()
Constructor.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Creation of the detector geometry from Gearbox (XML).
SensitiveDetector * m_sensitive
SensitiveDetector CLAW.
Sensitive Detector implementation of the CLAW detector.
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
int getInt(const std::string &path="") const noexcept(false)
Get the parameter path as a int.
static G4Material * get(const std::string &name)
Find given material.
geometry::CreatorFactory< ClawCreator > ClawFactory("CLAWCreator")
Creator creates the CLAW geometry.
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.
Very simple class to provide an easy way to register creators with the CreatorManager.