23#include <Inventor/nodes/SoTransform.h>
24#include <Inventor/nodes/SoSeparator.h>
36#include "GeoModelKernel/GeoTube.h"
37#include "GeoModelKernel/GeoTubs.h"
38#include "GeoModelKernel/GeoBox.h"
39#include "GeoModelKernel/GeoTrd.h"
40#include "GeoModelKernel/GeoShape.h"
41#include "GeoModelKernel/GeoShapeShift.h"
42#include "GeoModelKernel/GeoShapeSubtraction.h"
43#include "GeoModelKernel/GeoShapeIntersection.h"
44#include "GeoModelKernel/GeoShapeUnion.h"
45#include "GeoModelKernel/GeoSimplePolygonBrep.h"
46#include "GeoModelKernel/GeoDefinitions.h"
48#include "GaudiKernel/SystemOfUnits.h"
64 SoNode* sovol =
nullptr;
73 GeoSimplePolygonBrep* shape =
new GeoSimplePolygonBrep(tvolSpbBounds->
halflengthZ());
74 for (
unsigned int i=0;i<tvolSpbBounds->
xyVertices().size();i++)
84 if (tvolSubtrBounds) {
130 minHalfX, maxHalfX, halfY, minHalfX,
137 if (tvolDTrdBounds) {
148 const GeoShapeShift* shiftA =
new GeoShapeShift(trdA,GeoTrf::TranslateY3D(-y1)*GeoTrf::RotateX3D(-90*CLHEP::deg)*GeoTrf::RotateZ3D(-90*CLHEP::deg));
149 const GeoShapeShift* shiftB =
new GeoShapeShift(trdB,GeoTrf::TranslateY3D(+y2)*GeoTrf::RotateX3D(-90*CLHEP::deg)*GeoTrf::RotateZ3D(-90*CLHEP::deg));
150 const GeoShapeUnion* dtrd =
new GeoShapeUnion(shiftA,shiftB);
158 if (tvolBevCylBounds) {
160 int type = tvolBevCylBounds->
type();
162 double tp = tan(hPhi);
168 (*tvolTubs).pRMin = innerR;
169 (*tvolTubs).pRMax = outerR;
170 (*tvolTubs).pDz = hZ;
171 (*tvolTubs).pDPhi = 2*hPhi;
172 (*tvolTubs).pSPhi = -hPhi;
174 }
else if (
type==1 ) {
175 const GeoTubs* tubs =
new GeoTubs(innerR,outerR,hZ,-hPhi,2*hPhi);
176 const GeoBox* box =
new GeoBox( innerR, tp*innerR, hZ);
177 const GeoShapeSubtraction* sub =
new GeoShapeSubtraction(tubs,
new GeoShapeShift(box,GeoTrf::Transform3D::Identity()));
181 }
else if (
type==2 ) {
182 const GeoTubs* tubs =
new GeoTubs(innerR,outerR/cos(hPhi),hZ,-hPhi,2*hPhi);
183 const GeoBox* box =
new GeoBox( outerR*(1./cos(hPhi)-1.),tp*outerR,hZ );
184 const GeoShapeSubtraction* sub =
new GeoShapeSubtraction(tubs,
new GeoShapeShift(box,GeoTrf::TranslateX3D(outerR/cos(hPhi))));
188 }
else if (
type==3 ) {
189 const GeoTubs* tubs =
new GeoTubs(innerR,outerR/cos(hPhi),hZ,-hPhi,2*hPhi);
190 const GeoBox* boxO =
new GeoBox( outerR*(1./cos(hPhi)-1.),tp*outerR,hZ );
191 const GeoBox* boxI =
new GeoBox( innerR, tp*innerR, hZ);
192 const GeoShapeUnion* uni =
new GeoShapeUnion(boxI,
new GeoShapeShift(boxO,GeoTrf::TranslateX3D(outerR/cos(hPhi))));
193 const GeoShapeSubtraction* sub =
new GeoShapeSubtraction(tubs,uni);
200 if (!sovol)
return nullptr;
203 SoSeparator* sosep =
new SoSeparator();
205 sosep->addChild(sotra);
206 sosep->addChild(sovol);
214 const GeoShape*
sh=
nullptr;
227 GeoSimplePolygonBrep* shape =
new GeoSimplePolygonBrep(tvolSpbBounds->
halflengthZ());
228 for (
unsigned int i=0;i<tvolSpbBounds->
xyVertices().size();i++)
236 const GeoTube* tube =
new GeoTube(tvolCylBounds->
innerRadius(),
243 const GeoBox* box =
new GeoBox(tvolCubBounds->
halflengthX(),
251 const GeoTrd* trd =
new GeoTrd(tvolTrdBounds->
halflengthY(),
261 if (tvolBevCylBounds) {
266 double thPlus = tvolBevCylBounds->
thetaPlus();
267 double thMinus= tvolBevCylBounds->
thetaMinus();
268 const GeoTube* tub =
new GeoTube(innerR, outerR, halfZ);
269 GeoTrf::Transform3D trBoxP = GeoTrf::TranslateZ3D(+halfZ)*GeoTrf::RotateY3D(thPlus);
270 const GeoShapeShift* boxP =
new GeoShapeShift(
new GeoBox(2*outerR/cos(thPlus),outerR ,outerR*sin(thPlus)),trBoxP);
271 GeoTrf::Transform3D trBoxM = GeoTrf::TranslateZ3D(-halfZ)*GeoTrf::RotateY3D(-thMinus);
272 const GeoShapeShift* boxM =
new GeoShapeShift(
new GeoBox(2*outerR/cos(thPlus),outerR ,outerR*sin(thPlus)),trBoxM);
273 const GeoShapeSubtraction* shape=
new GeoShapeSubtraction(
new GeoShapeSubtraction(tub,boxM), boxP);
278 if (tvolSubtrBounds) {
300 const GeoShapeShift* shift1 =
new GeoShapeShift(shape1, transf1);
301 const GeoShapeShift* shift2 =
new GeoShapeShift(shape2, transf2);
302 const GeoShapeSubtraction* subtr=
new GeoShapeSubtraction(shift1, shift2);
306 if (tvolCombBounds) {
327 const GeoShapeShift* shift1 =
new GeoShapeShift(shape1,transf1);
328 const GeoShapeShift* shift2 =
new GeoShapeShift(shape2,transf2);
330 const GeoShapeIntersection*
intersection=
new GeoShapeIntersection( shift1, shift2);
333 const GeoShapeUnion* uni=
new GeoShapeUnion( shift1, shift2);
337 std::cout <<
"TrackingVolumeToSoNode::getShapeFromBounds: bounds not recognized" << std::endl;
void setParametersForBox(float dx, float dy, float dz, float xcenter=0.0, float ycenter=0.0, float zcenter=0.0)
void setParametersForTrapezoid(float dz, float theta, float phi, float dy1, float dx1, float dx2, float dy2, float dx3, float dx4, float alp1, float alp2)
SoTubs - Inventor version of the G4Tubs Geant Geometry entity.
static void initClass()
Class Initializer, required.
virtual void handleShape(const GeoShape *subtract)
const GeoShape * getShapeFromBounds(const Trk::VolumeBounds *volBounds) const
SoNode * translateTrackingVolume(const Trk::TrackingVolume &tvol) const
virtual ~TrackingVolumeToSoNode()
Bounds for a cylindrical Volume, the decomposeToSurfaces method creates a vector of up to 6 surfaces:
int type() const
This method returns the type.
double thetaPlus() const
This method returns the thetaPlus.
double halflengthZ() const
This method returns the halflengthZ.
double innerRadius() const
This method returns the inner radius.
double outerRadius() const
This method returns the outer radius.
double halfPhiSector() const
This method returns the halfPhiSector angle.
double thetaMinus() const
This method returns the thetaMinus.
Bounds for a generic combined volume, the decomposeToSurfaces method creates a vector of n surfaces (...
const Volume * second() const
This method returns the second VolumeBounds.
const Volume * first() const
This method returns the first VolumeBounds.
bool intersection() const
This method distinguishes between Union(0) and Intersection(1)
Bounds for a cubical Volume, the decomposeToSurfaces method creates a vector of 6 surfaces:
double halflengthX() const
This method returns the halflength in local x.
double halflengthY() const
This method returns the halflength in local y.
double halflengthZ() const
This method returns the halflength in local z.
Bounds for a cylindrical Volume, the decomposeToSurfaces method creates a vector of up to 6 surfaces:
double innerRadius() const
This method returns the inner radius.
double halflengthZ() const
This method returns the halflengthZ.
double outerRadius() const
This method returns the outer radius.
double halfPhiSector() const
This method returns the halfPhiSector angle.
Bounds for a double trapezoidal shaped Volume, the decomposeToSurfaces method creates a vector of 8 s...
double minHalflengthX() const
This method returns the X halflength at minimal Y.
double halflengthZ() const
This method returns the halflength in local z.
double halflengthY1() const
This method returns the halflength1 in local y.
double halflengthY2() const
This method returns the halflength2 in local y.
double maxHalflengthX() const
This method returns the X halflength at maximal Y (local coordinates)
double medHalflengthX() const
This method returns the (maximal) halflength in local x.
Bounds for the exact transcript of the GeoSimplePolygonBrep; volume defined by combination of symm....
double halflengthZ() const
This method returns the halflength in local z.
const std::vector< std::pair< double, double > > & xyVertices() const
This method returns the set of xy generating vertices.
Bounds for a generic subtracted volume, the decomposeToSurfaces method creates a vector of n surfaces...
const Volume * inner() const
This method returns the inner Volume.
const Volume * outer() const
This method returns the outer Volume.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Bounds for a trapezoidal shaped Volume, the decomposeToSurfaces method creates a vector of 6 surfaces...
double halflengthZ() const
This method returns the halflength in local z.
double minHalflengthX() const
This method returns the minimal halflength in local x.
double halflengthY() const
This method returns the halflength in local y.
double maxHalflengthX() const
This method returns the maximal halflength in local x.
Pure Absract Base Class for Volume bounds.
const Amg::Transform3D & transform() const
Return methods for geometry transform.
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Amg::Transform3D getRotateX3D(double angle)
get a rotation transformation around X-axis
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D