7 #include <CLHEP/Geometry/Point3D.h> 8 #include <CLHEP/Geometry/Plane3D.h> 13 typedef HepGeom::Plane3D<CCGFloat>
Pl3D;
26 m_borderPtrVec(nullptr),
29 m_cellVec(k_NumberOfCellsForCorners) {
47 for (
auto&
v : (*ptr)) {
66 return EEDetId(20 + 50 * (iLoc % 2), 50, 2 * (iLoc / 2) - 1);
82 if (
nullptr != cell) {
83 const CCGFloat z(cell->getPosition().z());
92 const unsigned int ix(myId.
ix());
93 const unsigned int iy(myId.
iy());
115 if (
nullptr != cell) {
168 <<
", xhi[1]=" <<
m_xhi[1] <<
"\nylo[0]=" <<
m_ylo[0] <<
", ylo[1]=" <<
m_ylo[1]
169 <<
", yhi[0]=" <<
m_yhi[0] <<
", yhi[1]=" <<
m_yhi[1];
172 <<
", yoff[1]" <<
m_yoff[1];
180 const int i(1 +
int((
x - xlo) /
m_wref));
182 return (1 >
i ? 1 : (
m_nref < (
unsigned int)
i ?
m_nref : (
unsigned int)
i));
187 const int i(1 +
int((
y - ylo) /
m_wref));
189 return (1 >
i ? 1 : (
m_nref < (
unsigned int)
i ?
m_nref : (
unsigned int)
i));
196 const unsigned int iz(
z > 0 ? 1 : -1);
202 for (
unsigned int i(1);
i != 6; ++
i) {
203 for (
unsigned int k(0);
k != 8; ++
k) {
204 const int jx(0 ==
k || 4 ==
k || 5 ==
k ? +
i : (1 ==
k || 5 <
k ? -
i : 0));
205 const int jy(2 ==
k || 4 ==
k || 6 ==
k ? +
i : (3 ==
k || 5 ==
k || 7 ==
k ? -
i : 0));
251 else if (x < 0 && y > 0)
253 else if (
x > 0 &&
y < 0)
255 else if (
x < 0 &&
y < 0)
261 else if (x < 0 && y > 0)
263 else if (
x > 0 &&
y < 0)
265 else if (
x < 0 &&
y < 0)
270 for (
unsigned ic = 0; ic < 4; ++ic) {
271 corners[ic] =
getGeometry(mycellID)->getCorners()[(unsigned)((zsign * ic +
offset) % 4)];
272 corners[4 + ic] =
getGeometry(mycellID)->getCorners()[(unsigned)(4 + (zsign * ic +
offset) % 4)];
276 for (
short i = 0;
i < 4; ++
i) {
277 A =
Pt3D(corners[
i % 4].
x(), corners[
i % 4].
y(), corners[
i % 4].
z());
278 B =
Pt3D(corners[(
i + 1) % 4].
x(), corners[(
i + 1) % 4].
y(), corners[(
i + 1) % 4].
z());
279 C =
Pt3D(corners[4 + (
i + 1) % 4].
x(), corners[4 + (
i + 1) % 4].
y(), corners[4 + (
i + 1) % 4].
z());
283 if (corners[0].
z() < 0.)
290 const bool yout(0 > SS[0] * SS[2]);
291 const bool xout(0 > SS[1] * SS[3]);
294 const int ydel(!yout ? 0 : (0 < SS[0] ? -1 : 1));
295 const int xdel(!xout ? 0 : (0 < SS[1] ? -1 : 1));
296 const unsigned int ix(mycellID.
ix() + xdel);
297 const unsigned int iy(mycellID.
iy() + ydel);
298 const unsigned int iz(mycellID.
zside());
321 const float reta(
r.eta());
322 const float rphi(
r.phi());
323 const float rx(
r.x());
324 const float ry(
r.y());
325 const float rz(
r.z());
327 const float xx(
rx * fac);
328 const float yy(
ry * fac);
329 const float zz(rz * fac);
331 const float xang(std::atan(
xx /
zz));
334 const float yang(std::atan(
yy /
zz));
338 const float refxlo(0 > rz ?
m_xlo[0] :
m_xlo[1]);
339 const float refxhi(0 > rz ?
m_xhi[0] :
m_xhi[1]);
340 const float refylo(0 > rz ?
m_ylo[0] :
m_ylo[1]);
341 const float refyhi(0 > rz ?
m_yhi[0] :
m_yhi[1]);
344 lowY < refyhi && highX > refxlo && highY > refylo) {
347 const int iz(rz > 0 ? 1 : -1);
349 const int ix_hi(ix_ctr +
int((highX -
xx) /
m_wref) + 2);
350 const int ix_lo(ix_ctr -
int((
xx - lowX) /
m_wref) - 2);
352 const int iy_hi(iy_ctr +
int((highY -
yy) /
m_wref) + 2);
353 const int iy_lo(iy_ctr -
int((
yy - lowY) /
m_wref) - 2);
355 for (
int kx(ix_lo); kx <= ix_hi; ++kx) {
356 if (kx > 0 && kx <= (
int)
m_nref) {
357 for (
int ky(iy_lo); ky <= iy_hi; ++ky) {
358 if (ky > 0 && ky <= (
int)
m_nref) {
384 const int iPhi(1 +
int(
phi) % 360);
385 const int iz(
id.
zside());
386 if (!
m_borderMgr.load(std::memory_order_acquire)) {
389 bool exchanged =
m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
395 ptrVec->reserve(720);
396 for (
unsigned int i(0);
i != 720; ++
i) {
397 const int kz(360 >
i ? -1 : 1);
398 const int iEta(kz * 85);
399 const int iEtam1(kz * 84);
400 const int iEtam2(kz * 83);
401 const int jPhi(
i % 360 + 1);
406 olist[3] =
EBDetId(iEtam1, jPhi);
411 olist[8] =
EBDetId(iEtam2, jPhi);
412 ptrVec->emplace_back(&olist);
414 bool exchanged =
m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
418 ptr = (*ptrVec)[(iPhi - 1) + (0 > iz ? 0 : 360)];
430 const unsigned int cellIndex(
EEDetId(
detId).denseIndex());
436 if (!
m_check.load(std::memory_order_acquire)) {
440 if (
nullptr != cell) {
441 sum += fabs(cell->getPosition().z());
445 m_check.store(
true, std::memory_order_release);
static EEDetId detIdFromDenseIndex(uint32_t din)
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Log< level::Info, true > LogVerbatim
double degrees(double radiants)
def degrees
CaloCellGeometry::Pt3DVec Pt3DVec
std::set< DetId > DetIdSet
~EcalEndcapGeometry() override
virtual float phiPos() const
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
CaloCellGeometry::Pt3D Pt3D
std::vector< Pt3D > Pt3DVec
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
static unsigned int alignmentTransformIndexLocal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
HepGeom::Plane3D< CCGFloat > Pl3D
CaloCellGeometry::CCGFloat CCGFloat
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
virtual float etaPos() const
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
CCGFloat avgAbsZFrontFaceCenter() const
CaloCellGeometry::Pt3DVec Pt3DVec
bool present(const DetId &id) const override
is this detid present in the geometry?
unsigned int yindex(CCGFloat y, CCGFloat z) const
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
std::vector< OrderedListOfEBDetId * > VecOrdListEBDetIdPtr
unsigned int xindex(CCGFloat x, CCGFloat z) const
EEDetId gId(float x, float y, float z) const
HepGeom::Plane3D< CCGFloat > Pl3D
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.
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void addValidID(const DetId &id)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
CaloCellGeometry::CornersMgr * cornersMgr()
CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
CaloCellGeometry::CCGFloat CCGFloat
HepGeom::Point3D< CCGFloat > Pt3D
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
std::atomic< bool > m_check
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
DetId getClosestCell(const GlobalPoint &r) const override
EZArrayFL< EBDetId > OrderedListOfEBDetId
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
const OrderedListOfEBDetId * getClosestBarrelCells(EEDetId id) const
const CCGFloat * param() 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
void initializeParms() override