test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
EcalEndcapGeometry Class Reference

#include <EcalEndcapGeometry.h>

Inheritance diagram for EcalEndcapGeometry:
CaloSubdetectorGeometry

Public Types

enum  { k_NumberOfCellsForCorners = EEDetId::kSizeForDenseIndexing }
 
enum  { k_NumberOfShapes = 1 }
 
enum  { k_NumberOfParametersPerShape = 11 }
 
typedef EcalEndcapGeometryRecord AlignedRecord
 
typedef EEAlignmentRcd AlignmentRecord
 
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector
< TruncatedPyramid
CellVec
 
typedef EEDetId DetIdType
 
typedef IdealGeometryRecord IdealRecord
 
typedef EcalEndcapNumberingScheme NumberingScheme
 
typedef EZArrayFL< EBDetIdOrderedListOfEBDetId
 
typedef PEcalEndcapRcd PGeometryRecord
 
typedef CaloCellGeometry::Pt3D Pt3D
 
typedef CaloCellGeometry::Pt3DVec Pt3DVec
 
typedef std::vector
< OrderedListOfEBDetId * > 
VecOrdListEBDetIdPtr
 
- Public Types inherited from CaloSubdetectorGeometry
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector
< CaloCellGeometry const * > 
CellSet
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< CCGFloatDimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< CCGFloatTrVec
 

Public Member Functions

CCGFloat avgAbsZFrontFaceCenter () const
 
 EcalEndcapGeometry ()
 
virtual
CaloSubdetectorGeometry::DetIdSet 
getCells (const GlobalPoint &r, double dR) const
 Get a list of all cells within a dR of the given cell. More...
 
const OrderedListOfEBDetIdgetClosestBarrelCells (EEDetId id) const
 
virtual DetId getClosestCell (const GlobalPoint &r) const
 
int getNumberOfCrystalPerModule () const
 
int getNumberOfModules () const
 
virtual void initializeParms ()
 
virtual void newCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
 
virtual unsigned int numberOfParametersPerShape () const
 
virtual unsigned int numberOfShapes () const
 
void setNumberOfCrystalPerModule (const int nncrys)
 
void setNumberOfModules (const int nnmods)
 
virtual ~EcalEndcapGeometry ()
 
- Public Member Functions inherited from CaloSubdetectorGeometry
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
CCGFloat deltaEta (const DetId &detId) const
 
CCGFloat deltaPhi (const DetId &detId) const
 
virtual void fillDefaultNamedParameters () const
 
virtual CellSet getCellSet (const GlobalPoint &r, double dR) const
 
