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 | 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 EEDetId DetIdType
 
typedef IdealGeometryRecord IdealRecord
 
typedef EcalEndcapNumberingScheme NumberingScheme
 
typedef EZArrayFL< EBDetIdOrderedListOfEBDetId
 
typedef PEcalEndcapRcd PGeometryRecord
 
typedef std::vector
< OrderedListOfEBDetId * > 
VecOrdListEBDetIdPtr
 
- Public Types inherited from CaloSubdetectorGeometry
typedef std::vector< const
CaloCellGeometry * > 
CellCont
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< double > DimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< double > TrVec
 

Public Member Functions

double 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 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 addCell (const DetId &id, CaloCellGeometry *ccg)
 Add a cell to the geometry. More...
 
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
const CellContcellGeometries () const
 the cells More...
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
double deltaEta (const DetId &detId) const
 
double 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 std::vector
< HepGeom::Point3D< double > > 
localCorners (const double *pv, unsigned int i, HepGeom::Point3D< double > &ref)
 
static CaloCellGeometrynewCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, CaloCellGeometry::CornersMgr *mgr, const double *parm, const DetId &detId)
 
static unsigned int numberOfAlignments ()
 
static std::string producerTag ()
 

Private Member Functions

EEDetId gId (float x, float y, float z) const
 
unsigned int xindex (double x, double z) const
 
