CMS 3D CMS Logo

DDG4SolidConverter.cc
Go to the documentation of this file.
2 #include "G4VSolid.hh"
3 
5 
8 #include "G4SystemOfUnits.hh"
9 
10 const std::vector<double> * DDG4SolidConverter::par_ = nullptr;
11 G4RotationMatrix* DDG4SolidConverter::rot = nullptr;
12 
14  // could also be done 'dynamically' from outside
15  // would then need to have a 'register' method ...
37 }
38 
40 
41 G4VSolid * DDG4SolidConverter::convert(const DDSolid & solid) {
42  if ( !solid ) {
43  edm::LogError("SimG4CoreGeometry") <<" DDG4SolidConverter::convert(..) found an undefined DDSolid " << solid.toString();
44  throw cms::Exception("SimG4CoreGeometry", "DDG4SolidConverter::convert(..) found an undefined DDSolid " + solid.toString());
45  }
46  G4VSolid * result = nullptr;
47  par_ = &(solid.parameters());
48  std::map<DDSolidShape,FNPTR>::iterator it = convDispatch_.find(solid.shape());
49  if (it != convDispatch_.end()) {
50  result = it->second(solid);
51  } else {
52  throw cms::Exception("DetectorDescriptionFault")
53  << "DDG4SolidConverter::convert: conversion failed for s=" << solid
54  << "\n solid.shape()=" << solid.shape()
55  << std::endl;
56  }
57  return result;
58 }
59 
60 
61 #include "G4Box.hh"
62 G4VSolid * DDG4SolidConverter::box(const DDSolid & solid) {
63  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: box = " << solid;
64  return new G4Box(solid.name().name(), (*par_)[0],(*par_)[1],(*par_)[2]);
65 }
66 
67 
68 #include "G4Tubs.hh"
69 G4VSolid * DDG4SolidConverter::tubs(const DDSolid & solid) {
70  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: tubs = " << solid;
71  return new G4Tubs(solid.name().name(), (*par_)[1], // rmin
72  (*par_)[2], // rmax
73  (*par_)[0], // dzHalf
74  (*par_)[3], // phiStart
75  (*par_)[4]);// deltaPhi
76 }
77 
78 #include "G4CutTubs.hh"
79 G4VSolid * DDG4SolidConverter::cuttubs(const DDSolid & solid) {
80  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: tubs = " << solid;
81  return new G4CutTubs(solid.name().name(), (*par_)[1], // rmin
82  (*par_)[2], // rmax
83  (*par_)[0], // dzHalf
84  (*par_)[3], // phiStart
85  (*par_)[4], // deltaPhi
86  G4ThreeVector((*par_)[5],(*par_)[6],(*par_)[7]),
87  G4ThreeVector((*par_)[8],(*par_)[9],(*par_)[10]));
88 }
89 
90 
91 #include "G4Trap.hh"
92 G4VSolid * DDG4SolidConverter::trap(const DDSolid & solid) {
93  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: trap = " << solid;
94  return new G4Trap(solid.name().name(), (*par_)[0], // pDz
95  (*par_)[1], // theta
96  (*par_)[2], // phi
97  (*par_)[3], // y1
98  (*par_)[4], // x1
99  (*par_)[5], // x2
100  (*par_)[6], // alpha1
101  (*par_)[7], // y2
102  (*par_)[8], // x3
103  (*par_)[9], // x4
104  (*par_)[10]);// alpha2
105 }
106 
107 
108 #include "G4Cons.hh"
109 G4VSolid * DDG4SolidConverter::cons(const DDSolid & solid) {
110  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: cons = " << solid;
111  return new G4Cons(solid.name().name(), (*par_)[1], // rmin -z
112  (*par_)[2], // rmax -z
113  (*par_)[3], // rmin +z
114  (*par_)[4], // rmax +z
115  (*par_)[0], // zHalf
116  (*par_)[5], // phistart
117  (*par_)[6]); // deltaphi
118 }
119 
120 
121 #include "G4Polycone.hh"
122 G4VSolid * DDG4SolidConverter::polycone_rz(const DDSolid & solid) {
123  LogDebug("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;
127  int count=0;
128  for(; i!=(*par_).end(); ++i) {
129  LogDebug("SimG4CoreGeometry") << " z=" << *i/CLHEP::cm;
130  z.push_back(*i); ++i;
131  LogDebug("SimG4CoreGeometry") << " r=" << *i/CLHEP::cm;
132  r.push_back(*i);
133  count++;
134  }
135  LogDebug("SimG4CoreGeometry") << "sp=" << (*par_)[0]/CLHEP::deg << " ep="
136  << (*par_)[1]/CLHEP::deg;
137  /*
138  std::cout << "### Polycone_RZ: " << "sp=" << (*par_)[0]/CLHEP::deg
139  << " ep=" << (*par_)[1]/CLHEP::deg
140  << " N= " << count << std::endl;
141  for(int i=0; i<count; ++i) {
142  std::cout << " R= " << r[i] << " Z= " << z[i] << std::endl;
143  }
144  */
145  return new G4Polycone(solid.name().name(), (*par_)[0], (*par_)[1], // start,delta-phi
146  count, // numRZ
147  &(r[0]),
148  &(z[0]));
149 }
150 
151 
152 G4VSolid * DDG4SolidConverter::polycone_rrz(const DDSolid & solid) {
153  LogDebug("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;
158  int count = 0;
159  for (; i!=par_->end(); ++i) {
160  LogDebug("SimG4CoreGeometry") << "z=" << *i/CLHEP::cm;
161  z_p.push_back(*i); ++i;
162  LogDebug("SimG4CoreGeometry") << "rmin=" << *i/CLHEP::cm;
163  rmin_p.push_back(*i); ++i;
164  LogDebug("SimG4CoreGeometry") << "rmax=" << *i/CLHEP::cm;
165  rmax_p.push_back(*i);
166  count++;
167  }
168  LogDebug("SimG4CoreGeometry") << "sp=" << (*par_)[0]/CLHEP::deg << " ep="
169  << (*par_)[1]/CLHEP::deg;
170  /*
171  std::cout << "### Polycone_RRZ: " << "sp=" << (*par_)[0]/CLHEP::deg
172  << " ep=" << (*par_)[1]/CLHEP::deg
173  << " N= " << count << std::endl;
174  for(int i=0; i<count; ++i) {
175  std::cout << " R1= " << rmin_p[i] << " R1= " << rmax_p[i] << " Z= " << z_p[i] << std::endl;
176  }
177  */
178  return new G4Polycone(solid.name().name(), (*par_)[0], (*par_)[1], // start,delta-phi
179  count, // sections
180  &(z_p[0]),
181  &(rmin_p[0]),
182  &(rmax_p[0]));
183 
184 }
185 
186 
187 #include "G4Polyhedra.hh"
188 G4VSolid * DDG4SolidConverter::polyhedra_rz(const DDSolid & solid) {
189  LogDebug("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;
193  int count=0;
194 
195  for(; i!=par_->end(); ++i) {
196  z.push_back(*i); ++i;
197  r.push_back(*i);
198  count++;
199  }
200 
201  return new G4Polyhedra(solid.name().name(), (*par_)[1], (*par_)[2], int((*par_)[0]),// start,delta-phi;sides
202  count, // numRZ
203  &(r[0]),
204  &(z[0]));
205 }
206 
207 
208 G4VSolid * DDG4SolidConverter::polyhedra_rrz(const DDSolid & solid) {
209  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: phed_rrz = " << solid;
210  std::vector<double> z_p;
211  std::vector<double> rmin_p;
212  std::vector<double> rmax_p;
213  std::vector<double>::const_iterator i = par_->begin()+3;
214  int count = 0;
215  for (; i!=par_->end(); ++i) {
216  LogDebug("SimG4CoreGeometry") << "z=" << *i/CLHEP::cm;
217  z_p.push_back(*i); ++i;
218  LogDebug("SimG4CoreGeometry") << "rmin=" << *i/CLHEP::cm;
219  rmin_p.push_back(*i); ++i;
220  LogDebug("SimG4CoreGeometry") << "rmax=" << *i/CLHEP::cm;
221  rmax_p.push_back(*i);
222  count++;
223  }
224  LogDebug("SimG4CoreGeometry") << "sp=" << (*par_)[0]/CLHEP::deg << " ep="
225  << (*par_)[1]/CLHEP::deg;
226  return new G4Polyhedra(solid.name().name(), (*par_)[1], (*par_)[2], int((*par_)[0]), // start,delta-phi,sides
227  count, // sections
228  &(z_p[0]),
229  &(rmin_p[0]),
230  &(rmax_p[0]));
231 }
232 
233 #include "G4Torus.hh"
234 G4VSolid * DDG4SolidConverter::torus(const DDSolid & solid) {
235  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: torus = " << solid;
236  return new G4Torus(solid.name().name(), (*par_)[0], // rmin
237  (*par_)[1], // rmax
238  (*par_)[2], // Rtor
239  (*par_)[3], // phiStart
240  (*par_)[4]);// deltaPhi
241 }
242 
243 
244 #include "G4ReflectedSolid.hh"
245 
246 namespace {
247  static const HepGeom::ReflectZ3D z_reflection;
248 }
249 
250 G4VSolid * DDG4SolidConverter::reflected(const DDSolid & solid) {
251  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: reflected = " << solid;
252  G4ReflectedSolid * rs = 0;
253  DDReflectionSolid rfs(solid);
254  if (rfs) {
255  rs = new G4ReflectedSolid(solid.name().name(),
256  DDG4SolidConverter().convert(rfs.unreflected()),
257  z_reflection);
258 
259  } // else ?
260  return rs;
261 }
262 
263 
264 #include "G4UnionSolid.hh"
265 G4VSolid * DDG4SolidConverter::unionsolid(const DDSolid & solid) {
266  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: unionsolid = " << solid.name();
267  G4UnionSolid * us = 0;
268  DDBooleanSolid bs(solid);
269  if (bs) {
270  LogDebug("SimG4CoreGeometry") << "SolidA=" << bs.solidA();
271  G4VSolid * sa = DDG4SolidConverter().convert(bs.solidA());
272  LogDebug("SimG4CoreGeometry") << "SolidB=" << bs.solidB();
273  G4VSolid * sb = DDG4SolidConverter().convert(bs.solidB());
274  LogDebug("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush;
275  LogDebug("SimG4CoreGeometry") << " " << bs.rotation().rotation()->Inverse() << std::flush;
276  std::vector<double> tdbl(9);
277  bs.rotation().rotation()->Inverse().GetComponents(tdbl.begin(), tdbl.end());
278  CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
279  CLHEP::Hep3Vector temphvec(bs.translation().X(), bs.translation().Y(), bs.translation().Z());
280  us = new G4UnionSolid(solid.name().name(),
281  sa,
282  sb,
283  new CLHEP::HepRotation(temprep),
284  temphvec);
285 
286  } // else?
287  return us;
288 }
289 
290 
291 #include "G4SubtractionSolid.hh"
292 #include <sstream>
293 G4VSolid * DDG4SolidConverter::subtraction(const DDSolid & solid) {
294  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: subtraction = " << solid;
295  G4SubtractionSolid * us = 0;
296  DDBooleanSolid bs(solid);
297  if (bs) {
298  G4VSolid * sa = DDG4SolidConverter().convert(bs.solidA());
299  G4VSolid * sb = DDG4SolidConverter().convert(bs.solidB());
300  LogDebug("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush;
301  // stringstream sst;
302  // bs.rotation().rotation()->inverse().print(sst);
303  // LogDebug("SimG4CoreGeometry") << " " << sst.str() << std::flush;
304  LogDebug("SimG4CoreGeometry") << " " << bs.rotation().rotation()->Inverse() << std::flush;
305  std::vector<double> tdbl(9);
306  bs.rotation().rotation()->Inverse().GetComponents(tdbl.begin(), tdbl.end());
307  CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
308  CLHEP::Hep3Vector temphvec(bs.translation().X(), bs.translation().Y(), bs.translation().Z());
309  us = new G4SubtractionSolid(solid.name().name(),
310  sa,
311  sb,
312  new CLHEP::HepRotation(temprep),
313  temphvec);
314  }
315  return us;
316 }
317 
318 
319 #include "G4IntersectionSolid.hh"
320 G4VSolid * DDG4SolidConverter::intersection(const DDSolid & solid) {
321  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: intersection = " << solid;
322  G4IntersectionSolid * us = 0;
323  DDBooleanSolid bs(solid);
324  if (bs) {
325  G4VSolid * sa = DDG4SolidConverter().convert(bs.solidA());
326  G4VSolid * sb = DDG4SolidConverter().convert(bs.solidB());
327  LogDebug("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush;
328  LogDebug("SimG4CoreGeometry") << " " << bs.rotation().rotation()->Inverse() << std::flush;
329  std::vector<double> tdbl(9);
330  bs.rotation().rotation()->Inverse().GetComponents(tdbl.begin(), tdbl.end());
331  CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]);
332  CLHEP::Hep3Vector temphvec(bs.translation().X(), bs.translation().Y(), bs.translation().Z());
333  us = new G4IntersectionSolid(solid.name().name(),
334  sa,
335  sb,
336  new CLHEP::HepRotation(temprep),
337  temphvec);
338  }
339  return us;
340 }
341 
342 
343 #include "G4Trd.hh"
344 G4VSolid * DDG4SolidConverter::pseudotrap(const DDSolid & solid) {
345  if(nullptr == rot) {
346  rot = new G4RotationMatrix;
347  rot->rotateX(90.*deg);
348  }
349 
350  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: pseudoTrap = " << solid;
351  G4Trd * trap = 0;
352  G4Tubs * tubs = 0;
353  G4VSolid * result = 0;
354  DDPseudoTrap pt(solid); // pt...PseudoTrap
355  double r = pt.radius();
356  bool atMinusZ = pt.atMinusZ();
357  double x = 0;
358  double h = 0;
359  bool intersec = false; // union or intersection solid
360  if (pt.atMinusZ()) {
361  x = pt.x1(); // tubs radius
362  }
363  else {
364  x = pt.x2(); // tubs radius
365  }
366  double openingAngle = 2.*asin(x/std::abs(r));
367  //trap = new G4Trd(solid.name().name(),
368  double displacement=0;
369  double startPhi=0;
370  /* calculate the displacement of the tubs w.r.t. to the trap,
371  determine the opening angle of the tubs */
372  double delta = sqrt(r*r-x*x);
373  if (r < 0 && std::abs(r) >= x) {
374  intersec = true; // intersection solid
375  h = pt.y1() < pt.y2() ? pt.y2() : pt.y1(); // tubs half height
376  h += h/20.; // enlarge a bit - for subtraction solid
377  if (atMinusZ) {
378  displacement = - pt.halfZ() - delta;
379  startPhi = 270.*deg - openingAngle/2.;
380  }
381  else {
382  displacement = pt.halfZ() + delta;
383  startPhi = 90.*deg - openingAngle/2.;
384  }
385  }
386  else if ( r > 0 && std::abs(r) >= x )
387  {
388  if (atMinusZ) {
389  displacement = - pt.halfZ() + delta;
390  startPhi = 90.*deg - openingAngle/2.;
391  h = pt.y1();
392  }
393  else {
394  displacement = pt.halfZ() - delta;
395  startPhi = 270.*deg - openingAngle/2.;
396  h = pt.y2();
397  }
398  }
399  else {
400  throw cms::Exception("DetectorDescriptionFault", "Check parameters of the PseudoTrap! name=" + pt.name().name());
401  }
402  G4ThreeVector displ(0.,0.,displacement); // displacement of the tubs w.r.t. trap
403  LogDebug("SimG4CoreGeometry") << "DDSolidConverter::pseudotrap(): displacement=" << displacement
404  << " openingAngle=" << openingAngle/deg << " x=" << x << " h=" << h;
405 
406  // Now create two solids (trd & tubs), and a boolean solid out of them
407  std::string name=pt.name().name();
408  trap = new G4Trd(name, pt.x1(), pt.x2(), pt.y1(), pt.y2(), pt.halfZ());
409  tubs = new G4Tubs(name,
410  0., // rMin
411  std::abs(r), // rMax
412  h, // half height
413  startPhi, // start angle
414  openingAngle);
415  if (intersec) {
416  result = new G4SubtractionSolid(name, trap, tubs, rot, displ);
417  }
418  else {
420  G4VSolid * tubicCap = new G4SubtractionSolid(name,
421  tubs,
422  new G4Box(name, 1.1*x, sqrt(r*r-x*x), 1.1*h),
423  0,
424  G4ThreeVector());
425  result = new G4UnionSolid(name, trap, tubicCap, rot, displ);
426 
427  // approximative implementation - also fails to visualize due to G4/Iguana limitations
428  /*
429  delete tubs;
430  tubs = new G4Tubs(name,
431  sqrt(r*r-x*x), // rMin-approximation!
432  std::abs(r), // rMax
433  h, // half height
434  startPhi, // start angle
435  openingAngle);
436  result = new G4UnionSolid(name, trap, tubs, rot, displ);
437  */
438  }
439  return result;
440 }
441 
442 
443 G4VSolid * DDG4SolidConverter::trunctubs(const DDSolid & solid) {
444  // truncated tube-section: a boolean subtraction solid:
445  // from a tube-section a box is subtracted according to the
446  // given parameters
447  LogDebug("SimG4CoreGeometry") << "MantisConverter: solidshape=" << DDSolidShapesName::name(solid.shape()) << " " << solid;
448  LogDebug("SimG4CoreGeometry") << "before";
449  DDTruncTubs tt(solid);
450  LogDebug("SimG4CoreGeometry") << "after";
451  double rIn(tt.rIn()), rOut(tt.rOut()), zHalf(tt.zHalf()),
452  startPhi(tt.startPhi()), deltaPhi(tt.deltaPhi()),
453  cutAtStart(tt.cutAtStart()), cutAtDelta(tt.cutAtDelta());
454  bool cutInside(bool(tt.cutInside()));
455  std::string name=tt.name().name();
456 
457  // check the parameters
458  if (rIn <= 0 || rOut <=0 || cutAtStart <=0 || cutAtDelta <= 0) {
459  throw cms::Exception("DetectorDescriptionFault", "TruncTubs " + std::string(tt.name().fullname()) + ": 0 <= rIn,cutAtStart,rOut,cutAtDelta,rOut violated!");
460  }
461  if (rIn >= rOut) {
462  throw cms::Exception("DetectorDescriptionFault", "TruncTubs " + std::string(tt.name().fullname()) + ": rIn<rOut violated!");
463  }
464  if (startPhi != 0.) {
465  throw cms::Exception("DetectorDescriptionFault", "TruncTubs " + std::string(tt.name().fullname()) + ": startPhi != 0 not supported!");
466  }
467  // if (cutInside != false) {
468  // throw cms::Exception("DetectorDescriptionFault", "TruncTubs " + std::string(tt.name()) + " cutInside == true not supported!");
469  // }
470 
471  startPhi=0.;
472  double r(cutAtStart), R(cutAtDelta);
473  G4VSolid * result(0);
474  G4VSolid * tubs = new G4Tubs(name,rIn,rOut,zHalf,startPhi,deltaPhi);
475  LogDebug("SimG4CoreGeometry") << "G4Tubs: " << rIn/CLHEP::cm << ' ' << rOut/CLHEP::cm << ' ' << zHalf/CLHEP::cm << ' ' << startPhi/CLHEP::deg << ' ' << deltaPhi/CLHEP::deg;
476  LogDebug("SimG4CoreGeometry") << solid;
477  // length & hight of the box
478  double boxX(30.*rOut), boxY(20.*rOut); // exaggerate dimensions - does not matter, it's subtracted!
479 
480  // width of the box > width of the tubs
481  double boxZ(1.1*zHalf);
482 
483  // angle of the box w.r.t. tubs
484  double cath = r-R*cos(deltaPhi);
485  double hypo = sqrt(r*r+R*R-2.*r*R*cos(deltaPhi));
486  double cos_alpha = cath/hypo;
487 
488  double alpha = -acos(cos_alpha);
489  LogDebug("SimG4CoreGeometry") << "cath=" << cath/CLHEP::cm;
490  LogDebug("SimG4CoreGeometry") << "hypo=" << hypo/CLHEP::cm;
491  LogDebug("SimG4CoreGeometry") << "al=" << acos(cath/hypo)/CLHEP::deg;
492  LogDebug("SimG4CoreGeometry") << "deltaPhi=" << deltaPhi/CLHEP::deg << "\n"
493  << "r=" << r/CLHEP::cm << "\n"
494  << "R=" << R/CLHEP::cm;
495 
496  LogDebug("SimG4CoreGeometry") << "alpha=" << alpha/CLHEP::deg;
497 
498  // rotationmatrix of box w.r.t. tubs
499  G4RotationMatrix * rot = new G4RotationMatrix;
500  rot->rotateZ(-alpha);
501  LogDebug("SimG4CoreGeometry") << (*rot);
502 
503  // center point of the box
504  double xBox;
505  if (!cutInside) {
506  xBox = r+boxY/sin(std::abs(alpha));
507  } else {
508  xBox = -(boxY/sin(std::abs(alpha))-r);
509  }
510 
511  G4ThreeVector trans(xBox,0.,0.);
512  LogDebug("SimG4CoreGeometry") << "trans=" << trans;
513 
514  G4VSolid * box = new G4Box(name,boxX,boxY,boxZ);
515  result = new G4SubtractionSolid(name,tubs,box,rot,trans);
516 
517  return result;
518 
519 }
520 
521 #include "G4Sphere.hh"
522 G4VSolid * DDG4SolidConverter::sphere(const DDSolid & solid) {
523  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: sphere = " << solid;
524  DDSphere sp(solid);
525  return new G4Sphere(solid.name().name(), sp.innerRadius(),
526  sp.outerRadius(),
527  sp.startPhi(),
528  sp.deltaPhi(),
529  sp.startTheta(),
530  sp.deltaTheta());
531 }
532 
533 #include "G4Orb.hh"
534 G4VSolid * DDG4SolidConverter::orb(const DDSolid & solid) {
535  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: orb = " << solid;
536  DDOrb sp(solid);
537  return new G4Orb(solid.name().name(), sp.radius());
538 }
539 
540 #include "G4EllipticalTube.hh"
541 G4VSolid * DDG4SolidConverter::ellipticaltube(const DDSolid & solid) {
542  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: ellipticaltube = " << solid;
543  DDEllipticalTube sp(solid);
544  return new G4EllipticalTube(solid.name().name(),
545  sp.xSemiAxis(),
546  sp.ySemiAxis(),
547  sp.zHeight());
548 }
549 
550 #include "G4Ellipsoid.hh"
551 G4VSolid * DDG4SolidConverter::ellipsoid(const DDSolid & solid) {
552  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: ellipsoid = " << solid;
553  DDEllipsoid sp(solid);
554  return new G4Ellipsoid(solid.name().name(),
555  sp.xSemiAxis(),
556  sp.ySemiAxis(),
557  sp.zSemiAxis(),
558  sp.zBottomCut(),
559  sp.zTopCut());
560 }
561 
562 #include "G4Para.hh"
563 G4VSolid * DDG4SolidConverter::para(const DDSolid & solid) {
564  LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: parallelepiped = " << solid;
565  DDParallelepiped sp(solid);
566  return new G4Para(solid.name().name(),
567  sp.xHalf(),
568  sp.yHalf(),
569  sp.zHalf(),
570  sp.alpha(),
571  sp.theta(),
572  sp.phi());
573 }
574 
#define LogDebug(id)
dbl * delta
Definition: mlp_gen.cc:36
double cutAtStart(void) const
truncation at begin of the tube-section
Definition: DDSolid.cc:219
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:88
static G4VSolid * polyhedra_rrz(const DDSolid &)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:146
double xHalf(void) const
Definition: DDSolid.cc:650
double xSemiAxis(void) const
Definition: DDSolid.cc:626
float alpha
Definition: AMPTWrapper.h:95
double phi(void) const
Definition: DDSolid.cc:665
static G4RotationMatrix * rot
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
Definition: DDSolid.cc:225
static G4VSolid * orb(const DDSolid &)
A truncated tube section.
Definition: DDSolid.h:134
double theta(void) const
Definition: DDSolid.cc:662
const N & name() const
Definition: DDBase.h:78
double zHalf(void) const
half of the z-Axis
Definition: DDSolid.cc:204
double y2(void) const
half length along y on +z
Definition: DDSolid.cc:249
static G4VSolid * ellipsoid(const DDSolid &)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double startTheta(void) const
Definition: DDSolid.cc:581
double deltaPhi(void) const
angular span of the tube-section
Definition: DDSolid.cc:216
double deltaPhi(void) const
Definition: DDSolid.cc:578
static G4VSolid * trap(const DDSolid &)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static G4VSolid * cons(const DDSolid &)
double cutAtDelta(void) const
truncation at end of the tube-section
Definition: DDSolid.cc:222
static G4VSolid * tubs(const DDSolid &)
double zTopCut(void) const
Definition: DDSolid.cc:638
double radius(void) const
Definition: DDSolid.cc:596
double rIn(void) const
inner radius
Definition: DDSolid.cc:207
static G4VSolid * sphere(const DDSolid &)
DDTranslation translation(void) const
Definition: DDSolid.cc:542
double ySemiAxis(void) const
Definition: DDSolid.cc:629
double innerRadius(void) const
Definition: DDSolid.cc:569
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
double y1(void) const
half length along y on -z
Definition: DDSolid.cc:246
DDSolid solidB(void) const
Definition: DDSolid.cc:554
static G4VSolid * cuttubs(const DDSolid &)
double outerRadius(void) const
Definition: DDSolid.cc:572
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:22
DDSolid unreflected(void) const
Definition: DDSolid.cc:287
static G4VSolid * pseudotrap(const DDSolid &s)
static G4VSolid * reflected(const DDSolid &)
DDRotation rotation(void) const
Definition: DDSolid.cc:536
static G4VSolid * para(const DDSolid &)
double yHalf(void) const
Definition: DDSolid.cc:653
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
Definition: DDSolid.cc:255
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:237
T sqrt(T t)
Definition: SSEVec.h:18
static const std::vector< double > * par_
double xSemiAxis(void) const
Definition: DDSolid.cc:608
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const std::string fullname() const
Definition: DDName.h:53
double startPhi(void) const
Definition: DDSolid.cc:575
double alpha(void) const
Definition: DDSolid.cc:659
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:140
double deltaTheta(void) const
Definition: DDSolid.cc:584
static G4VSolid * box(const DDSolid &)
double ySemiAxis(void) const
Definition: DDSolid.cc:611
DDSolid solidA(void) const
Definition: DDSolid.cc:548
std::string toString() const
Definition: DDBase.h:82
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
Definition: DDSolid.cc:213
double zBottomCut(void) const
Definition: DDSolid.cc:635
static G4VSolid * unionsolid(const DDSolid &)
Definition: DDSolid.h:371
static G4VSolid * trunctubs(const DDSolid &)
double zHeight(void) const
Definition: DDSolid.cc:614
double zSemiAxis(void) const
Definition: DDSolid.cc:632
static G4VSolid * torus(const DDSolid &)
static G4VSolid * polyhedra_rz(const DDSolid &)
double zHalf(void) const
Definition: DDSolid.cc:656
Definition: sp.h:21
static G4VSolid * polycone_rrz(const DDSolid &)
double x2(void) const
half length along x on +z
Definition: DDSolid.cc:243
std::map< DDSolidShape, FNPTR > convDispatch_
double rOut(void) const
outer radius
Definition: DDSolid.cc:210
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
double x1(void) const
half length along x on -z
Definition: DDSolid.cc:240
static G4VSolid * subtraction(const DDSolid &)
double radius(void) const
radius of the cut-out (neg.) or rounding (pos.)
Definition: DDSolid.cc:252