virtual const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
virtual void getSummary (TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
 
virtual const std::vector
< DetId > & 
getValidDetIds (DetId::Detector det=DetId::Detector(0), int subdet=0) const
 Get a list of valid detector ids (for the given subdetector) More...
 
virtual unsigned int numberOfTransformParms () const
 
ParMgrparMgr ()
 
const ParMgrparMgrConst () const
 
ParVecVecparVecVec ()
 
const ParVecVecparVecVec () const
 
virtual bool present (const DetId &id) const
 is this detid present in the geometry? More...
 
virtual ~CaloSubdetectorGeometry ()
 The base class DOES assume that it owns the CaloCellGeometry objects. More...
 

Static Public Member Functions

static unsigned int alignmentTransformIndexGlobal (const DetId &id)
 
static unsigned int alignmentTransformIndexLocal (const DetId &id)
 
static std::string dbString ()
 
static DetId detIdFromLocalAlignmentIndex (unsigned int iLoc)
 
static std::string hitString ()
 
static void localCorners (Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
 
static unsigned int numberOfAlignments ()
 
static std::string producerTag ()
 

Protected Member Functions

virtual const CaloCellGeometrycellGeomPtr (uint32_t index) const
 
- Protected Member Functions inherited from CaloSubdetectorGeometry
void addValidID (const DetId &id)
 
virtual unsigned int indexFor (const DetId &id) const
 
virtual unsigned int sizeForDenseIndex (const DetId &id) const
 

Private Member Functions

EEDetId gId (float x, float y, float z) const
 
unsigned int xindex (CCGFloat x, CCGFloat z) const
 
unsigned int yindex (CCGFloat y, CCGFloat z) const
 

Static Private Member Functions

static int myPhi (int i)
 

Private Attributes

int _nncrys
 number of crystals per module More...
 
int _nnmods
 number of modules More...
 
CCGFloat m_avgZ
 
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
 
std::atomic
< VecOrdListEBDetIdPtr * > 
m_borderPtrVec
 
CellVec m_cellVec
 
std::atomic< bool > m_check
 
CCGFloat m_del
 
unsigned int m_nref
 
CCGFloat m_wref
 
CCGFloat m_xhi [2]
 
CCGFloat m_xlo [2]
 
CCGFloat m_xoff [2]
 
CCGFloat m_yhi [2]
 
CCGFloat m_ylo [2]
 
CCGFloat m_yoff [2]
 
CCGFloat zeN
 
CCGFloat zeP
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloSubdetectorGeometry
static CCGFloat deltaR (const GlobalPoint &p1, const GlobalPoint &p2)
 
- Protected Attributes inherited from CaloSubdetectorGeometry
ParVecVec m_parVecVec
 

Detailed Description

Definition at line 19 of file EcalEndcapGeometry.h.

Member Typedef Documentation

Definition at line 30 of file EcalEndcapGeometry.h.

Definition at line 31 of file EcalEndcapGeometry.h.

Definition at line 25 of file EcalEndcapGeometry.h.

Definition at line 23 of file EcalEndcapGeometry.h.

Definition at line 40 of file EcalEndcapGeometry.h.

Definition at line 29 of file EcalEndcapGeometry.h.

Definition at line 38 of file EcalEndcapGeometry.h.

Definition at line 34 of file EcalEndcapGeometry.h.

Definition at line 32 of file EcalEndcapGeometry.h.

Definition at line 26 of file EcalEndcapGeometry.h.

Definition at line 27 of file EcalEndcapGeometry.h.

Definition at line 36 of file EcalEndcapGeometry.h.

Member Enumeration Documentation

anonymous enum
anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 44 of file EcalEndcapGeometry.h.

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 46 of file EcalEndcapGeometry.h.

Constructor & Destructor Documentation

EcalEndcapGeometry::EcalEndcapGeometry ( void  )

Definition at line 14 of file EcalEndcapGeometry.cc.

References m_xhi, m_xlo, m_xoff, m_yhi, m_ylo, and m_yoff.

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( nullptr ),
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 }
int _nncrys
number of crystals per module
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
int _nnmods
number of modules
std::atomic< bool > m_check
EcalEndcapGeometry::~EcalEndcapGeometry ( )
virtual

Definition at line 42 of file EcalEndcapGeometry.cc.

References m_borderMgr, m_borderPtrVec, and findQualityFiles::v.

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 }
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec

Member Function Documentation

unsigned int EcalEndcapGeometry::alignmentTransformIndexGlobal ( const DetId id)
static

Definition at line 74 of file EcalEndcapGeometry.cc.

References DetId::Ecal.

75 {
76  return (unsigned int)DetId::Ecal - 1 ;
77 }
unsigned int EcalEndcapGeometry::alignmentTransformIndexLocal ( const DetId id)
static

Definition at line 57 of file EcalEndcapGeometry.cc.

References cmsHarvester::index, CaloGenericDetId::isEE(), and ecaldqm::zside().

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 }
int zside(DetId const &)
CCGFloat EcalEndcapGeometry::avgAbsZFrontFaceCenter ( ) const

Definition at line 501 of file EcalEndcapGeometry.cc.

References cellGeomPtr(), CaloCellGeometry::getPosition(), i, m_avgZ, m_cellVec, m_check, and PV3DBase< T, PVType, FrameType >::z().

502 {
503  if(!m_check.load(std::memory_order_acquire))
504  {
505  CCGFloat sum ( 0 ) ;
506  for( unsigned int i ( 0 ) ; i != m_cellVec.size() ; ++i )
507  {
508  const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
509  if( 0 != cell )
510  {
511  sum += fabs( cell->getPosition().z() ) ;
512  }
513  }
514  m_avgZ = sum/m_cellVec.size();
515  m_check.store(true, std::memory_order_release);
516  }
517  return m_avgZ;
518 }
int i
Definition: DBlmapReader.cc:9
virtual const CaloCellGeometry * cellGeomPtr(uint32_t index) const
CaloCellGeometry::CCGFloat CCGFloat
std::atomic< bool > m_check
const CaloCellGeometry * EcalEndcapGeometry::cellGeomPtr ( uint32_t  index) const
protectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 521 of file EcalEndcapGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

