11 #include <beast/he3tube/geometry/He3tubeCreator.h>
12 #include <beast/he3tube/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>
27 #include <G4UserLimits.hh>
31 #include <G4VisAttributes.hh>
35 using namespace boost;
48 geometry::CreatorFactory<He3tubeCreator>
He3tubeFactory(
"HE3TUBECreator");
50 He3tubeCreator::He3tubeCreator(): m_sensitive(0)
55 He3tubeCreator::~He3tubeCreator()
64 G4double abundance, density;
67 G4Isotope* iHe3 =
new G4Isotope(
"iHe3", z = 2, n = 3, a = 3.0160293 * CLHEP::g / CLHEP::mole);
68 G4Element* eHe3 =
new G4Element(
"eHe3", symbol =
"eHe3", ncomponents = 1);
69 eHe3->AddIsotope(iHe3, abundance = 100.);
70 G4Material* gHe3 =
new G4Material(
"gHe3", density = 0.00066 * CLHEP::g / CLHEP::cm3, ncomponents = 1);
71 gHe3->AddElement(eHe3, 1);
74 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
80 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
83 G4double startAngle = 0.*CLHEP::deg;
84 G4double spanningAngle = 360.*CLHEP::deg;
85 G4Tubs* s_He3TUBE =
new G4Tubs(
"s_He3TUBE",
86 activeParams.
getLength(
"tube_innerRadius")*CLHEP::cm,
87 activeParams.
getLength(
"tube_outerRadius")*CLHEP::cm,
88 activeParams.
getLength(
"tube_hz")*CLHEP::cm,
89 startAngle, spanningAngle);
91 string matTube = activeParams.
getString(
"MaterialTube");
94 G4VisAttributes* l_He3TubeVisAtt =
new G4VisAttributes(G4Colour(0, 1.0, 1.0, 1.0));
95 l_He3TUBE->SetVisAttributes(l_He3TubeVisAtt);
98 G4ThreeVector He3TUBEpos = G4ThreeVector(
99 activeParams.
getLength(
"x_he3tube") * CLHEP::cm,
100 activeParams.
getLength(
"y_he3tube") * CLHEP::cm,
101 activeParams.
getLength(
"z_he3tube") * CLHEP::cm
104 G4RotationMatrix* rot_he3tube =
new G4RotationMatrix();
105 rot_he3tube->rotateX(activeParams.
getAngle(
"AngleX"));
106 rot_he3tube->rotateY(activeParams.
getAngle(
"AngleY"));
107 rot_he3tube->rotateZ(activeParams.
getAngle(
"AngleZ"));
111 new G4PVPlacement(rot_he3tube, He3TUBEpos, l_He3TUBE,
"p_He3TUBE", &topVolume,
false, 1);
113 B2INFO(
"HE3-tube-" << detID <<
" placed at: " << He3TUBEpos <<
" mm");
116 G4double EndcapinnerRadius = 0.;
117 G4Tubs* s_He3endcap =
new G4Tubs(
"s_He3endcap",
119 activeParams.
getLength(
"tube_outerRadius")*CLHEP::cm,
120 activeParams.
getLength(
"endcap_hz")*CLHEP::cm,
121 startAngle, spanningAngle);
125 l_He3endcap->SetVisAttributes(l_He3TubeVisAtt);
128 G4ThreeVector He3endcapposTop = G4ThreeVector(
129 activeParams.
getLength(
"x_he3tube") * CLHEP::cm,
130 activeParams.
getLength(
"y_he3tube") * CLHEP::cm,
131 activeParams.
getLength(
"z_he3tube") * CLHEP::cm + activeParams.
getLength(
"tube_hz") * CLHEP::cm +
132 activeParams.
getLength(
"endcap_hz") * CLHEP::cm
135 G4ThreeVector He3endcapposBot = G4ThreeVector(
136 activeParams.
getLength(
"x_he3tube") * CLHEP::cm,
137 activeParams.
getLength(
"y_he3tube") * CLHEP::cm,
138 activeParams.
getLength(
"z_he3tube") * CLHEP::cm - activeParams.
getLength(
"tube_hz") * CLHEP::cm -
139 activeParams.
getLength(
"endcap_hz") * CLHEP::cm
142 new G4PVPlacement(rot_he3tube, He3endcapposTop, l_He3endcap,
"p_He3endcapTop", &topVolume,
false, 1);
143 new G4PVPlacement(rot_he3tube, He3endcapposBot, l_He3endcap,
"p_He3endcapBot", &topVolume,
false, 1);
146 G4double GasinnerRadius = 0.;
147 G4Tubs* s_iHe3Gas =
new G4Tubs(
"s_iHe3Gas",
149 activeParams.
getLength(
"tube_innerRadius")*CLHEP::cm,
150 activeParams.
getLength(
"tube_hz")*CLHEP::cm,
151 startAngle, spanningAngle);
154 G4LogicalVolume* l_iHe3Gas =
new G4LogicalVolume(s_iHe3Gas, gHe3,
"l_iHe3Gas");
155 l_iHe3Gas->SetVisAttributes(l_He3TubeVisAtt);
157 new G4PVPlacement(rot_he3tube, He3TUBEpos, l_iHe3Gas,
"p_iHe3Gas", &topVolume,
false, 1);
160 G4Tubs* s_He3Gas =
new G4Tubs(
"s_He3Gas",
162 activeParams.
getLength(
"gas_outerRadius")*CLHEP::cm,
163 activeParams.
getLength(
"gas_hz")*CLHEP::cm,
164 startAngle, spanningAngle);
166 G4LogicalVolume* l_He3Gas =
new G4LogicalVolume(s_He3Gas, gHe3,
"l_He3Gas", 0,
m_sensitive);
167 l_He3Gas->SetVisAttributes(l_He3TubeVisAtt);
169 l_He3Gas->SetUserLimits(
new G4UserLimits(stepSize));
171 new G4PVPlacement(0, G4ThreeVector(0, 0, activeParams.
getLength(
"SV_offset_inZ")*CLHEP::cm), l_He3Gas,
"p_He3Gas", l_iHe3Gas,
false,
173 B2INFO(
"HE3-tube-Sensitive-Volume-" << detID <<
" placed at: (" << He3TUBEpos.getX() <<
"," << He3TUBEpos.getY() <<
"," <<
174 He3TUBEpos.getZ() + activeParams.
getLength(
"SV_offset_inZ")*CLHEP::cm <<
") mm");