8 #include "G4SystemOfUnits.hh"
40 edm::LogError(
"SimG4CoreGeometry") <<
" DDG4SolidConverter::convert(..) found an undefined DDSolid "
43 "DDG4SolidConverter::convert(..) found an undefined DDSolid " + solid.
toString());
45 G4VSolid *
result =
nullptr;
49 result = it->second(solid);
52 <<
"DDG4SolidConverter::convert: conversion failed for s=" << solid
60 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: box = " << solid;
61 return new G4Box(solid.
name().
name(), (*par_)[0], (*par_)[1], (*par_)[2]);
66 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: tubs = " << solid;
67 return new G4Tubs(solid.
name().
name(),
75 #include "G4CutTubs.hh"
77 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: tubs = " << solid;
78 return new G4CutTubs(solid.
name().
name(),
84 G4ThreeVector((*par_)[5], (*par_)[6], (*par_)[7]),
85 G4ThreeVector((*par_)[8], (*par_)[9], (*par_)[10]));
90 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: trap = " << solid;
91 return new G4Trap(solid.
name().
name(),
107 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: cons = " << solid;
108 return new G4Cons(solid.
name().
name(),
118 #include "G4Polycone.hh"
120 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pcon_rz = " << solid;
121 std::vector<double>
r;
122 std::vector<double>
z;
123 std::vector<double>::const_iterator
i = (*par_).begin() + 2;
125 for (; i != (*par_).end(); ++
i) {
133 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0] / CLHEP::deg <<
" ep=" << (*par_)[1] / CLHEP::deg;
142 return new G4Polycone(solid.
name().
name(),
151 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pcon_rrz = " << solid;
152 std::vector<double> z_p;
153 std::vector<double> rmin_p;
154 std::vector<double> rmax_p;
155 std::vector<double>::const_iterator
i =
par_->begin() + 2;
157 for (; i !=
par_->end(); ++
i) {
162 rmin_p.push_back(*i);
165 rmax_p.push_back(*i);
168 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0] / CLHEP::deg <<
" ep=" << (*par_)[1] / CLHEP::deg;
178 return new G4Polycone(solid.
name().
name(),
187 #include "G4Polyhedra.hh"
189 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: phed_rz = " << solid;
190 std::vector<double>
r;
191 std::vector<double>
z;
192 std::vector<double>::const_iterator
i =
par_->begin() + 3;
195 for (; i !=
par_->end(); ++
i) {
202 return new G4Polyhedra(solid.
name().
name(),
212 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: phed_rrz = " << solid;
213 std::vector<double> z_p;
214 std::vector<double> rmin_p;
215 std::vector<double> rmax_p;
216 std::vector<double>::const_iterator
i =
par_->begin() + 3;
218 for (; i !=
par_->end(); ++
i) {
223 rmin_p.push_back(*i);
226 rmax_p.push_back(*i);
229 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0] / CLHEP::deg <<
" ep=" << (*par_)[1] / CLHEP::deg;
230 return new G4Polyhedra(solid.
name().
name(),
240 #include "G4ExtrudedSolid.hh"
242 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: extr_pgon = " << solid;
250 std::vector<G4TwoVector> polygon;
251 std::vector<G4ExtrudedSolid::ZSection> zsections;
252 for (
unsigned int it = 0; it < x.size(); ++it)
253 polygon.emplace_back(x[it], y[it]);
254 for (
unsigned int it = 0; it < z.size(); ++it)
255 zsections.emplace_back(z[it], G4TwoVector(zx[it], zy[it]), zs[it]);
256 return new G4ExtrudedSolid(solid.
name().
name(), polygon, zsections);
259 #include "G4Torus.hh"
261 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: torus = " << solid;
262 return new G4Torus(solid.
name().
name(),
270 #include "G4UnionSolid.hh"
273 G4UnionSolid *us =
nullptr;
282 std::vector<double> tdbl(9);
284 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
286 us =
new G4UnionSolid(solid.
name().
name(), sa, sb,
new CLHEP::HepRotation(temprep), temphvec);
292 #include "G4SubtractionSolid.hh"
295 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: subtraction = " << solid;
296 G4SubtractionSolid *us =
nullptr;
303 std::vector<double> tdbl(9);
305 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
307 us =
new G4SubtractionSolid(solid.
name().
name(), sa, sb,
new CLHEP::HepRotation(temprep), temphvec);
312 #include "G4IntersectionSolid.hh"
314 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: intersection = " << solid;
315 G4IntersectionSolid *us =
nullptr;
322 std::vector<double> tdbl(9);
324 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
326 us =
new G4IntersectionSolid(solid.
name().
name(), sa, sb,
new CLHEP::HepRotation(temprep), temphvec);
333 if (
nullptr ==
rot) {
334 rot =
new G4RotationMatrix;
335 rot->rotateX(90. * deg);
338 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pseudoTrap = " << solid;
339 G4Trd *
trap =
nullptr;
340 G4Tubs *
tubs =
nullptr;
341 G4VSolid *
result =
nullptr;
347 bool intersec =
false;
353 double openingAngle = 2. * asin(x /
std::abs(r));
355 double displacement = 0;
362 h = pt.
y1() < pt.
y2() ? pt.
y2() : pt.
y1();
366 startPhi = 270. * deg - openingAngle / 2.;
369 startPhi = 90. * deg - openingAngle / 2.;
371 }
else if (r > 0 &&
std::abs(r) >= x) {
374 startPhi = 90. * deg - openingAngle / 2.;
378 startPhi = 270. * deg - openingAngle / 2.;
382 throw cms::Exception(
"DetectorDescriptionFault",
"Check parameters of the PseudoTrap! name=" + pt.
name().
name());
384 G4ThreeVector displ(0., 0.,
386 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDSolidConverter::pseudotrap(): displacement=" << displacement
387 <<
" openingAngle=" << openingAngle / deg <<
" x=" << x <<
" h=" <<
h;
391 trap =
new G4Trd(name, pt.
x1(), pt.
x2(), pt.
y1(), pt.
y2(), pt.
halfZ());
392 tubs =
new G4Tubs(name,
399 result =
new G4SubtractionSolid(name, trap, tubs,
rot, displ);
401 G4VSolid *tubicCap =
new G4SubtractionSolid(
402 name, tubs,
new G4Box(name, 1.1 * x,
sqrt(r * r - x * x), 1.1 * h),
nullptr, G4ThreeVector());
403 result =
new G4UnionSolid(name, trap, tubicCap,
rot, displ);
423 if (rIn <= 0 || rOut <= 0 || cutAtStart <= 0 || cutAtDelta <= 0) {
425 "DetectorDescriptionFault",
432 if (startPhi != 0.) {
438 double r(cutAtStart),
R(cutAtDelta);
439 G4VSolid *
result(
nullptr);
440 G4VSolid *
tubs =
new G4Tubs(name, rIn, rOut, zHalf, startPhi,
deltaPhi);
441 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"G4Tubs: " << rIn / CLHEP::cm <<
' ' << rOut / CLHEP::cm <<
' '
442 << zHalf / CLHEP::cm <<
' ' << startPhi / CLHEP::deg <<
' '
450 double boxZ(1.1 * zHalf);
455 double cos_alpha = cath / hypo;
457 double alpha = -acos(cos_alpha);
460 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"al=" << acos(cath / hypo) / CLHEP::deg;
462 <<
"r=" <<
r / CLHEP::cm <<
"\n"
463 <<
"R=" << R / CLHEP::cm;
468 G4RotationMatrix *
rot =
new G4RotationMatrix;
469 rot->rotateZ(-alpha);
480 G4ThreeVector trans(xBox, 0., 0.);
483 G4VSolid *
box =
new G4Box(name, boxX, boxY, boxZ);
484 result =
new G4SubtractionSolid(name, tubs, box, rot, trans);
489 #include "G4Sphere.hh"
491 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: sphere = " << solid;
493 return new G4Sphere(solid.
name().
name(),
502 #include "G4EllipticalTube.hh"
504 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: ellipticaltube = " << solid;
Log< level::Info, true > LogVerbatim
double cutAtStart(void) const
truncation at begin of the tube-section
static G4VSolid * polyhedra_rrz(const DDSolid &)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
static G4RotationMatrix * rot
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
A truncated tube section.
double zHalf(void) const
half of the z-Axis
double y2(void) const
half length along y on +z
double startTheta(void) const
double deltaPhi(void) const
angular span of the tube-section
double deltaPhi(void) const
static G4VSolid * trap(const DDSolid &)
Sin< T >::type sin(const T &t)
static G4VSolid * cons(const DDSolid &)
double cutAtDelta(void) const
truncation at end of the tube-section
static G4VSolid * tubs(const DDSolid &)
double rIn(void) const
inner radius
static G4VSolid * sphere(const DDSolid &)
DDTranslation translation(void) const
Log< level::Error, false > LogError
double innerRadius(void) const
A DDSolid represents the shape of a part.
double y1(void) const
half length along y on -z
DDSolid solidB(void) const
static G4VSolid * cuttubs(const DDSolid &)
double outerRadius(void) const
static const char *const name(DDSolidShape s)
static G4VSolid * pseudotrap(const DDSolid &s)
DDRotation rotation(void) const
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
double halfZ(void) const
half of the z-Axis
static const std::vector< double > * par_
double xSemiAxis(void) const
Cos< T >::type cos(const T &t)
const std::string fullname() const
double startPhi(void) const
Abs< T >::type abs(const T &t)
DDSolidShape shape(void) const
The type of the solid.
double deltaTheta(void) const
static G4VSolid * box(const DDSolid &)
double ySemiAxis(void) const
DDSolid solidA(void) const
std::string toString() const
static G4VSolid * ellipticaltube(const DDSolid &)
static G4VSolid * polycone_rz(const DDSolid &)
static G4VSolid * intersection(const DDSolid &)
G4VSolid * convert(const DDSolid &)
double startPhi(void) const
angular start of the tube-section
static G4VSolid * unionsolid(const DDSolid &)
static G4VSolid * extrudedpolygon(const DDSolid &)
std::map< DDSolidShape, FNPTR > convDispatch_
static G4VSolid * trunctubs(const DDSolid &)
double zHeight(void) const
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
static G4VSolid * torus(const DDSolid &)
static G4VSolid * polyhedra_rz(const DDSolid &)
static G4VSolid * polycone_rrz(const DDSolid &)
double x2(void) const
half length along x on +z
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
double rOut(void) const
outer radius
const std::string & name() const
Returns the name.
double x1(void) const
half length along x on -z
static G4VSolid * subtraction(const DDSolid &)
double radius(void) const
radius of the cut-out (neg.) or rounding (pos.)