9 #include "G4SystemOfUnits.hh" 43 edm::LogError(
"SimG4CoreGeometry") <<
" DDG4SolidConverter::convert(..) found an undefined DDSolid " 46 "DDG4SolidConverter::convert(..) found an undefined DDSolid " + solid.
toString());
48 G4VSolid *
result =
nullptr;
52 result = it->second(solid);
55 <<
"DDG4SolidConverter::convert: conversion failed for s=" << solid
63 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: box = " << solid;
64 return new G4Box(solid.
name().
name(), (*par_)[0], (*par_)[1], (*par_)[2]);
69 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: tubs = " << solid;
70 return new G4Tubs(solid.
name().
name(),
78 #include "G4CutTubs.hh" 80 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: tubs = " << solid;
81 return new G4CutTubs(solid.
name().
name(),
93 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: trap = " << solid;
94 return new G4Trap(solid.
name().
name(),
110 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: cons = " << solid;
111 return new G4Cons(solid.
name().
name(),
121 #include "G4Polycone.hh" 123 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pcon_rz = " << solid;
124 std::vector<double>
r;
125 std::vector<double>
z;
126 std::vector<double>::const_iterator
i = (*par_).begin() + 2;
128 for (;
i != (*par_).end(); ++
i) {
136 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0] / CLHEP::deg <<
" ep=" << (*par_)[1] / CLHEP::deg;
138 G4cout <<
"### Polycone_RZ: " 139 <<
"sp=" << (*par_)[0] / CLHEP::deg <<
" ep=" << (*par_)[1] / CLHEP::deg <<
" N= " <<
count << G4endl;
141 G4cout <<
" R= " <<
r[
i] <<
" Z= " <<
z[
i] << G4endl;
144 return new G4Polycone(solid.
name().
name(),
153 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pcon_rrz = " << solid;
154 std::vector<double> z_p;
155 std::vector<double> rmin_p;
156 std::vector<double> rmax_p;
157 std::vector<double>::const_iterator
i =
par_->begin() + 2;
159 for (;
i !=
par_->end(); ++
i) {
164 rmin_p.push_back(*
i);
167 rmax_p.push_back(*
i);
170 edm::LogVerbatim(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0] / CLHEP::deg <<
" ep=" << (*par_)[1] / CLHEP::deg;
172 G4cout <<
"### Polycone_RRZ: " 173 <<
"sp=" << (*par_)[0] / CLHEP::deg <<
" ep=" << (*par_)[1] / CLHEP::deg <<
" N= " <<
count << G4endl;
175 G4cout <<
" R1= " << rmin_p[
i] <<
" R1= " << rmax_p[
i] <<
" Z= " << z_p[
i] << G4endl;
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;
280 edm::LogVerbatim(
"SimG4CoreGeometry") <<
" name:" << solid.
name() <<
" t=" <<
bs.translation() << std::flush;
281 edm::LogVerbatim(
"SimG4CoreGeometry") <<
" " <<
bs.rotation().rotation().Inverse() << std::flush;
282 std::vector<double> tdbl(9);
283 bs.rotation().rotation().Inverse().GetComponents(tdbl.begin(), tdbl.end());
284 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
285 CLHEP::Hep3Vector temphvec(
bs.translation().X(),
bs.translation().Y(),
bs.translation().Z());
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;
301 edm::LogVerbatim(
"SimG4CoreGeometry") <<
" name:" << solid.
name() <<
" t=" <<
bs.translation() << std::flush;
302 edm::LogVerbatim(
"SimG4CoreGeometry") <<
" " <<
bs.rotation().rotation().Inverse() << std::flush;
303 std::vector<double> tdbl(9);
304 bs.rotation().rotation().Inverse().GetComponents(tdbl.begin(), tdbl.end());
305 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
306 CLHEP::Hep3Vector temphvec(
bs.translation().X(),
bs.translation().Y(),
bs.translation().Z());
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;
320 edm::LogVerbatim(
"SimG4CoreGeometry") <<
" name:" << solid.
name() <<
" t=" <<
bs.translation() << std::flush;
321 edm::LogVerbatim(
"SimG4CoreGeometry") <<
" " <<
bs.rotation().rotation().Inverse() << std::flush;
322 std::vector<double> tdbl(9);
323 bs.rotation().rotation().Inverse().GetComponents(tdbl.begin(), tdbl.end());
324 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
325 CLHEP::Hep3Vector temphvec(
bs.translation().X(),
bs.translation().Y(),
bs.translation().Z());
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;
343 double r =
pt.radius();
344 bool atMinusZ =
pt.atMinusZ();
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();
365 displacement = -
pt.halfZ() -
delta;
366 startPhi = 270. * deg - openingAngle / 2.;
368 displacement =
pt.halfZ() +
delta;
369 startPhi = 90. * deg - openingAngle / 2.;
373 displacement = -
pt.halfZ() +
delta;
374 startPhi = 90. * deg - openingAngle / 2.;
377 displacement =
pt.halfZ() -
delta;
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;
401 G4VSolid *tubicCap =
new G4SubtractionSolid(
417 double rIn(
tt.rIn()), rOut(
tt.rOut()), zHalf(
tt.zHalf()), startPhi(
tt.startPhi()),
deltaPhi(
tt.deltaPhi()),
418 cutAtStart(
tt.cutAtStart()), cutAtDelta(
tt.cutAtDelta());
419 bool cutInside(
bool(
tt.cutInside()));
423 if (rIn <= 0 || rOut <= 0 || cutAtStart <= 0 || cutAtDelta <= 0) {
425 "DetectorDescriptionFault",
426 "TruncTubs " +
std::string(
tt.name().fullname()) +
": 0 <= rIn,cutAtStart,rOut,cutAtDelta,rOut violated!");
430 "TruncTubs " +
std::string(
tt.name().fullname()) +
": rIn<rOut violated!");
432 if (startPhi != 0.) {
434 "TruncTubs " +
std::string(
tt.name().fullname()) +
": startPhi != 0 not supported!");
438 double r(cutAtStart),
R(cutAtDelta);
439 G4VSolid *
result(
nullptr);
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;
480 G4ThreeVector trans(xBox, 0., 0.);
483 G4VSolid *
box =
new G4Box(
name, boxX, boxY, boxZ);
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
static G4VSolid * polyhedra_rrz(const DDSolid &)
double zHeight(void) const
static G4RotationMatrix * rot
A truncated tube section.
double outerRadius(void) const
static G4VSolid * trap(const DDSolid &)
Sin< T >::type sin(const T &t)
double deltaPhi(void) const
static G4VSolid * cons(const DDSolid &)
double ySemiAxis(void) const
double innerRadius(void) const
static G4VSolid * tubs(const DDSolid &)
static G4VSolid * sphere(const DDSolid &)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Log< level::Error, false > LogError
A DDSolid represents the shape of a part.
static G4VSolid * cuttubs(const DDSolid &)
double startTheta(void) const
static const char *const name(DDSolidShape s)
const std::string & name() const
Returns the name.
static G4VSolid * pseudotrap(const DDSolid &s)
static const std::vector< double > * par_
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
static G4VSolid * box(const DDSolid &)
std::string toString() const
DDSolidShape shape(void) const
The type of the solid.
double deltaTheta(void) const
static G4VSolid * ellipticaltube(const DDSolid &)
static G4VSolid * polycone_rz(const DDSolid &)
static G4VSolid * intersection(const DDSolid &)
G4VSolid * convert(const DDSolid &)
static G4VSolid * unionsolid(const DDSolid &)
static G4VSolid * extrudedpolygon(const DDSolid &)
std::map< DDSolidShape, FNPTR > convDispatch_
static G4VSolid * trunctubs(const DDSolid &)
double xSemiAxis(void) const
static G4VSolid * torus(const DDSolid &)
static G4VSolid * polyhedra_rz(const DDSolid &)
static G4VSolid * polycone_rrz(const DDSolid &)
double startPhi(void) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static G4VSolid * subtraction(const DDSolid &)