ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SbPolyhedrizeAction Class Reference

#include <SbPolyhedrizeAction.h>

Inheritance diagram for SbPolyhedrizeAction:
Collaboration diagram for SbPolyhedrizeAction:

Public Member Functions

 SbPolyhedrizeAction ()
 
virtual ~SbPolyhedrizeAction ()
 
virtual void handleShift (const GeoShapeShift *shift)
 
virtual void handleUnion (const GeoShapeUnion *unio)
 
virtual void handleIntersection (const GeoShapeIntersection *isect)
 
virtual void handleSubtraction (const GeoShapeSubtraction *subtract)
 
virtual void handleBox (const GeoBox *box)
 
virtual void handleCons (const GeoCons *cons)
 
virtual void handlePara (const GeoPara *para)
 
virtual void handlePcon (const GeoPcon *pcon)
 
virtual void handlePgon (const GeoPgon *pgon)
 
virtual void handleTrap (const GeoTrap *trap)
 
virtual void handleTrd (const GeoTrd *trd)
 
virtual void handleTube (const GeoTube *tube)
 
virtual void handleTubs (const GeoTubs *tubs)
 
virtual void handleSimplePolygonBrep (const GeoSimplePolygonBrep *brep)
 
virtual void handleTessellatedSolid (const GeoTessellatedSolid *tessellated)
 
virtual void handleGenericTrap (const GeoGenericTrap *gentrap)
 
const SbPolyhedrongetPolyhedron () const
 

Private Member Functions

 SbPolyhedrizeAction (const SbPolyhedrizeAction &right)
 
const SbPolyhedrizeActionoperator= (const SbPolyhedrizeAction &right)
 

Private Attributes

SbPolyhedronm_polyhedron
 

Detailed Description

Definition at line 16 of file SbPolyhedrizeAction.h.

Constructor & Destructor Documentation

◆ SbPolyhedrizeAction() [1/2]

SbPolyhedrizeAction::SbPolyhedrizeAction ( )

Definition at line 30 of file SbPolyhedrizeAction.cxx.

31  : m_polyhedron(NULL)
32 {
33  setDepthLimit(0);
34 }

◆ ~SbPolyhedrizeAction()

SbPolyhedrizeAction::~SbPolyhedrizeAction ( )
virtual

Definition at line 37 of file SbPolyhedrizeAction.cxx.

38 {
39  delete m_polyhedron;
40 }

◆ SbPolyhedrizeAction() [2/2]

SbPolyhedrizeAction::SbPolyhedrizeAction ( const SbPolyhedrizeAction right)
private

Member Function Documentation

◆ getPolyhedron()

const SbPolyhedron * SbPolyhedrizeAction::getPolyhedron ( ) const

Definition at line 280 of file SbPolyhedrizeAction.cxx.

281 {
282  return m_polyhedron;
283 }

◆ handleBox()

void SbPolyhedrizeAction::handleBox ( const GeoBox *  box)
virtual

Definition at line 89 of file SbPolyhedrizeAction.cxx.

90 {
91  m_polyhedron=new SbPolyhedronBox (box->getXHalfLength(),
92  box->getYHalfLength(),
93  box->getZHalfLength());
94 }

◆ handleCons()

void SbPolyhedrizeAction::handleCons ( const GeoCons *  cons)
virtual

Definition at line 96 of file SbPolyhedrizeAction.cxx.

97 {
98  m_polyhedron = new SbPolyhedronCons (cons->getRMin1(),
99  cons->getRMax1(),
100  cons->getRMin2(),
101  cons->getRMax2(),
102  cons->getDZ(),
103  cons->getSPhi(),
104  cons->getDPhi());
105 }

◆ handleGenericTrap()

void SbPolyhedrizeAction::handleGenericTrap ( const GeoGenericTrap *  gentrap)
virtual

Definition at line 271 of file SbPolyhedrizeAction.cxx.

272 {
273  std::vector<std::pair<double,double> > vertices;
274  vertices.reserve(8);
275  for(size_t i=0; i<8; ++i)
276  vertices.push_back(std::pair<double,double>(gentrap->getVertices()[i].x(),gentrap->getVertices()[i].y()));
277  m_polyhedron = new SbPolyhedronGenericTrap(gentrap->getZHalfLength(),vertices);
278 }

◆ handleIntersection()

void SbPolyhedrizeAction::handleIntersection ( const GeoShapeIntersection *  isect)
virtual

Definition at line 73 of file SbPolyhedrizeAction.cxx.

