CMS 3D CMS Logo

EcalEndcapGeometry.cc
Go to the documentation of this file.
6 #include <CLHEP/Geometry/Point3D.h>
7 #include <CLHEP/Geometry/Plane3D.h>
8 
12 typedef HepGeom::Plane3D<CCGFloat> Pl3D ;
13 
15  : _nnmods( 316 ),
16  _nncrys( 25 ),
17  zeP( 0. ),
18  zeN( 0. ),
19  m_wref( 0. ),
20  m_del( 0. ),
21  m_nref( 0 ),
22  m_borderMgr( nullptr ),
23  m_borderPtrVec( nullptr ),
24  m_avgZ( -1 ),
25  m_check( false ),
26  m_cellVec( k_NumberOfCellsForCorners )
27 {
28  m_xlo[0] = 999.;
29  m_xlo[1] = 999.;
30  m_xhi[0] = -999.;
31  m_xhi[1] = -999.;
32  m_ylo[0] = 999.;
33  m_ylo[1] = 999.;
34  m_yhi[0] = -999.;
35  m_yhi[1] = -999.;
36  m_xoff[0] = 0.;
37  m_xoff[1] = 0.;
38  m_yoff[0] = 0.;
39  m_yoff[1] = 0.;
40 }
41 
43 {
44  if(m_borderPtrVec)
45  {
46  auto ptr = m_borderPtrVec.load(std::memory_order_acquire);
47  for(auto& v: (*ptr)) {
48  if(v) delete v;
49  v = nullptr;
50  }
51  delete m_borderPtrVec.load() ;
52  }
53  delete m_borderMgr.load() ;
54 }
55 
56 unsigned int
58 {
59  const CaloGenericDetId gid ( id ) ;
60 
61  assert( gid.isEE() ) ;
62  unsigned int index ( EEDetId(id).ix()/51 + ( EEDetId(id).zside()<0 ? 0 : 2 ) ) ;
63 
64  return index ;
65 }
66 
67 DetId
69 {
70  return EEDetId( 20 + 50*( iLoc%2 ), 50, 2*( iLoc/2 ) - 1 ) ;
71 }
72 
73 unsigned int
75 {
76  return (unsigned int)DetId::Ecal - 1 ;
77 }
78 
79 void
81 {
82  zeP=0.;
83  zeN=0.;
84  unsigned nP=0;
85  unsigned nN=0;
86  m_nref = 0 ;
87 
88  for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
89  {
90  const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
91  if( 0 != cell )
92  {
93  const CCGFloat z ( cell->getPosition().z() ) ;
94  if(z>0.)
95  {
96  zeP+=z;
97  ++nP;
98  }
99  else
100  {
101  zeN+=z;
102  ++nN;
103  }
104  const EEDetId myId ( EEDetId::detIdFromDenseIndex(i) ) ;
105  const unsigned int ix ( myId.ix() ) ;
106  const unsigned int iy ( myId.iy() ) ;
107  if( ix > m_nref ) m_nref = ix ;
108  if( iy > m_nref ) m_nref = iy ;
109  }
110  }
111  if( 0 < nP ) zeP/=(CCGFloat)nP;
112  if( 0 < nN ) zeN/=(CCGFloat)nN;
113 
114  m_xlo[0] = 999 ;
115  m_xhi[0] = -999 ;
116  m_ylo[0] = 999 ;
117  m_yhi[0] = -999 ;
118  m_xlo[1] = 999 ;
119  m_xhi[1] = -999 ;
120  m_ylo[1] = 999 ;
121  m_yhi[1] = -999 ;
122  for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
123  {
124  const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
125  if( 0 != cell )
126  {
127  const GlobalPoint p ( cell->getPosition() ) ;
128  const CCGFloat z ( p.z() ) ;
129  const CCGFloat zz ( 0 > z ? zeN : zeP ) ;
130  const CCGFloat x ( p.x()*zz/z ) ;
131  const CCGFloat y ( p.y()*zz/z ) ;
132 
133  if( 0 > z && x < m_xlo[0] ) m_xlo[0] = x ;
134  if( 0 < z && x < m_xlo[1] ) m_xlo[1] = x ;
135  if( 0 > z && y < m_ylo[0] ) m_ylo[0] = y ;
136  if( 0 < z && y < m_ylo[1] ) m_ylo[1] = y ;
137 
138  if( 0 > z && x > m_xhi[0] ) m_xhi[0] = x ;
139  if( 0 < z && x > m_xhi[1] ) m_xhi[1] = x ;
140  if( 0 > z && y > m_yhi[0] ) m_yhi[0] = y ;
141  if( 0 < z && y > m_yhi[1] ) m_yhi[1] = y ;
142  }
143  }
144 
145  m_xoff[0] = ( m_xhi[0] + m_xlo[0] )/2. ;
146  m_xoff[1] = ( m_xhi[1] + m_xlo[1] )/2. ;
147  m_yoff[0] = ( m_yhi[0] + m_ylo[0] )/2. ;
148  m_yoff[1] = ( m_yhi[1] + m_ylo[1] )/2. ;
149 
150  m_del = ( m_xhi[0] - m_xlo[0] + m_xhi[1] - m_xlo[1] +
151  m_yhi[0] - m_ylo[0] + m_yhi[1] - m_ylo[1] ) ;
152 
153  if( 1 != m_nref ) m_wref = m_del/(4.*(m_nref-1)) ;
154 
155  m_xlo[0] -= m_wref/2 ;
156  m_xlo[1] -= m_wref/2 ;
157  m_xhi[0] += m_wref/2 ;
158  m_xhi[1] += m_wref/2 ;
159 
160  m_ylo[0] -= m_wref/2 ;
161  m_ylo[1] -= m_wref/2 ;
162  m_yhi[0] += m_wref/2 ;
163  m_yhi[1] += m_wref/2 ;
164 
165  m_del += m_wref ;
166 /*
167  std::cout<<"zeP="<<zeP<<", zeN="<<zeN<<", nP="<<nP<<", nN="<<nN<<std::endl ;
168 
169  std::cout<<"xlo[0]="<<m_xlo[0]<<", xlo[1]="<<m_xlo[1]<<", xhi[0]="<<m_xhi[0]<<", xhi[1]="<<m_xhi[1]
170  <<"\nylo[0]="<<m_ylo[0]<<", ylo[1]="<<m_ylo[1]<<", yhi[0]="<<m_yhi[0]<<", yhi[1]="<<m_yhi[1]<<std::endl ;
171 
172  std::cout<<"xoff[0]="<<m_xoff[0]<<", xoff[1]"<<m_xoff[1]<<", yoff[0]="<<m_yoff[0]<<", yoff[1]"<<m_yoff[1]<<std::endl ;
173 
174  std::cout<<"nref="<<m_nref<<", m_wref="<<m_wref<<std::endl ;
175 */
176 }
177 
178 
179 unsigned int
181  CCGFloat z ) const
182 {
183  const CCGFloat xlo ( 0 > z ? m_xlo[0] : m_xlo[1] ) ;
184  const int i ( 1 + int( ( x - xlo )/m_wref ) ) ;
185 
186  return ( 1 > i ? 1 :
187  ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;
188 
189 }
190 
191 unsigned int
193  CCGFloat z ) const
194 {
195  const CCGFloat ylo ( 0 > z ? m_ylo[0] : m_ylo[1] ) ;
196  const int i ( 1 + int( ( y - ylo )/m_wref ) ) ;
197 
198  return ( 1 > i ? 1 :
199  ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;
200 }
201 
202 EEDetId
204  float y,
205  float z ) const
206 {
207  const CCGFloat fac ( fabs( ( 0 > z ? zeN : zeP )/z ) ) ;
208  const unsigned int ix ( xindex( x*fac, z ) ) ;
209  const unsigned int iy ( yindex( y*fac, z ) ) ;
210  const unsigned int iz ( z>0 ? 1 : -1 ) ;
211 
212  if( EEDetId::validDetId( ix, iy, iz ) )
213  {
214  return EEDetId( ix, iy, iz ) ; // first try is on target
215  }
216  else // try nearby coordinates, spiraling out from center
217  {
218  for( unsigned int i ( 1 ) ; i != 6 ; ++i )
219  {
220  for( unsigned int k ( 0 ) ; k != 8 ; ++k )
221  {
222  const int jx ( 0 == k || 4 == k || 5 == k ? +i :
223  ( 1 == k || 5 < k ? -i : 0 ) ) ;
224  const int jy ( 2 == k || 4 == k || 6 == k ? +i :
225  ( 3 == k || 5 == k || 7 == k ? -i : 0 ) ) ;
226  if( EEDetId::validDetId( ix + jx, iy + jy, iz ) )
227  {
228  return EEDetId( ix + jx, iy + jy, iz ) ;
229  }
230  }
231  }
232  }
233  return EEDetId() ; // nowhere near any crystal
234 }
235 
236 
237 // Get closest cell, etc...
238 DetId
240 {
241  try
242  {
243  EEDetId mycellID ( gId( r.x(), r.y(), r.z() ) ) ; // educated guess
244 
245  if( EEDetId::validDetId( mycellID.ix(),
246  mycellID.iy(),
247  mycellID.zside() ) )
248  {
249  // now get points in convenient ordering
250 
251  Pt3D A;
252  Pt3D B;
253  Pt3D C;
254  Pt3D point(r.x(),r.y(),r.z());
255  // D.K. : equation of plane : AA*x+BB*y+CC*z+DD=0;
256  // finding equation for each edge
257 
258  // ================================================================
259  CCGFloat x,y,z;
260  unsigned offset=0;
261  int zsign=1;
262  //================================================================
263 
264  // compute the distance of the point with respect of the 4 crystal lateral planes
265 
266 
267  if( 0 != getGeometry(mycellID) )
268  {
269  const GlobalPoint& myPosition=getGeometry(mycellID)->getPosition();
270 
271  x=myPosition.x();
272  y=myPosition.y();
273  z=myPosition.z();
274 
275  offset=0;
276  // This will disappear when Andre has applied his fix
277 
278  if(z>0)
279  {
280  if(x>0&&y>0)
281  offset=1;
282  else if(x<0&&y>0)
283  offset=2;
284  else if(x>0&&y<0)
285  offset=0;
286  else if (x<0&&y<0)
287  offset=3;
288  zsign=1;
289  }
290  else
291  {
292  if(x>0&&y>0)
293  offset=3;
294  else if(x<0&&y>0)
295  offset=2;
296  else if(x>0&&y<0)
297  offset=0;
298  else if(x<0&&y<0)
299  offset=1;
300  zsign=-1;
301  }
302  GlobalPoint corners[8];
303  for(unsigned ic=0;ic<4;++ic)
304  {
305  corners[ic]=getGeometry(mycellID)->getCorners()[(unsigned)((zsign*ic+offset)%4)];
306  corners[4+ic]=getGeometry(mycellID)->getCorners()[(unsigned)(4+(zsign*ic+offset)%4)];
307  }
308 
309  CCGFloat SS[4];
310  for (short i=0; i < 4 ; ++i)
311  {
312  A = Pt3D(corners[i%4].x(),corners[i%4].y(),corners[i%4].z());
313  B = Pt3D(corners[(i+1)%4].x(),corners[(i+1)%4].y(),corners[(i+1)%4].z());
314  C = Pt3D(corners[4+(i+1)%4].x(),corners[4+(i+1)%4].y(),corners[4+(i+1)%4].z());
315  Pl3D plane(A,B,C);
316  plane.normalize();
317  CCGFloat distance = plane.distance(point);
318  if (corners[0].z()<0.) distance=-distance;
319  SS[i] = distance;
320  }
321 
322  // Only one move in necessary direction
323 
324  const bool yout ( 0 > SS[0]*SS[2] ) ;
325  const bool xout ( 0 > SS[1]*SS[3] ) ;
326 
327  if( yout || xout )
328  {
329  const int ydel ( !yout ? 0 : ( 0 < SS[0] ? -1 : 1 ) ) ;
330  const int xdel ( !xout ? 0 : ( 0 < SS[1] ? -1 : 1 ) ) ;
331  const unsigned int ix ( mycellID.ix() + xdel ) ;
332  const unsigned int iy ( mycellID.iy() + ydel ) ;
333  const unsigned int iz ( mycellID.zside() ) ;
334  if( EEDetId::validDetId( ix, iy, iz ) )
335  mycellID = EEDetId( ix, iy, iz ) ;
336  }
337 
338  return mycellID;
339  }
340  return DetId(0);
341  }
342  }
343  catch ( cms::Exception &e )
344  {
345  return DetId(0);
346  }
347  return DetId(0);
348 }
349 
352  double dR ) const
353 {
354  CaloSubdetectorGeometry::DetIdSet dis ; // return object
355  if( 0.000001 < dR )
356  {
357  if( dR > M_PI/2. ) // this code assumes small dR
358  {
359  dis = CaloSubdetectorGeometry::getCells( r, dR ) ; // base class version
360  }
361  else
362  {
363  const float dR2 ( dR*dR ) ;
364  const float reta ( r.eta() ) ;
365  const float rphi ( r.phi() ) ;
366  const float rx ( r.x() ) ;
367  const float ry ( r.y() ) ;
368  const float rz ( r.z() ) ;
369  const float fac ( std::abs( zeP/rz ) ) ;
370  const float xx ( rx*fac ) ; // xyz at endcap z
371  const float yy ( ry*fac ) ;
372  const float zz ( rz*fac ) ;
373 
374  const float xang ( std::atan( xx/zz ) ) ;
375  const float lowX ( zz>0 ? zz*std::tan( xang - dR ) : zz*std::tan( xang + dR ) ) ;
376  const float highX ( zz>0 ? zz*std::tan( xang + dR ) : zz*std::tan( xang - dR ) ) ;
377  const float yang ( std::atan( yy/zz ) ) ;
378  const float lowY ( zz>0 ? zz*std::tan( yang - dR ) : zz*std::tan( yang + dR ) ) ;
379  const float highY ( zz>0 ? zz*std::tan( yang + dR ) : zz*std::tan( yang - dR ) ) ;
380 
381  const float refxlo ( 0 > rz ? m_xlo[0] : m_xlo[1] ) ;
382  const float refxhi ( 0 > rz ? m_xhi[0] : m_xhi[1] ) ;
383  const float refylo ( 0 > rz ? m_ylo[0] : m_ylo[1] ) ;
384  const float refyhi ( 0 > rz ? m_yhi[0] : m_yhi[1] ) ;
385 
386  if( lowX < refxhi && // proceed if any possible overlap with the endcap
387  lowY < refyhi &&
388  highX > refxlo &&
389  highY > refylo )
390  {
391  const int ix_ctr ( xindex( xx, rz ) ) ;
392  const int iy_ctr ( yindex( yy, rz ) ) ;
393  const int iz ( rz>0 ? 1 : -1 ) ;
394 
395  const int ix_hi ( ix_ctr + int( ( highX - xx )/m_wref ) + 2 ) ;
396  const int ix_lo ( ix_ctr - int( ( xx - lowX )/m_wref ) - 2 ) ;
397 
398  const int iy_hi ( iy_ctr + int( ( highY - yy )/m_wref ) + 2 ) ;
399  const int iy_lo ( iy_ctr - int( ( yy - lowY )/m_wref ) - 2 ) ;
400 
401  for( int kx ( ix_lo ) ; kx <= ix_hi ; ++kx )
402  {
403  if( kx > 0 &&
404  kx <= (int) m_nref )
405  {
406  for( int ky ( iy_lo ) ; ky <= iy_hi ; ++ky )
407  {
408  if( ky > 0 &&
409  ky <= (int) m_nref )
410  {
411  if( EEDetId::validDetId( kx, ky, iz ) ) // reject invalid ids
412  {
413  const EEDetId id ( kx, ky, iz ) ;
414  const CaloCellGeometry* cell = &m_cellVec[ id.denseIndex()];
415  const float eta (cell->etaPos() ) ;
416  const float phi (cell->phiPos() ) ;
417  if( reco::deltaR2( eta, phi, reta, rphi ) < dR2 ) dis.insert( id ) ;
418  }
419  }
420  }
421  }
422  }
423  }
424  }
425  }
426  return dis;
427 }
428 
431 {
432  OrderedListOfEBDetId* ptr ( nullptr ) ;
433  auto ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
434  if(!ptrVec) {
435  if(0 != id.rawId() && 0 != getGeometry(id)) {
436  const float phi(370.+getGeometry(id)->getPosition().phi().degrees());
437  const int iPhi(1+int(phi)%360) ;
438  const int iz(id.zside()) ;
439  if (!m_borderMgr.load(std::memory_order_acquire)) {
440  EZMgrFL<EBDetId>* expect = nullptr;
441  auto ptrMgr = new EZMgrFL<EBDetId>( 720*9, 9 );
442  bool exchanged = m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
443  if(!exchanged) delete ptrMgr;
444  }
445  VecOrdListEBDetIdPtr* expect = nullptr;
446  auto ptrVec = new VecOrdListEBDetIdPtr();
447  ptrVec->reserve(720);
448  for( unsigned int i ( 0 ) ; i != 720 ; ++i )
449  {
450  const int kz ( 360>i ? -1 : 1 ) ;
451  const int iEta ( kz*85 ) ;
452  const int iEtam1 ( kz*84 ) ;
453  const int iEtam2 ( kz*83 ) ;
454  const int jPhi ( i%360 + 1 ) ;
455  OrderedListOfEBDetId& olist ( *new OrderedListOfEBDetId( m_borderMgr.load(std::memory_order_acquire) ) );
456  olist[0]=EBDetId( iEta , jPhi ) ;
457  olist[1]=EBDetId( iEta , myPhi( jPhi+1 ) ) ;
458  olist[2]=EBDetId( iEta , myPhi( jPhi-1 ) ) ;
459  olist[3]=EBDetId( iEtam1, jPhi ) ;
460  olist[4]=EBDetId( iEtam1, myPhi( jPhi+1 ) ) ;
461  olist[5]=EBDetId( iEtam1, myPhi( jPhi-1 ) ) ;
462  olist[6]=EBDetId( iEta , myPhi( jPhi+2 ) ) ;
463  olist[7]=EBDetId( iEta , myPhi( jPhi-2 ) ) ;
464  olist[8]=EBDetId( iEtam2, jPhi ) ;
465  ptrVec->push_back( &olist ) ;
466  }
467  bool exchanged = m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
468  if(!exchanged) delete ptrVec;
469  ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
470  ptr = (*ptrVec)[ ( iPhi - 1 ) + ( 0>iz ? 0 : 360 ) ] ;
471  }
472  }
473  return ptr;
474 }
475 
476 void
478  const CCGFloat* pv ,
479  unsigned int /*i*/,
480  Pt3D& ref )
481 {
482  TruncatedPyramid::localCorners( lc, pv, ref ) ;
483 }
484 
485 void
487  const GlobalPoint& f2 ,
488  const GlobalPoint& f3 ,
489  const CCGFloat* parm ,
490  const DetId& detId )
491 {
492  const unsigned int cellIndex ( EEDetId( detId ).denseIndex() ) ;
493  m_cellVec[ cellIndex ] =
494  TruncatedPyramid( cornersMgr(), f1, f2, f3, parm ) ;
495  addValidID( detId ) ;
496 }
497 
498 
499 CCGFloat
501 {
502  if(!m_check.load(std::memory_order_acquire))
503  {
504  CCGFloat sum ( 0 ) ;
505  for( unsigned int i ( 0 ) ; i != m_cellVec.size() ; ++i )
506  {
507  const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
508  if( 0 != cell )
509  {
510  sum += fabs( cell->getPosition().z() ) ;
511  }
512  }
513  m_avgZ = sum/m_cellVec.size();
514  m_check.store(true, std::memory_order_release);
515  }
516  return m_avgZ;
517 }
518 
519 const CaloCellGeometry*
521 {
522  const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
523  return ( m_cellVec.size() < index ||
524  0 == cell->param() ? 0 : cell ) ;
525 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
virtual DetId getClosestCell(const GlobalPoint &r) const
double degrees(double radiants)
def degrees
CaloCellGeometry::Pt3DVec Pt3DVec
int ix() const
Definition: EEDetId.h:76
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
float phiPos() const
CaloCellGeometry::Pt3D Pt3D
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
std::vector< Pt3D > Pt3DVec
#define nullptr
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
virtual const CaloCellGeometry * cellGeomPtr(uint32_t index) const
CaloCellGeometry::CCGFloat CCGFloat
CCGFloat avgAbsZFrontFaceCenter() const
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
virtual CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static unsigned int alignmentTransformIndexLocal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
HepGeom::Plane3D< CCGFloat > Pl3D
unsigned int yindex(CCGFloat y, CCGFloat z) const
CaloCellGeometry::CCGFloat CCGFloat
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
const CCGFloat * param() const
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
CaloCellGeometry::Pt3DVec Pt3DVec
T z() const
Definition: PV3DBase.h:64
int zside() const
Definition: EEDetId.h:70
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
def pv(vc)
Definition: MetAnalyzer.py:6
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< OrderedListOfEBDetId * > VecOrdListEBDetIdPtr
int iy() const
Definition: EEDetId.h:82
const OrderedListOfEBDetId * getClosestBarrelCells(EEDetId id) const
virtual void initializeParms()
static const std::string B
HepGeom::Plane3D< CCGFloat > Pl3D
#define M_PI
int k[5][pyjets_maxn]
unsigned int xindex(CCGFloat x, CCGFloat z) const
Definition: DetId.h:18
void addValidID(const DetId &id)
static int myPhi(int i)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
CaloCellGeometry::CornersMgr * cornersMgr()
bool isEE() const
CaloCellGeometry::CCGFloat CCGFloat
HepGeom::Point3D< CCGFloat > Pt3D
Definition: EZMgrFL.h:8
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
std::atomic< bool > m_check
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
T eta() const
Definition: PV3DBase.h:76
EZArrayFL< EBDetId > OrderedListOfEBDetId
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
float etaPos() const
EEDetId gId(float x, float y, float z) const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T x() const
Definition: PV3DBase.h:62
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5