6 #include <CLHEP/Geometry/Point3D.h>
7 #include <CLHEP/Geometry/Plane3D.h>
29 assert( gid.
isEE() ) ;
38 return EEDetId( 20 + 50*( iLoc%2 ), 50, 2*( iLoc/2 ) - 1 ) ;
73 const unsigned int ix ( myId.
ix() ) ;
74 const unsigned int iy ( myId.
iy() ) ;
79 if( 0 < nP )
zeP/=(double)nP;
80 if( 0 < nN )
zeN/=(double)nN;
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 ) ;
147 const double xlo ( 0 > z ?
m_xlo[0] :
m_xlo[1] ) ;
148 const int i ( 1 +
int( ( x - xlo )/
m_wref ) ) ;
151 (
m_nref < (
unsigned int) i ?
m_nref : (
unsigned int) i ) ) ;
159 const double ylo ( 0 > z ?
m_ylo[0] :
m_ylo[1] ) ;
160 const int i ( 1 +
int( ( y - ylo )/
m_wref ) ) ;
163 (
m_nref < (
unsigned int) i ?
m_nref : (
unsigned int) i ) ) ;
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 ) ;
182 for(
unsigned int i ( 1 ) ;
i != 6 ; ++
i )
184 for(
unsigned int k ( 0 ) ;
k != 8 ; ++
k )
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 ) ) ;
192 return EEDetId( ix + jx, iy + jy, iz ) ;
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());
227 std::vector<double> SS;
268 std::vector<GlobalPoint> corners;
271 for(
unsigned ic=0;ic<4;++ic)
277 for (
short i=0;
i < 4 ; ++
i)
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);
284 double distance = plane.distance(
point);
285 if (corners[0].
z()<0.) distance=-distance;
286 SS.push_back(distance);
291 const bool yout ( 0 > SS[0]*SS[2] ) ;
292 const bool xout ( 0 > SS[1]*SS[3] ) ;
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() ) ;
302 mycellID =
EEDetId( ix, iy, iz ) ;
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 ) ;
338 const double yy ( ry*fac ) ;
339 const double zz ( rz*fac ) ;
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 ) ) ;
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] ) ;
358 const int ix_ctr (
xindex( xx, rz ) ) ;
359 const int iy_ctr (
yindex( yy, rz ) ) ;
360 const int iz ( rz>0 ? 1 : -1 ) ;
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 ) ;
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 ) ;
368 for(
int kx ( ix_lo ) ; kx <= ix_hi ; ++kx )
373 for(
int ky ( iy_lo ) ; ky <= iy_hi ; ++ky )
380 const EEDetId id ( kx, ky, iz ) ;
385 const double eta (
p.eta() ) ;
386 const double phi (
p.phi() ) ;
404 if( 0 !=
id.rawId() &&
407 const float phi ( 370. +
409 const int iPhi ( 1 +
int(phi)%360 ) ;
410 const int iz (
id.zside() ) ;
419 for(
unsigned int i ( 0 ) ;
i != 720 ; ++
i )
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 ) ;
430 olist[3]=
EBDetId( iEtam1, jPhi ) ;
435 olist[8]=
EBDetId( iEtam2, jPhi ) ;
439 ptr = (*m_borderPtrVec)[ ( iPhi - 1 ) + ( 0>iz ? 0 : 360 ) ] ;
444 std::vector<HepGeom::Point3D<double> >
447 HepGeom::Point3D<double> & ref )
471 for(
unsigned int i ( 0 ) ;
i != cells.size() ; ++
i )
473 sum += fabs( cells[
i]->getPosition().
z() ) ;
475 m_avgZ = sum/cells.size() ;
static EEDetId detIdFromDenseIndex(uint32_t din)
virtual DetId getClosestCell(const GlobalPoint &r) const
double degrees(double radiants)
def degrees
double avgAbsZFrontFaceCenter() const
std::set< DetId > DetIdSet
std::vector< const CaloCellGeometry * > CellCont
Geom::Phi< T > phi() const
VecOrdListEBDetIdPtr * m_borderPtrVec
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
virtual CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static unsigned int alignmentTransformIndexLocal(const DetId &id)
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.
static CaloCellGeometry * newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, CaloCellGeometry::CornersMgr *mgr, const double *parm, const DetId &detId)
const CellCont & cellGeometries() const
the cells
EZMgrFL< EBDetId > * m_borderMgr
virtual ~EcalEndcapGeometry()
Tan< T >::type tan(const T &t)
std::vector< OrderedListOfEBDetId * > VecOrdListEBDetIdPtr
const OrderedListOfEBDetId * getClosestBarrelCells(EEDetId id) const
virtual void initializeParms()
unsigned int offset(bool)
double deltaR2(double eta1, double phi1, double eta2, double phi2)
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, unsigned int i, HepGeom::Point3D< double > &ref)
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
EZArrayFL< EBDetId > OrderedListOfEBDetId
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, HepGeom::Point3D< double > &ref)
EEDetId gId(float x, float y, float z) const
const GlobalPoint & getPosition() const
unsigned int yindex(double y, double z) const
*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
virtual const CornersVec & getCorners() const =0