25 std::unordered_map<std::string, G4Volume*>* g4s) {
37 if (thisG4Volume->getSolid() !=
nullptr)
return thisG4Volume->getSolid();
43 auto volume_copy =
gsystem +
"/" + copyOf;
45 if (thisG4Volume->getSolid() !=
nullptr)
return thisG4Volume->getSolid();
51 std::string type = s->
getType();
53 if (type ==
"G4Box") {
54 thisG4Volume->setSolid(
new G4Box(g4name,
59 return thisG4Volume->getSolid();
61 else if (type ==
"G4Tubs") {
62 thisG4Volume->setSolid(
new G4Tubs(g4name,
69 return thisG4Volume->getSolid();
71 else if (type ==
"G4Sphere") {
72 thisG4Volume->setSolid(
new G4Sphere(g4name,
80 return thisG4Volume->getSolid();
82 else if (type ==
"G4CutTubs") {
83 thisG4Volume->setSolid(
new G4CutTubs(g4name,
89 G4ThreeVector(pars[5], pars[6], pars[7]),
90 G4ThreeVector(pars[8], pars[9], pars[10])
92 return thisG4Volume->getSolid();
94 else if (type ==
"G4Cons") {
95 thisG4Volume->setSolid(
new G4Cons(g4name,
104 return thisG4Volume->getSolid();
106 else if (type ==
"G4Para") {
107 thisG4Volume->setSolid(
new G4Para(g4name,
118 return thisG4Volume->getSolid();
120 else if (type ==
"G4Trd") {
121 thisG4Volume->setSolid(
new G4Trd(g4name,
128 return thisG4Volume->getSolid();
130 else if (type ==
"G4Trap") {
132 if (pars.size() == 4) {
133 thisG4Volume->setSolid(
new G4Trap(g4name,
140 else if (pars.size() == 11) {
141 thisG4Volume->setSolid(
new G4Trap(g4name,
156 else if (pars.size() == 24) {
158 pt[0] = G4ThreeVector(pars[0], pars[1], pars[2]);
159 pt[1] = G4ThreeVector(pars[3], pars[4], pars[5]);
160 pt[2] = G4ThreeVector(pars[6], pars[7], pars[8]);
161 pt[3] = G4ThreeVector(pars[9], pars[10], pars[11]);
162 pt[4] = G4ThreeVector(pars[12], pars[13], pars[14]);
163 pt[5] = G4ThreeVector(pars[15], pars[16], pars[17]);
164 pt[6] = G4ThreeVector(pars[18], pars[19], pars[20]);
165 pt[7] = G4ThreeVector(pars[21], pars[22], pars[23]);
167 thisG4Volume->setSolid(
new G4Trap(g4name, pt),
log);
171 "The constructor of <", g4name,
"> must have 4, 11 or 24 parameters",
172 " see https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html");
174 return thisG4Volume->getSolid();
176 else if (type ==
"G4Polycone") {
177 double phistart = pars[0];
178 double phitotal = pars[1];
179 int zplanes =
static_cast<int>(pars[2]);
182 auto zPlane = std::make_unique<double[]>(zplanes);
183 auto rInner = std::make_unique<double[]>(zplanes);
184 auto rOuter = std::make_unique<double[]>(zplanes);
186 for (
int zpl = 0; zpl < zplanes; ++zpl) {
187 zPlane[zpl] = pars[3 + 0 * zplanes + zpl];
188 rInner[zpl] = pars[3 + 1 * zplanes + zpl];
189 rOuter[zpl] = pars[3 + 2 * zplanes + zpl];
192 thisG4Volume->setSolid(
new G4Polycone(g4name,
200 return thisG4Volume->getSolid();
204 "The constructor of <", g4name,
"> uses an unknown solid type <", type,
205 ">. See Geant4 manual for supported primitives.");