Referenced by avgAbsZFrontFaceCenter(), and initializeParms().

522 {
523  const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
524  return ( m_cellVec.size() < index ||
525  0 == cell->param() ? 0 : cell ) ;
526 }
static std::string EcalEndcapGeometry::dbString ( )
inlinestatic

Definition at line 49 of file EcalEndcapGeometry.h.

49 { return "PEcalEndcapRcd" ; }
DetId EcalEndcapGeometry::detIdFromLocalAlignmentIndex ( unsigned int  iLoc)
static

Definition at line 68 of file EcalEndcapGeometry.cc.

Referenced by FakeCaloAlignmentEP::produceEEAli(), and TestCaloAlignmentEP::produceEEAli().

69 {
70  return EEDetId( 20 + 50*( iLoc%2 ), 50, 2*( iLoc/2 ) - 1 ) ;
71 }
CaloSubdetectorGeometry::DetIdSet EcalEndcapGeometry::getCells ( const GlobalPoint r,
double  dR 
) const
virtual

Get a list of all cells within a dR of the given cell.

The default implementation makes a loop over all cell geometries. Cleverer implementations are suggested to use rough conversions between eta/phi and ieta/iphi and test on the boundaries.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 352 of file EcalEndcapGeometry.cc.

References funct::abs(), reco::deltaR2(), PV3DBase< T, PVType, FrameType >::eta(), eta(), CaloCellGeometry::etaPos(), CaloSubdetectorGeometry::getCells(), m_cellVec, m_nref, M_PI, m_wref, m_xhi, m_xlo, m_yhi, m_ylo, phi, PV3DBase< T, PVType, FrameType >::phi(), CaloCellGeometry::phiPos(), corrVsCorr::rx, corrVsCorr::ry, funct::tan(), EEDetId::validDetId(), PV3DBase< T, PVType, FrameType >::x(), xindex(), PV3DBase< T, PVType, FrameType >::y(), yindex(), PV3DBase< T, PVType, FrameType >::z(), and zeP.

