6#include "GeoModelKernel/GeoBox.h"
7#include "GeoModelKernel/GeoCons.h"
8#include "GeoModelKernel/GeoPcon.h"
9#include "GeoModelKernel/GeoTrap.h"
10#include "GeoModelKernel/GeoTrd.h"
11#include "GeoModelKernel/GeoTube.h"
12#include "GeoModelKernel/GeoTubs.h"
13#include "GeoModelKernel/GeoSimplePolygonBrep.h"
14#include "GeoModelKernel/GeoTessellatedSolid.h"
15#include "GeoModelKernel/GeoFacet.h"
16#include "GeoModelKernel/GeoGenericTrap.h"
17#include "GeoModelKernel/GeoUnidentifiedShape.h"
31 #include "GeoModelKernel/Units.h"
32 #define SYSTEM_OF_UNITS GeoModelKernelUnits
34 #include "GaudiKernel/SystemOfUnits.h"
35 #define SYSTEM_OF_UNITS Gaudi::Units
55 const GeoUnidentifiedShape* custom =
dynamic_cast< const GeoUnidentifiedShape*
>( shape );
57 std::string customName = custom->name();
58 static const double eta_hi = 3.2;
59 static const double eta_mid = 2.5;
60 static const double eta_low = 1.375;
62 static const double dMechFocaltoWRP = 3691. *SYSTEM_OF_UNITS::mm;
63 static const double dWRPtoFrontFace = 11. *SYSTEM_OF_UNITS::mm;
64 static const double rOuterCutoff = 2034. *SYSTEM_OF_UNITS::mm;
65 static const double activeLength = 510*SYSTEM_OF_UNITS::mm;
66 static const double straightStartSection = 2*SYSTEM_OF_UNITS::mm;
67 static const double wheelThickness = activeLength+2*straightStartSection;
71 if (customName.find(
"Inner")!=std::string::npos) {
72 float zPlane[2],rInner[2],rOuter[2];
74 zPlane[1]=wheelThickness;
76 double tanThetaInner = 2. * exp(-eta_hi ) / (1. - exp(2.*-eta_hi ));
77 double tanThetaMid = 2. * exp(-eta_mid) / (1. - exp(2.*-eta_mid));
78 double zWheelFrontFace = dMechFocaltoWRP + dWRPtoFrontFace;
79 double zWheelBackFace = zWheelFrontFace + wheelThickness;
80 rInner[0] = zWheelFrontFace * tanThetaInner;
81 rInner[1] = zWheelBackFace * tanThetaInner;
84 double HalfGapBetweenWheels = 0.15*SYSTEM_OF_UNITS::cm;
85 rOuter[0] = zWheelFrontFace * tanThetaMid - HalfGapBetweenWheels;
86 rOuter[1] = zWheelBackFace * tanThetaMid - HalfGapBetweenWheels;
87 solar->
fRmin.setValues(0,2,rInner);
88 solar->
fRmax.setValues(0,2,rOuter);
89 solar->
fDz.setValues (0,2,zPlane);
91 else if (customName.find(
"Outer")!=std::string::npos) {
92 float zPlane[3], rInner[3], rOuter[3];
94 zPlane[2] = wheelThickness;
95 double tanThetaMid = 2. * exp(-eta_mid) / (1. - exp(2.*-eta_mid));
96 double tanThetaOuter = 2. * exp(-eta_low) / (1. - exp(2.*-eta_low));
97 double zWheelFrontFace = dMechFocaltoWRP + dWRPtoFrontFace;
98 double zWheelBackFace = zWheelFrontFace + wheelThickness;
101 double HalfGapBetweenWheels = 0.15*SYSTEM_OF_UNITS::cm;
102 rInner[0] = zWheelFrontFace * tanThetaMid + HalfGapBetweenWheels;
103 rInner[2] = zWheelBackFace * tanThetaMid + HalfGapBetweenWheels;
104 rOuter[0] = zWheelFrontFace * tanThetaOuter;
105 rOuter[2] = zWheelBackFace * tanThetaOuter;
112 double slopeMin = (rInner[2] - rInner[0]) / (zPlane[2] - zPlane[0]);
113 double slopeMax = (rOuter[2] - rOuter[0]) / (zPlane[2] - zPlane[0]);
114 double interceptMin = rInner[0] - slopeMin * zPlane[0];
115 double interceptMax = rOuter[0] - slopeMax * zPlane[0];
117 zPlane[1] = (rOuterCutoff - interceptMax) / slopeMax;
119 rInner[1] = slopeMin * zPlane[1] + interceptMin;
120 rOuter[1] = rOuterCutoff;
122 rOuter[2] = rOuterCutoff;
123 solar->
fRmin.setValues(0,3,rInner);
124 solar->
fRmax.setValues(0,3,rOuter);
125 solar->
fDz.setValues (0,3,zPlane);
151 gb->
setParametersForBox( box->getXHalfLength(),box->getYHalfLength(),box->getZHalfLength() );
160 socons->
fRmin1 =cons->getRMin1();
161 socons->
fRmin2 =cons->getRMin2();
162 socons->
fRmax1 =cons->getRMax1();
163 socons->
fRmax2 =cons->getRMax2();
164 socons->
fDz =cons->getDZ();
165 socons->
fSPhi =cons->getSPhi();
166 socons->
fDPhi =cons->getDPhi();
177 float *
z =
new float[pcon->getNPlanes()];
178 float *rmn=
new float[pcon->getNPlanes()];
179 float *rmx=
new float[pcon->getNPlanes()];
181 for (
unsigned s=0;s<pcon->getNPlanes();++s) {
182 z[s]=pcon->getZPlane(s);
183 rmn[s]=pcon->getRMinPlane(s);
184 rmx[s]=pcon->getRMaxPlane(s);
189 sopcons->
fSPhi = pcon->getSPhi();
190 sopcons->
fDPhi = pcon->getDPhi();
191 sopcons->
fRmin.setValues(0,pcon->getNPlanes(),rmn);
192 sopcons->
fRmax.setValues(0,pcon->getNPlanes(),rmx);
193 sopcons->
fDz.setValues (0,pcon->getNPlanes(),
z);
209 trap->getDydzn(), trap->getDxdyndzn(), trap->getDxdypdzn(),
210 trap->getDydzp(), trap->getDxdyndzp(), trap->getDxdypdzp(),
211 trap->getAngleydzn(), trap->getAngleydzp());
220 trd->getYHalfLength1(), trd->getYHalfLength2(),
221 trd->getZHalfLength() );
229 sotubs->
pRMin= tube->getRMin();
230 sotubs->
pRMax= tube->getRMax();
231 sotubs->
pDz = tube->getZHalfLength();
241 sotubs->
pRMin= tubs->getRMin();
242 sotubs->
pRMax= tubs->getRMax();
243 sotubs->
pDz = tubs->getZHalfLength();
244 sotubs->
pSPhi= tubs->getSPhi();
245 sotubs->
pDPhi= tubs->getDPhi();
254 double dz = brep->getDZ();
255 std::vector<double>
x,
y;
256 for(
unsigned int i=0; i<brep->getNVertices(); ++i)
258 x.push_back(brep->getXVertex(i));
259 y.push_back(brep->getYVertex(i));
272 for(
size_t i=0; i<geoTessellated->getNumberOfFacets();++i) {
273 GeoFacet* facet = geoTessellated->getFacet(i);
274 if(facet->getNumberOfVertices()==3) {
275 if(facet->getVertexType()==GeoFacet::ABSOLUTE)
276 soTessellated->
addTriangularFacet(facet->getVertex(0).x(),facet->getVertex(0).y(),facet->getVertex(0).z(),
277 facet->getVertex(1).x(),facet->getVertex(1).y(),facet->getVertex(1).z(),
278 facet->getVertex(2).x(),facet->getVertex(2).y(),facet->getVertex(2).z());
280 soTessellated->
addTriangularFacet(facet->getVertex(0).x(),facet->getVertex(0).y(),facet->getVertex(0).z(),
281 facet->getVertex(0).x()+facet->getVertex(1).x(),
282 facet->getVertex(0).y()+facet->getVertex(1).y(),
283 facet->getVertex(0).z()+facet->getVertex(1).z(),
284 facet->getVertex(0).x()+facet->getVertex(2).x(),
285 facet->getVertex(0).y()+facet->getVertex(2).y(),
286 facet->getVertex(0).z()+facet->getVertex(2).z());
289 if(facet->getVertexType()==GeoFacet::ABSOLUTE)
290 soTessellated->
addQuadrangularFacet(facet->getVertex(0).x(),facet->getVertex(0).y(),facet->getVertex(0).z(),
291 facet->getVertex(1).x(),facet->getVertex(1).y(),facet->getVertex(1).z(),
292 facet->getVertex(2).x(),facet->getVertex(2).y(),facet->getVertex(2).z(),
293 facet->getVertex(3).x(),facet->getVertex(3).y(),facet->getVertex(3).z());
295 soTessellated->
addQuadrangularFacet(facet->getVertex(0).x(),facet->getVertex(0).y(),facet->getVertex(0).z(),
296 facet->getVertex(0).x()+facet->getVertex(1).x(),
297 facet->getVertex(0).y()+facet->getVertex(1).y(),
298 facet->getVertex(0).z()+facet->getVertex(1).z(),
299 facet->getVertex(0).x()+facet->getVertex(2).x(),
300 facet->getVertex(0).y()+facet->getVertex(2).y(),
301 facet->getVertex(0).z()+facet->getVertex(2).z(),
302 facet->getVertex(0).x()+facet->getVertex(3).x(),
303 facet->getVertex(0).y()+facet->getVertex(3).y(),
304 facet->getVertex(0).z()+facet->getVertex(3).z());
316 const GeoGenericTrapVertices& trapVertices = gentrap->getVertices();
317 double dZ = gentrap->getZHalfLength();
319 trapVertices[1].
x(),trapVertices[1].
y(),-dZ,
320 trapVertices[2].
x(),trapVertices[2].
y(),-dZ,
321 trapVertices[3].
x(),trapVertices[3].
y(),-dZ,
322 trapVertices[4].
x(),trapVertices[4].
y(),dZ,
323 trapVertices[5].
x(),trapVertices[5].
y(),dZ,
324 trapVertices[6].
x(),trapVertices[6].
y(),dZ,
325 trapVertices[7].
x(),trapVertices[7].
y(),dZ);
SoCons - Inventor version of the G4Cons Geant Geometry entity.
SoSFFloat fDPhi
Delta-angle, in radians.
static void initClass()
Class Initializer, required.
SoSFFloat fSPhi
Starting angle, in radians.
SoSFFloat fRmax2
Outside radius at +fDz.
SoSFFloat fRmax1
Outside radius at -fDz.
SoSFFloat fRmin1
Inside radius at -fDz.
SoSFFloat fRmin2
Inside radius at +fDz.
SoSFFloat fDz
Half-length along Z.
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)
void setParametersForTrd(float dx1, float dx2, float dy1, float dy2, float dz)
void setGenericParameters(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, float x5, float y5, float z5, float x6, float y6, float z6, float x7, float y7, float z7)
SoLAr - Inventor version of the G4Cons Geant Geometry entity.
SoMFFloat fDz
Z Positions.
SoSFFloat fSPhi
Starting angle, in radians.
SoMFFloat fRmin
Inside radii.
SoSFFloat fDPhi
Delta-angle, in radians.
SoMFFloat fRmax
Outside radii.
static void initClass()
Class Initializer, required.
SoPcons - Inventor version of the G4Cons Geant Geometry entity.
SoMFFloat fRmax
Outside radii.
SoSFFloat fDPhi
Delta-angle, in radians.
SoSFFloat fSPhi
Starting angle, in radians.
SoMFFloat fRmin
Inside radii.
static void initClass()
Class Initializer, required.
SoMFFloat fDz
Z Positions.
SoPolyhedron is an Inventor encapsulation of the HepPolyedron class written by E.Chernyaev.
void addTriangularFacet(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3)
void addQuadrangularFacet(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
SoTubs - Inventor version of the G4Tubs Geant Geometry entity.
SoSFFloat pDz
Half-length in Z.
SoSFFloat pDPhi
Delta-angle, in radians.
SoSFFloat pSPhi
Starting angle, in radians.
SoSFFloat pRMin
Inside radius of the tube.
SoSFFloat pRMax
Outside radius of the tube.
virtual void handleBox(const GeoBox *box)
virtual void handleCons(const GeoCons *cons)
virtual void handleTube(const GeoTube *tube)
virtual void handleTessellatedSolid(const GeoTessellatedSolid *)
virtual void handleTrd(const GeoTrd *trd)
virtual void handleGenericTrap(const GeoGenericTrap *)
virtual void handleShape(const GeoShape *subtract)
virtual void handleSimplePolygonBrep(const GeoSimplePolygonBrep *)
virtual void handleTrap(const GeoTrap *trap)
virtual void handlePcon(const GeoPcon *pcon)
virtual ~SoVisualizeAction()
virtual void handleTubs(const GeoTubs *tubs)
static void initAllCustomClasses()