8 #include <CLHEP/Geometry/Point3D.h>
9 #include <CLHEP/Geometry/Plane3D.h>
10 #include <CLHEP/Geometry/Vector3D.h>
18 typedef HepGeom::Plane3D<CCGFloat>
Pl3D ;
25 m_borderPtrVec ( 0 ) ,
27 m_cellVec ( k_NumberOfCellsForCorners )
29 const int neba[] = {25,45,65,85} ;
30 _EtaBaskets = std::vector<int>( &neba[0], &neba[3] ) ;
46 assert( gid.
isEB() ) ;
83 int guessed_eta = (int)( fabs(pointeta) / 0.0174)+1;
84 int guessed_eta_begin = guessed_eta-1;
85 int guessed_eta_end = guessed_eta+1;
86 if (guessed_eta_begin < 1) guessed_eta_begin = 1;
87 if (guessed_eta_end > 85) guessed_eta_end = 85;
89 for(
int bin=guessed_eta_begin;
bin<= guessed_eta_end;
bin++)
98 if(fabs(pointeta-eta)<deta)
100 deta=fabs(pointeta-eta);
125 int phibin =
static_cast<int>(pointphi / (twopi/
_nnxtalPhi)) + 1;
149 std::vector<CCGFloat> history;
150 history.resize(4,0.);
156 while (leverx==1 || levery == 1)
162 std::vector<CCGFloat> SS;
165 for (
short i=0;
i < 4 ; ++
i)
167 A =
Pt3D(corners[
i%4].
x(),corners[
i%4].
y(),corners[
i%4].
z());
168 B =
Pt3D(corners[(
i+1)%4].
x(),corners[(
i+1)%4].
y(),corners[(
i+1)%4].
z());
169 C =
Pt3D(corners[4+(
i+1)%4].
x(),corners[4+(
i+1)%4].
y(),corners[4+(
i+1)%4].
z());
173 if(plane.d()>0.) distance=-distance;
174 if (corners[0].
z()<0.) distance=-distance;
175 SS.push_back(distance);
182 if ( ( SS[0]>0.&&SS[2]>0. )||( SS[0]<0.&&SS[2]<0. ) )
185 if ( history[0]>0. && history[2]>0. && SS[0]<0 && SS[2]<0 &&
186 (fabs(SS[0])+fabs(SS[2]))> (fabs(history[0])+fabs(history[2]))) levery = 0 ;
187 if ( history[0]<0. && history[2]<0. && SS[0]>0 && SS[2]>0 &&
188 (fabs(SS[0])+fabs(SS[2]))> (fabs(history[0])+fabs(history[2]))) levery = 0 ;
218 if ( ( ( SS[1]>0.&&SS[3]>0. )||( SS[1]<0.&&SS[3]<0. )) && start==1 )
222 if ( history[1]>0. && history[3]>0. && SS[1]<0 && SS[3]<0 &&
223 (fabs(SS[1])+fabs(SS[3]))> (fabs(history[1])+fabs(history[3])) )
229 if ( history[1]<0. && history[3]<0. && SS[1]>0 && SS[3]>0 &&
230 (fabs(SS[1])+fabs(SS[3]))> (fabs(history[1])+fabs(history[3])) )
240 if (myCell.
ieta()==-1)
244 int nieta= myCell.
ieta()+1;
245 if(nieta==86) nieta=85;
256 if (myCell.
ieta()==1)
260 int nieta=myCell.
ieta()-1;
261 if(nieta==-86) nieta=-85;
283 return DetId(myCell);
308 const double dR2 ( dR*dR ) ;
309 const double reta ( r.
eta() ) ;
310 const double rz ( r.
z() ) ;
311 const double rphi ( r.
phi() ) ;
312 const double lowEta ( reta - dR ) ;
313 const double highEta ( reta + dR ) ;
315 if( highEta > -1.5 &&
319 const int ieta_center (
int( reta*scale + ((rz<0)?(-1):(1))) ) ;
320 const double phi ( rphi<0 ? rphi + 2*
M_PI : rphi ) ;
321 const int iphi_center (
int( phi*scale + 11. ) ) ;
323 const double fr ( dR*scale ) ;
324 const double frp ( 1.08*fr + 1. ) ;
325 const double frm ( 0.92*fr - 1. ) ;
326 const int idr ( (
int)frp ) ;
327 const int idr2p ( (
int)(frp*frp) ) ;
328 const int idr2m ( frm > 0 ?
int(frm*frm) : 0 ) ;
330 for(
int de ( -idr ) ; de <= idr ; ++de )
332 int ieta ( de + ieta_center ) ;
337 const int de2 ( de*de ) ;
338 for(
int dp ( -idr ) ; dp <= idr ; ++dp )
340 const int irange2 ( dp*dp + de2 ) ;
342 if( irange2 <= idr2p )
344 const int iphi ( ( iphi_center + dp + maxphi - 1 )%maxphi + 1 ) ;
350 bool ok ( irange2 < idr2m ) ;
358 const double eta (
p.eta() ) ;
359 const double phi (
p.phi() ) ;
363 if( ok ) dis.insert(
id ) ;
379 if( 0 !=
id.rawId() )
381 const int iPhi (
id.iphi() ) ;
383 const int iz (
id.ieta()>0 ? 1 : -1 ) ;
390 const int xout ( 1==iq || 4==iq ? 1 : -1 ) ;
391 const int yout ( 1==iq || 2==iq ? 1 : -1 ) ;
400 for(
unsigned int i ( 0 ) ;
i != 720 ; ++
i )
402 const int kz ( 360>
i ? -1 : 1 ) ;
405 const int jx ( eeid.
ix() ) ;
406 const int jy ( eeid.
iy() ) ;
411 for(
unsigned int k ( 1 ) ;
k <= 25 ; ++
k )
413 const int kx ( 1==
k || 2==
k || 3==
k || 12==
k || 13==
k ? 0 :
414 ( 4==
k || 6==
k || 8==
k || 15==
k || 20==
k ? 1 :
415 ( 5==
k || 7==
k || 9==
k || 16==
k || 19==
k ? -1 :
416 ( 10==
k || 14==
k || 21==
k || 22==
k || 25==
k ? 2 : -2 )))) ;
417 const int ky ( 1==
k || 4==
k || 5==
k || 10==
k || 11==
k ? 0 :
418 ( 2==
k || 6==
k || 7==
k || 14==
k || 17==
k ? 1 :
419 ( 3==
k || 8==
k || 9==
k || 18==
k || 21==
k ? -1 :
420 ( 12==
k || 15==
k || 16==
k || 22==
k || 23==
k ? 2 : -2 )))) ;
423 jy + ky*yout , kz ) )
425 olist[il++]=
EEDetId( jx + kx*xout ,
426 jy + ky*yout , kz ) ;
432 ptr = (*m_borderPtrVec)[ iPhi - 1 + ( 0>iz ? 0 : 360 ) ] ;
444 const bool odd ( 1 == i%2 ) ;
446 if( ( ( negz && !odd ) ||
464 const unsigned int cellIndex (
EBDetId( detId ).denseIndex() ) ;
495 0 == cell->
param() ? 0 : cell ) ;
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
std::set< DetId > DetIdSet
const OrderedListOfEEDetId * getClosestEndcapCells(EBDetId id) const
static const int MIN_IPHI
virtual CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
virtual DetId getClosestCell(const GlobalPoint &r) const
CaloCellGeometry::Pt3DVec Pt3DVec
Geom::Phi< T > phi() const
std::vector< int > _EtaBaskets
std::vector< Pt3D > Pt3DVec
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
EZArrayFL< EEDetId > OrderedListOfEEDetId
CaloCellGeometry::CCGFloat CCGFloat
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CCGFloat * param() const
int iphi() const
get the crystal iphi
HepGeom::Plane3D< CCGFloat > Pl3D
virtual bool present(const DetId &id) const
is this detid present in the geometry?
static void localCornersSwap(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
VecOrdListEEDetIdPtr * m_borderPtrVec
std::vector< DetId > m_validIds
CaloCellGeometry::CCGFloat CCGFloat
int ieta() const
get the crystal ieta
double deltaR2(double eta1, double phi1, double eta2, double phi2)
static const int ETAPHIMODE
CCGFloat avgRadiusXYFrontFaceCenter() const
CaloCellGeometry::Pt3D Pt3D
static const int MAX_IPHI
virtual const CaloCellGeometry * cellGeomPtr(uint32_t index) const
CaloCellGeometry::CornersMgr * cornersMgr()
EZMgrFL< EEDetId > * m_borderMgr
static const int MAX_IETA
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
std::vector< OrderedListOfEEDetId * > VecOrdListEEDetIdPtr
static EEDetId idOuterRing(int iPhi, int zEnd)
static const int SMCRYSTALMODE
virtual ~EcalBarrelGeometry()
int ism(int ieta, int iphi)
static void localCornersReflection(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
static unsigned int alignmentTransformIndexLocal(const DetId &id)
*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
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)