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(nullptr),
28 m_cellVec(k_NumberOfCellsForCorners) {
29 const int neba[] = {25, 45, 65, 85};
36 for (
auto&
v : (*ptr)) {
78 int guessed_eta = (
int)(fabs(pointeta) / 0.0174) + 1;
79 int guessed_eta_begin = guessed_eta - 1;
80 int guessed_eta_end = guessed_eta + 1;
81 if (guessed_eta_begin < 1)
82 guessed_eta_begin = 1;
83 if (guessed_eta_end > 85)
86 for (
int bin = guessed_eta_begin;
bin <= guessed_eta_end;
bin++) {
93 if (fabs(pointeta -
eta) < deta) {
94 deta = fabs(pointeta -
eta);
110 if (pointphi > twopi)
116 int phibin =
static_cast<int>(pointphi / (twopi /
_nnxtalPhi)) + 1;
146 while (leverx == 1 || levery == 1) {
153 for (
short i = 0;
i < 4; ++
i) {
154 A =
Pt3D(corners[
i % 4].
x(), corners[
i % 4].
y(), corners[
i % 4].
z());
155 B =
Pt3D(corners[(
i + 1) % 4].
x(), corners[(
i + 1) % 4].
y(), corners[(
i + 1) % 4].
z());
156 C =
Pt3D(corners[4 + (
i + 1) % 4].
x(), corners[4 + (
i + 1) % 4].
y(), corners[4 + (
i + 1) % 4].
z());
162 if (corners[0].
z() < 0.)
171 if ((SS[0] > 0. && SS[2] > 0.) || (SS[0] < 0. && SS[2] < 0.)) {
173 if (history[0] > 0. && history[2] > 0. && SS[0] < 0 && SS[2] < 0 &&
174 (fabs(SS[0]) + fabs(SS[2])) > (fabs(history[0]) + fabs(history[2])))
176 if (history[0] < 0. && history[2] < 0. && SS[0] > 0 && SS[2] > 0 &&
177 (fabs(SS[0]) + fabs(SS[2])) > (fabs(history[0]) + fabs(history[2])))
203 if (((SS[1] > 0. && SS[3] > 0.) || (SS[1] < 0. && SS[3] < 0.)) &&
start == 1) {
206 if (history[1] > 0. && history[3] > 0. && SS[1] < 0 && SS[3] < 0 &&
207 (fabs(SS[1]) + fabs(SS[3])) > (fabs(history[1]) + fabs(history[3]))) {
212 if (history[1] < 0. && history[3] < 0. && SS[1] > 0 && SS[3] > 0 &&
213 (fabs(SS[1]) + fabs(SS[3])) > (fabs(history[1]) + fabs(history[3]))) {
220 if (myCell.
ieta() == -1)
223 int nieta = myCell.
ieta() + 1;
234 if (myCell.
ieta() == 1)
237 int nieta = myCell.
ieta() - 1;
260 return DetId(myCell);
279 const float reta(
r.eta());
280 const float rz(
r.z());
281 const float rphi(
r.phi());
282 const float lowEta(reta -
dR);
283 const float highEta(reta +
dR);
285 if (highEta > -1.5 && lowEta < 1.5)
287 const int ieta_center(
int(reta *
scale + ((rz < 0) ? (-1) : (1))));
288 const float phi(rphi < 0 ? rphi +
float(2 *
M_PI) : rphi);
289 const int iphi_center(
int(
phi *
scale + 11.
f));
292 const float frp(1.08
f * fr + 1.
f);
293 const float frm(0.92
f * fr - 1.
f);
294 const int idr((
int)frp);
295 const int idr2p((
int)(frp * frp));
296 const int idr2m(frm > 0 ?
int(frm * frm) : 0);
298 for (
int de(-idr); de <= idr; ++de)
300 int ieta(de + ieta_center);
304 const int de2(de * de);
305 for (
int dp(-idr);
dp <= idr; ++
dp)
307 const int irange2(
dp *
dp + de2);
309 if (irange2 <= idr2p)
311 const int iphi((iphi_center +
dp + maxphi - 1) % maxphi + 1);
316 bool ok(irange2 < idr2m);
342 if (0 !=
id.
rawId()) {
343 const int iPhi(
id.
iphi());
344 const int iz(
id.
ieta() > 0 ? 1 : -1);
347 const int xout(1 == iq || 4 == iq ? 1 : -1);
348 const int yout(1 == iq || 2 == iq ? 1 : -1);
349 if (!
m_borderMgr.load(std::memory_order_acquire)) {
352 bool exchanged =
m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
358 ptrVec->reserve(720);
359 for (
unsigned int i(0);
i != 720; ++
i) {
360 const int kz(360 >
i ? -1 : 1);
363 const int jx(eeid.
ix());
364 const int jy(eeid.
iy());
369 for (
unsigned int k(1);
k <= 25; ++
k) {
370 const int kx(1 ==
k || 2 ==
k || 3 ==
k || 12 ==
k || 13 ==
k 372 : (4 ==
k || 6 ==
k || 8 ==
k || 15 ==
k || 20 ==
k 374 : (5 ==
k || 7 ==
k || 9 ==
k || 16 ==
k || 19 ==
k 376 : (10 ==
k || 14 ==
k || 21 ==
k || 22 ==
k || 25 ==
k ? 2 : -2))));
377 const int ky(1 ==
k || 4 ==
k || 5 ==
k || 10 ==
k || 11 ==
k 379 : (2 ==
k || 6 ==
k || 7 ==
k || 14 ==
k || 17 ==
k 381 : (3 ==
k || 8 ==
k || 9 ==
k || 18 ==
k || 21 ==
k 383 : (12 ==
k || 15 ==
k || 16 ==
k || 22 ==
k || 23 ==
k ? 2 : -2))));
386 olist[il++] =
EEDetId(jx + kx * xout, jy + ky * yout, kz);
389 ptrVec->emplace_back(&olist);
391 bool exchanged =
m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
395 ptr = (*ptrVec)[iPhi - 1 + (0 > iz ? 0 : 360)];
403 const bool odd(1 ==
i % 2);
405 if (((negz && !odd) || (!negz && odd))) {
414 const unsigned int cellIndex(
EBDetId(
detId).denseIndex());
420 if (!
m_check.load(std::memory_order_acquire)) {
424 if (
nullptr != cell) {
430 m_check.store(
true, std::memory_order_release);
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
std::set< DetId > DetIdSet
static const int MIN_IPHI
virtual float phiPos() const
CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
CaloCellGeometry::Pt3DVec Pt3DVec
int iphi() const
get the crystal iphi
std::atomic< bool > m_check
const OrderedListOfEEDetId * getClosestEndcapCells(EBDetId id) 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 ieta() const
get the crystal ieta
HepGeom::Plane3D< CCGFloat > Pl3D
static void localCornersSwap(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
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.
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
CCGFloat avgRadiusXYFrontFaceCenter() const
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
Abs< T >::type abs(const T &t)
std::atomic< VecOrdListEEDetIdPtr * > m_borderPtrVec
static const int ETAPHIMODE
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.
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Pt3D Pt3D
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void addValidID(const DetId &id)
static const int MAX_IPHI
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
CaloCellGeometry::CornersMgr * cornersMgr()
static const int MAX_IETA
HepGeom::Point3D< CCGFloat > Pt3D
DetId getClosestCell(const GlobalPoint &r) const override
std::atomic< EZMgrFL< EEDetId > * > m_borderMgr
bool present(const DetId &id) const override
is this detid present in the geometry?
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)
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
static const int SMCRYSTALMODE
int ism(int ieta, int iphi)
static void localCornersReflection(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
const CCGFloat * param() const
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)