354 {
355  CaloSubdetectorGeometry::DetIdSet dis ; // return object
356  if( 0.000001 < dR )
357  {
358  if( dR > M_PI/2. ) // this code assumes small dR
359  {
360  dis = CaloSubdetectorGeometry::getCells( r, dR ) ; // base class version
361  }
362  else
363  {
364  const float dR2 ( dR*dR ) ;
365  const float reta ( r.eta() ) ;
366  const float rphi ( r.phi() ) ;
367  const float rx ( r.x() ) ;
368  const float ry ( r.y() ) ;
369  const float rz ( r.z() ) ;
370  const float fac ( std::abs( zeP/rz ) ) ;
371  const float xx ( rx*fac ) ; // xyz at endcap z
372  const float yy ( ry*fac ) ;
373  const float zz ( rz*fac ) ;
374 
375  const float xang ( std::atan( xx/zz ) ) ;
376  const float lowX ( zz>0 ? zz*std::tan( xang - dR ) : zz*std::tan( xang + dR ) ) ;
377  const float highX ( zz>0 ? zz*std::tan( xang + dR ) : zz*std::tan( xang - dR ) ) ;
378  const float yang ( std::atan( yy/zz ) ) ;
379  const float lowY ( zz>0 ? zz*std::tan( yang - dR ) : zz*std::tan( yang + dR ) ) ;
380  const float highY ( zz>0 ? zz*std::tan( yang + dR ) : zz*std::tan( yang - dR ) ) ;
381 
382  const float refxlo ( 0 > rz ? m_xlo[0] : m_xlo[1] ) ;
383  const float refxhi ( 0 > rz ? m_xhi[0] : m_xhi[1] ) ;
384  const float refylo ( 0 > rz ? m_ylo[0] : m_ylo[1] ) ;
385  const float refyhi ( 0 > rz ? m_yhi[0] : m_yhi[1] ) ;
386 
387  if( lowX < refxhi && // proceed if any possible overlap with the endcap
388  lowY < refyhi &&
389  highX > refxlo &&
390  highY > refylo )
391  {
392  const int ix_ctr ( xindex( xx, rz ) ) ;
393  const int iy_ctr ( yindex( yy, rz ) ) ;
394  const int iz ( rz>0 ? 1 : -1 ) ;
395 
396  const int ix_hi ( ix_ctr + int( ( highX - xx )/m_wref ) + 2 ) ;
397  const int ix_lo ( ix_ctr - int( ( xx - lowX )/m_wref ) - 2 ) ;
398 
399  const int iy_hi ( iy_ctr + int( ( highY - yy )/m_wref ) + 2 ) ;
400  const int iy_lo ( iy_ctr - int( ( yy - lowY )/m_wref ) - 2 ) ;
401 
402  for( int kx ( ix_lo ) ; kx <= ix_hi ; ++kx )
403  {
404  if( kx > 0 &&
405  kx <= (int) m_nref )
406  {
407  for( int ky ( iy_lo ) ; ky <= iy_hi ; ++ky )
408  {
409  if( ky > 0 &&
410  ky <= (int) m_nref )
411  {
412  if( EEDetId::validDetId( kx, ky, iz ) ) // reject invalid ids
413  {
414  const EEDetId id ( kx, ky, iz ) ;
415  const CaloCellGeometry* cell = &m_cellVec[ id.denseIndex()];
416  const float eta (cell->etaPos() ) ;
417  const float phi (cell->phiPos() ) ;
418  if( reco::deltaR2( eta, phi, reta, rphi ) < dR2 ) dis.insert( id ) ;
419  }
420  }
421  }
422  }
423  }
424  }
425  }
426  }
427  return dis;
428 }
float phiPos() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
T eta() const
unsigned int yindex(CCGFloat y, CCGFloat z) const
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
T z() const
Definition: PV3DBase.h:64
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
#define M_PI
unsigned int xindex(CCGFloat x, CCGFloat z) const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
T eta() const
Definition: PV3DBase.h:76
float etaPos() const
T x() const
Definition: PV3DBase.h:62
Definition: DDAxes.h:10
const EcalEndcapGeometry::OrderedListOfEBDetId * EcalEndcapGeometry::getClosestBarrelCells ( EEDetId  id) const

Definition at line 431 of file EcalEndcapGeometry.cc.

References degrees(), CaloSubdetectorGeometry::getGeometry(), i, m_borderMgr, m_borderPtrVec, myPhi(), phi, and ecaldqm::zside().

Referenced by spr::simpleMove(), and PFECALHashNavigator::stdsimplemove().

432 {
433  OrderedListOfEBDetId* ptr ( nullptr ) ;
434  auto ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
435  if(!ptrVec) {
436  if(0 != id.rawId() && 0 != getGeometry(id)) {
437  const float phi(370.+getGeometry(id)->getPosition().phi().degrees());
438  const int iPhi(1+int(phi)%360) ;
439  const int iz(id.zside()) ;
440  if (!m_borderMgr.load(std::memory_order_acquire)) {
441  EZMgrFL<EBDetId>* expect = nullptr;
442  auto ptrMgr = new EZMgrFL<EBDetId>( 720*9, 9 );
443  bool exchanged = m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
444  if(!exchanged) delete ptrMgr;
445  }
446  VecOrdListEBDetIdPtr* expect = nullptr;
447  auto ptrVec = new VecOrdListEBDetIdPtr();
448  ptrVec->reserve(720);
449  for( unsigned int i ( 0 ) ; i != 720 ; ++i )
450  {
451  const int kz ( 360>i ? -1 : 1 ) ;
452  const int iEta ( kz*85 ) ;
453  const int iEtam1 ( kz*84 ) ;
454  const int iEtam2 ( kz*83 ) ;
455  const int jPhi ( i%360 + 1 ) ;
456  OrderedListOfEBDetId& olist ( *new OrderedListOfEBDetId( m_borderMgr.load(std::memory_order_acquire) ) );
457  olist[0]=EBDetId( iEta , jPhi ) ;
458  olist[1]=EBDetId( iEta , myPhi( jPhi+1 ) ) ;
459  olist[2]=EBDetId( iEta , myPhi( jPhi-1 ) ) ;
460  olist[3]=EBDetId( iEtam1, jPhi ) ;
461  olist[4]=EBDetId( iEtam1, myPhi( jPhi+1 ) ) ;
462  olist[5]=EBDetId( iEtam1, myPhi( jPhi-1 ) ) ;
463  olist[6]=EBDetId( iEta , myPhi( jPhi+2 ) ) ;
464  olist[7]=EBDetId( iEta , myPhi( jPhi-2 ) ) ;
465  olist[8]=EBDetId( iEtam2, jPhi ) ;
466  ptrVec->push_back( &olist ) ;
467  }
468  bool exchanged = m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
469  if(!exchanged) delete ptrVec;
470  ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
471  ptr = (*ptrVec)[ ( iPhi - 1 ) + ( 0>iz ? 0 : 360 ) ] ;
472  }
473  }
474  return ptr;
475 }
double degrees(double radiants)
def degrees
int i
Definition: DBlmapReader.cc:9
int zside(DetId const &)
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
std::vector< OrderedListOfEBDetId * > VecOrdListEBDetIdPtr
static int myPhi(int i)
Definition: EZMgrFL.h:8
EZArrayFL< EBDetId > OrderedListOfEBDetId
Definition: DDAxes.h:10
DetId EcalEndcapGeometry::getClosestCell ( const GlobalPoint r) const
virtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 239 of file EcalEndcapGeometry.cc.