74 {
75  SbPolyhedrizeAction auxA,auxB;
76  isect->getOpA()->exec(&auxA);
77  isect->getOpB()->exec(&auxB);
79 }

◆ handlePara()

void SbPolyhedrizeAction::handlePara ( const GeoPara *  para)
virtual

Definition at line 107 of file SbPolyhedrizeAction.cxx.

108 {
109  m_polyhedron=new SbPolyhedronPara(para->getXHalfLength(),
110  para->getYHalfLength(),
111  para->getZHalfLength(),
112  para->getAlpha(),
113  para->getTheta(),
114  para->getPhi());
115 }

◆ handlePcon()

void SbPolyhedrizeAction::handlePcon ( const GeoPcon *  pcon)
virtual

Definition at line 117 of file SbPolyhedrizeAction.cxx.

118 {
119  double *z = new double[pcon->getNPlanes ()];
120  double *rmn = new double[pcon->getNPlanes ()];
121  double *rmx = new double[pcon->getNPlanes ()];
122 
123  for (unsigned s = 0; s < pcon->getNPlanes (); s++) {
124  z[s] = pcon->getZPlane (s);
125  rmn[s] = pcon->getRMinPlane (s);
126  rmx[s] = pcon->getRMaxPlane (s);
127  }
128  m_polyhedron = new SbPolyhedronPcon (pcon->getSPhi(), pcon->getDPhi(), pcon->getNPlanes (), z, rmn, rmx);
129 
130  delete[]z;
131  delete[]rmn;
132  delete[]rmx;
133 }

◆ handlePgon()

void SbPolyhedrizeAction::handlePgon ( const GeoPgon *  pgon)
virtual

Definition at line 135 of file SbPolyhedrizeAction.cxx.

136 {
137  double *z = new double[pgon->getNPlanes ()];
138  double *rmn = new double[pgon->getNPlanes ()];
139  double *rmx = new double[pgon->getNPlanes ()];
140 
141  for (unsigned s = 0; s < pgon->getNPlanes (); s++) {
142  z[s] = pgon->getZPlane (s);
143  rmn[s] = pgon->getRMinPlane (s);
144  rmx[s] = pgon->getRMaxPlane (s);
145  }
146  m_polyhedron = new SbPolyhedronPgon (pgon->getSPhi(), pgon->getDPhi(), pgon->getNSides(), pgon->getNPlanes (), z, rmn, rmx);
147 
148  delete[]z;
149  delete[]rmn;
150  delete[]rmx;
151 }

◆ handleShift()

void SbPolyhedrizeAction::handleShift ( const GeoShapeShift *  shift)
virtual

Definition at line 42 of file SbPolyhedrizeAction.cxx.

43 {
44  shift->getOp()->exec(this);
45  GeoTrf::RotationMatrix3D rotation=shift->getX().rotation();
46  GeoTrf::Vector3D translation = shift->getX().translation();
47 
48  // rbianchi - 14.12.2012
49 // SbVec3f trx(translation.x(),translation.y(),translation.z());
50 // SbRotation rot(SbMatrix(rotation.xx(),rotation.yx(),rotation.zx(),0,
51 // rotation.xy(),rotation.yy(),rotation.zy(),0,
52 // rotation.xz(),rotation.yz(),rotation.zz(),0,
53 // 0,0,0,1));
54  SbVec3d trx(translation.x(),translation.y(),translation.z());
55  #include <VP1HEPVis/SbRotation.h> //using doubles instead of floats.
56  HEPVis::SbRotation rot(rotation(0,0),rotation(1,0),rotation(2,0),0,
57  rotation(0,1),rotation(1,1),rotation(2,1),0,
58  rotation(0,2),rotation(1,2),rotation(2,2),0,
59  0,0,0,1);
60  //---
61 
62  m_polyhedron->Transform (rot, trx);
63 }

◆ handleSimplePolygonBrep()

void SbPolyhedrizeAction::handleSimplePolygonBrep ( const GeoSimplePolygonBrep *  brep)
virtual

Definition at line 189 of file SbPolyhedrizeAction.cxx.

190 {
191  double dz = brep->getDZ();
192  std::vector<double> x, y;
193  for(unsigned int i=0; i<brep->getNVertices(); i++)
194  {
195  x.push_back(brep->getXVertex(i));
196  y.push_back(brep->getYVertex(i));
197  }
198 
200 }

◆ handleSubtraction()

void SbPolyhedrizeAction::handleSubtraction ( const GeoShapeSubtraction *  subtract)
virtual

