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::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 const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
void getSummary (TrVec &trVector, IVec &iVector, DimVec &dimVector) 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
 

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
 
EZMgrFL< EBDetId > * m_borderMgr
 
VecOrdListEBDetIdPtrm_borderPtrVec
 
CellVec m_cellVec
 
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 18 of file EcalEndcapGeometry.h.

Member Typedef Documentation

Definition at line 29 of file EcalEndcapGeometry.h.

Definition at line 30 of file EcalEndcapGeometry.h.

Definition at line 24 of file EcalEndcapGeometry.h.

Definition at line 22 of file EcalEndcapGeometry.h.

Definition at line 39 of file EcalEndcapGeometry.h.

Definition at line 28 of file EcalEndcapGeometry.h.

Definition at line 37 of file EcalEndcapGeometry.h.

Definition at line 33 of file EcalEndcapGeometry.h.

Definition at line 31 of file EcalEndcapGeometry.h.

Definition at line 25 of file EcalEndcapGeometry.h.

Definition at line 26 of file EcalEndcapGeometry.h.

Definition at line 35 of file EcalEndcapGeometry.h.

Member Enumeration Documentation

anonymous enum
anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 43 of file EcalEndcapGeometry.h.

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 45 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( 0 ),
23  m_borderPtrVec( 0 ),
24  m_avgZ( -1 ),
26 {
27  m_xlo[0] = 999.;
28  m_xlo[1] = 999.;
29  m_xhi[0] = -999.;
30  m_xhi[1] = -999.;
31  m_ylo[0] = 999.;
32  m_ylo[1] = 999.;
33  m_yhi[0] = -999.;
34  m_yhi[1] = -999.;
35  m_xoff[0] = 0.;
36  m_xoff[1] = 0.;
37  m_yoff[0] = 0.;
38  m_yoff[0] = 0.;
39 }
int _nncrys
number of crystals per module
VecOrdListEBDetIdPtr * m_borderPtrVec
EZMgrFL< EBDetId > * m_borderMgr
int _nnmods
number of modules
EcalEndcapGeometry::~EcalEndcapGeometry ( )
virtual

Definition at line 41 of file EcalEndcapGeometry.cc.

References m_borderMgr, and m_borderPtrVec.

42 {
43  delete m_borderPtrVec ;
44  delete m_borderMgr ;
45 }
VecOrdListEBDetIdPtr * m_borderPtrVec
EZMgrFL< EBDetId > * m_borderMgr

Member Function Documentation

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

Definition at line 65 of file EcalEndcapGeometry.cc.

References DetId::Ecal.

66 {
67  return (unsigned int)DetId::Ecal - 1 ;
68 }
unsigned int EcalEndcapGeometry::alignmentTransformIndexLocal ( const DetId id)
static

Definition at line 48 of file EcalEndcapGeometry.cc.

References getHLTprescales::index, and CaloGenericDetId::isEE().

49 {
50  const CaloGenericDetId gid ( id ) ;
51 
52  assert( gid.isEE() ) ;
53  unsigned int index ( EEDetId(id).ix()/51 + ( EEDetId(id).zside()<0 ? 0 : 2 ) ) ;
54 
55  return index ;
56 }
CCGFloat EcalEndcapGeometry::avgAbsZFrontFaceCenter ( ) const

Definition at line 495 of file EcalEndcapGeometry.cc.

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

496 {
497  if( 0 > m_avgZ )
498  {
499  CCGFloat sum ( 0 ) ;
500  for( unsigned int i ( 0 ) ; i != m_cellVec.size() ; ++i )
501  {
502  const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
503  if( 0 != cell )
504  {
505  sum += fabs( cell->getPosition().z() ) ;
506  }
507  }
508  m_avgZ = sum/m_cellVec.size() ;
509  }
510  return m_avgZ ;
511 }
int i
Definition: DBlmapReader.cc:9
virtual const CaloCellGeometry * cellGeomPtr(uint32_t index) const
CaloCellGeometry::CCGFloat CCGFloat
const CaloCellGeometry * EcalEndcapGeometry::cellGeomPtr ( uint32_t  index) const
protectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 514 of file EcalEndcapGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