References funct::A, funct::C, alignCSCRings::e, CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), gId(), i, EEDetId::ix(), EEDetId::iy(), evf::evtn::offset(), point, EEDetId::validDetId(), x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, PV3DBase< T, PVType, FrameType >::z(), and EEDetId::zside().

Referenced by spr::chargeIsolationEcal(), CaloGeometryHelper::getClosestCell(), and spr::propagateCALO().

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  zsign=1;
278 
279  if(z>0)
280  {
281  if(x>0&&y>0)
282  offset=1;
283  else if(x<0&&y>0)
284  offset=2;
285  else if(x>0&&y<0)
286  offset=0;
287  else if (x<0&&y<0)
288  offset=3;
289  zsign=1;
290  }
291  else
292  {
293  if(x>0&&y>0)
294  offset=3;
295  else if(x<0&&y>0)
296  offset=2;
297  else if(x>0&&y<0)
298  offset=0;
299  else if(x<0&&y<0)
300  offset=1;
301  zsign=-1;
302  }
303  GlobalPoint corners[8];
304  for(unsigned ic=0;ic<4;++ic)
305  {
306  corners[ic]=getGeometry(mycellID)->getCorners()[(unsigned)((zsign*ic+offset)%4)];
307  corners[4+ic]=getGeometry(mycellID)->getCorners()[(unsigned)(4+(zsign*ic+offset)%4)];
308  }
309 
310  CCGFloat SS[4];
311  for (short i=0; i < 4 ; ++i)
312  {
313  A = Pt3D(corners[i%4].x(),corners[i%4].y(),corners[i%4].z());
314  B = Pt3D(corners[(i+1)%4].x(),corners[(i+1)%4].y(),corners[(i+1)%4].z());
315  C = Pt3D(corners[4+(i+1)%4].x(),corners[4+(i+1)%4].y(),corners[4+(i+1)%4].z());
316  Pl3D plane(A,B,C);
317  plane.normalize();
318  CCGFloat distance = plane.distance(point);
319  if (corners[0].z()<0.) distance=-distance;
320  SS[i] = distance;
321  }
322 
323  // Only one move in necessary direction
324 
325  const bool yout ( 0 > SS[0]*SS[2] ) ;
326  const bool xout ( 0 > SS[1]*SS[3] ) ;
327 
328  if( yout || xout )
329  {
330  const int ydel ( !yout ? 0 : ( 0 < SS[0] ? -1 : 1 ) ) ;
331  const int xdel ( !xout ? 0 : ( 0 < SS[1] ? -1 : 1 ) ) ;
332  const unsigned int ix ( mycellID.ix() + xdel ) ;
333  const unsigned int iy ( mycellID.iy() + ydel ) ;
334  const unsigned int iz ( mycellID.zside() ) ;
335  if( EEDetId::validDetId( ix, iy, iz ) )
336  mycellID = EEDetId( ix, iy, iz ) ;
337  }
338 
339  return mycellID;
340  }
341  return DetId(0);
342  }
343  }
344  catch ( cms::Exception &e )
345  {
346  return DetId(0);
347  }
348  return DetId(0);
349 }
int i
Definition: DBlmapReader.cc:9
double_binary B
Definition: DDStreamer.cc:234
CaloCellGeometry::Pt3D Pt3D
T y() const
Definition: PV3DBase.h:63
float float float z
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
HepGeom::Plane3D< CCGFloat > Pl3D
T z() const
Definition: PV3DBase.h:64
CaloCellGeometry::CCGFloat CCGFloat
unsigned int offset(bool)
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:18
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
Definition: DDAxes.h:10
EEDetId gId(float x, float y, float z) const
const CornersVec & getCorners() const
Returns the corner points of this cell&#39;s volume.
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
int EcalEndcapGeometry::getNumberOfCrystalPerModule ( ) const
inline

