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 Referencefinal

#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
 
std::vector< DetIdm_validIds
 

Detailed Description

Definition at line 20 of file EcalEndcapGeometry.h.

Member Typedef Documentation

Definition at line 31 of file EcalEndcapGeometry.h.

Definition at line 32 of file EcalEndcapGeometry.h.

Definition at line 26 of file EcalEndcapGeometry.h.

Definition at line 24 of file EcalEndcapGeometry.h.

Definition at line 41 of file EcalEndcapGeometry.h.

Definition at line 30 of file EcalEndcapGeometry.h.

Definition at line 39 of file EcalEndcapGeometry.h.

Definition at line 35 of file EcalEndcapGeometry.h.

Definition at line 33 of file EcalEndcapGeometry.h.

Definition at line 27 of file EcalEndcapGeometry.h.

Definition at line 28 of file EcalEndcapGeometry.h.

Definition at line 37 of file EcalEndcapGeometry.h.

Member Enumeration Documentation

anonymous enum
anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 45 of file EcalEndcapGeometry.h.

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 47 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( false ),
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 assert(), 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 }
assert(m_qm.get())
int zside(DetId const &)
CCGFloat EcalEndcapGeometry::avgAbsZFrontFaceCenter ( ) const

Definition at line 500 of file EcalEndcapGeometry.cc.

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

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 }
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 520 of file EcalEndcapGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

Referenced by avgAbsZFrontFaceCenter(), and initializeParms().

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

Definition at line 50 of file EcalEndcapGeometry.h.

50 { 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 351 of file EcalEndcapGeometry.cc.

References funct::abs(), reco::deltaR2(), eta, PV3DBase< T, PVType, FrameType >::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.

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 }
float phiPos() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
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
#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
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
T eta() const
Definition: PV3DBase.h:76
float etaPos() const
T x() const
Definition: PV3DBase.h:62
const EcalEndcapGeometry::OrderedListOfEBDetId * EcalEndcapGeometry::getClosestBarrelCells ( EEDetId  id) const

Definition at line 430 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().

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 }
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
DetId EcalEndcapGeometry::getClosestCell ( const GlobalPoint r) const
virtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 239 of file EcalEndcapGeometry.cc.

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

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

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 }
int i
Definition: DBlmapReader.cc:9
double_binary B
Definition: DDStreamer.cc:234
CaloCellGeometry::Pt3D Pt3D
T y() const
Definition: PV3DBase.h:63
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
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:18
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
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
int EcalEndcapGeometry::getNumberOfCrystalPerModule ( ) const
inline

Definition at line 61 of file EcalEndcapGeometry.h.

References _nncrys.

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

Definition at line 59 of file EcalEndcapGeometry.h.

References _nnmods.

59 { 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, relval_2017::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
unsigned int yindex(CCGFloat y, CCGFloat z) const
CaloCellGeometry::CCGFloat CCGFloat
unsigned int xindex(CCGFloat x, CCGFloat z) const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static std::string EcalEndcapGeometry::hitString ( )
inlinestatic

Definition at line 78 of file EcalEndcapGeometry.h.

78 { 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, y, 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
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
void EcalEndcapGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)
static

Definition at line 477 of file EcalEndcapGeometry.cc.

References TruncatedPyramid::localCorners().

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

Definition at line 107 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells().

107 { 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 486 of file EcalEndcapGeometry.cc.

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

491 {
492  const unsigned int cellIndex ( EEDetId( detId ).denseIndex() ) ;
493  m_cellVec[ cellIndex ] =
494  TruncatedPyramid( cornersMgr(), f1, f2, f3, parm ) ;
495  addValidID( detId ) ;
496 }
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 82 of file EcalEndcapGeometry.h.

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

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 52 of file EcalEndcapGeometry.h.

References k_NumberOfShapes.

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

Definition at line 80 of file EcalEndcapGeometry.h.

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

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

Definition at line 65 of file EcalEndcapGeometry.h.

References _nncrys.

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

Definition at line 63 of file EcalEndcapGeometry.h.

References _nnmods.

63 { _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
CaloCellGeometry::CCGFloat CCGFloat
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
CaloCellGeometry::CCGFloat CCGFloat

Member Data Documentation

int EcalEndcapGeometry::_nncrys
private

number of crystals per module

Definition at line 113 of file EcalEndcapGeometry.h.

Referenced by getNumberOfCrystalPerModule(), and setNumberOfCrystalPerModule().

int EcalEndcapGeometry::_nnmods
private

number of modules

Definition at line 110 of file EcalEndcapGeometry.h.

Referenced by getNumberOfModules(), and setNumberOfModules().

CCGFloat EcalEndcapGeometry::m_avgZ
mutableprivate

Definition at line 130 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

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

Definition at line 126 of file EcalEndcapGeometry.h.

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

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

Definition at line 128 of file EcalEndcapGeometry.h.

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

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

Definition at line 131 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

CCGFloat EcalEndcapGeometry::m_del
private

Definition at line 117 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

unsigned int EcalEndcapGeometry::m_nref
private

Definition at line 119 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_wref
private

Definition at line 117 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_xhi[2]
private

Definition at line 117 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_xlo[2]
private

Definition at line 117 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_xoff[2]
private

Definition at line 117 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

CCGFloat EcalEndcapGeometry::m_yhi[2]
private

Definition at line 117 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_ylo[2]
private

Definition at line 117 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_yoff[2]
private

Definition at line 117 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

CCGFloat EcalEndcapGeometry::zeN
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by gId(), and initializeParms().

CCGFloat EcalEndcapGeometry::zeP
private

Definition at line 115 of file EcalEndcapGeometry.h.

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