11 #include <beast/bgo/geometry/BgoCreator.h>
12 #include <beast/bgo/simulation/SensitiveDetector.h>
14 #include <geometry/CreatorFactory.h>
15 #include <framework/gearbox/GearDir.h>
16 #include <framework/logging/Logger.h>
18 #include <boost/format.hpp>
19 #include <boost/foreach.hpp>
20 #include <boost/algorithm/string.hpp>
22 #include <G4LogicalVolume.hh>
23 #include <G4PVPlacement.hh>
27 #include <G4UserLimits.hh>
28 #include "G4NistManager.hh"
31 using namespace boost;
44 geometry::CreatorFactory<BgoCreator>
BgoFactory(
"BGOCreator");
46 BgoCreator::BgoCreator(): m_sensitive(0)
51 BgoCreator::~BgoCreator()
59 G4NistManager* man = G4NistManager::Instance();
61 G4bool isotopes =
false;
63 G4Element* O = man->FindOrBuildElement(
"O" , isotopes);
64 G4Element* Bi = man->FindOrBuildElement(
"Bi", isotopes);
65 G4Element* Ge = man->FindOrBuildElement(
"Ge", isotopes);
67 G4Material* BGO_BGO =
new G4Material(
"BGO_BGO",
68 7.13 * CLHEP::g / CLHEP::cm3,
70 BGO_BGO->AddElement(O, 12);
71 BGO_BGO->AddElement(Bi, 4);
72 BGO_BGO->AddElement(Ge, 3);
75 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
79 vector<double> bar = content.getArray(
"bar");
80 B2INFO(
"Contents of bar: ");
81 BOOST_FOREACH(
double value, bar) {
82 B2INFO(
"value: " << value);
86 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
89 G4Trap* s_BGO =
new G4Trap(
"s_BGO",
90 activeParams.
getLength(
"cDz") / 2.*CLHEP::cm ,
93 activeParams.
getLength(
"cDy1") / 2.*CLHEP::cm ,
94 activeParams.
getLength(
"cDx2") / 2.*CLHEP::cm ,
95 activeParams.
getLength(
"cDx1") / 2.*CLHEP::cm , 0,
96 activeParams.
getLength(
"cDy2") / 2.*CLHEP::cm ,
97 activeParams.
getLength(
"cDx4") / 2.*CLHEP::cm ,
98 activeParams.
getLength(
"cDx3") / 2.*CLHEP::cm , 0);
101 G4LogicalVolume* l_BGO =
new G4LogicalVolume(s_BGO, BGO_BGO,
"l_BGO", 0,
m_sensitive);
107 l_BGO->SetUserLimits(
new G4UserLimits(stepSize));
121 double px = activeParams.
getDouble(
"px");
122 double py = activeParams.
getDouble(
"py");
123 double pz = activeParams.
getDouble(
"pz");
124 double angle = activeParams.
getDouble(
"angle");
125 double rx = activeParams.
getDouble(
"rx");
126 double ry = activeParams.
getDouble(
"ry");
127 double rz = activeParams.
getDouble(
"rz");
129 G4RotationMatrix* pRot =
new G4RotationMatrix();
130 pRot->rotate(-angle, G4ThreeVector(rx, ry, rz));
132 new G4PVPlacement(pRot, G4ThreeVector(px, py, pz), l_BGO,
"p_BGO", &topVolume,
false, detID);
134 B2INFO(
"BGO-" << detID <<
" placed at: (" << px <<
"," << py <<
"," << pz <<
")" <<
" mm ");
136 B2INFO(
" rotation of " << -angle <<
" degree a long (" << rx <<
"," << ry <<
"," << rz <<
") axis");