Definition at line 60 of file EcalEndcapGeometry.h.

References _nncrys.

60 { return _nncrys ; }
int _nncrys
number of crystals per module
int EcalEndcapGeometry::getNumberOfModules ( ) const
inline

Definition at line 58 of file EcalEndcapGeometry.h.

References _nnmods.

58 { return _nnmods ; }
int _nnmods
number of modules
EEDetId EcalEndcapGeometry::gId ( float  x,
float  y,
float  z 
) const
private

Definition at line 203 of file EcalEndcapGeometry.cc.

References i, gen::k, EEDetId::validDetId(), xindex(), yindex(), zeN, and zeP.

Referenced by getClosestCell().

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 }
int i
Definition: DBlmapReader.cc:9
float float float z
unsigned int yindex(CCGFloat y, CCGFloat z) const
CaloCellGeometry::CCGFloat CCGFloat
int k[5][pyjets_maxn]
unsigned int xindex(CCGFloat x, CCGFloat z) const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
Definition: DDAxes.h:10
static std::string EcalEndcapGeometry::hitString ( )
inlinestatic

Definition at line 77 of file EcalEndcapGeometry.h.

77 { return "EcalHitsEE" ; }
void EcalEndcapGeometry::initializeParms ( )
virtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 80 of file EcalEndcapGeometry.cc.

References cellGeomPtr(), EEDetId::detIdFromDenseIndex(), CaloCellGeometry::getPosition(), i, EEDetId::ix(), EEDetId::iy(), m_cellVec, m_del, m_nref, m_wref, m_xhi, m_xlo, m_xoff, m_yhi, m_ylo, m_yoff, AlCaHLTBitMon_ParallelJobs::p, x, detailsBasic3DVector::y, detailsBasic3DVector::z, PV3DBase< T, PVType, FrameType >::z(), zeN, and zeP.

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 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
int i
Definition: DBlmapReader.cc:9
virtual const CaloCellGeometry * cellGeomPtr(uint32_t index) const
float float float z
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: DDAxes.h:10
void EcalEndcapGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)
static

Definition at line 478 of file EcalEndcapGeometry.cc.

References TruncatedPyramid::localCorners().

482 {
483  TruncatedPyramid::localCorners( lc, pv, ref ) ;
484 }
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
static int EcalEndcapGeometry::myPhi ( int  i)
inlinestaticprivate

Definition at line 106 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells().

106 { i+=720; return ( 1 + (i-1)%360 ) ; }
int i
Definition: DBlmapReader.cc:9
void EcalEndcapGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
virtual

Implements CaloSubdetectorGeometry.

Definition at line 487 of file EcalEndcapGeometry.cc.

References CaloSubdetectorGeometry::addValidID(), CaloSubdetectorGeometry::cornersMgr(), and m_cellVec.

492 {
493  const unsigned int cellIndex ( EEDetId( detId ).denseIndex() ) ;
494  m_cellVec[ cellIndex ] =
495  TruncatedPyramid( cornersMgr(), f1, f2, f3, parm ) ;
496  addValidID( detId ) ;
497 }
void addValidID(const DetId &id)
CaloCellGeometry::CornersMgr * cornersMgr()
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
static unsigned int EcalEndcapGeometry::numberOfAlignments ( )
inlinestatic

Definition at line 81 of file EcalEndcapGeometry.h.

Referenced by FakeCaloAlignmentEP::produceEEAli(), and TestCaloAlignmentEP::produceEEAli().