Referenced by avgAbsZFrontFaceCenter(), and initializeParms().

515 {
516  const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
517  return ( m_cellVec.size() < index ||
518  0 == cell->param() ? 0 : cell ) ;
519 }
static std::string EcalEndcapGeometry::dbString ( )
inlinestatic

Definition at line 48 of file EcalEndcapGeometry.h.

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

Definition at line 59 of file EcalEndcapGeometry.cc.

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

60 {
61  return EEDetId( 20 + 50*( iLoc%2 ), 50, 2*( iLoc/2 ) - 1 ) ;
62 }
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 345 of file EcalEndcapGeometry.cc.

References reco::deltaR2(), PV3DBase< T, PVType, FrameType >::eta(), eta(), CaloSubdetectorGeometry::getCells(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), errorMatrix2Lands_multiChannel::id, m_nref, M_PI, m_wref, m_xhi, m_xlo, m_yhi, m_ylo, AlCaHLTBitMon_ParallelJobs::p, phi, PV3DBase< T, PVType, FrameType >::phi(), 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.

347 {
348  CaloSubdetectorGeometry::DetIdSet dis ; // return object
349  if( 0.000001 < dR )
350  {
351  if( dR > M_PI/2. ) // this code assumes small dR
352  {
353  dis = CaloSubdetectorGeometry::getCells( r, dR ) ; // base class version
354  }
355  else
356  {
357  const double dR2 ( dR*dR ) ;
358  const double reta ( r.eta() ) ;
359  const double rphi ( r.phi() ) ;
360  const double rx ( r.x() ) ;
361  const double ry ( r.y() ) ;
362  const double rz ( r.z() ) ;
363  const double fac ( fabs( zeP/rz ) ) ;
364  const double xx ( rx*fac ) ; // xyz at endcap z
365  const double yy ( ry*fac ) ;
366  const double zz ( rz*fac ) ;
367 
368  const double xang ( atan( xx/zz ) ) ;
369  const double lowX ( zz>0 ? zz*tan( xang - dR ) : zz*tan( xang + dR ) ) ;
370  const double highX ( zz>0 ? zz*tan( xang + dR ) : zz*tan( xang - dR ) ) ;
371  const double yang ( atan( yy/zz ) ) ;
372  const double lowY ( zz>0 ? zz*tan( yang - dR ) : zz*tan( yang + dR ) ) ;
373  const double highY ( zz>0 ? zz*tan( yang + dR ) : zz*tan( yang - dR ) ) ;
374 
375  const double refxlo ( 0 > rz ? m_xlo[0] : m_xlo[1] ) ;
376  const double refxhi ( 0 > rz ? m_xhi[0] : m_xhi[1] ) ;
377  const double refylo ( 0 > rz ? m_ylo[0] : m_ylo[1] ) ;
378  const double refyhi ( 0 > rz ? m_yhi[0] : m_yhi[1] ) ;
379 
380  if( lowX < refxhi && // proceed if any possible overlap with the endcap
381  lowY < refyhi &&
382  highX > refxlo &&
383  highY > refylo )
384  {
385  const int ix_ctr ( xindex( xx, rz ) ) ;
386  const int iy_ctr ( yindex( yy, rz ) ) ;
387  const int iz ( rz>0 ? 1 : -1 ) ;
388 
389  const int ix_hi ( ix_ctr + int( ( highX - xx )/m_wref ) + 2 ) ;
390  const int ix_lo ( ix_ctr - int( ( xx - lowX )/m_wref ) - 2 ) ;
391 
392  const int iy_hi ( iy_ctr + int( ( highY - yy )/m_wref ) + 2 ) ;
393  const int iy_lo ( iy_ctr - int( ( yy - lowY )/m_wref ) - 2 ) ;
394 
395  for( int kx ( ix_lo ) ; kx <= ix_hi ; ++kx )
396  {
397  if( kx > 0 &&
398  kx <= (int) m_nref )
399  {
400  for( int ky ( iy_lo ) ; ky <= iy_hi ; ++ky )
401  {
402  if( ky > 0 &&
403  ky <= (int) m_nref )
404  {
405  if( EEDetId::validDetId( kx, ky, iz ) ) // reject invalid ids
406  {
407  const EEDetId id ( kx, ky, iz ) ;
408  const CaloCellGeometry* cell ( getGeometry( id ) );
409  if( 0 != cell )
410  {
411  const GlobalPoint& p ( cell->getPosition() ) ;
412  const double eta ( p.eta() ) ;
413  const double phi ( p.phi() ) ;
414  if( reco::deltaR2( eta, phi, reta, rphi ) < dR2 ) dis.insert( id ) ;
415  }
416  }
417  }
418  }
419  }
420  }
421  }
422  }
423  }
424  return dis;
425 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
T eta() const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
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:63
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double deltaR2(double eta1, double phi1, double eta2, double phi2)
Definition: deltaR.h:13
unsigned int xindex(CCGFloat x, CCGFloat z) const
#define M_PI
Definition: BFit3D.cc:3
T eta() const
Definition: PV3DBase.h:75
T x() const
Definition: PV3DBase.h:61
Definition: DDAxes.h:10
const EcalEndcapGeometry::OrderedListOfEBDetId * EcalEndcapGeometry::getClosestBarrelCells ( EEDetId  id) const

Definition at line 428 of file EcalEndcapGeometry.cc.

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

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

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 230 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(), PV3DBase< T, PVType, FrameType >::x(), vdt::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().

231 {
232  try
233  {
234  EEDetId mycellID ( gId( r.x(), r.y(), r.z() ) ) ; // educated guess
235 
236  if( EEDetId::validDetId( mycellID.ix(),
237  mycellID.iy(),
238  mycellID.zside() ) )
239  {
240  // now get points in convenient ordering
241 
242  Pt3D A;
243  Pt3D B;
244  Pt3D C;
245  Pt3D point(r.x(),r.y(),r.z());
246  // D.K. : equation of plane : AA*x+BB*y+CC*z+DD=0;
247  // finding equation for each edge
248 
249  // ================================================================
250  CCGFloat x,y,z;
251  unsigned offset=0;
252  int zsign=1;
253  //================================================================
254  std::vector<CCGFloat> SS;
255 
256  // compute the distance of the point with respect of the 4 crystal lateral planes
257 
258 
259  if( 0 != getGeometry(mycellID) )
260  {
261  const GlobalPoint& myPosition=getGeometry(mycellID)->getPosition();
262 
263  x=myPosition.x();
264  y=myPosition.y();
265  z=myPosition.z();
266 
267  offset=0;
268  // This will disappear when Andre has applied his fix
269  zsign=1;
270 
271  if(z>0)
272  {
273  if(x>0&&y>0)
274  offset=1;
275  else if(x<0&&y>0)
276  offset=2;
277  else if(x>0&&y<0)
278  offset=0;
279  else if (x<0&&y<0)
280  offset=3;
281  zsign=1;
282  }
283  else
284  {
285  if(x>0&&y>0)
286  offset=3;
287  else if(x<0&&y>0)
288  offset=2;
289  else if(x>0&&y<0)
290  offset=0;
291  else if(x<0&&y<0)
292  offset=1;
293  zsign=-1;
294  }
295  std::vector<GlobalPoint> corners;
296  corners.clear();
297  corners.resize(8);
298  for(unsigned ic=0;ic<4;++ic)
299  {
300  corners[ic]=getGeometry(mycellID)->getCorners()[(unsigned)((zsign*ic+offset)%4)];
301  corners[4+ic]=getGeometry(mycellID)->getCorners()[(unsigned)(4+(zsign*ic+offset)%4)];
302  }
303 
304  for (short i=0; i < 4 ; ++i)
305  {
306  A = Pt3D(corners[i%4].x(),corners[i%4].y(),corners[i%4].z());
307  B = Pt3D(corners[(i+1)%4].x(),corners[(i+1)%4].y(),corners[(i+1)%4].z());
308  C = Pt3D(corners[4+(i+1)%4].x(),corners[4+(i+1)%4].y(),corners[4+(i+1)%4].z());
309  Pl3D plane(A,B,C);
310  plane.normalize();
311  CCGFloat distance = plane.distance(point);
312  if (corners[0].z()<0.) distance=-distance;
313  SS.push_back(distance);
314  }
315 
316  // Only one move in necessary direction
317 
318  const bool yout ( 0 > SS[0]*SS[2] ) ;
319  const bool xout ( 0 > SS[1]*SS[3] ) ;
320 
321  if( yout || xout )
322  {
323  const int ydel ( !yout ? 0 : ( 0 < SS[0] ? -1 : 1 ) ) ;
324  const int xdel ( !xout ? 0 : ( 0 < SS[1] ? -1 : 1 ) ) ;
325  const unsigned int ix ( mycellID.ix() + xdel ) ;
326  const unsigned int iy ( mycellID.iy() + ydel ) ;
327  const unsigned int iz ( mycellID.zside() ) ;
328  if( EEDetId::validDetId( ix, iy, iz ) )
329  mycellID = EEDetId( ix, iy, iz ) ;
330  }
331 
332  return mycellID;
333  }
334  return DetId(0);
335  }
336  }
337  catch ( cms::Exception &e )
338  {
339  return DetId(0);
340  }
341  return DetId(0);
342 }
int i
Definition: DBlmapReader.cc:9
double_binary B
Definition: DDStreamer.cc:234
CaloCellGeometry::Pt3D Pt3D
T y() const
Definition: PV3DBase.h:62
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
double double double 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:63
CaloCellGeometry::CCGFloat CCGFloat
unsigned int offset(bool)
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:20
x
Definition: VDTMath.h:216
EEDetId gId(float x, float y, float z) const
T x() const
Definition: PV3DBase.h:61
*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
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
int EcalEndcapGeometry::getNumberOfCrystalPerModule ( ) const
inline

Definition at line 59 of file EcalEndcapGeometry.h.

References _nncrys.

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

Definition at line 57 of file EcalEndcapGeometry.h.

References _nnmods.

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

Definition at line 194 of file EcalEndcapGeometry.cc.

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

Referenced by getClosestCell().

197 {
198  const CCGFloat fac ( fabs( ( 0 > z ? zeN : zeP )/z ) ) ;
199  const unsigned int ix ( xindex( x*fac, z ) ) ;
200  const unsigned int iy ( yindex( y*fac, z ) ) ;
201  const unsigned int iz ( z>0 ? 1 : -1 ) ;
202 
203  if( EEDetId::validDetId( ix, iy, iz ) )
204  {
205  return EEDetId( ix, iy, iz ) ; // first try is on target
206  }
207  else // try nearby coordinates, spiraling out from center
208  {
209  for( unsigned int i ( 1 ) ; i != 6 ; ++i )
210  {
211  for( unsigned int k ( 0 ) ; k != 8 ; ++k )
212  {
213  const int jx ( 0 == k || 4 == k || 5 == k ? +i :
214  ( 1 == k || 5 < k ? -i : 0 ) ) ;
215  const int jy ( 2 == k || 4 == k || 6 == k ? +i :
216  ( 3 == k || 5 == k || 7 == k ? -i : 0 ) ) ;
217  if( EEDetId::validDetId( ix + jx, iy + jy, iz ) )
218  {
219  return EEDetId( ix + jx, iy + jy, iz ) ;
220  }
221  }
222  }
223  }
224  return EEDetId() ; // nowhere near any crystal
225 }
int i
Definition: DBlmapReader.cc:9
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
double double double 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
x
Definition: VDTMath.h:216
static std::string EcalEndcapGeometry::hitString ( )
inlinestatic

Definition at line 76 of file EcalEndcapGeometry.h.

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 71 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, errorMatrix2Lands_multiChannel::nN, AlCaHLTBitMon_ParallelJobs::p, vdt::x, detailsBasic3DVector::y, detailsBasic3DVector::z, PV3DBase< T, PVType, FrameType >::z(), zeN, and zeP.

72 {
73  zeP=0.;
74  zeN=0.;
75  unsigned nP=0;
76  unsigned nN=0;
77  m_nref = 0 ;
78 
79  for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
80  {
81  const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
82  if( 0 != cell )
83  {
84  const CCGFloat z ( cell->getPosition().z() ) ;
85  if(z>0.)
86  {
87  zeP+=z;
88  ++nP;
89  }
90  else
91  {
92  zeN+=z;
93  ++nN;
94  }
95  const EEDetId myId ( EEDetId::detIdFromDenseIndex(i) ) ;
96  const unsigned int ix ( myId.ix() ) ;
97  const unsigned int iy ( myId.iy() ) ;
98  if( ix > m_nref ) m_nref = ix ;
99  if( iy > m_nref ) m_nref = iy ;
100  }
101  }
102  if( 0 < nP ) zeP/=(CCGFloat)nP;
103  if( 0 < nN ) zeN/=(CCGFloat)nN;
104 
105  m_xlo[0] = 999 ;
106  m_xhi[0] = -999 ;
107  m_ylo[0] = 999 ;
108  m_yhi[0] = -999 ;
109  m_xlo[1] = 999 ;
110  m_xhi[1] = -999 ;
111  m_ylo[1] = 999 ;
112  m_yhi[1] = -999 ;
113  for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
114  {
115  const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
116  if( 0 != cell )
117  {
118  const GlobalPoint p ( cell->getPosition() ) ;
119  const CCGFloat z ( p.z() ) ;
120  const CCGFloat zz ( 0 > z ? zeN : zeP ) ;
121  const CCGFloat x ( p.x()*zz/z ) ;
122  const CCGFloat y ( p.y()*zz/z ) ;
123 
124  if( 0 > z && x < m_xlo[0] ) m_xlo[0] = x ;
125  if( 0 < z && x < m_xlo[1] ) m_xlo[1] = x ;
126  if( 0 > z && y < m_ylo[0] ) m_ylo[0] = y ;
127  if( 0 < z && y < m_ylo[1] ) m_ylo[1] = y ;
128 
129  if( 0 > z && x > m_xhi[0] ) m_xhi[0] = x ;
130  if( 0 < z && x > m_xhi[1] ) m_xhi[1] = x ;
131  if( 0 > z && y > m_yhi[0] ) m_yhi[0] = y ;
132  if( 0 < z && y > m_yhi[1] ) m_yhi[1] = y ;
133  }
134  }
135 
136  m_xoff[0] = ( m_xhi[0] + m_xlo[0] )/2. ;
137  m_xoff[1] = ( m_xhi[1] + m_xlo[1] )/2. ;
138  m_yoff[0] = ( m_yhi[0] + m_ylo[0] )/2. ;
139  m_yoff[1] = ( m_yhi[1] + m_ylo[1] )/2. ;
140 
141  m_del = ( m_xhi[0] - m_xlo[0] + m_xhi[1] - m_xlo[1] +
142  m_yhi[0] - m_ylo[0] + m_yhi[1] - m_ylo[1] ) ;
143 
144  if( 1 != m_nref ) m_wref = m_del/(4.*(m_nref-1)) ;
145 
146  m_xlo[0] -= m_wref/2 ;
147  m_xlo[1] -= m_wref/2 ;
148  m_xhi[0] += m_wref/2 ;
149  m_xhi[1] += m_wref/2 ;
150 
151  m_ylo[0] -= m_wref/2 ;
152  m_ylo[1] -= m_wref/2 ;
153  m_yhi[0] += m_wref/2 ;
154  m_yhi[1] += m_wref/2 ;
155 
156  m_del += m_wref ;
157 /*
158  std::cout<<"zeP="<<zeP<<", zeN="<<zeN<<", nP="<<nP<<", nN="<<nN<<std::endl ;
159 
160  std::cout<<"xlo[0]="<<m_xlo[0]<<", xlo[1]="<<m_xlo[1]<<", xhi[0]="<<m_xhi[0]<<", xhi[1]="<<m_xhi[1]
161  <<"\nylo[0]="<<m_ylo[0]<<", ylo[1]="<<m_ylo[1]<<", yhi[0]="<<m_yhi[0]<<", yhi[1]="<<m_yhi[1]<<std::endl ;
162 
163  std::cout<<"xoff[0]="<<m_xoff[0]<<", xoff[1]"<<m_xoff[1]<<", yoff[0]="<<m_yoff[0]<<", yoff[1]"<<m_yoff[1]<<std::endl ;
164 
165  std::cout<<"nref="<<m_nref<<", m_wref="<<m_wref<<std::endl ;
166 */
167 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:215
int i
Definition: DBlmapReader.cc:9
tuple nN
people filling error matrix uses the naive 1/sqrt(N) errors
virtual const CaloCellGeometry * cellGeomPtr(uint32_t index) const
double double double z
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
x
Definition: VDTMath.h:216
void EcalEndcapGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)
static

Definition at line 472 of file EcalEndcapGeometry.cc.

References TruncatedPyramid::localCorners().

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

Definition at line 105 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells().

105 { 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 481 of file EcalEndcapGeometry.cc.

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

486 {
487  const unsigned int cellIndex ( EEDetId( detId ).denseIndex() ) ;
488  m_cellVec[ cellIndex ] =
489  TruncatedPyramid( cornersMgr(), f1, f2, f3, parm ) ;
490  m_validIds.push_back( detId ) ;
491 }
std::vector< DetId > m_validIds
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 80 of file EcalEndcapGeometry.h.

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

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 50 of file EcalEndcapGeometry.h.

References k_NumberOfShapes.

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

Definition at line 78 of file EcalEndcapGeometry.h.

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

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

Definition at line 63 of file EcalEndcapGeometry.h.

References _nncrys.

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

Definition at line 61 of file EcalEndcapGeometry.h.

References _nnmods.

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

Definition at line 171 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_xlo.

Referenced by getCells(), and gId().

173 {
174  const CCGFloat xlo ( 0 > z ? m_xlo[0] : m_xlo[1] ) ;
175  const int i ( 1 + int( ( x - xlo )/m_wref ) ) ;
176 
177  return ( 1 > i ? 1 :
178  ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;
179 
180 }
int i
Definition: DBlmapReader.cc:9
double double double z
CaloCellGeometry::CCGFloat CCGFloat
x
Definition: VDTMath.h:216
unsigned int EcalEndcapGeometry::yindex ( CCGFloat  y,
CCGFloat  z 
) const
private

Definition at line 183 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_ylo.

Referenced by getCells(), and gId().

185 {
186  const CCGFloat ylo ( 0 > z ? m_ylo[0] : m_ylo[1] ) ;
187  const int i ( 1 + int( ( y - ylo )/m_wref ) ) ;
188 
189  return ( 1 > i ? 1 :
190  ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;
191 }
int i
Definition: DBlmapReader.cc:9
double double double z
CaloCellGeometry::CCGFloat CCGFloat

Member Data Documentation

int EcalEndcapGeometry::_nncrys
private

number of crystals per module

Definition at line 111 of file EcalEndcapGeometry.h.

Referenced by getNumberOfCrystalPerModule(), and setNumberOfCrystalPerModule().

int EcalEndcapGeometry::_nnmods
private

number of modules

Definition at line 108 of file EcalEndcapGeometry.h.

Referenced by getNumberOfModules(), and setNumberOfModules().

CCGFloat EcalEndcapGeometry::m_avgZ
mutableprivate

Definition at line 128 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

EZMgrFL<EBDetId>* EcalEndcapGeometry::m_borderMgr
mutableprivate

Definition at line 124 of file EcalEndcapGeometry.h.

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

VecOrdListEBDetIdPtr* EcalEndcapGeometry::m_borderPtrVec
mutableprivate

Definition at line 126 of file EcalEndcapGeometry.h.

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

CellVec EcalEndcapGeometry::m_cellVec
private
CCGFloat EcalEndcapGeometry::m_del
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

unsigned int EcalEndcapGeometry::m_nref
private

Definition at line 117 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_wref
private

Definition at line 115 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_xhi[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_xlo[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_xoff[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

CCGFloat EcalEndcapGeometry::m_yhi[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_ylo[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

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

CCGFloat EcalEndcapGeometry::m_yoff[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

CCGFloat EcalEndcapGeometry::zeN
private

Definition at line 113 of file EcalEndcapGeometry.h.

Referenced by gId(), and initializeParms().

CCGFloat EcalEndcapGeometry::zeP
private

Definition at line 113 of file EcalEndcapGeometry.h.

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