8 #include <CLHEP/Geometry/Point3D.h> 9 #include <CLHEP/Geometry/Plane3D.h> 10 #include <CLHEP/Geometry/Vector3D.h> 18 typedef HepGeom::Plane3D<CCGFloat>
Pl3D ;
28 m_cellVec ( k_NumberOfCellsForCorners )
30 const int neba[] = {25,45,65,85} ;
40 for(
auto&
v: (*ptr)) {
55 assert( gid.
isEB() ) ;
92 int guessed_eta = (
int)( fabs(pointeta) / 0.0174)+1;
93 int guessed_eta_begin = guessed_eta-1;
94 int guessed_eta_end = guessed_eta+1;
95 if (guessed_eta_begin < 1) guessed_eta_begin = 1;
96 if (guessed_eta_end > 85) guessed_eta_end = 85;
98 for(
int bin=guessed_eta_begin;
bin<= guessed_eta_end;
bin++)
107 if(fabs(pointeta-eta)<deta)
109 deta=fabs(pointeta-eta);
134 int phibin =
static_cast<int>(pointphi / (twopi/
_nnxtalPhi)) + 1;
165 while (leverx==1 || levery == 1)
174 for (
short i=0;
i < 4 ; ++
i)
176 A =
Pt3D(corners[
i%4].
x(),corners[
i%4].
y(),corners[
i%4].
z());
177 B =
Pt3D(corners[(
i+1)%4].
x(),corners[(
i+1)%4].
y(),corners[(
i+1)%4].
z());
178 C =
Pt3D(corners[4+(
i+1)%4].
x(),corners[4+(
i+1)%4].
y(),corners[4+(
i+1)%4].
z());
182 if(plane.d()>0.) distance=-
distance;
183 if (corners[0].
z()<0.) distance=-
distance;
191 if ( ( SS[0]>0.&&SS[2]>0. )||( SS[0]<0.&&SS[2]<0. ) )
194 if ( history[0]>0. && history[2]>0. && SS[0]<0 && SS[2]<0 &&
195 (fabs(SS[0])+fabs(SS[2]))> (fabs(history[0])+fabs(history[2]))) levery = 0 ;
196 if ( history[0]<0. && history[2]<0. && SS[0]>0 && SS[2]>0 &&
197 (fabs(SS[0])+fabs(SS[2]))> (fabs(history[0])+fabs(history[2]))) levery = 0 ;
227 if ( ( ( SS[1]>0.&&SS[3]>0. )||( SS[1]<0.&&SS[3]<0. )) && start==1 )
231 if ( history[1]>0. && history[3]>0. && SS[1]<0 && SS[3]<0 &&
232 (fabs(SS[1])+fabs(SS[3]))> (fabs(history[1])+fabs(history[3])) )
238 if ( history[1]<0. && history[3]<0. && SS[1]>0 && SS[3]>0 &&
239 (fabs(SS[1])+fabs(SS[3]))> (fabs(history[1])+fabs(history[3])) )
249 if (myCell.
ieta()==-1)
253 int nieta= myCell.
ieta()+1;
254 if(nieta==86) nieta=85;
265 if (myCell.
ieta()==1)
269 int nieta=myCell.
ieta()-1;
270 if(nieta==-86) nieta=-85;
292 return DetId(myCell);
319 const float dR2 ( dR*dR ) ;
320 const float reta ( r.
eta() ) ;
321 const float rz ( r.
z() ) ;
322 const float rphi ( r.
phi() ) ;
323 const float lowEta ( reta - dR ) ;
324 const float highEta ( reta + dR ) ;
326 if( highEta > -1.5 &&
329 const int ieta_center (
int( reta*scale + ((rz<0)?(-1):(1))) ) ;
330 const float phi ( rphi<0 ? rphi +
float(2*
M_PI) : rphi ) ;
331 const int iphi_center (
int( phi*scale + 11.
f ) ) ;
333 const float fr ( dR*scale ) ;
334 const float frp ( 1.08
f*fr + 1.
f ) ;
335 const float frm ( 0.92
f*fr - 1.
f ) ;
336 const int idr ( (
int)frp ) ;
337 const int idr2p ( (
int)(frp*frp) ) ;
338 const int idr2m ( frm > 0 ?
int(frm*frm) : 0 ) ;
340 for(
int de ( -idr ) ; de <= idr ; ++de )
342 int ieta ( de + ieta_center ) ;
347 const int de2 ( de*de ) ;
348 for(
int dp ( -idr ) ;
dp <= idr ; ++
dp )
350 const int irange2 (
dp*
dp + de2 ) ;
352 if( irange2 <= idr2p )
354 const int iphi ( ( iphi_center +
dp + maxphi - 1 )%maxphi + 1 ) ;
360 bool ok ( irange2 < idr2m ) ;
369 if( ok ) dis.insert(
id ) ;
387 if( 0 !=
id.rawId() ) {
388 const int iPhi (
id.iphi() ) ;
389 const int iz (
id.ieta()>0 ? 1 : -1 ) ;
392 const int xout ( 1==iq || 4==iq ? 1 : -1 ) ;
393 const int yout ( 1==iq || 2==iq ? 1 : -1 ) ;
394 if (!
m_borderMgr.load(std::memory_order_acquire)) {
397 bool exchanged =
m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
398 if(!exchanged)
delete ptrMgr;
402 ptrVec->reserve(720);
403 for(
unsigned int i ( 0 ) ;
i != 720 ; ++
i )
405 const int kz ( 360>
i ? -1 : 1 ) ;
408 const int jx ( eeid.
ix() ) ;
409 const int jy ( eeid.
iy() ) ;
414 for(
unsigned int k ( 1 ) ;
k <= 25 ; ++
k )
416 const int kx ( 1==
k || 2==
k || 3==
k || 12==
k || 13==
k ? 0 :
417 ( 4==
k || 6==
k || 8==
k || 15==
k || 20==
k ? 1 :
418 ( 5==
k || 7==
k || 9==
k || 16==
k || 19==
k ? -1 :
419 ( 10==
k || 14==
k || 21==
k || 22==
k || 25==
k ? 2 : -2 )))) ;
420 const int ky ( 1==
k || 4==
k || 5==
k || 10==
k || 11==
k ? 0 :
421 ( 2==
k || 6==
k || 7==
k || 14==
k || 17==
k ? 1 :
422 ( 3==
k || 8==
k || 9==
k || 18==
k || 21==
k ? -1 :
423 ( 12==
k || 15==
k || 16==
k || 22==
k || 23==
k ? 2 : -2 )))) ;
426 jy + ky*yout , kz ) )
428 olist[il++]=
EEDetId( jx + kx*xout, jy + ky*yout, kz ) ;
431 ptrVec->emplace_back( &olist ) ;
433 bool exchanged =
m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
434 if(!exchanged)
delete ptrVec;
436 ptr = (*ptrVec)[iPhi - 1 + ( 0>iz ? 0 : 360 )];
449 const bool odd ( 1 == i%2 ) ;
451 if( ( ( negz && !odd ) ||
469 const unsigned int cellIndex (
EBDetId( detId ).denseIndex() ) ;
478 if(!
m_check.load(std::memory_order_acquire))
484 if(
nullptr != cell )
491 m_check.store(
true, std::memory_order_release);
500 nullptr == cell->
param() ?
nullptr : cell);
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
std::set< DetId > DetIdSet
const OrderedListOfEEDetId * getClosestEndcapCells(EBDetId id) const
static const int MIN_IPHI
DetId getClosestCell(const GlobalPoint &r) const override
bool present(const DetId &id) const override
is this detid present in the geometry?
CaloCellGeometry::Pt3DVec Pt3DVec
std::atomic< bool > m_check
Geom::Phi< T > phi() const
std::vector< int > _EtaBaskets
std::vector< Pt3D > Pt3DVec
EZArrayFL< EEDetId > OrderedListOfEEDetId
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
static bool validDetId(int i, int j)
check if a valid index combination
~EcalBarrelGeometry() override
int iphi() const
get the crystal iphi
HepGeom::Plane3D< CCGFloat > Pl3D
static void localCornersSwap(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
const CCGFloat * param() const
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
static const std::string B
std::atomic< VecOrdListEEDetIdPtr * > m_borderPtrVec
static const int ETAPHIMODE
CCGFloat avgRadiusXYFrontFaceCenter() const
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Pt3D Pt3D
bin
set the eta bin as selection string.
void addValidID(const DetId &id)
static const int MAX_IPHI
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
CaloCellGeometry::CornersMgr * cornersMgr()
static const int MAX_IETA
HepGeom::Point3D< CCGFloat > Pt3D
std::atomic< EZMgrFL< EEDetId > * > m_borderMgr
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
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)
CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
static const int SMCRYSTALMODE
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
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)