45 edm::LogError(
"SimG4CoreGeometry") <<
" DDG4SolidConverter::convert(..) found an undefined DDSolid " << s.
toString();
46 throw cms::Exception(
"SimG4CoreGeometry",
"DDG4SolidConverter::convert(..) found an undefined DDSolid " + s.
toString());
50 map<DDSolidShape,FNPTR>::iterator it = convDispatch_.find(s.
shape());
51 if (it != convDispatch_.end()) {
52 result = it->second(s);
56 <<
"DDG4SolidConverter::convert: conversion failed for s=" << s
57 <<
"\n solid.shape()=" << s.
shape()
67 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: box = " <<
s ;
68 return new G4Box(s.
name().
name(), (*par_)[0],(*par_)[1],(*par_)[2]);
75 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: tubs = " <<
s ;
76 return new G4Tubs(s.
name().
name(), (*par_)[1],
87 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: trap = " <<
s ;
88 return new G4Trap(s.
name().
name(), (*par_)[0],
105 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: cons = " <<
s ;
106 return new G4Cons(s.
name().
name(), (*par_)[1],
116 #include "G4Polycone.hh"
119 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pcon_rz = " <<
s ;
122 vector<double>::const_iterator
i = (*par_).begin()+2;
124 for(; i!=(*par_).end(); ++
i) {
125 LogDebug(
"SimG4CoreGeometry") <<
"z=" << *
i ;
126 z.push_back(*i); ++
i;
127 LogDebug(
"SimG4CoreGeometry") <<
" r=" << *
i ;
131 LogDebug(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0]/deg <<
" ep=" << (*par_)[1]/deg ;
132 return new G4Polycone(s.
name().
name(), (*par_)[0], (*par_)[1],
141 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pcon_rrz = " <<
s ;
143 vector<double> rmin_p;
144 vector<double> rmax_p;
145 vector<double>::const_iterator
i = par_->begin()+2;
147 for (; i!=par_->end(); ++
i) {
148 LogDebug(
"SimG4CoreGeometry") <<
"z=" << *
i ;
149 z_p.push_back(*i); ++
i;
150 LogDebug(
"SimG4CoreGeometry") <<
"rmin=" << *
i ;
151 rmin_p.push_back(*i); ++
i;
152 LogDebug(
"SimG4CoreGeometry") <<
"rmax=" << *
i ;
153 rmax_p.push_back(*i);
156 LogDebug(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0]/deg <<
" ep=" << (*par_)[1]/deg ;
157 return new G4Polycone(s.
name().
name(), (*par_)[0], (*par_)[1],
166 #include "G4Polyhedra.hh"
169 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: phed_rz = " <<
s ;
172 vector<double>::const_iterator
i = par_->begin()+3;
175 for(; i!=par_->end(); ++
i) {
176 z.push_back(*i); ++
i;
181 return new G4Polyhedra(s.
name().
name(), (*par_)[1], (*par_)[2], int((*par_)[0]),
190 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: phed_rrz = " <<
s ;
192 vector<double> rmin_p;
193 vector<double> rmax_p;
194 vector<double>::const_iterator
i = par_->begin()+3;
196 for (; i!=par_->end(); ++
i) {
197 LogDebug(
"SimG4CoreGeometry") <<
"z=" << *
i ;
198 z_p.push_back(*i); ++
i;
199 LogDebug(
"SimG4CoreGeometry") <<
"rmin=" << *
i ;
200 rmin_p.push_back(*i); ++
i;
201 LogDebug(
"SimG4CoreGeometry") <<
"rmax=" << *
i ;
202 rmax_p.push_back(*i);
205 LogDebug(
"SimG4CoreGeometry") <<
"sp=" << (*par_)[0]/deg <<
" ep=" << (*par_)[1]/deg ;
206 return new G4Polyhedra(s.
name().
name(), (*par_)[1], (*par_)[2], int((*par_)[0]),
213 #include "G4Torus.hh"
216 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: torus = " <<
s ;
217 return new G4Torus(s.
name().
name(), (*par_)[0],
225 #include "G4ReflectedSolid.hh"
228 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: reflected = " <<
s ;
229 G4ReflectedSolid * rs = 0;
232 static HepGeom::ReflectZ3D z_reflection;
233 rs =
new G4ReflectedSolid(s.
name().
name(),
242 #include "G4UnionSolid.hh"
245 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: unionsolid = " << s.
name() ;
246 G4UnionSolid * us = 0;
255 std::vector<double> tdbl(9);
256 bs.
rotation().
rotation()->Inverse().GetComponents(tdbl.begin(), tdbl.end());
257 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
259 us =
new G4UnionSolid(s.
name().
name(),
262 new CLHEP::HepRotation(temprep),
270 #include "G4SubtractionSolid.hh"
274 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: subtraction = " <<
s ;
275 G4SubtractionSolid * us = 0;
285 std::vector<double> tdbl(9);
286 bs.
rotation().
rotation()->Inverse().GetComponents(tdbl.begin(), tdbl.end());
287 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
289 us =
new G4SubtractionSolid(s.
name().
name(),
292 new CLHEP::HepRotation(temprep),
299 #include "G4IntersectionSolid.hh"
302 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: intersection = " <<
s ;
303 G4IntersectionSolid * us = 0;
310 std::vector<double> tdbl(9);
311 bs.
rotation().
rotation()->Inverse().GetComponents(tdbl.begin(), tdbl.end());
312 CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
314 us =
new G4IntersectionSolid(s.
name().
name(),
317 new CLHEP::HepRotation(temprep),
327 static G4RotationMatrix *
rot = 0;
331 rot =
new G4RotationMatrix;
332 rot->rotateX(90.*deg);
335 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: pseudoTrap = " <<
s ;
344 bool intersec =
false;
351 double openingAngle = 2.*asin(x/
abs(r));
353 double displacement=0;
358 if (r < 0 &&
abs(r) >= x) {
360 h = pt.
y1() < pt.
y2() ? pt.
y2() : pt.
y1();
364 startPhi = 270.*deg - openingAngle/2.;
368 startPhi = 90.*deg - openingAngle/2.;
371 else if ( r > 0 &&
abs(r) >= x )
375 startPhi = 90.*deg - openingAngle/2.;
380 startPhi = 270.*deg - openingAngle/2.;
385 throw cms::Exception(
"DetectorDescriptionFault",
"Check parameters of the PseudoTrap! name=" + pt.
name().
name());
387 G4ThreeVector displ(0.,0.,displacement);
388 LogDebug(
"SimG4CoreGeometry") <<
"DDSolidConverter::pseudotrap(): displacement=" << displacement
389 <<
" openingAngle=" << openingAngle/deg <<
" x=" << x <<
" h=" <<
h;
393 trap =
new G4Trd(name, pt.
x1(), pt.
x2(), pt.
y1(), pt.
y2(), pt.
halfZ());
394 tubs =
new G4Tubs(name,
401 result =
new G4SubtractionSolid(name, trap, tubs, rot, displ);
405 G4VSolid * tubicCap =
new G4SubtractionSolid(name,
407 new G4Box(name, 1.1*x,
sqrt(r*r-x*x), 1.1*h),
410 result =
new G4UnionSolid(name, trap, tubicCap, rot, displ);
434 LogDebug(
"SimG4CoreGeometry") <<
"before";
436 LogDebug(
"SimG4CoreGeometry") <<
"after";
437 double rIn(tt.
rIn()), rOut(tt.
rOut()), zHalf(tt.
zHalf()),
444 if (rIn <= 0 || rOut <=0 || cutAtStart <=0 || cutAtDelta <= 0) {
445 throw cms::Exception(
"DetectorDescriptionFault",
"TruncTubs " +
string(tt.
name().
fullname()) +
": 0 <= rIn,cutAtStart,rOut,cutAtDelta,rOut violated!");
450 if (startPhi != 0.) {
451 throw cms::Exception(
"DetectorDescriptionFault",
"TruncTubs " +
string(tt.
name().
fullname()) +
": startPhi != 0 not supported!");
458 double r(cutAtStart),
R(cutAtDelta);
460 G4VSolid * tubs =
new G4Tubs(name,rIn,rOut,zHalf,startPhi,
deltaPhi);
461 LogDebug(
"SimG4CoreGeometry") <<
"G4Tubs: " << rIn <<
' ' << rOut <<
' ' << zHalf <<
' ' << startPhi/deg <<
' ' <<
deltaPhi/deg;
464 double boxX(30.*rOut), boxY(20.*rOut);
467 double boxZ(1.1*zHalf);
472 double cos_alpha = cath/hypo;
474 double alpha = -acos(cos_alpha);
475 LogDebug(
"SimG4CoreGeometry") <<
"cath=" << cath/
m;
476 LogDebug(
"SimG4CoreGeometry") <<
"hypo=" << hypo/
m;
477 LogDebug(
"SimG4CoreGeometry") <<
"al=" << acos(cath/hypo)/deg;
479 <<
"r=" <<
r/
m <<
"\n"
482 LogDebug(
"SimG4CoreGeometry") <<
"alpha=" << alpha/deg;
485 G4RotationMatrix *
rot =
new G4RotationMatrix;
486 rot->rotateZ(-alpha);
487 LogDebug(
"SimG4CoreGeometry") << (*rot);
494 xBox = -(boxY/
sin(
abs(alpha))-
r);
497 G4ThreeVector trans(xBox,0.,0.);
498 LogDebug(
"SimG4CoreGeometry") <<
"trans=" << trans;
500 G4VSolid * box =
new G4Box(name,boxX,boxY,boxZ);
501 result =
new G4SubtractionSolid(name,tubs,box,rot,trans);
507 #include "G4Sphere.hh"
510 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: sphere = " <<
s ;
523 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: orb = " <<
s ;
528 #include "G4EllipticalTube.hh"
531 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: ellipticaltube = " <<
s ;
533 return new G4EllipticalTube(s.
name().
name(),
539 #include "G4Ellipsoid.hh"
542 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: ellipsoid = " <<
s ;
544 return new G4Ellipsoid(s.
name().
name(),
555 LogDebug(
"SimG4CoreGeometry") <<
"DDG4SolidConverter: parallelepiped = " <<
s ;
double cutAtStart(void) const
truncation at begin of the tube-section
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
static G4VSolid * polyhedra_rrz(const DDSolid &)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
static const std::vector< double > * par_
double xSemiAxis(void) const
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
static G4VSolid * orb(const DDSolid &)
A truncated tube section.
double zHalf(void) const
half of the z-Axis
double y2(void) const
half length along y on +z
static G4VSolid * ellipsoid(const DDSolid &)
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 zTopCut(void) const
double radius(void) const
double rIn(void) const
inner radius
static G4VSolid * sphere(const DDSolid &)
DDTranslation translation(void) const
double ySemiAxis(void) const
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
double outerRadius(void) const
DDSolid unreflected(void) const
static G4VSolid * reflected(const DDSolid &)
DDRotation rotation(void) const
static const char * name(DDSolidShape s)
static G4VSolid * para(const DDSolid &)
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
double halfZ(void) const
half of the z-Axis
double xSemiAxis(void) const
Cos< T >::type cos(const T &t)
const std::string fullname() const
double startPhi(void) const
DDSolidShape shape(void) const
The type of the solid.
double deltaTheta(void) const
static G4VSolid * pseudotrap(const DDSolid &)
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 &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static G4VSolid * intersection(const DDSolid &)
G4VSolid * convert(const DDSolid &)
double startPhi(void) const
angular start of the tube-section
double zBottomCut(void) const
static G4VSolid * unionsolid(const DDSolid &)
static G4VSolid * trunctubs(const DDSolid &)
double zHeight(void) const
double zSemiAxis(void) const
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
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.)