Definition at line 81 of file SbPolyhedrizeAction.cxx.

82 {
83  SbPolyhedrizeAction auxA,auxB;
84  subtract->getOpA()->exec(&auxA);
85  subtract->getOpB()->exec(&auxB);
87 }

◆ handleTessellatedSolid()

void SbPolyhedrizeAction::handleTessellatedSolid ( const GeoTessellatedSolid *  tessellated)
virtual

Definition at line 202 of file SbPolyhedrizeAction.cxx.

203 {
204  // ______ Perform actions a la SetSolidClosed ________
205  double vertTolerance = 1E-15; // kCarTolerance ??
206  std::vector<GeoFacetVertex> vertexList;
207  std::map<GeoFacet*,std::vector<size_t> > facetVertIndInSolid; // Vacet vertex indices in the vertexList
208 
209  // Loop over facets in the solid
210  for(size_t facetIndInSolid = 0; facetIndInSolid<tessellated->getNumberOfFacets(); ++facetIndInSolid) {
211  GeoFacet* facet = tessellated->getFacet(facetIndInSolid);
212 
213  facetVertIndInSolid[facet] = std::vector<size_t>();
214  std::vector<size_t>& current = facetVertIndInSolid[facet];
215  if(facet->getNumberOfVertices()==3)
216  current.resize(3,0);
217  else
218  current.resize(4,0);
219 
220  size_t vertexListSize = vertexList.size();
221  GeoFacetVertex vertex(0.,0.,0.);
222 
223  // Loop over vertices in the current facet
224  for(size_t vertexIndInFacet=0; vertexIndInFacet<facet->getNumberOfVertices(); ++vertexIndInFacet) {
225  vertex = facet->getVertex(vertexIndInFacet);
226 
227  // Check if we already have this vertex in our vertexList
228  bool found = false;
229  size_t j=0;
230  while(j<vertexListSize && !found) {
231  GeoFacetVertex vertexToCheck = vertexList[j];
232  found = (vertexToCheck-vertex).mag() < vertTolerance;
233  if(!found) j++;
234  }
235 
236  if(found) {
237  current[vertexIndInFacet] = j;
238  }
239  else {
240  vertexList.push_back(vertex);
241  current[vertexIndInFacet] = vertexList.size()-1;
242  }
243  }
244  }
245 
246  // ______ Create Polyhedron itself ______
247  SbPolyhedronArbitrary* polyhedron= new SbPolyhedronArbitrary(vertexList.size(),tessellated->getNumberOfFacets());
248 
249  // add vertices from the list
250  for(size_t vertexInd=0; vertexInd<vertexList.size(); ++vertexInd) {
251  GeoFacetVertex vertex = vertexList[vertexInd];
252  polyhedron->AddVertex(vertex.x(),vertex.y(),vertex.z());
253  }
254 
255  // add facets
256  for(size_t facetIndInSolid = 0; facetIndInSolid<tessellated->getNumberOfFacets(); ++facetIndInSolid) {
257  GeoFacet* facet = tessellated->getFacet(facetIndInSolid);
258  std::vector<size_t>& current = facetVertIndInSolid[facet];
259 
260  size_t v[4];
261  for (size_t j=0; j<4; j++)
262  v[j] = (j<current.size() ? current[j]+1 : 0);
263 
264  polyhedron->AddFacet(v[0],v[1],v[2],v[3]);
265  }
266 
267  polyhedron->Finalize();
268  m_polyhedron = polyhedron;
269 }

◆ handleTrap()

void SbPolyhedrizeAction::handleTrap ( const GeoTrap *  trap)
virtual

Definition at line 153 of file SbPolyhedrizeAction.cxx.

154 {
155  m_polyhedron = new SbPolyhedronTrap (trap->getZHalfLength(),
156  trap->getTheta(),
157  trap->getPhi(),
158  trap->getDydzn(),
159  trap->getDxdyndzn(),
160  trap->getDxdypdzn(), 0,
161  trap->getDydzp(),
162  trap->getDxdyndzp(),
163  trap->getDxdypdzp(),0);
164 }

◆ handleTrd()

void SbPolyhedrizeAction::handleTrd ( const GeoTrd *  trd)
virtual

Definition at line 166 of file SbPolyhedrizeAction.cxx.

167 {
168  m_polyhedron = new SbPolyhedronTrd2 (trd->getXHalfLength1(),
169  trd->getXHalfLength2(),
170  trd->getYHalfLength1(),
171  trd->getYHalfLength2(),
172  trd->getZHalfLength());
173 }

