DD4hep  1.33.0
Detector Description Toolkit for High Energy Physics
Surface.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : F.Gaede
11 //
12 //==========================================================================
13 #include "DDRec/Surface.h"
15 #include "DD4hep/Memory.h"
16 
17 #include "DDRec/MaterialManager.h"
18 
19 #include <cmath>
20 #include <memory>
21 
22 #include "TGeoMatrix.h"
23 #include "TGeoShape.h"
24 #include "TRotation.h"
25 //TGeoTrd1 is apparently not included by default
26 #include "TGeoTrd1.h"
27 
28 namespace dd4hep {
29  namespace rec {
30 
31  using namespace detail ;
32 
33 
34  //======================================================================================================
35 
36  void VolSurfaceBase::setU(const Vector3D& u_val) { _u = u_val ; }
37  void VolSurfaceBase::setV(const Vector3D& v_val) { _v = v_val ; }
38  void VolSurfaceBase::setNormal(const Vector3D& n) { _n = n ; }
39  void VolSurfaceBase::setOrigin(const Vector3D& o) { _o = o ; }
40 
41  long64 VolSurfaceBase::id() const { return _id ; }
42 
43  const SurfaceType& VolSurfaceBase::type() const { return _type ; }
44  Vector3D VolSurfaceBase::u(const Vector3D& /*point*/) const { return _u ; }
45  Vector3D VolSurfaceBase::v(const Vector3D& /*point*/) const { return _v ; }
46  Vector3D VolSurfaceBase::normal(const Vector3D& /*point*/) const { return _n ; }
47  const Vector3D& VolSurfaceBase::origin() const { return _o ;}
48 
50 
51  Vector3D p = point - origin() ;
52 
53  // create new orthogonal unit vectors
54  // FIXME: these vectors should be cached really ...
55 
56  double uv = u() * v() ;
57  Vector3D uprime = ( u() - uv * v() ).unit() ;
58  Vector3D vprime = ( v() - uv * u() ).unit() ;
59  double uup = u() * uprime ;
60  double vvp = v() * vprime ;
61 
62  return Vector2D( p*uprime / uup , p*vprime / vvp ) ;
63  }
64 
66 
67  Vector3D g = origin() + point[0] * u() + point[1] * v() ;
68 
69  return g ;
70  }
71 
72  const IMaterial& VolSurfaceBase::innerMaterial() const { return _innerMat ; }
73  const IMaterial& VolSurfaceBase::outerMaterial() const { return _outerMat ; }
74  double VolSurfaceBase::innerThickness() const { return _th_i ; }
75  double VolSurfaceBase::outerThickness() const { return _th_o ; }
76 
77 
79 
80  const Vector3D& o = this->origin() ;
81  const Vector3D& u_val = this->u( o ) ;
82  Vector3D um = -1. * u_val ;
83 
84  double dist_p = 0. ;
85  double dist_m = 0. ;
86 
87 
88  // std::cout << " VolSurfaceBase::length_along_u() : o = " << o << " u = " << this->u( o )
89  // << " -u = " << um << std::endl ;
90 
91 
92  if( volume()->GetShape()->Contains( o.const_array() ) ){
93 
94  dist_p = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) ,
95  const_cast<double*> ( u_val.const_array() ) ) ;
96  dist_m = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) ,
97  const_cast<double*> ( um.array() ) ) ;
98 
99 
100  // std::cout << " VolSurfaceBase::length_along_u() : shape contains(o) = " << volume()->GetShape()->Contains( o.const_array() )
101  // << " dist_p " << dist_p
102  // << " dist_m " << dist_m
103  // << std::endl ;
104 
105 
106  } else{
107 
108  dist_p = volume()->GetShape()->DistFromOutside( const_cast<double*> ( o.const_array() ) ,
109  const_cast<double*> ( u_val.const_array() ) ) ;
110  dist_m = volume()->GetShape()->DistFromOutside( const_cast<double*> ( o.const_array() ) ,
111  const_cast<double*> ( um.array() ) ) ;
112 
113  dist_p *= 1.0001 ;
114  dist_m *= 1.0001 ;
115 
116  // std::cout << " VolSurfaceBase::length_along_u() : shape contains(o) = " << volume()->GetShape()->Contains( o.const_array() )
117  // << " dist_p " << dist_p
118  // << " dist_m " << dist_m
119  // << std::endl ;
120 
121  Vector3D o_1 = this->origin() + dist_p * u_val ;
122  Vector3D o_2 = this->origin() + dist_m * um ;
123 
124  dist_p += volume()->GetShape()->DistFromInside( const_cast<double*> ( o_1.const_array() ) ,
125  const_cast<double*> ( u_val.const_array() ) ) ;
126 
127  dist_m += volume()->GetShape()->DistFromInside( const_cast<double*> ( o_2.const_array() ) ,
128  const_cast<double*> ( um.array() ) ) ;
129 
130  // std::cout << " VolSurfaceBase::length_along_u() : shape contains(o) = " << volume()->GetShape()->Contains( o.const_array() )
131  // << " dist_p " << dist_p
132  // << " dist_m " << dist_m
133  // << std::endl ;
134  }
135 
136  return dist_p + dist_m ;
137 
138 
139  }
140 
142 
143  const Vector3D& o = this->origin() ;
144  const Vector3D& v_val = this->v( o ) ;
145  Vector3D vm = -1. * v_val ;
146 
147  double dist_p = 0. ;
148  double dist_m = 0. ;
149 
150 
151  // std::cout << " VolSurfaceBase::length_along_u() : o = " << o << " u = " << this->u( o )
152  // << " -u = " << vm << std::endl ;
153 
154 
155  if( volume()->GetShape()->Contains( o.const_array() ) ){
156 
157  dist_p = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) ,
158  const_cast<double*> ( v_val.const_array() ) ) ;
159  dist_m = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) ,
160  const_cast<double*> ( vm.array() ) ) ;
161 
162 
163  // std::cout << " VolSurfaceBase::length_along_u() : shape contains(o) = " << volume()->GetShape()->Contains( o.const_array() )
164  // << " dist_p " << dist_p
165  // << " dist_m " << dist_m
166  // << std::endl ;
167 
168 
169  } else{
170 
171  dist_p = volume()->GetShape()->DistFromOutside( const_cast<double*> ( o.const_array() ) ,
172  const_cast<double*> ( v_val.const_array() ) ) ;
173  dist_m = volume()->GetShape()->DistFromOutside( const_cast<double*> ( o.const_array() ) ,
174  const_cast<double*> ( vm.array() ) ) ;
175 
176  dist_p *= 1.0001 ;
177  dist_m *= 1.0001 ;
178 
179  // std::cout << " VolSurfaceBase::length_along_u() : shape contains(o) = " << volume()->GetShape()->Contains( o.const_array() )
180  // << " dist_p " << dist_p
181  // << " dist_m " << dist_m
182  // << std::endl ;
183 
184  Vector3D o_1 = this->origin() + dist_p * v_val ;
185  Vector3D o_2 = this->origin() + dist_m * vm ;
186 
187  dist_p += volume()->GetShape()->DistFromInside( const_cast<double*> ( o_1.const_array() ) ,
188  const_cast<double*> ( v_val.const_array() ) ) ;
189 
190  dist_m += volume()->GetShape()->DistFromInside( const_cast<double*> ( o_2.const_array() ) ,
191  const_cast<double*> ( vm.array() ) ) ;
192 
193  // std::cout << " VolSurfaceBase::length_along_u() : shape contains(o) = " << volume()->GetShape()->Contains( o.const_array() )
194  // << " dist_p " << dist_p
195  // << " dist_m " << dist_m
196  // << std::endl ;
197  }
198 
199  return dist_p + dist_m ;
200 
201  }
202 
203 
204  double VolSurfaceBase::distance(const Vector3D& /*point*/ ) const { return 1.e99 ; }
205 
207  bool VolSurfaceBase::insideBounds(const Vector3D& point, double epsilon) const {
208 
209 #if 0
210 
211  bool inShape = ( type().isUnbounded() ? true : volume()->GetShape()->Contains( point.const_array() ) ) ;
212 
213  double dist = std::abs ( distance( point ) ) ;
214 
215  std::cout << " ** Surface::insideBound( " << point << " ) - distance = " << dist
216  << " origin = " << origin() << " normal = " << normal()
217  << " p * n = " << point * normal()
218  << " isInShape : " << inShape << std::endl ;
219 
220  return dist < epsilon && inShape ;
221 #else
222 
223  if( type().isUnbounded() ){
224 
225  return std::abs ( distance( point ) ) < epsilon ;
226 
227  } else {
228 
229  return ( std::abs ( distance( point ) ) < epsilon && volume()->GetShape()->Contains( point.const_array() ) ) ;
230  }
231 
232 #endif
233 
234  }
235 
236 
237  std::vector< std::pair<Vector3D, Vector3D> > VolSurfaceBase::getLines(unsigned ) {
238  // dummy implementation returning empty set
239  std::vector< std::pair<Vector3D, Vector3D> > lines ;
240  return lines ;
241  }
242 
243  //===================================================================
244  // simple wrapper methods forwarding the call to the implementation object
245 
246  long64 VolSurface::id() const { return _surf->id() ; }
247  const SurfaceType& VolSurface::type() const { return _surf->type() ; }
248  Vector3D VolSurface::u( const Vector3D& point ) const { return _surf->u(point) ; }
249  Vector3D VolSurface::v(const Vector3D& point ) const { return _surf->v(point) ; }
250  Vector3D VolSurface::normal(const Vector3D& point ) const { return _surf->normal(point) ; }
251  const Vector3D& VolSurface::origin() const { return _surf->origin() ;}
252  Vector2D VolSurface::globalToLocal( const Vector3D& point) const { return _surf->globalToLocal( point ) ; }
253  Vector3D VolSurface::localToGlobal( const Vector2D& point) const { return _surf->localToGlobal( point) ; }
254  const IMaterial& VolSurface::innerMaterial() const{ return _surf->innerMaterial() ; }
255  const IMaterial& VolSurface::outerMaterial() const { return _surf->outerMaterial() ; }
256  double VolSurface::innerThickness() const { return _surf->innerThickness() ; }
257  double VolSurface::outerThickness() const { return _surf->outerThickness() ; }
258  double VolSurface::length_along_u() const { return _surf->length_along_u() ; }
259  double VolSurface::length_along_v() const { return _surf->length_along_v() ; }
260  double VolSurface::distance(const Vector3D& point ) const { return _surf->distance( point ) ; }
261  bool VolSurface::insideBounds(const Vector3D& point, double epsilon) const {
262  return _surf->insideBounds( point, epsilon ) ;
263  }
264  std::vector< std::pair<Vector3D, Vector3D> > VolSurface::getLines(unsigned nMax) {
265  return _surf->getLines(nMax) ;
266  }
267 
268  //===================================================================
269 
271  double VolPlaneImpl::distance(const Vector3D& point ) const {
272  return ( point - origin() ) * normal() ;
273  }
274  //======================================================================================================
275 
277  double thickness_inner ,double thickness_outer, Vector3D o ) :
278 
279  VolSurfaceBase(typ, thickness_inner, thickness_outer, Vector3D() , Vector3D() , Vector3D() , o , vol, 0) {
280  Vector3D v_val( 0., 0., 1. ) ;
281  Vector3D o_rphi( o.x() , o.y() , 0. ) ;
282  Vector3D n = o_rphi.unit() ;
283  Vector3D u_val = v_val.cross( n ) ;
284 
285  setU( u_val ) ;
286  setV( v_val ) ;
287  setNormal( n ) ;
288 
291  _type.setProperty( SurfaceType::Cone , false ) ;
292  _type.checkParallelToZ( *this ) ;
293  _type.checkOrthogonalToZ( *this ) ;
294  }
295 
296  Vector3D VolCylinderImpl::u(const Vector3D& point ) const {
297 
298  Vector3D n( 1. , point.phi() , 0. , Vector3D::cylindrical ) ;
299 
300  return v().cross( n ) ;
301  }
302 
303  Vector3D VolCylinderImpl::normal(const Vector3D& point ) const {
304 
305  // normal is just given by phi of the point
306  return Vector3D( 1. , point.phi() , 0. , Vector3D::cylindrical ) ;
307  }
308 
310 
311  // cylinder is parallel to v here so u is Z and v is r *Phi
312  double phi = point.phi() - origin().phi() ;
313 
314  while( phi < -M_PI ) phi += 2.*M_PI ;
315  while( phi > M_PI ) phi -= 2.*M_PI ;
316 
317  return Vector2D( origin().rho() * phi, point.z() - origin().z() ) ;
318  }
319 
320 
322 
323  double z = point.v() + origin().z() ;
324  double phi = point.u() / origin().rho() + origin().phi() ;
325 
326  while( phi < -M_PI ) phi += 2.*M_PI ;
327  while( phi > M_PI ) phi -= 2.*M_PI ;
328 
329  return Vector3D( origin().rho() , phi, z , Vector3D::cylindrical ) ;
330  }
331 
332 
334  double VolCylinderImpl::distance(const Vector3D& point ) const {
335 
336  return point.rho() - origin().rho() ;
337  }
338 
339  //================================================================================================================
341  double thickness_inner ,double thickness_outer, Vector3D v_val, Vector3D o_val ) :
342 
343  VolSurfaceBase(typ, thickness_inner, thickness_outer, Vector3D() , v_val , Vector3D() , Vector3D() , vol, 0) {
344 
345  Vector3D o_rphi( o_val.x() , o_val.y() , 0. ) ;
346 
347  // sanity check: v and o have to have a common phi
348  double dphi = v_val.phi() - o_rphi.phi() ;
349  while( dphi < -M_PI ) dphi += 2.*M_PI ;
350  while( dphi > M_PI ) dphi -= 2.*M_PI ;
351 
352  if( std::fabs( dphi ) > 1e-6 ){
353  std::stringstream sst ; sst << "VolConeImpl::VolConeImpl() - incompatibel vector v and o given "
354  << v_val << " - " << o_val ;
355  throw std::runtime_error( sst.str() ) ;
356  }
357 
358  double theta = v_val.theta() ;
359 
360  Vector3D n( 1. , v_val.phi() , ( theta + M_PI/2. ) , Vector3D::spherical ) ;
361  Vector3D u_val = v_val.cross( n ) ;
362 
363  setU( u_val ) ;
364  setOrigin( o_rphi ) ;
365  setNormal( n ) ;
366 
367  // set helper variable for faster computations (describe cone with tip at origin)
368  _tanTheta = std::tan( theta ) ;
369  double tipoffset = o_val.rho() / _tanTheta ; // distance from tip to origin.z()
370  _ztip = o_val.z() - tipoffset ;
371 
372  double dist_p = vol->GetShape()->DistFromInside( const_cast<double*> ( o_val.const_array() ) ,
373  const_cast<double*> ( v_val.const_array() ) ) ;
374  Vector3D vm = -1. * v_val ;
375  double dist_m = vol->GetShape()->DistFromInside( const_cast<double*> ( o_val.const_array() ) ,
376  const_cast<double*> ( vm.array() ) ) ;
377 
378  double costh = std::cos( theta) ;
379  _zt0 = tipoffset - dist_m * costh ;
380  _zt1 = tipoffset + dist_p * costh ;
381 
382 
388  }
389 
390 
391  Vector3D VolConeImpl::v(const Vector3D& point ) const {
392  // just take phi from point
393  Vector3D av( 1. , point.phi() , _v.theta() , Vector3D::spherical ) ;
394  return av ;
395  }
396 
397  Vector3D VolConeImpl::u(const Vector3D& point ) const {
398  // compute from v X n
399  const Vector3D& av = this->v( point ) ;
400  const Vector3D& n = normal( point ) ;
401  return av.cross( n ) ;
402  }
403 
404  Vector3D VolConeImpl::normal(const Vector3D& point ) const {
405  // just take phi from point
406  Vector3D n( 1. , point.phi() , _n.theta() , Vector3D::spherical ) ;
407  return n ;
408  }
409 
411 
412  // cone is parallel to z here, so u is r *Phi and v is "along" z
413  double phi = point.phi() - origin().phi() ;
414 
415  while( phi < -M_PI ) phi += 2.*M_PI ;
416  while( phi > M_PI ) phi -= 2.*M_PI ;
417 
418 
419  double r = ( point.z() - _ztip ) * _tanTheta ;
420 
421  return Vector2D( r*phi, ( point.z() - origin().z() ) / cos( _v.theta() ) ) ;
422  }
423 
424 
426 
427  double z = point.v() * cos( _v.theta() ) + origin().z() ;
428 
429  double r = ( z - _ztip ) * _tanTheta ;
430 
431  double phi = point.u() / r + origin().phi() ;
432 
433  while( phi < -M_PI ) phi += 2.*M_PI ;
434  while( phi > M_PI ) phi -= 2.*M_PI ;
435 
436  return Vector3D( r , phi, z , Vector3D::cylindrical ) ;
437  }
438 
439 
441  double VolConeImpl::distance(const Vector3D& point ) const {
442 
443  // // if the point is in the other hemispere we return the distance to origin
444  // // -> this assumes that the cones do not cross the xy-plane ...
445  // // otherwise we get the distance to the mirrored part of the cone
446  // // needs more thought ..
447  // if( origin().z() * point.z() < 0. )
448  // return point.r() ;
449 
450  //fixme: there are probably faster ways to compute this
451  // e.g by using the intercept theorem - tbd. ...
452  // const Vector2D& lp = globalToLocal( point ) ;
453  // const Vector3D& gp = localToGlobal( lp ) ;
454 
455  // Vector3D dz = point - gp ;
456 
457  //return dz * normal( point ) ;
458 
459  double zp = point.z() - _ztip ;
460  double r = point.rho() - zp * _tanTheta ;
461  return r * std::cos( _v.theta() ) ;
462 
463  }
464 
466  std::vector< std::pair<Vector3D, Vector3D> > VolConeImpl::getLines(unsigned nMax){
467 
468  std::vector< std::pair<Vector3D, Vector3D> > lines ;
469 
470  lines.reserve( nMax ) ;
471 
472  double theta = v().theta() ;
473  double half_length = 0.5 * length_along_v() * cos( theta ) ;
474 
475  Vector3D zv( 0. , 0. , half_length ) ;
476 
477  double dr = half_length * tan( theta ) ;
478 
479  double r0 = origin().rho() - dr ;
480  double r1 = origin().rho() + dr ;
481 
482 
483  unsigned n = nMax / 4 ;
484  double dPhi = 2.* ROOT::Math::Pi() / double( n ) ;
485 
486  for( unsigned i = 0 ; i < n ; ++i ) {
487 
488  Vector3D r0v0( r0*sin( i *dPhi ) , r0*cos( i *dPhi ) , 0. ) ;
489  Vector3D r0v1( r0*sin( (i+1)*dPhi ) , r0*cos( (i+1)*dPhi ) , 0. ) ;
490 
491  Vector3D r1v0( r1*sin( i *dPhi ) , r1*cos( i *dPhi ) , 0. ) ;
492  Vector3D r1v1( r1*sin( (i+1)*dPhi ) , r1*cos( (i+1)*dPhi ) , 0. ) ;
493 
494  Vector3D pl0 = zv + r1v0 ;
495  Vector3D pl1 = zv + r1v1 ;
496  Vector3D pl2 = -zv + r0v1 ;
497  Vector3D pl3 = -zv + r0v0 ;
498 
499  lines.emplace_back( pl0, pl1 );
500  lines.emplace_back( pl1, pl2 );
501  lines.emplace_back( pl2, pl3 );
502  lines.emplace_back( pl3, pl0 );
503  }
504  return lines;
505  }
506 
507  //================================================================================================================
508 
510  if( _isOwner ) {
511  // delete all surfaces attached to this volume
512  std::for_each(begin(), end(), detail::deleteObject<ISurface>);
513  }
514  }
515 
516  //================================================================================================================
517 
519  VolSurfaceList* list = det.extension< VolSurfaceList >(false);
520  if ( !list ) {
521  list = det.addExtension<VolSurfaceList >(new VolSurfaceList);
522  }
523  return list ;
524  }
525 
526 
527  //======================================================================================================================
528 
529  bool findVolume( PlacedVolume pv, Volume theVol, std::list< PlacedVolume >& volList ) {
530 
531 
532  volList.emplace_back( pv ) ;
533 
534  // unsigned count = volList.size() ;
535  // for(unsigned i=0 ; i < count ; ++i) {
536  // std::cout << " **" ;
537  // }
538  // std::cout << " searching for volume: " << theVol.name() << " " << std::hex << theVol.ptr() << " <-> pv.volume : " << pv.name() << " " << pv.volume().ptr()
539  // << " pv.volume().ptr() == theVol.ptr() " << (pv.volume().ptr() == theVol.ptr() )
540  // << std::endl ;
541 
542 
543  if( pv.volume().ptr() == theVol.ptr() ) {
544 
545  return true ;
546 
547  } else {
548 
549  //--------------------------------
550 
551  const TGeoNode* node = pv.ptr();
552 
553  if ( !node ) {
554 
555  // std::cout << " *** findVolume: Invalid placement: - node pointer Null for volume: " << pv.name() << std::endl ;
556 
557  throw std::runtime_error("*** findVolume: Invalid placement: - node pointer Null ! " + std::string( pv.name() ) );
558  }
559  // Volume vol = pv.volume();
560 
561  // std::cout << " ndau = " << node->GetNdaughters() << std::endl ;
562 
563  for (Int_t idau = 0, ndau = node->GetNdaughters(); idau < ndau; ++idau) {
564 
565  TGeoNode* daughter = node->GetDaughter(idau);
566  PlacedVolume placement( daughter );
567 
568  if ( !placement.data() ) {
569  throw std::runtime_error("*** findVolume: Invalid not instrumented placement:"+std::string(daughter->GetName())
570  +" [Internal error -- bad detector constructor]");
571  }
572 
573  PlacedVolume pv_dau( daughter );
574 
575  if( findVolume( pv_dau , theVol , volList ) ) {
576 
577  // std::cout << " ----- found in daughter volume !!! " << std::hex << pv_dau.volume().ptr() << std::endl ;
578 
579  return true ;
580  }
581  }
582 
583  // ------- not found:
584 
585  volList.pop_back() ;
586 
587  return false ;
588  //--------------------------------
589 
590  }
591  }
592 
593  //======================================================================================================================
594 
595  Surface::Surface( DetElement det, VolSurface volSurf ) : _det( det) , _volSurf( volSurf ),
596  _wtM() , _id( 0) , _type( _volSurf.type() ) {
597 
598  initialize() ;
599  }
600 
601  long64 Surface::id() const { return _id ; }
602 
603  const SurfaceType& Surface::type() const { return _type ; }
604 
605  Vector3D Surface::u(const Vector3D& /*point*/) const { return _u ; }
606  Vector3D Surface::v(const Vector3D& /*point*/) const { return _v ; }
607  Vector3D Surface::normal(const Vector3D& /*point*/) const { return _n ; }
608  const Vector3D& Surface::origin() const { return _o ;}
609  double Surface::innerThickness() const { return _volSurf.innerThickness() ; }
610  double Surface::outerThickness() const { return _volSurf.outerThickness() ; }
611  double Surface::length_along_u() const { return _volSurf.length_along_u() ; }
612  double Surface::length_along_v() const { return _volSurf.length_along_v() ; }
613 
617 
618  const IMaterial& mat = _volSurf.innerMaterial() ;
619 
620  if( mat.Z() <= 0 ) {
621 
622  MaterialManager matMgr( _det.placement().volume() ) ;
623 
624  Vector3D p = _o - innerThickness() * _n ;
625 
626  const MaterialVec& materials = matMgr.materialsBetween( _o , p ) ;
627 
628  _volSurf.setInnerMaterial( materials.size() > 1 ?
629  matMgr.createAveragedMaterial( materials ) :
630  materials[0].first ) ;
631  }
632  return mat ;
633  }
634 
636 
637  const IMaterial& mat = _volSurf.outerMaterial() ;
638 
639  if( mat.Z() <= 0 ) {
640 
641  MaterialManager matMgr( _det.placement().volume() ) ;
642 
643  Vector3D p = _o + outerThickness() * _n ;
644 
645  const MaterialVec& materials = matMgr.materialsBetween( _o , p ) ;
646 
647  _volSurf.setOuterMaterial( materials.size() > 1 ?
648  matMgr.createAveragedMaterial( materials ) :
649  materials[0].first ) ;
650  }
651  return mat ;
652  }
653 
654 
655  Vector2D Surface::globalToLocal( const Vector3D& point) const {
656 
657  Vector3D p = point - origin() ;
658 
659  // create new orthogonal unit vectors
660  // FIXME: these vectors should be cached really ...
661 
662  double uv = u() * v() ;
663  Vector3D uprime = ( u() - uv * v() ).unit() ;
664  Vector3D vprime = ( v() - uv * u() ).unit() ;
665  double uup = u() * uprime ;
666  double vvp = v() * vprime ;
667 
668  return Vector2D( p*uprime / uup , p*vprime / vvp ) ;
669  }
670 
671 
672  Vector3D Surface::localToGlobal( const Vector2D& point) const {
673 
674  Vector3D g = origin() + point[0] * u() + point[1] * v() ;
675  return g ;
676  }
677 
678 
680 
681  double o_array[3] ;
682 
683  _wtM->LocalToMaster ( Vector3D() , o_array ) ;
684 
685  Vector3D o(o_array) ;
686 
687  return o ;
688  }
689 
690 
691  double Surface::distance(const Vector3D& point ) const {
692 
693  double pa[3] ;
694  _wtM->MasterToLocal( point , pa ) ;
695  Vector3D localPoint( pa ) ;
696 
697  return _volSurf.distance( localPoint ) ;
698  }
699 
700  bool Surface::insideBounds(const Vector3D& point, double epsilon) const {
701 
702  double pa[3] ;
703  _wtM->MasterToLocal( point , pa ) ;
704  Vector3D localPoint( pa ) ;
705 
706  return _volSurf.insideBounds( localPoint , epsilon) ;
707  }
708 
710 
711  // first we need to find the right volume for the local surface in the DetElement's volumes
712  std::list< PlacedVolume > pVList ;
713  PlacedVolume pv = _det.placement() ;
714  Volume theVol = _volSurf.volume() ;
715 
716  if( ! findVolume( pv, theVol , pVList ) ){
717  theVol = _volSurf.volume() ;
718  std::stringstream sst ; sst << " ***** ERROR: Volume " << theVol.name() << " not found for DetElement " << _det.name() << " with surface " ;
719  throw std::runtime_error( sst.str() ) ;
720  }
721 
722  //=========== compute and cache world transform for surface ==========
723  Alignment nominal = _det.nominal();
724  const TGeoHMatrix& wm = nominal.worldTransformation() ;
725 
726 #if 0 // debug
727  wm.Print() ;
728  for( std::list<PlacedVolume>::iterator it= pVList.begin(), n = pVList.end() ; it != n ; ++it ){
729  PlacedVolume pv = *it ;
730  TGeoMatrix* m = pv->GetMatrix();
731  std::cout << " +++ matrix for placed volume : " << std::endl ;
732  m->Print() ;
733  }
734 #endif
735 
736  // need to get the inverse transformation ( see Detector.cpp )
737  // std::auto_ptr<TGeoHMatrix> wtI( new TGeoHMatrix( wm.Inverse() ) ) ;
738  // has been fixed now, no need to get the inverse anymore:
739  std::unique_ptr<TGeoHMatrix> wtI( new TGeoHMatrix( wm ) ) ;
740 
741  //---- if the volSurface is not in the DetElement's volume, we need to mutliply the path to the volume to the
742  // DetElements world transform
743  for( auto it = std::next(pVList.begin()) ; it != pVList.end() ; ++it ) {
744 
745  PlacedVolume pvol = *it ;
746  TGeoMatrix* m = pvol->GetMatrix();
747  // std::cout << " +++ matrix for placed volume : " << std::endl ;
748  // m->Print() ;
749  //wtI->MultiplyLeft( m );
750 
751  wtI->Multiply( m );
752  }
753 
754  // std::cout << " +++ new world transform matrix : " << std::endl ;
755 
756 #if 0 //fixme: which convention to use here - the correct should be wtI, however it is the inverse of what is stored in DetElement ???
757  dd4hep_ptr<TGeoHMatrix> wt( new TGeoHMatrix( wtI->Inverse() ) ) ;
758  wt->Print() ;
759  // cache the world transform for the surface
760  _wtM = std::move(wtI);
761 #else
762  // wtI->Print() ;
763  // cache the world transform for the surface
764  _wtM = std::move(wtI);
765 #endif
766 
767 
768  // ============ now fill the global surface vectors ==========================
769 
770  double ua[3], va[3], na[3], oa[3] ;
771 
772  _wtM->LocalToMasterVect( _volSurf.u() , ua ) ;
773  _wtM->LocalToMasterVect( _volSurf.v() , va ) ;
774  _wtM->LocalToMasterVect( _volSurf.normal() , na ) ;
775  _wtM->LocalToMaster ( _volSurf.origin() , oa ) ;
776 
777  _u.fill( ua ) ;
778  _v.fill( va ) ;
779  _n.fill( na ) ;
780  _o.fill( oa ) ;
781 
782  // std::cout << " --- local and global surface vectors : ------- " << std::endl
783  // << " u : " << _volSurf.u() << " - " << _u << std::endl
784  // << " v : " << _volSurf.v() << " - " << _v << std::endl
785  // << " n : " << _volSurf.normal() << " - " << _n << std::endl
786  // << " o : " << _volSurf.origin() << " - " << _o << std::endl ;
787 
788 
789  // =========== check parallel and orthogonal to Z ===================
790 
791  if( ! _type.isCone() ) {
792  //fixme: workaround for conical surfaces that should always be parallel to z
793  // however the check with the normal does not work here ...
794 
795  _type.checkParallelToZ( *this ) ;
796 
797  _type.checkOrthogonalToZ( *this ) ;
798  }
799 
800  //======== set the unique surface ID from the DetElement ( and placements below ? )
801 
802  // just use the DetElement ID for now ...
803  // or the id set by the user to the VolSurface ...
804  _id = ( _volSurf.id()==0 ? _det.volumeID() : _volSurf.id() ) ;
805 
806  // typedef PlacedVolume::VolIDs IDV ;
807  // DetElement d = _det ;
808  // while( d.isValid() && d.parent().isValid() ){
809  // PlacedVolume pv = d.placement() ;
810  // if( pv.isValid() ){
811  // const IDV& idV = pv.volIDs() ;
812  // std::cout << " VolIDs : " << d.name() << std::endl ;
813  // for( unsigned i=0, n=idV.size() ; i<n ; ++i){
814  // std::cout << " " << idV[i].first << " - " << idV[i].second << std::endl ;
815  // }
816  // }
817  // d = d.parent() ;
818  // }
819 
820  }
821  //===================================================================================================================
822 
823  std::vector< std::pair<Vector3D, Vector3D> > Surface::getLines(unsigned nMax) {
824 
825 
826  const static double epsilon = 1e-6 ;
827 
828  std::vector< std::pair<Vector3D, Vector3D> > lines ;
829 
830  //--------------------------------------------
831  // check if there are lines defined in the VolSurface :
832  const std::vector< std::pair<Vector3D, Vector3D> >& local_lines = _volSurf.getLines() ;
833 
834  if( local_lines.size() > 0 ) {
835  unsigned n=local_lines.size() ;
836  lines.reserve( n ) ;
837 
838  for( unsigned i=0;i<n;++i){
839 
840  Vector3D av,bv;
841  _wtM->LocalToMaster( local_lines[i].first , av.array() ) ;
842  _wtM->LocalToMaster( local_lines[i].second , bv.array() ) ;
843 
844  lines.emplace_back( av, bv );
845  }
846 
847  return lines ;
848  }
849  //--------------------------------------------
850 
851 
852  // get local and global surface vectors
853  const Vector3D& lu = _volSurf.u() ;
854  // const Vector3D& lv = _volSurf.v() ;
855  const Vector3D& ln = _volSurf.normal() ;
856  Vector3D lo = _volSurf.origin() ;
857 
858  Volume vol = volume() ;
859  const TGeoShape* shape = vol->GetShape() ;
860 
861 
862  if( type().isPlane() ) {
863 
864  if( shape->IsA() == TGeoBBox::Class() ) {
865 
866  TGeoBBox* box = ( TGeoBBox* ) shape ;
867 
868  Vector3D boxDim( box->GetDX() , box->GetDY() , box->GetDZ() ) ;
869 
870 
871  bool isYZ = std::fabs( ln.x() - 1.0 ) < epsilon ; // normal parallel to x
872  bool isXZ = std::fabs( ln.y() - 1.0 ) < epsilon ; // normal parallel to y
873  bool isXY = std::fabs( ln.z() - 1.0 ) < epsilon ; // normal parallel to z
874 
875 
876  if( isYZ || isXZ || isXY ) { // plane is parallel to one of the box' sides -> need 4 vertices from box dimensions
877 
878  // if isYZ :
879  unsigned uidx = 1 ;
880  unsigned vidx = 2 ;
881 
882  Vector3D ubl( 0., 1., 0. ) ;
883  Vector3D vbl( 0., 0., 1. ) ;
884 
885  if( isXZ ) {
886 
887  ubl.fill( 1., 0., 0. ) ;
888  vbl.fill( 0., 0., 1. ) ;
889  uidx = 0 ;
890  vidx = 2 ;
891 
892  } else if( isXY ) {
893 
894  ubl.fill( 1., 0., 0. ) ;
895  vbl.fill( 0., 1., 0. ) ;
896  uidx = 0 ;
897  vidx = 1 ;
898  }
899 
900  Vector3D ub ;
901  Vector3D vb ;
902  _wtM->LocalToMasterVect( ubl , ub.array() ) ;
903  _wtM->LocalToMasterVect( vbl , vb.array() ) ;
904 
905  lines.reserve(4) ;
906 
907  lines.emplace_back(_o + boxDim[ uidx ] * ub + boxDim[ vidx ] * vb , _o - boxDim[ uidx ] * ub + boxDim[ vidx ] * vb );
908  lines.emplace_back(_o - boxDim[ uidx ] * ub + boxDim[ vidx ] * vb , _o - boxDim[ uidx ] * ub - boxDim[ vidx ] * vb );
909  lines.emplace_back(_o - boxDim[ uidx ] * ub - boxDim[ vidx ] * vb , _o + boxDim[ uidx ] * ub - boxDim[ vidx ] * vb );
910  lines.emplace_back(_o + boxDim[ uidx ] * ub - boxDim[ vidx ] * vb , _o + boxDim[ uidx ] * ub + boxDim[ vidx ] * vb );
911 
912  return lines ;
913  }
914 
915  } else if( shape->InheritsFrom("TGeoTube") || shape->InheritsFrom("TGeoCone") ) {
916 
917 
918  // can only deal with special case of z-disk and origin in center of cone
919  if( type().isZDisk() ) { // && lo.rho() < epsilon ) {
920 
921  if( lo.rho() > epsilon ) {
922  // move origin to z-axis
923  lo.x() = 0. ;
924  lo.y() = 0. ;
925  }
926 
927  double zhalf = 0 ;
928  double rmax1 = 0 ;
929  double rmax2 = 0 ;
930  double rmin1 = 0 ;
931  double rmin2 = 0 ;
932  if( shape->InheritsFrom("TGeoTube") ) {
933  TGeoTube* tube = ( TGeoTube* ) shape ;
934  zhalf = tube->GetDZ() ;
935  rmax1 = tube->GetRmax() ;
936  rmax2 = tube->GetRmax() ;
937  rmin1 = tube->GetRmin() ;
938  rmin2 = tube->GetRmin() ;
939  } else { // shape->InheritsFrom("TGeoCone") )
940  TGeoCone* cone = ( TGeoCone* ) shape ;
941  zhalf = cone->GetDZ() ;
942  rmax1 = cone->GetRmax1() ;
943  rmax2 = cone->GetRmax2() ;
944  rmin1 = cone->GetRmin1() ;
945  rmin2 = cone->GetRmin2() ;
946  }
947 
948  // two circles around origin
949  // get radii at position of plane
950  double r0 = rmin1 + ( rmin2 - rmin1 ) / ( 2. * zhalf ) * ( zhalf + lo.z() ) ;
951  double r1 = rmax1 + ( rmax2 - rmax1 ) / ( 2. * zhalf ) * ( zhalf + lo.z() ) ;
952 
953 
954  unsigned n = nMax / 4 ;
955  double dPhi = 2.* ROOT::Math::Pi() / double( n ) ;
956 
957  for( unsigned i = 0 ; i < n ; ++i ) {
958 
959  Vector3D rv00( r0*sin( i *dPhi ) , r0*cos( i *dPhi ) , 0. ) ;
960  Vector3D rv01( r0*sin( (i+1)*dPhi ) , r0*cos( (i+1)*dPhi ) , 0. ) ;
961 
962  Vector3D rv10( r1*sin( i *dPhi ) , r1*cos( i *dPhi ) , 0. ) ;
963  Vector3D rv11( r1*sin( (i+1)*dPhi ) , r1*cos( (i+1)*dPhi ) , 0. ) ;
964 
965 
966  Vector3D pl0 = lo + rv00 ;
967  Vector3D pl1 = lo + rv01 ;
968 
969  Vector3D pl2 = lo + rv10 ;
970  Vector3D pl3 = lo + rv11 ;
971 
972 
973  Vector3D pg0,pg1,pg2,pg3 ;
974 
975  _wtM->LocalToMaster( pl0, pg0.array() ) ;
976  _wtM->LocalToMaster( pl1, pg1.array() ) ;
977  _wtM->LocalToMaster( pl2, pg2.array() ) ;
978  _wtM->LocalToMaster( pl3, pg3.array() ) ;
979 
980  lines.emplace_back( pg0, pg1 );
981  lines.emplace_back( pg2, pg3 );
982  }
983 
984  //add some vertical and horizontal lines so that the disc is seen in the rho-z projection
985 
986  n = 4 ; dPhi = 2.* ROOT::Math::Pi() / double( n ) ;
987 
988  for( unsigned i = 0 ; i < n ; ++i ) {
989 
990  Vector3D rv0( r0*sin( i * dPhi ) , r0*cos( i * dPhi ) , 0. ) ;
991  Vector3D rv1( r1*sin( i * dPhi ) , r1*cos( i * dPhi ) , 0. ) ;
992 
993  Vector3D pl0 = lo + rv0 ;
994  Vector3D pl1 = lo + rv1 ;
995 
996  Vector3D pg0,pg1 ;
997 
998  _wtM->LocalToMaster( pl0, pg0.array() ) ;
999  _wtM->LocalToMaster( pl1, pg1.array() ) ;
1000 
1001  lines.emplace_back(pg0, pg1);
1002  }
1003 
1004  }
1005 
1006  return lines ;
1007  }
1008 
1009  else if(shape->IsA() == TGeoTrap::Class()) {
1010  TGeoTrap* trapezoid = ( TGeoTrap* ) shape;
1011 
1012  double dx1 = trapezoid->GetBl1();
1013  double dx2 = trapezoid->GetTl1();
1014  double dz = trapezoid->GetH1();
1015 
1016  //according to the TGeoTrap definition, the lengths are given such that the normal vector of the surface
1017  //points in the e_z direction.
1018  Vector3D ubl( 1., 0., 0. ) ;
1019  Vector3D vbl( 0., 1., 0. ) ;
1020 
1021  //the local span vectors are transformed into the main coordinate system (in LocalToMasterVect())
1022  Vector3D ub ;
1023  Vector3D vb ;
1024  _wtM->LocalToMasterVect( ubl , ub.array() ) ;
1025  _wtM->LocalToMasterVect( vbl , vb.array() ) ;
1026 
1027  //the trapezoid is drawn as a set of four lines connecting its four corners
1028  lines.reserve(4) ;
1029  //_o is vector to the origin
1030  lines.emplace_back( _o + dx1 * ub - dz * vb , _o + dx2 * ub + dz * vb);
1031  lines.emplace_back( _o + dx2 * ub + dz * vb , _o - dx2 * ub + dz * vb);
1032  lines.emplace_back( _o - dx2 * ub + dz * vb , _o - dx1 * ub - dz * vb);
1033  lines.emplace_back( _o - dx1 * ub - dz * vb , _o + dx1 * ub - dz * vb);
1034 
1035  return lines;
1036  }
1037  //added code by Thorben Quast for simplified set of lines for trapezoids with unequal lengths in x
1038  else if(shape->IsA() == TGeoTrd1::Class()){
1039  TGeoTrd1* trapezoid = ( TGeoTrd1* ) shape;
1040  //all lengths are half length
1041  double dx1 = trapezoid->GetDx1();
1042  double dx2 = trapezoid->GetDx2();
1043  double dy = trapezoid->GetDy();
1044  double dz = trapezoid->GetDz();
1045 
1046  bool isYZ = std::fabs( ln.x() - 1.0 ) < epsilon ; // normal parallel to x
1047  bool isXZ = std::fabs( ln.y() - 1.0 ) < epsilon ; // normal parallel to y
1048  bool isXY = std::fabs( ln.z() - 1.0 ) < epsilon ; // normal parallel to z
1049 
1050  if(not (isYZ || isXZ || isXY)) {
1051  std::stringstream sst ;
1052  sst << " ***** ERROR: Trapezoid surface cannot be defined, normal not parallel to x, y, or z axis";
1053  throw std::runtime_error( sst.str() ) ;
1054  }
1055 
1056  Vector3D ubl, vbl;
1057 
1058  if(isYZ) {
1059  ubl.fill( 0., 1., 0. ) ;
1060  vbl.fill( 0., 0., 1. ) ;
1061  } else if( isXZ ) {
1062  ubl.fill( 1., 0., 0. ) ;
1063  vbl.fill( 0., 0., 1. ) ;
1064  } else if( isXY ) {
1065  ubl.fill( 1., 0., 0. ) ;
1066  vbl.fill( 0., 1., 0. ) ;
1067  }
1068 
1069  Vector3D ub ;
1070  Vector3D vb ;
1071  _wtM->LocalToMasterVect( ubl , ub.array() ) ;
1072  _wtM->LocalToMasterVect( vbl , vb.array() ) ;
1073  //the trapezoid is drawn as a set of four lines connecting its four corners
1074  lines.reserve(4) ;
1075  //_o is vector to the origin
1076 
1077  if( isYZ ) {
1078  lines.emplace_back( _o + dy * ub - dz * vb , _o + dy * ub + dz * vb);
1079  lines.emplace_back( _o + dy * ub + dz * vb , _o - dy * ub + dz * vb);
1080  lines.emplace_back( _o - dy * ub + dz * vb , _o - dy * ub - dz * vb);
1081  lines.emplace_back( _o - dy * ub - dz * vb , _o + dy * ub - dz * vb);
1082  } else if( isXZ ) {
1083  lines.emplace_back( _o + dx1 * ub - dz * vb , _o + dx2 * ub + dz * vb);
1084  lines.emplace_back( _o + dx2 * ub + dz * vb , _o - dx2 * ub + dz * vb);
1085  lines.emplace_back( _o - dx2 * ub + dz * vb , _o - dx1 * ub - dz * vb);
1086  lines.emplace_back( _o - dx1 * ub - dz * vb , _o + dx1 * ub - dz * vb);
1087  } else if( isXY ) {
1088  lines.emplace_back( _o + dx1 * ub - dy * vb , _o + dx2 * ub + dy * vb);
1089  lines.emplace_back( _o + dx2 * ub + dy * vb , _o - dx2 * ub + dy * vb);
1090  lines.emplace_back( _o - dx2 * ub + dy * vb , _o - dx1 * ub - dy * vb);
1091  lines.emplace_back( _o - dx1 * ub - dy * vb , _o + dx1 * ub - dy * vb);
1092  }
1093  return lines ;
1094  }
1095  //added code by Thorben Quast for simplified set of lines for trapezoids with unequal lengths in x AND y
1096  else if(shape->IsA() == TGeoTrd2::Class()){
1097  TGeoTrd2* trapezoid = ( TGeoTrd2* ) shape;
1098  //all lengths are half length
1099  double dx1 = trapezoid->GetDx1();
1100  double dx2 = trapezoid->GetDx2();
1101  //double dy1 = trapezoid->GetDy1();
1102  //double dy2 = trapezoid->GetDy2();
1103  double dz = trapezoid->GetDz();
1104 
1105  //the normal vector is parallel to e_y for all geometry cases in CLIC
1106  //if that is at some point not the case anymore, then local plane vectors ubl, vbl
1107  //must be initialized like it is done for the boxes (line 674 following)
1108  Vector3D ubl( 1., 0., 0. ) ;
1109  Vector3D vbl( 0., 0., 1. ) ;
1110 
1111  //the local span vectors are transformed into the main coordinate system (in LocalToMasterVect())
1112  Vector3D ub ;
1113  Vector3D vb ;
1114  _wtM->LocalToMasterVect( ubl , ub.array() ) ;
1115  _wtM->LocalToMasterVect( vbl , vb.array() ) ;
1116 
1117  //the trapezoid is drawn as a set of four lines connecting its four corners
1118  lines.reserve(4) ;
1119  //_o is vector to the origin
1120  lines.emplace_back( _o + dx1 * ub - dz * vb , _o + dx2 * ub + dz * vb);
1121  lines.emplace_back( _o + dx2 * ub + dz * vb , _o - dx2 * ub + dz * vb);
1122  lines.emplace_back( _o - dx2 * ub + dz * vb , _o - dx1 * ub - dz * vb);
1123  lines.emplace_back( _o - dx1 * ub - dz * vb , _o + dx1 * ub - dz * vb);
1124 
1125  return lines;
1126  }
1127  // ===== default for arbitrary planes in arbitrary shapes =================
1128 
1129  // We create nMax vertices by rotating the local u vector around the normal
1130  // and checking the distance to the volume boundary in that direction.
1131  // This is brute force and not very smart, as many points are created on straight
1132  // lines and the edges are still rounded.
1133  // The alterative would be to compute the true intersections a plane and the most
1134  // common shapes - at least for boxes that should be not too hard. To be done...
1135 
1136  lines.reserve( nMax ) ;
1137 
1138  double dAlpha = 2.* ROOT::Math::Pi() / double( nMax ) ;
1139 
1140  TVector3 norm( ln.x() , ln.y() , ln.z() ) ;
1141 
1142 
1143  Vector3D first, previous ;
1144 
1145  for(unsigned i=0 ; i< nMax ; ++i ){
1146 
1147  double alpha = double(i) * dAlpha ;
1148 
1149  TVector3 vec( lu.x() , lu.y() , lu.z() ) ;
1150 
1151  TRotation rot ;
1152  rot.Rotate( alpha , norm );
1153 
1154  TVector3 vecR = rot * vec ;
1155 
1156  Vector3D luRot ;
1157  luRot.fill( vecR ) ;
1158 
1159  double dist = shape->DistFromInside( const_cast<double*> (lo.const_array()) , const_cast<double*> (luRot.const_array()) , 3, 0.1 ) ;
1160 
1161  // local point at volume boundary
1162  Vector3D lp = lo + dist * luRot ;
1163 
1164  Vector3D gp ;
1165 
1166  _wtM->LocalToMaster( lp , gp.array() ) ;
1167 
1168  // std::cout << " **** normal:" << ln << " lu:" << lu << " alpha:" << alpha << " luRot:" << luRot << " lp :" << lp << " gp:" << gp << " dist : " << dist
1169  // << " is point " << gp << " inside : " << shape->Contains( gp.const_array() )
1170  // << " dist from outside for lo,lu " << shape->DistFromOutside( lo.const_array() , lu.const_array() , 3 )
1171  // << " dist from inside for lo,ln " << shape->DistFromInside( lo.const_array() , ln.const_array() , 3 )
1172  // << std::endl;
1173  // shape->Dump() ;
1174 
1175 
1176  if( i > 0 )
1177  lines.emplace_back(previous, gp);
1178  else
1179  first = gp ;
1180 
1181  previous = gp ;
1182  }
1183  lines.emplace_back(previous, first);
1184 
1185 
1186  } else if( type().isCylinder() ) {
1187 
1188  if( shape->InheritsFrom("TGeoTube") || shape->InheritsFrom("TGeoCone") ) {
1189 
1190  lines.reserve( nMax ) ;
1191 
1192  TGeoBBox* tube = ( TGeoBBox* ) shape ;
1193 
1194  double zHalf = tube->GetDZ() ;
1195 
1196  Vector3D zv( 0. , 0. , zHalf ) ;
1197 
1198  double r = lo.rho() ;
1199 
1200 
1201  unsigned n = nMax / 4 ;
1202  double dPhi = 2.* ROOT::Math::Pi() / double( n ) ;
1203 
1204  for( unsigned i = 0 ; i < n ; ++i ) {
1205 
1206  Vector3D rv0( r*sin( i *dPhi ) , r*cos( i *dPhi ) , 0. ) ;
1207  Vector3D rv1( r*sin( (i+1)*dPhi ) , r*cos( (i+1)*dPhi ) , 0. ) ;
1208 
1209  // 4 points on local cylinder
1210 
1211  Vector3D pl0 = zv + rv0 ;
1212  Vector3D pl1 = zv + rv1 ;
1213  Vector3D pl2 = -zv + rv1 ;
1214  Vector3D pl3 = -zv + rv0 ;
1215 
1216  Vector3D pg0,pg1,pg2,pg3 ;
1217 
1218  _wtM->LocalToMaster( pl0, pg0.array() ) ;
1219  _wtM->LocalToMaster( pl1, pg1.array() ) ;
1220  _wtM->LocalToMaster( pl2, pg2.array() ) ;
1221  _wtM->LocalToMaster( pl3, pg3.array() ) ;
1222 
1223  lines.emplace_back( pg0, pg1 );
1224  lines.emplace_back( pg1, pg2 );
1225  lines.emplace_back( pg2, pg3 );
1226  lines.emplace_back( pg3, pg0 );
1227  }
1228  }
1229  }
1230  return lines ;
1231 
1232  }
1233 
1234  //================================================================================================================
1235 
1236 
1237  Vector3D CylinderSurface::u( const Vector3D& point ) const {
1238 
1239  Vector3D lp , u_val ;
1240  _wtM->MasterToLocal( point , lp.array() ) ;
1241  const Vector3D& lu = _volSurf.u( lp ) ;
1242  _wtM->LocalToMasterVect( lu , u_val.array() ) ;
1243  return u_val ;
1244  }
1245 
1246  Vector3D CylinderSurface::v(const Vector3D& point ) const {
1247  Vector3D lp , v_val ;
1248  _wtM->MasterToLocal( point , lp.array() ) ;
1249  const Vector3D& lv = _volSurf.v( lp ) ;
1250  _wtM->LocalToMasterVect( lv , v_val.array() ) ;
1251  return v_val ;
1252  }
1253 
1255  Vector3D lp , n ;
1256  _wtM->MasterToLocal( point , lp.array() ) ;
1257  const Vector3D& ln = _volSurf.normal( lp ) ;
1258  _wtM->LocalToMasterVect( ln , n.array() ) ;
1259  return n ;
1260  }
1261 
1263 
1264  Vector3D lp;
1265  _wtM->MasterToLocal( point , lp.array() ) ;
1266 
1267  return _volSurf.globalToLocal( lp ) ;
1268  }
1269 
1270 
1272 
1273  Vector3D lp = _volSurf.localToGlobal( point ) ;
1274  Vector3D p ;
1275  _wtM->LocalToMaster( lp , p.array() ) ;
1276 
1277  return p ;
1278  }
1279 
1280  double CylinderSurface::radius() const { return _volSurf.origin().rho() ; }
1281 
1283 
1284 
1285  //================================================================================================================
1286 
1287 
1288  double ConeSurface::radius0() const {
1289 
1290  double theta = _volSurf.v().theta() ;
1291  double l = length_along_v() * cos( theta ) ;
1292 
1293  return origin().rho() - 0.5 * l * tan( theta ) ;
1294  }
1295 
1296  double ConeSurface::radius1() const {
1297 
1298  double theta = _volSurf.v().theta() ;
1299  double l = length_along_v() * cos( theta ) ;
1300 
1301  return origin().rho() + 0.5 * l * tan( theta ) ;
1302  }
1303 
1304  double ConeSurface::z0() const {
1305 
1306  double theta = _volSurf.v().theta() ;
1307  double l = length_along_v() * cos( theta ) ;
1308 
1309  return origin().z() - 0.5 * l ;
1310  }
1311 
1312  double ConeSurface::z1() const {
1313 
1314  double theta = _volSurf.v().theta() ;
1315  double l = length_along_v() * cos( theta ) ;
1316 
1317  return origin().z() + 0.5 * l ;
1318  }
1319 
1321 
1322 
1323  //================================================================================================================
1324 
1325  } // namespace
1326 } // namespace
1327 
1328 
dd4hep::rec::VolConeImpl::getLines
virtual std::vector< std::pair< Vector3D, Vector3D > > getLines(unsigned nMax=100) override
create outer bounding lines for the given symmetry of the polyhedron
Definition: Surface.cpp:466
dd4hep::rec::VolSurfaceBase::_type
SurfaceType _type
Definition: Surface.h:48
dd4hep::rec::VolCylinderImpl::globalToLocal
virtual Vector2D globalToLocal(const Vector3D &point) const override
Definition: Surface.cpp:309
dd4hep::rec::Vector3D::fill
const Vector3D & fill(const T &v)
fill vector from arbitrary class that defines operator[]
Definition: Vector3D.h:82
dd4hep::rec::CylinderSurface::radius
virtual double radius() const override
the radius of the cylinder (rho of the origin vector)
Definition: Surface.cpp:1280
dd4hep::rec::Surface::initialize
void initialize()
Definition: Surface.cpp:709
dd4hep::rec::Surface::length_along_v
virtual double length_along_v() const override
Definition: Surface.cpp:612
dd4hep::rec::Vector3D::rho
double rho() const
Definition: Vector3D.h:148
dd4hep::rec::Vector3D::z
double z() const
Definition: Vector3D.h:109
dd4hep::rec::SurfaceType::checkOrthogonalToZ
bool checkOrthogonalToZ(const ISurface &surf, double epsilon=1.e-6) const
Definition: ISurface.h:269
dd4hep::rec::ConeSurface::z0
virtual double z0() const override
the start z of the cone
Definition: Surface.cpp:1304
dd4hep::rec::SurfaceType::OrthogonalToZ
@ OrthogonalToZ
Definition: ISurface.h:150
dd4hep::rec::VolCylinderImpl::VolCylinderImpl
VolCylinderImpl()
default c'tor
Definition: Surface.h:364
dd4hep::rec::VolSurface::u
virtual Vector3D u(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:248
dd4hep::rec::VolSurface::outerMaterial
virtual const IMaterial & outerMaterial() const override
Access to the material in direction of the normal.
Definition: Surface.cpp:255
dd4hep::rec::VolSurface::outerThickness
virtual double outerThickness() const override
Definition: Surface.cpp:257
dd4hep::rec::VolConeImpl::_tanTheta
double _tanTheta
Definition: Surface.h:405
v
View * v
Definition: MultiView.cpp:28
dd4hep::rec::Surface::_u
Vector3D _u
Definition: Surface.h:507
dd4hep::rec::Vector3D::array
double * array()
direct access to data as double* - allows modification
Definition: Vector3D.h:216
dd4hep::rec::Vector3D
Definition: Vector3D.h:32
dd4hep::rec::Surface::_det
DetElement _det
Definition: Surface.h:500
dd4hep::rec::VolSurface::getLines
virtual std::vector< std::pair< Vector3D, Vector3D > > getLines(unsigned nMax=100)
Definition: Surface.cpp:264
dd4hep::rec::Surface::_wtM
std::unique_ptr< TGeoMatrix > _wtM
Definition: Surface.h:502
dd4hep::rec::MaterialManager::materialsBetween
const MaterialVec & materialsBetween(const Vector3D &p0, const Vector3D &p1, double eps=MaterialManager::epsilon)
Definition: MaterialManager.cpp:47
dd4hep::rec::MaterialManager::createAveragedMaterial
MaterialData createAveragedMaterial(const MaterialVec &materials)
Definition: MaterialManager.cpp:208
M_PI
#define M_PI
Definition: Handle.h:31
dd4hep::rec::VolSurfaceBase::u
virtual Vector3D u(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:44
dd4hep::rec::VolSurface::innerThickness
virtual double innerThickness() const override
Definition: Surface.cpp:256
dd4hep::rec::SurfaceType::Plane
@ Plane
Definition: ISurface.h:146
dd4hep::rec::findVolume
bool findVolume(PlacedVolume pv, Volume theVol, std::list< PlacedVolume > &volList)
Definition: Surface.cpp:529
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:164
dd4hep::DetElement::placement
PlacedVolume placement() const
Access to the physical volume of this detector element.
Definition: DetElement.cpp:321
dd4hep::rec::ConeSurface::radius1
virtual double radius1() const override
the end radius of the cone
Definition: Surface.cpp:1296
dd4hep::rec::MaterialVec
std::vector< std::pair< Material, double > > MaterialVec
Definition: MaterialManager.h:30
dd4hep::rec::CylinderSurface::normal
virtual Vector3D normal(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:1254
dd4hep::rec::Vector3D::cylindrical
static Cylindrical cylindrical()
Definition: Vector3D.h:278
dd4hep::rec::VolSurface::volume
Volume volume() const
the volume to which this surface is attached.
Definition: Surface.h:214
DetectorInterna.h
dd4hep::rec::Surface::_type
SurfaceType _type
Definition: Surface.h:506
dd4hep::rec::VolConeImpl::distance
virtual double distance(const Vector3D &point) const override
Definition: Surface.cpp:441
dd4hep::rec::VolSurface::type
virtual const SurfaceType & type() const override
Definition: Surface.cpp:247
dd4hep::rec::Vector3D::x
double x() const
Definition: Vector3D.h:103
dd4hep::DetElement::volumeID
VolumeID volumeID() const
The cached VolumeID of this subdetector element.
Definition: DetElement.cpp:344
dd4hep::rec::VolCylinderImpl::normal
virtual Vector3D normal(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:303
dd4hep::rec::Surface::u
virtual Vector3D u(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:605
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::rec::SurfaceType::checkParallelToZ
bool checkParallelToZ(const ISurface &surf, double epsilon=1.e-6) const
Definition: ISurface.h:252
dd4hep::rec::Vector3D::phi
double phi() const
Definition: Vector3D.h:142
dd4hep::rec::ConeSurface::z1
virtual double z1() const override
the end z of the cone
Definition: Surface.cpp:1312
dd4hep::rec::VolSurfaceBase::innerMaterial
virtual const IMaterial & innerMaterial() const override
Access to the material in opposite direction of the normal.
Definition: Surface.cpp:72
dd4hep::rec::VolSurfaceBase::origin
virtual const Vector3D & origin() const override
Definition: Surface.cpp:47
dd4hep::rec::Surface::length_along_u
virtual double length_along_u() const override
Definition: Surface.cpp:611
dd4hep::rec::VolSurfaceBase::_v
Vector3D _v
Definition: Surface.h:50
dd4hep::rec::VolConeImpl::localToGlobal
virtual Vector3D localToGlobal(const Vector2D &point) const override
Definition: Surface.cpp:425
epsilon
const double epsilon
Definition: test_cellid_position_converter.cpp:41
dd4hep::rec::Surface::v
virtual Vector3D v(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:606
dd4hep::rec::VolSurfaceBase::setNormal
virtual void setNormal(const Vector3D &n)
setter for daughter classes
Definition: Surface.cpp:38
dd4hep::rec::Surface::_n
Vector3D _n
Definition: Surface.h:509
dd4hep::rec::SurfaceList::_isOwner
bool _isOwner
Definition: Surface.h:682
dd4hep::rec::SurfaceType::isCone
bool isCone() const
true if this a conical surface
Definition: ISurface.h:211
Surface.h
dd4hep::rec::VolSurfaceBase::globalToLocal
virtual Vector2D globalToLocal(const Vector3D &point) const override
Definition: Surface.cpp:49
dd4hep::rec::CylinderSurface::globalToLocal
virtual Vector2D globalToLocal(const Vector3D &point) const override
Definition: Surface.cpp:1262
dd4hep::rec::Surface::outerMaterial
virtual const IMaterial & outerMaterial() const override
Access to the material in direction of the normal.
Definition: Surface.cpp:635
dd4hep::rec::Vector2D::v
double v() const
Definition: Vector2D.h:36
dd4hep::rec::VolSurface::insideBounds
virtual bool insideBounds(const Vector3D &point, double epsilon=1e-4) const override
Checks if the given point lies within the surface.
Definition: Surface.cpp:261
dd4hep::rec::VolConeImpl::VolConeImpl
VolConeImpl()
default c'tor
Definition: Surface.h:410
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:187
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:371
dd4hep::rec::VolSurface::normal
virtual Vector3D normal(const Vector3D &point=Vector3D()) const override
Access to the normal direction at the given point.
Definition: Surface.cpp:250
dd4hep::rec::VolSurface::globalToLocal
virtual Vector2D globalToLocal(const Vector3D &point) const override
Definition: Surface.cpp:252
dd4hep::rec::VolSurface::origin
virtual const Vector3D & origin() const override
Definition: Surface.cpp:251
dd4hep::rec::VolConeImpl::globalToLocal
virtual Vector2D globalToLocal(const Vector3D &point) const override
Definition: Surface.cpp:410
dd4hep::rec::VolCylinderImpl::u
virtual Vector3D u(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:296
dd4hep::rec::VolSurface
Definition: Surface.h:181
dd4hep::rec::VolSurfaceBase::setV
virtual void setV(const Vector3D &v)
setter for daughter classes
Definition: Surface.cpp:37
dd4hep::rec::VolSurfaceBase::length_along_v
virtual double length_along_v() const override
Definition: Surface.cpp:141
dd4hep::Alignment::worldTransformation
const TGeoHMatrix & worldTransformation() const
Create cached matrix to transform to world coordinates.
Definition: Alignments.cpp:68
dd4hep::rec::long64
long long int long64
Definition: ISurface.h:26
dd4hep::rec::Vector3D::unit
Vector3D unit() const
Definition: Vector3D.h:199
dd4hep::rec::ConeSurface::radius0
virtual double radius0() const override
the start radius of the cone
Definition: Surface.cpp:1288
dd4hep::rec::VolSurfaceList
Definition: Surface.h:300
dd4hep::rec::Vector2D::u
double u() const
Definition: Vector2D.h:34
dd4hep::rec::VolSurfaceBase::normal
virtual Vector3D normal(const Vector3D &point=Vector3D()) const override
Access to the normal direction at the given point.
Definition: Surface.cpp:46
dd4hep::rec::Surface::_id
long64 _id
Definition: Surface.h:504
dd4hep::rec::VolSurface::localToGlobal
virtual Vector3D localToGlobal(const Vector2D &point) const override
Definition: Surface.cpp:253
dd4hep::rec::Surface::Surface
Surface()=delete
default c'tor etc. removed
dd4hep::rec::VolConeImpl::_zt1
double _zt1
Definition: Surface.h:404
dd4hep::rec::SurfaceType::ParallelToZ
@ ParallelToZ
Definition: ISurface.h:149
dd4hep::rec::MaterialManager
Definition: MaterialManager.h:41
dd4hep::rec::SurfaceList::~SurfaceList
virtual ~SurfaceList()
d'tor deletes all owned surfaces
Definition: Surface.cpp:509
dd4hep::rec::Surface::insideBounds
virtual bool insideBounds(const Vector3D &point, double epsilon=1.e-4) const override
Checks if the given point lies within the surface.
Definition: Surface.cpp:700
dd4hep::rec::Surface::volumeOrigin
virtual Vector3D volumeOrigin() const
Definition: Surface.cpp:679
dd4hep::Alignment
Main handle class to hold an alignment object.
Definition: Alignments.h:115
dd4hep::rec::VolSurface::distance
virtual double distance(const Vector3D &point) const override
Definition: Surface.cpp:260
dd4hep::DetElement::nominal
Alignment nominal() const
Access to the constant ideal (nominal) alignment information.
Definition: DetElement.cpp:185
dd4hep::rec::Vector2D
Definition: Vector2D.h:24
dd4hep::rec::CylinderSurface::localToGlobal
virtual Vector3D localToGlobal(const Vector2D &point) const override
Definition: Surface.cpp:1271
dd4hep::rec::Surface::getLines
virtual std::vector< std::pair< Vector3D, Vector3D > > getLines(unsigned nMax=100)
Definition: Surface.cpp:823
dd4hep::rec::VolConeImpl::_zt0
double _zt0
Definition: Surface.h:403
dd4hep::rec::VolConeImpl::_ztip
double _ztip
Definition: Surface.h:402
dd4hep::rec::Surface::innerMaterial
virtual const IMaterial & innerMaterial() const override
Access to the material in opposite direction of the normal.
Definition: Surface.cpp:616
dd4hep::rec::VolSurfaceBase::distance
virtual double distance(const Vector3D &point) const override
Definition: Surface.cpp:204
dd4hep::rec::VolSurfaceBase::id
virtual long64 id() const override
The id of this surface.
Definition: Surface.cpp:41
dd4hep::rec::VolConeImpl::v
virtual Vector3D v(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:391
dd4hep::rec::SurfaceType
Definition: ISurface.h:140
dd4hep::rec::Surface::innerThickness
virtual double innerThickness() const override
Definition: Surface.cpp:609
dd4hep::rec::VolSurface::setOuterMaterial
void setOuterMaterial(const IMaterial &mat)
set the outer Materal
Definition: Surface.h:282
dd4hep::rec::Surface::type
virtual const SurfaceType & type() const override
Definition: Surface.cpp:603
dd4hep::rec::Surface::volume
Volume volume() const
The volume that has the surface attached.
Definition: Surface.h:535
dd4hep::rec::CylinderSurface::center
virtual Vector3D center() const override
the center of the cylinder
Definition: Surface.cpp:1282
dd4hep::rec::Vector3D::cross
Vector3D cross(const Vector3D &v) const
Definition: Vector3D.h:191
dd4hep::rec::Vector3D::const_array
const double * const_array() const
direct access to data as const double*
Definition: Vector3D.h:211
dd4hep::rec::CylinderSurface::u
virtual Vector3D u(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:1237
dd4hep::rec::Surface::_volSurf
VolSurface _volSurf
Definition: Surface.h:501
dd4hep::rec::VolSurfaceBase
Definition: Surface.h:43
dd4hep::rec::Surface::id
virtual long64 id() const override
The id of this surface - corresponds to DetElement id.
Definition: Surface.cpp:601
dd4hep::rec::Surface::localToGlobal
virtual Vector3D localToGlobal(const Vector2D &point) const override
Definition: Surface.cpp:672
dd4hep::rec::Surface::normal
virtual Vector3D normal(const Vector3D &point=Vector3D()) const override
Access to the normal direction at the given point.
Definition: Surface.cpp:607
Memory.h
dd4hep::rec::Vector3D::y
double y() const
Definition: Vector3D.h:106
dd4hep::rec::VolSurface::setInnerMaterial
void setInnerMaterial(const IMaterial &mat)
set the innerMaterial
Definition: Surface.h:279
dd4hep::rec::VolSurfaceBase::_n
Vector3D _n
Definition: Surface.h:51
dd4hep::rec::VolSurfaceBase::v
virtual Vector3D v(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:45
dd4hep::rec::VolCylinderImpl::localToGlobal
virtual Vector3D localToGlobal(const Vector2D &point) const override
Definition: Surface.cpp:321
dd4hep::rec::SurfaceType::Cylinder
@ Cylinder
Definition: ISurface.h:145
dd4hep::rec::VolSurfaceBase::innerThickness
virtual double innerThickness() const override
Definition: Surface.cpp:74
dd4hep::rec::VolSurfaceBase::setU
virtual void setU(const Vector3D &u)
setter for daughter classes
Definition: Surface.cpp:36
dd4hep::rec::VolSurfaceBase::getLines
virtual std::vector< std::pair< Vector3D, Vector3D > > getLines(unsigned nMax=100)
Definition: Surface.cpp:237
dd4hep::rec::Vector3D::spherical
static Spherical spherical()
Definition: Vector3D.h:279
MaterialManager.h
dd4hep::rec::VolSurface::length_along_v
virtual double length_along_v() const override
Definition: Surface.cpp:259
dist
double dist(const Position &p0, const Position &p1)
Definition: test_cellid_position_converter.cpp:45
dd4hep::rec::VolSurface::id
virtual long64 id() const override
The id of this surface - always 0 for VolSurfaces.
Definition: Surface.cpp:246
dd4hep::rec::VolConeImpl::normal
virtual Vector3D normal(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:404
dd4hep::rec::VolSurface::length_along_u
virtual double length_along_u() const override
Definition: Surface.cpp:258
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:151
dd4hep::rec::Surface::_v
Vector3D _v
Definition: Surface.h:508
dd4hep::rec::IMaterial::Z
virtual double Z() const =0
averaged proton number
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::PlacedVolume::volume
Volume volume() const
Logical volume of this placement.
Definition: Volumes.cpp:468
dd4hep::PlacedVolume::data
Object * data() const
Check if placement is properly instrumented.
Definition: Volumes.cpp:447
dd4hep::rec::VolSurfaceBase::outerMaterial
virtual const IMaterial & outerMaterial() const override
Access to the material in direction of the normal.
Definition: Surface.cpp:73
dd4hep::rec::VolSurfaceBase::length_along_u
virtual double length_along_u() const override
Definition: Surface.cpp:78
dd4hep::rec::Surface::globalToLocal
virtual Vector2D globalToLocal(const Vector3D &point) const override
Definition: Surface.cpp:655
dd4hep::rec::Surface::distance
virtual double distance(const Vector3D &point) const override
Definition: Surface.cpp:691
dd4hep::rec::volSurfaceList
VolSurfaceList * volSurfaceList(const DetElement &det)
Definition: Surface.cpp:518
dd4hep::rec::VolSurfaceBase::setOrigin
virtual void setOrigin(const Vector3D &o)
setter for daughter classes
Definition: Surface.cpp:39
dd4hep::rec::SurfaceType::setProperty
void setProperty(unsigned prop, bool val=true)
set the given peorperty
Definition: ISurface.h:196
dd4hep::rec::VolSurface::v
virtual Vector3D v(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:249
dd4hep::rec::ConeSurface::center
virtual Vector3D center() const override
the center of the cone
Definition: Surface.cpp:1320
dd4hep::rec::VolSurfaceBase::type
virtual const SurfaceType & type() const override
Definition: Surface.cpp:43
dd4hep::rec::IMaterial
Definition: IMaterial.h:28
dd4hep::rec::VolSurface::innerMaterial
virtual const IMaterial & innerMaterial() const override
Access to the material in opposite direction of the normal.
Definition: Surface.cpp:254
dd4hep::rec::VolSurfaceBase::outerThickness
virtual double outerThickness() const override
Definition: Surface.cpp:75
dd4hep::rec::VolConeImpl::u
virtual Vector3D u(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:397
dd4hep::rec::VolCylinderImpl::distance
virtual double distance(const Vector3D &point) const override
Definition: Surface.cpp:334
dd4hep::rec::Surface::origin
virtual const Vector3D & origin() const override
Definition: Surface.cpp:608
dd4hep::rec::Surface::_o
Vector3D _o
Definition: Surface.h:510
dd4hep::rec::CylinderSurface::v
virtual Vector3D v(const Vector3D &point=Vector3D()) const override
Definition: Surface.cpp:1246
dd4hep::rec::VolPlaneImpl::distance
virtual double distance(const Vector3D &point) const override
Definition: Surface.cpp:271
dd4hep::rec::VolSurfaceBase::localToGlobal
virtual Vector3D localToGlobal(const Vector2D &point) const override
Definition: Surface.cpp:65
dd4hep::rec::Surface::outerThickness
virtual double outerThickness() const override
Definition: Surface.cpp:610
dd4hep::rec::SurfaceType::Cone
@ Cone
Definition: ISurface.h:153
dd4hep::dd4hep_ptr
Out version of the std auto_ptr implementation base either on auto_ptr or unique_ptr.
Definition: Memory.h:46
dd4hep::rec::VolSurfaceBase::insideBounds
virtual bool insideBounds(const Vector3D &point, double epsilon=1e-4) const override
Checks if the given point lies within the surface.
Definition: Surface.cpp:207
dd4hep::rec::Vector3D::theta
double theta() const
Definition: Vector3D.h:179