81 { return 4 ; }
virtual unsigned int EcalEndcapGeometry::numberOfParametersPerShape ( ) const
inlinevirtual
virtual unsigned int EcalEndcapGeometry::numberOfShapes ( ) const
inlinevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 51 of file EcalEndcapGeometry.h.

References k_NumberOfShapes.

static std::string EcalEndcapGeometry::producerTag ( )
inlinestatic

Definition at line 79 of file EcalEndcapGeometry.h.

Referenced by PCaloGeometryBuilder::beginRun(), and CaloGeometryBuilder::produceAligned().

79 { return "EcalEndcap" ; }
void EcalEndcapGeometry::setNumberOfCrystalPerModule ( const int  nncrys)
inline

Definition at line 64 of file EcalEndcapGeometry.h.

References _nncrys.

64 { _nncrys=nncrys ; }
int _nncrys
number of crystals per module
void EcalEndcapGeometry::setNumberOfModules ( const int  nnmods)
inline

Definition at line 62 of file EcalEndcapGeometry.h.

References _nnmods.

62 { _nnmods=nnmods ; }
int _nnmods
number of modules
unsigned int EcalEndcapGeometry::xindex ( CCGFloat  x,
CCGFloat  z 
) const
private

Definition at line 180 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_xlo.

Referenced by getCells(), and gId().

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 }
int i
Definition: DBlmapReader.cc:9
float float float z
CaloCellGeometry::CCGFloat CCGFloat
Definition: DDAxes.h:10
unsigned int EcalEndcapGeometry::yindex ( CCGFloat  y,
CCGFloat  z 
) const
private

Definition at line 192 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_ylo.

Referenced by getCells(), and gId().

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 }
int i
Definition: DBlmapReader.cc:9
float float float z
CaloCellGeometry::CCGFloat CCGFloat

Member Data Documentation

int EcalEndcapGeometry::_nncrys
private

number of crystals per module

Definition at line 112 of file EcalEndcapGeometry.h.

Referenced by getNumberOfCrystalPerModule(), and setNumberOfCrystalPerModule().

int EcalEndcapGeometry::_nnmods
private

number of modules

Definition at line 109 of file EcalEndcapGeometry.h.

Referenced by getNumberOfModules(), and setNumberOfModules().

CCGFloat EcalEndcapGeometry::m_avgZ
mutableprivate

Definition at line 129 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

std::atomic<EZMgrFL<EBDetId>*> EcalEndcapGeometry::m_borderMgr
mutableprivate

Definition at line 125 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells(), and ~EcalEndcapGeometry().

std::atomic<VecOrdListEBDetIdPtr*> EcalEndcapGeometry::m_borderPtrVec
mutableprivate

Definition at line 127 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells(), and ~EcalEndcapGeometry().

CellVec EcalEndcapGeometry::m_cellVec
private
std::atomic<bool> EcalEndcapGeometry::m_check
mutableprivate

Definition at line 130 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

CCGFloat EcalEndcapGeometry::m_del
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

unsigned int EcalEndcapGeometry::m_nref
private

Definition at line 118 of file EcalEndcapGeometry.h.

Referenced by getCells(), initializeParms(), xindex(), and yindex().

CCGFloat EcalEndcapGeometry::m_wref
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by getCells(), initializeParms(), xindex(), and yindex().

CCGFloat EcalEndcapGeometry::m_xhi[2]
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), and initializeParms().

CCGFloat EcalEndcapGeometry::m_xlo[2]
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), initializeParms(), and xindex().

CCGFloat EcalEndcapGeometry::m_xoff[2]
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

CCGFloat EcalEndcapGeometry::m_yhi[2]
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), and initializeParms().

CCGFloat EcalEndcapGeometry::m_ylo[2]
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), initializeParms(), and yindex().

CCGFloat EcalEndcapGeometry::m_yoff[2]
private

Definition at line 116 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

CCGFloat EcalEndcapGeometry::zeN
private

Definition at line 114 of file EcalEndcapGeometry.h.

Referenced by gId(), and initializeParms().

CCGFloat EcalEndcapGeometry::zeP
private

Definition at line 114 of file EcalEndcapGeometry.h.

Referenced by getCells(), gId(), and initializeParms().