unsigned int yindex (double y, double 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...
 
double m_avgZ
 
EZMgrFL< EBDetId > * m_borderMgr
 
VecOrdListEBDetIdPtrm_borderPtrVec
 
double m_del
 
unsigned int m_nref
 
double m_wref
 
double m_xhi [2]
 
double m_xlo [2]
 
double m_xoff [2]
 
double m_yhi [2]
 
double m_ylo [2]
 
double m_yoff [2]
 
double zeN
 
double zeP
 

Additional Inherited Members

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

Detailed Description

Definition at line 18 of file EcalEndcapGeometry.h.

Member Typedef Documentation

Definition at line 23 of file EcalEndcapGeometry.h.

Definition at line 24 of file EcalEndcapGeometry.h.

Definition at line 33 of file EcalEndcapGeometry.h.

Definition at line 22 of file EcalEndcapGeometry.h.

Definition at line 31 of file EcalEndcapGeometry.h.

Definition at line 27 of file EcalEndcapGeometry.h.

Definition at line 25 of file EcalEndcapGeometry.h.

Definition at line 29 of file EcalEndcapGeometry.h.

Member Enumeration Documentation

anonymous enum
anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 37 of file EcalEndcapGeometry.h.

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 39 of file EcalEndcapGeometry.h.

Constructor & Destructor Documentation

EcalEndcapGeometry::EcalEndcapGeometry ( )

Definition at line 9 of file EcalEndcapGeometry.cc.

9  :
10  _nnmods ( 316 ) ,
11  _nncrys ( 25 ) ,
12  m_borderMgr ( 0 ),
13  m_borderPtrVec ( 0 ),
14  m_avgZ ( -1 )
15 {
16 }
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 18 of file EcalEndcapGeometry.cc.

References m_borderMgr, and m_borderPtrVec.

19 {
20  delete m_borderPtrVec ;
21  delete m_borderMgr ;
22 }
VecOrdListEBDetIdPtr * m_borderPtrVec
EZMgrFL< EBDetId > * m_borderMgr

Member Function Documentation

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

Definition at line 42 of file EcalEndcapGeometry.cc.

References DetId::Ecal.

43 {
44  return (unsigned int)DetId::Ecal - 1 ;
45 }
unsigned int EcalEndcapGeometry::alignmentTransformIndexLocal ( const DetId id)
static

Definition at line 25 of file EcalEndcapGeometry.cc.

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

26 {
27  const CaloGenericDetId gid ( id ) ;
28 
29  assert( gid.isEE() ) ;
30  unsigned int index ( EEDetId(id).ix()/51 + ( EEDetId(id).zside()<0 ? 0 : 2 ) ) ;
31 
32  return index ;
33 }
double EcalEndcapGeometry::avgAbsZFrontFaceCenter ( ) const

Definition at line 465 of file EcalEndcapGeometry.cc.

References CaloSubdetectorGeometry::cellGeometries(), i, m_avgZ, and z.

466 {
467  if( 0 > m_avgZ )
468  {
469  double sum ( 0 ) ;
471  for( unsigned int i ( 0 ) ; i != cells.size() ; ++i )
472  {
473  sum += fabs( cells[i]->getPosition().z() ) ;
474  }
475  m_avgZ = sum/cells.size() ;
476  }
477  return m_avgZ ;
478 }
int i
Definition: DBlmapReader.cc:9
std::vector< const CaloCellGeometry * > CellCont
Definition: DDAxes.h:10
const CellCont & cellGeometries() const
the cells
static std::string EcalEndcapGeometry::dbString ( )
inlinestatic

Definition at line 42 of file EcalEndcapGeometry.h.

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

Definition at line 36 of file EcalEndcapGeometry.cc.

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

37 {
38  return EEDetId( 20 + 50*( iLoc%2 ), 50, 2*( iLoc/2 ) - 1 ) ;
39 }
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 318 of file EcalEndcapGeometry.cc.

References reco::deltaR2(), PV3DBase< T, PVType, FrameType >::eta(), eta(), CaloSubdetectorGeometry::getCells(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), ExpressReco_HICollisions_FallBack::id, m_nref, M_PI, m_wref, m_xhi, m_xlo, m_yhi, m_ylo, L1TEmulatorMonitor_cff::p, phi, PV3DBase< T, PVType, FrameType >::phi(), funct::tan(), EEDetId::validDetId(), PV3DBase< T, PVType, FrameType >::x(), xindex(), PV3DBase< T, PVType, FrameType >::y(), yindex(), PV3DBase< T, PVType, FrameType >::z(), and zeP.

320 {
321  CaloSubdetectorGeometry::DetIdSet dis ; // return object
322  if( 0.000001 < dR )
323  {
324  if( dR > M_PI/2. ) // this code assumes small dR
325  {
326  dis = CaloSubdetectorGeometry::getCells( r, dR ) ; // base class version
327  }
328  else
329  {
330  const double dR2 ( dR*dR ) ;
331  const double reta ( r.eta() ) ;
332  const double rphi ( r.phi() ) ;
333  const double rx ( r.x() ) ;
334  const double ry ( r.y() ) ;
335  const double rz ( r.z() ) ;
336  const double fac ( fabs( zeP/rz ) ) ;
337  const double xx ( rx*fac ) ; // xyz at endcap z
338  const double yy ( ry*fac ) ;
339  const double zz ( rz*fac ) ;
340 
341  const double xang ( atan( xx/zz ) ) ;
342  const double lowX ( zz>0 ? zz*tan( xang - dR ) : zz*tan( xang + dR ) ) ;
343  const double highX ( zz>0 ? zz*tan( xang + dR ) : zz*tan( xang - dR ) ) ;
344  const double yang ( atan( yy/zz ) ) ;
345  const double lowY ( zz>0 ? zz*tan( yang - dR ) : zz*tan( yang + dR ) ) ;
346  const double highY ( zz>0 ? zz*tan( yang + dR ) : zz*tan( yang - dR ) ) ;
347 
348  const double refxlo ( 0 > rz ? m_xlo[0] : m_xlo[1] ) ;
349  const double refxhi ( 0 > rz ? m_xhi[0] : m_xhi[1] ) ;
350  const double refylo ( 0 > rz ? m_ylo[0] : m_ylo[1] ) ;
351  const double refyhi ( 0 > rz ? m_yhi[0] : m_yhi[1] ) ;
352 
353  if( lowX < refxhi && // proceed if any possible overlap with the endcap
354  lowY < refyhi &&
355  highX > refxlo &&
356  highY > refylo )
357  {
358  const int ix_ctr ( xindex( xx, rz ) ) ;
359  const int iy_ctr ( yindex( yy, rz ) ) ;
360  const int iz ( rz>0 ? 1 : -1 ) ;
361 
362  const int ix_hi ( ix_ctr + int( ( highX - xx )/m_wref ) + 2 ) ;
363  const int ix_lo ( ix_ctr - int( ( xx - lowX )/m_wref ) - 2 ) ;
364 
365  const int iy_hi ( iy_ctr + int( ( highY - yy )/m_wref ) + 2 ) ;
366  const int iy_lo ( iy_ctr - int( ( yy - lowY )/m_wref ) - 2 ) ;
367 
368  for( int kx ( ix_lo ) ; kx <= ix_hi ; ++kx )
369  {
370  if( kx > 0 &&
371  kx <= (int) m_nref )
372  {
373  for( int ky ( iy_lo ) ; ky <= iy_hi ; ++ky )
374  {
375  if( ky > 0 &&
376  ky <= (int) m_nref )
377  {
378  if( EEDetId::validDetId( kx, ky, iz ) ) // reject invalid ids
379  {
380  const EEDetId id ( kx, ky, iz ) ;
381  const CaloCellGeometry* cell ( getGeometry( id ) );
382  if( 0 != cell )
383  {
384  const GlobalPoint& p ( cell->getPosition() ) ;
385  const double eta ( p.eta() ) ;
386  const double phi ( p.phi() ) ;
387  if( reco::deltaR2( eta, phi, reta, rphi ) < dR2 ) dis.insert( id ) ;
388  }
389  }
390  }
391  }
392  }
393  }
394  }
395  }
396  }
397  return dis;
398 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
T y() const
Definition: PV3DBase.h:57
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 xindex(double x, double 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:58
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
#define M_PI
Definition: BFit3D.cc:3
T eta() const
Definition: PV3DBase.h:70
T x() const
Definition: PV3DBase.h:56
unsigned int yindex(double y, double z) const
Definition: DDAxes.h:10
const EcalEndcapGeometry::OrderedListOfEBDetId * EcalEndcapGeometry::getClosestBarrelCells ( EEDetId  id) const

Definition at line 401 of file EcalEndcapGeometry.cc.

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

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

402 {
403  OrderedListOfEBDetId* ptr ( 0 ) ;
404  if( 0 != id.rawId() &&
405  0 != getGeometry( id ) )
406  {
407  const float phi ( 370. +
408  getGeometry( id )->getPosition().phi().degrees() );
409  const int iPhi ( 1 + int(phi)%360 ) ;
410  const int iz ( id.zside() ) ;
411  if( 0 == m_borderMgr )
412  {
413  m_borderMgr = new EZMgrFL<EBDetId>( 720*9, 9 ) ;
414  }
415  if( 0 == m_borderPtrVec )
416  {
418  m_borderPtrVec->reserve( 720 ) ;
419  for( unsigned int i ( 0 ) ; i != 720 ; ++i )
420  {
421  const int kz ( 360>i ? -1 : 1 ) ;
422  const int iEta ( kz*85 ) ;
423  const int iEtam1 ( kz*84 ) ;
424  const int iEtam2 ( kz*83 ) ;
425  const int jPhi ( i%360 + 1 ) ;
427  olist[0]=EBDetId( iEta , jPhi ) ;
428  olist[1]=EBDetId( iEta , myPhi( jPhi+1 ) ) ;
429  olist[2]=EBDetId( iEta , myPhi( jPhi-1 ) ) ;
430  olist[3]=EBDetId( iEtam1, jPhi ) ;
431  olist[4]=EBDetId( iEtam1, myPhi( jPhi+1 ) ) ;
432  olist[5]=EBDetId( iEtam1, myPhi( jPhi-1 ) ) ;
433  olist[6]=EBDetId( iEta , myPhi( jPhi+2 ) ) ;
434  olist[7]=EBDetId( iEta , myPhi( jPhi-2 ) ) ;
435  olist[8]=EBDetId( iEtam2, jPhi ) ;
436  m_borderPtrVec->push_back( &olist ) ;
437  }
438  }
439  ptr = (*m_borderPtrVec)[ ( iPhi - 1 ) + ( 0>iz ? 0 : 360 ) ] ;
440  }
441  return ptr ;
442 }
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 203 of file EcalEndcapGeometry.cc.

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

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

204 {
205  try
206  {
207  EEDetId mycellID ( gId( r.x(), r.y(), r.z() ) ) ; // educated guess
208 
209  if( EEDetId::validDetId( mycellID.ix(),
210  mycellID.iy(),
211  mycellID.zside() ) )
212  {
213  // now get points in convenient ordering
214 
215  HepGeom::Point3D<double> A;
216  HepGeom::Point3D<double> B;
217  HepGeom::Point3D<double> C;
218  HepGeom::Point3D<double> point(r.x(),r.y(),r.z());
219  // D.K. : equation of plane : AA*x+BB*y+CC*z+DD=0;
220  // finding equation for each edge
221 
222  // ================================================================
223  double x,y,z;
224  unsigned offset=0;
225  int zsign=1;
226  //================================================================
227  std::vector<double> SS;
228 
229  // compute the distance of the point with respect of the 4 crystal lateral planes
230 
231 
232  if( 0 != getGeometry(mycellID) )
233  {
234  const GlobalPoint& myPosition=getGeometry(mycellID)->getPosition();
235 
236  x=myPosition.x();
237  y=myPosition.y();
238  z=myPosition.z();
239 
240  offset=0;
241  // This will disappear when Andre has applied his fix
242  zsign=1;
243 
244  if(z>0)
245  {
246  if(x>0&&y>0)
247  offset=1;
248  else if(x<0&&y>0)
249  offset=2;
250  else if(x>0&&y<0)
251  offset=0;
252  else if (x<0&&y<0)
253  offset=3;
254  zsign=1;
255  }
256  else
257  {
258  if(x>0&&y>0)
259  offset=3;
260  else if(x<0&&y>0)
261  offset=2;
262  else if(x>0&&y<0)
263  offset=0;
264  else if(x<0&&y<0)
265  offset=1;
266  zsign=-1;
267  }
268  std::vector<GlobalPoint> corners;
269  corners.clear();
270  corners.resize(8);
271  for(unsigned ic=0;ic<4;++ic)
272  {
273  corners[ic]=getGeometry(mycellID)->getCorners()[(unsigned)((zsign*ic+offset)%4)];
274  corners[4+ic]=getGeometry(mycellID)->getCorners()[(unsigned)(4+(zsign*ic+offset)%4)];
275  }
276 
277  for (short i=0; i < 4 ; ++i)
278  {
279  A = HepGeom::Point3D<double> (corners[i%4].x(),corners[i%4].y(),corners[i%4].z());
280  B = HepGeom::Point3D<double> (corners[(i+1)%4].x(),corners[(i+1)%4].y(),corners[(i+1)%4].z());
281  C = HepGeom::Point3D<double> (corners[4+(i+1)%4].x(),corners[4+(i+1)%4].y(),corners[4+(i+1)%4].z());
282  HepGeom::Plane3D<double> plane(A,B,C);
283  plane.normalize();
284  double distance = plane.distance(point);
285  if (corners[0].z()<0.) distance=-distance;
286  SS.push_back(distance);
287  }
288 
289  // Only one move in necessary direction
290 
291  const bool yout ( 0 > SS[0]*SS[2] ) ;
292  const bool xout ( 0 > SS[1]*SS[3] ) ;
293 
294  if( yout || xout )
295  {
296  const int ydel ( !yout ? 0 : ( 0 < SS[0] ? -1 : 1 ) ) ;
297  const int xdel ( !xout ? 0 : ( 0 < SS[1] ? -1 : 1 ) ) ;
298  const unsigned int ix ( mycellID.ix() + xdel ) ;
299  const unsigned int iy ( mycellID.iy() + ydel ) ;
300  const unsigned int iz ( mycellID.zside() ) ;
301  if( EEDetId::validDetId( ix, iy, iz ) )
302  mycellID = EEDetId( ix, iy, iz ) ;
303  }
304 
305  return mycellID;
306  }
307  return DetId(0);
308  }
309  }
310  catch ( cms::Exception &e )
311  {
312  return DetId(0);
313  }
314  return DetId(0);
315 }
int i
Definition: DBlmapReader.cc:9
double_binary B
Definition: DDStreamer.cc:235
T y() const
Definition: PV3DBase.h:57
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.
Definition: DDAxes.h:10
T z() const
Definition: PV3DBase.h:58
unsigned int offset(bool)
Definition: DetId.h:20
EEDetId gId(float x, float y, float z) const
const GlobalPoint & getPosition() const
T x() const
Definition: PV3DBase.h:56
*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
int EcalEndcapGeometry::getNumberOfCrystalPerModule ( ) const
inline

Definition at line 53 of file EcalEndcapGeometry.h.

References _nncrys.

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

Definition at line 51 of file EcalEndcapGeometry.h.

References _nnmods.

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

Definition at line 167 of file EcalEndcapGeometry.cc.

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

Referenced by getClosestCell().

170 {
171  const double fac ( fabs( ( 0 > z ? zeN : zeP )/z ) ) ;
172  const unsigned int ix ( xindex( x*fac, z ) ) ;
173  const unsigned int iy ( yindex( y*fac, z ) ) ;
174  const unsigned int iz ( z>0 ? 1 : -1 ) ;
175 
176  if( EEDetId::validDetId( ix, iy, iz ) )
177  {
178  return EEDetId( ix, iy, iz ) ; // first try is on target
179  }
180  else // try nearby coordinates, spiraling out from center
181  {
182  for( unsigned int i ( 1 ) ; i != 6 ; ++i )
183  {
184  for( unsigned int k ( 0 ) ; k != 8 ; ++k )
185  {
186  const int jx ( 0 == k || 4 == k || 5 == k ? +i :
187  ( 1 == k || 5 < k ? -i : 0 ) ) ;
188  const int jy ( 2 == k || 4 == k || 6 == k ? +i :
189  ( 3 == k || 5 == k || 7 == k ? -i : 0 ) ) ;
190  if( EEDetId::validDetId( ix + jx, iy + jy, iz ) )
191  {
192  return EEDetId( ix + jx, iy + jy, iz ) ;
193  }
194  }
195  }
196  }
197  return EEDetId() ; // nowhere near any crystal
198 }
int i
Definition: DBlmapReader.cc:9
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
unsigned int xindex(double x, double z) const
Definition: DDAxes.h:10
int k[5][pyjets_maxn]
unsigned int yindex(double y, double z) const
static std::string EcalEndcapGeometry::hitString ( )
inlinestatic

Definition at line 70 of file EcalEndcapGeometry.h.

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 48 of file EcalEndcapGeometry.cc.

References CaloSubdetectorGeometry::cellGeometries(), EEDetId::detIdFromDenseIndex(), i, EEDetId::ix(), EEDetId::iy(), m_del, m_nref, m_wref, m_xhi, m_xlo, m_xoff, m_yhi, m_ylo, m_yoff, L1TEmulatorMonitor_cff::p, PV3DBase< T, PVType, FrameType >::x(), ExpressReco_HICollisions_FallBack::x, PV3DBase< T, PVType, FrameType >::y(), ExpressReco_HICollisions_FallBack::y, z, PV3DBase< T, PVType, FrameType >::z(), zeN, and zeP.

49 {
50  zeP=0.;
51  zeN=0.;
52  unsigned nP=0;
53  unsigned nN=0;
54  m_nref = 0 ;
55 
56  for( uint32_t i ( 0 ) ; i != cellGeometries().size() ; ++i )
57  {
58  if( 0 != cellGeometries()[i] )
59  {
60 // addCrystalToZGridmap(i->first,dynamic_cast<const TruncatedPyramid*>(i->second));
61  const double z ( cellGeometries()[i]->getPosition().z() ) ;
62  if(z>0.)
63  {
64  zeP+=z;
65  ++nP;
66  }
67  else
68  {
69  zeN+=z;
70  ++nN;
71  }
72  const EEDetId myId ( EEDetId::detIdFromDenseIndex(i) ) ;
73  const unsigned int ix ( myId.ix() ) ;
74  const unsigned int iy ( myId.iy() ) ;
75  if( ix > m_nref ) m_nref = ix ;
76  if( iy > m_nref ) m_nref = iy ;
77  }
78  }
79  if( 0 < nP ) zeP/=(double)nP;
80  if( 0 < nN ) zeN/=(double)nN;
81 
82  m_xlo[0] = 999 ;
83  m_xhi[0] = -999 ;
84  m_ylo[0] = 999 ;
85  m_yhi[0] = -999 ;
86  m_xlo[1] = 999 ;
87  m_xhi[1] = -999 ;
88  m_ylo[1] = 999 ;
89  m_yhi[1] = -999 ;
90  for( uint32_t i ( 0 ) ; i != cellGeometries().size() ; ++i )
91  {
92  const GlobalPoint p ( cellGeometries()[i]->getPosition() ) ;
93  const double z ( p.z() ) ;
94  const double zz ( 0 > z ? zeN : zeP ) ;
95  const double x ( p.x()*zz/z ) ;
96  const double y ( p.y()*zz/z ) ;
97 
98  if( 0 > z && x < m_xlo[0] ) m_xlo[0] = x ;
99  if( 0 < z && x < m_xlo[1] ) m_xlo[1] = x ;
100  if( 0 > z && y < m_ylo[0] ) m_ylo[0] = y ;
101  if( 0 < z && y < m_ylo[1] ) m_ylo[1] = y ;
102 
103  if( 0 > z && x > m_xhi[0] ) m_xhi[0] = x ;
104  if( 0 < z && x > m_xhi[1] ) m_xhi[1] = x ;
105  if( 0 > z && y > m_yhi[0] ) m_yhi[0] = y ;
106  if( 0 < z && y > m_yhi[1] ) m_yhi[1] = y ;
107  }
108 
109  m_xoff[0] = ( m_xhi[0] + m_xlo[0] )/2. ;
110  m_xoff[1] = ( m_xhi[1] + m_xlo[1] )/2. ;
111  m_yoff[0] = ( m_yhi[0] + m_ylo[0] )/2. ;
112  m_yoff[1] = ( m_yhi[1] + m_ylo[1] )/2. ;
113 
114  m_del = ( m_xhi[0] - m_xlo[0] + m_xhi[1] - m_xlo[1] +
115  m_yhi[0] - m_ylo[0] + m_yhi[1] - m_ylo[1] ) ;
116 
117  m_wref = m_del/(4.*(m_nref-1)) ;
118 
119  m_xlo[0] -= m_wref/2 ;
120  m_xlo[1] -= m_wref/2 ;
121  m_xhi[0] += m_wref/2 ;
122  m_xhi[1] += m_wref/2 ;
123 
124  m_ylo[0] -= m_wref/2 ;
125  m_ylo[1] -= m_wref/2 ;
126  m_yhi[0] += m_wref/2 ;
127  m_yhi[1] += m_wref/2 ;
128 
129  m_del += m_wref ;
130 /*
131  std::cout<<"zeP="<<zeP<<", zeN="<<zeN<<", nP="<<nP<<", nN="<<nN<<std::endl ;
132 
133  std::cout<<"xlo[0]="<<m_xlo[0]<<", xlo[1]="<<m_xlo[1]<<", xhi[0]="<<m_xhi[0]<<", xhi[1]="<<m_xhi[1]
134  <<"\nylo[0]="<<m_ylo[0]<<", ylo[1]="<<m_ylo[1]<<", yhi[0]="<<m_yhi[0]<<", yhi[1]="<<m_yhi[1]<<std::endl ;
135 
136  std::cout<<"xoff[0]="<<m_xoff[0]<<", xoff[1]"<<m_xoff[1]<<", yoff[0]="<<m_yoff[0]<<", yoff[1]"<<m_yoff[1]<<std::endl ;
137 
138  std::cout<<"nref="<<m_nref<<", m_wref="<<m_wref<<std::endl ;
139 */
140 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:215
int i
Definition: DBlmapReader.cc:9
Definition: DDAxes.h:10
const CellCont & cellGeometries() const
the cells
std::vector< HepGeom::Point3D< double > > EcalEndcapGeometry::localCorners ( const double *  pv,
unsigned int  i,
HepGeom::Point3D< double > &  ref 
)
static

Definition at line 445 of file EcalEndcapGeometry.cc.

References TruncatedPyramid::localCorners().

448 {
449  return ( TruncatedPyramid::localCorners( pv, ref ) ) ;
450 }
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, HepGeom::Point3D< double > &ref)
static int EcalEndcapGeometry::myPhi ( int  i)
inlinestaticprivate

Definition at line 95 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells().

95 { i+=720; return ( 1 + (i-1)%360 ) ; }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry * EcalEndcapGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
CaloCellGeometry::CornersMgr mgr,
const double *  parm,
const DetId detId 
)
static

Definition at line 453 of file EcalEndcapGeometry.cc.

459 {
460  return ( new TruncatedPyramid( mgr, f1, f2, f3, parm ) ) ;
461 }
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 74 of file EcalEndcapGeometry.h.

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

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 44 of file EcalEndcapGeometry.h.

References k_NumberOfShapes.

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

Definition at line 72 of file EcalEndcapGeometry.h.

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

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

Definition at line 57 of file EcalEndcapGeometry.h.

References _nncrys.

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

Definition at line 55 of file EcalEndcapGeometry.h.

References _nnmods.

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

Definition at line 144 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_xlo.

Referenced by getCells(), and gId().

146 {
147  const double xlo ( 0 > z ? m_xlo[0] : m_xlo[1] ) ;
148  const int i ( 1 + int( ( x - xlo )/m_wref ) ) ;
149 
150  return ( 1 > i ? 1 :
151  ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;
152 
153 }
int i
Definition: DBlmapReader.cc:9
Definition: DDAxes.h:10
unsigned int EcalEndcapGeometry::yindex ( double  y,
double  z 
) const
private

Definition at line 156 of file EcalEndcapGeometry.cc.

References i, m_nref, m_wref, and m_ylo.

Referenced by getCells(), and gId().

158 {
159  const double ylo ( 0 > z ? m_ylo[0] : m_ylo[1] ) ;
160  const int i ( 1 + int( ( y - ylo )/m_wref ) ) ;
161 
162  return ( 1 > i ? 1 :
163  ( m_nref < (unsigned int) i ? m_nref : (unsigned int) i ) ) ;
164 }
int i
Definition: DBlmapReader.cc:9
Definition: DDAxes.h:10

Member Data Documentation

int EcalEndcapGeometry::_nncrys
private

number of crystals per module

Definition at line 101 of file EcalEndcapGeometry.h.

Referenced by getNumberOfCrystalPerModule(), and setNumberOfCrystalPerModule().

int EcalEndcapGeometry::_nnmods
private

number of modules

Definition at line 98 of file EcalEndcapGeometry.h.

Referenced by getNumberOfModules(), and setNumberOfModules().

double EcalEndcapGeometry::m_avgZ
mutableprivate

Definition at line 118 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

EZMgrFL<EBDetId>* EcalEndcapGeometry::m_borderMgr
mutableprivate

Definition at line 114 of file EcalEndcapGeometry.h.

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

VecOrdListEBDetIdPtr* EcalEndcapGeometry::m_borderPtrVec
mutableprivate

Definition at line 116 of file EcalEndcapGeometry.h.

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

double EcalEndcapGeometry::m_del
private

Definition at line 105 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

unsigned int EcalEndcapGeometry::m_nref
private

Definition at line 107 of file EcalEndcapGeometry.h.

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

double EcalEndcapGeometry::m_wref
private

Definition at line 105 of file EcalEndcapGeometry.h.

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

double EcalEndcapGeometry::m_xhi[2]
private

Definition at line 105 of file EcalEndcapGeometry.h.

Referenced by getCells(), and initializeParms().

double EcalEndcapGeometry::m_xlo[2]
private

Definition at line 105 of file EcalEndcapGeometry.h.

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

double EcalEndcapGeometry::m_xoff[2]
private

Definition at line 105 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

double EcalEndcapGeometry::m_yhi[2]
private

Definition at line 105 of file EcalEndcapGeometry.h.

Referenced by getCells(), and initializeParms().

double EcalEndcapGeometry::m_ylo[2]
private

Definition at line 105 of file EcalEndcapGeometry.h.

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

double EcalEndcapGeometry::m_yoff[2]
private

Definition at line 105 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

double EcalEndcapGeometry::zeN
private

Definition at line 103 of file EcalEndcapGeometry.h.

Referenced by gId(), and initializeParms().

double EcalEndcapGeometry::zeP
private

Definition at line 103 of file EcalEndcapGeometry.h.

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