◆ handleTube()

void SbPolyhedrizeAction::handleTube ( const GeoTube *  tube)
virtual

Definition at line 175 of file SbPolyhedrizeAction.cxx.

176 {
177  m_polyhedron = new SbPolyhedronTube (tube->getRMin(),tube->getRMax(),tube->getZHalfLength());
178 }

◆ handleTubs()

void SbPolyhedrizeAction::handleTubs ( const GeoTubs *  tubs)
virtual

Definition at line 180 of file SbPolyhedrizeAction.cxx.

181 {
182  m_polyhedron= new SbPolyhedronTubs (tubs->getRMin(),
183  tubs->getRMax(),
184  tubs->getZHalfLength(),
185  tubs->getSPhi(),
186  tubs->getDPhi());
187 }

◆ handleUnion()

void SbPolyhedrizeAction::handleUnion ( const GeoShapeUnion *  unio)
virtual

Definition at line 65 of file SbPolyhedrizeAction.cxx.

66 {
67  SbPolyhedrizeAction auxA,auxB;
68  unio->getOpA()->exec(&auxA);
69  unio->getOpB()->exec(&auxB);
71 }

◆ operator=()

const SbPolyhedrizeAction& SbPolyhedrizeAction::operator= ( const SbPolyhedrizeAction right)
private

Member Data Documentation

◆ m_polyhedron

SbPolyhedron* SbPolyhedrizeAction::m_polyhedron
private

Definition at line 66 of file SbPolyhedrizeAction.h.


The documentation for this class was generated from the following files:
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
SbPolyhedron
Definition: SbPolyhedron.h:231
SbPolyhedronTube
Definition: SbPolyhedron.h:479
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
SbPolyhedron::add
SbPolyhedron add(const SbPolyhedron &p) const
Definition: SbPolyhedron.cxx:1842
SbPolyhedronTubs
Definition: SbPolyhedron.h:469
SbPolyhedrizeAction
Definition: SbPolyhedrizeAction.h:18
x
#define x
SbPolyhedronBox
Definition: SbPolyhedron.h:416
SbPolyhedron::Transform
SbPolyhedron & Transform(const HEPVis::SbRotation &rot, const SbVec3d &trans)
Definition: SbPolyhedron.cxx:878
SbPolyhedronTrap
Definition: SbPolyhedron.h:425
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
xAOD::rotation
rotation
Definition: TrackSurface_v1.cxx:15
SbPolyhedronTrd2
Definition: SbPolyhedron.h:396
SbPolyhedronArbitrary
Definition: SbPolyhedron.h:552
SbRotation.h
SbPolyhedrizeAction::getPolyhedron
const SbPolyhedron * getPolyhedron() const
Definition: SbPolyhedrizeAction.cxx:280
SbPolyhedronPgon
Definition: SbPolyhedron.h:488
SbPolyhedronPcon
Definition: SbPolyhedron.h:500
SbPolyhedronArbitrary::Finalize
void Finalize()
Definition: SbPolyhedron.cxx:2406
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
SbPolyhedronArbitrary::AddFacet
void AddFacet(const int iv1, const int iv2, const int iv3, const int iv4=0)
Definition: SbPolyhedron.cxx:2377
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.PyAthena.v
v
Definition: PyAthena.py:154
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
SbPolyhedronArbitrary::AddVertex
void AddVertex(const double v1, const double v2, const double v3)
Definition: SbPolyhedron.cxx:2365
y
#define y
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
Amg::RotationMatrix3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Definition: GeoPrimitives.h:49
SbPolyhedronGenericTrap
Definition: SbPolyhedron.h:572
SbPolyhedron::subtract
SbPolyhedron subtract(const SbPolyhedron &p) const
Definition: SbPolyhedron.cxx:1878
SbPolyhedronCons
Definition: SbPolyhedron.h:448
SbPolyhedronPara
Definition: SbPolyhedron.h:438
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
calibdata.tube
tube
Definition: calibdata.py:31
SbPolyhedron::intersect
SbPolyhedron intersect(const SbPolyhedron &p) const
Definition: SbPolyhedron.cxx:1860
HEPVis::SbRotation
Definition: SbRotation.h:35
SbPolyhedrizeAction::m_polyhedron
SbPolyhedron * m_polyhedron
Definition: SbPolyhedrizeAction.h:66
SbPolyhedronPolygonXSect
Definition: SbPolyhedron.h:534