60 {
61
62
63
64 SoNode* sovol = nullptr;
65
66
67 const Trk::VolumeBounds& tvolBounds = tvol.
volumeBounds();
68
69 const Trk::SimplePolygonBrepVolumeBounds* tvolSpbBounds = dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*>(&tvolBounds);
70 if (tvolSpbBounds) {
71
72
73 GeoSimplePolygonBrep* shape =
new GeoSimplePolygonBrep(tvolSpbBounds->
halflengthZ());
74 for (
unsigned int i=0;
i<tvolSpbBounds->
xyVertices().size();
i++)
76
77 SoVisualizeAction* sa = new SoVisualizeAction();
80
81 }
82
83 const Trk::SubtractedVolumeBounds* tvolSubtrBounds = dynamic_cast<const Trk::SubtractedVolumeBounds*>(&tvolBounds);
84 if (tvolSubtrBounds) {
85
87
88 SoVisualizeAction* sa = new SoVisualizeAction();
91 }
92
93 const Trk::CombinedVolumeBounds* tvolCombBounds = dynamic_cast<const Trk::CombinedVolumeBounds*>(&tvolBounds);
94 if (tvolCombBounds) {
95
97
98 SoVisualizeAction* sa = new SoVisualizeAction();
101 }
102
103 const Trk::CylinderVolumeBounds* tvolCylBounds = dynamic_cast<const Trk::CylinderVolumeBounds*>(&tvolBounds);
104 if (tvolCylBounds){
105
106 SoTubs* tvolTubs = new SoTubs();
112
113 sovol = tvolTubs;
114 }
115 const Trk::CuboidVolumeBounds* tvolCubBounds = dynamic_cast<const Trk::CuboidVolumeBounds*>(&tvolBounds);
116 if (tvolCubBounds){
117
118 SoGenericBox * gb = new SoGenericBox;
120
121 sovol = gb;
122 }
123 const Trk::TrapezoidVolumeBounds* tvolTrdBounds = dynamic_cast<const Trk::TrapezoidVolumeBounds*>(&tvolBounds);
124 if (tvolTrdBounds) {
125
128 SoGenericBox * gb = new SoGenericBox;
130 minHalfX, maxHalfX, halfY, minHalfX,
131 maxHalfX, 0, 0 );
132
133 sovol = gb;
134 }
135
136 const Trk::DoubleTrapezoidVolumeBounds* tvolDTrdBounds = dynamic_cast<const Trk::DoubleTrapezoidVolumeBounds*>(&tvolBounds);
137 if (tvolDTrdBounds) {
144 Trk::TrapezoidVolumeBounds* trBoundA =
new Trk::TrapezoidVolumeBounds(minX,medX,
z,y1);
145 Trk::TrapezoidVolumeBounds* trBoundB =
new Trk::TrapezoidVolumeBounds(medX,maxX,
z,y2);
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);
151
152 SoVisualizeAction* sa = new SoVisualizeAction();
155 }
156
157 const Trk::BevelledCylinderVolumeBounds* tvolBevCylBounds = dynamic_cast<const Trk::BevelledCylinderVolumeBounds*>(&tvolBounds);
158 if (tvolBevCylBounds) {
159
160 int type = tvolBevCylBounds->
type();
162 double tp =
tan(hPhi);
166 if (type<1) {
167 SoTubs* tvolTubs = new SoTubs();
168 (*tvolTubs).pRMin = innerR;
169 (*tvolTubs).pRMax = outerR;
170 (*tvolTubs).pDz = hZ;
171 (*tvolTubs).pDPhi = 2*hPhi;
172 (*tvolTubs).pSPhi = -hPhi;
173 sovol = tvolTubs;
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()));
178 SoVisualizeAction* sa = new SoVisualizeAction();
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))));
185 SoVisualizeAction* sa = new SoVisualizeAction();
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);
194 SoVisualizeAction* sa = new SoVisualizeAction();
197 }
198 }
199
200 if (!sovol) return nullptr;
201
202
203 SoSeparator* sosep = new SoSeparator();
205 sosep->addChild(sotra);
206 sosep->addChild(sovol);
207
208 return sosep;
209
210}
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)
virtual void handleShape(const GeoShape *subtract)
int type() const
This method returns the type.
double halfPhiSector() const
This method returns the halfPhiSector angle.
double halfPhiSector() const
This method returns the halfPhiSector angle.
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.
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
double halfY(const Acts::VolumeBounds &bounds)
Returns the half-Y length for the parsed volume bounds (Trapezoid/ Cuboid)