6 #include <CLHEP/Geometry/Point3D.h> 7 #include <CLHEP/Geometry/Plane3D.h> 12 typedef HepGeom::Plane3D<CCGFloat>
Pl3D;
26 m_cellVec(k_NumberOfCellsForCorners) {
44 for (
auto&
v : (*ptr)) {
63 return EEDetId(20 + 50 * (iLoc % 2), 50, 2 * (iLoc / 2) - 1);
79 if (
nullptr != cell) {
80 const CCGFloat z(cell->getPosition().z());
89 const unsigned int ix(myId.
ix());
90 const unsigned int iy(myId.
iy());
112 if (
nullptr != cell) {
174 const int i(1 +
int((x - xlo) /
m_wref));
176 return (1 > i ? 1 : (
m_nref < (
unsigned int)i ?
m_nref : (
unsigned int)i));
181 const int i(1 +
int((y - ylo) /
m_wref));
183 return (1 > i ? 1 : (
m_nref < (
unsigned int)i ?
m_nref : (
unsigned int)i));
188 const unsigned int ix(
xindex(x * fac, z));
189 const unsigned int iy(
yindex(y * fac, z));
190 const unsigned int iz(z > 0 ? 1 : -1);
196 for (
unsigned int i(1);
i != 6; ++
i) {
197 for (
unsigned int k(0);
k != 8; ++
k) {
198 const int jx(0 ==
k || 4 ==
k || 5 ==
k ? +
i : (1 ==
k || 5 <
k ? -
i : 0));
199 const int jy(2 ==
k || 4 ==
k || 6 ==
k ? +
i : (3 ==
k || 5 ==
k || 7 ==
k ? -
i : 0));
201 return EEDetId(ix + jx, iy + jy, iz);
245 else if (x < 0 && y > 0)
247 else if (x > 0 && y < 0)
249 else if (x < 0 && y < 0)
255 else if (x < 0 && y > 0)
257 else if (x > 0 && y < 0)
259 else if (x < 0 && y < 0)
264 for (
unsigned ic = 0; ic < 4; ++ic) {
265 corners[ic] =
getGeometry(mycellID)->getCorners()[(unsigned)((zsign * ic + offset) % 4)];
266 corners[4 + ic] =
getGeometry(mycellID)->getCorners()[(unsigned)(4 + (zsign * ic + offset) % 4)];
270 for (
short i = 0;
i < 4; ++
i) {
271 A =
Pt3D(corners[
i % 4].
x(), corners[
i % 4].
y(), corners[
i % 4].
z());
272 B =
Pt3D(corners[(
i + 1) % 4].
x(), corners[(
i + 1) % 4].
y(), corners[(
i + 1) % 4].
z());
273 C =
Pt3D(corners[4 + (
i + 1) % 4].
x(), corners[4 + (
i + 1) % 4].
y(), corners[4 + (
i + 1) % 4].
z());
277 if (corners[0].
z() < 0.)
284 const bool yout(0 > SS[0] * SS[2]);
285 const bool xout(0 > SS[1] * SS[3]);
288 const int ydel(!yout ? 0 : (0 < SS[0] ? -1 : 1));
289 const int xdel(!xout ? 0 : (0 < SS[1] ? -1 : 1));
290 const unsigned int ix(mycellID.
ix() + xdel);
291 const unsigned int iy(mycellID.
iy() + ydel);
292 const unsigned int iz(mycellID.
zside());
294 mycellID =
EEDetId(ix, iy, iz);
314 const float dR2(dR * dR);
315 const float reta(r.
eta());
316 const float rphi(r.
phi());
317 const float rx(r.
x());
318 const float ry(r.
y());
319 const float rz(r.
z());
321 const float xx(
rx * fac);
322 const float yy(
ry * fac);
323 const float zz(rz * fac);
325 const float xang(std::atan(xx / zz));
326 const float lowX(zz > 0 ? zz *
std::tan(xang - dR) : zz *
std::tan(xang + dR));
327 const float highX(zz > 0 ? zz *
std::tan(xang + dR) : zz *
std::tan(xang - dR));
328 const float yang(std::atan(yy / zz));
329 const float lowY(zz > 0 ? zz *
std::tan(yang - dR) : zz *
std::tan(yang + dR));
330 const float highY(zz > 0 ? zz *
std::tan(yang + dR) : zz *
std::tan(yang - dR));
332 const float refxlo(0 > rz ?
m_xlo[0] :
m_xlo[1]);
333 const float refxhi(0 > rz ?
m_xhi[0] :
m_xhi[1]);
334 const float refylo(0 > rz ?
m_ylo[0] :
m_ylo[1]);
335 const float refyhi(0 > rz ?
m_yhi[0] :
m_yhi[1]);
338 lowY < refyhi && highX > refxlo && highY > refylo) {
339 const int ix_ctr(
xindex(xx, rz));
340 const int iy_ctr(
yindex(yy, rz));
341 const int iz(rz > 0 ? 1 : -1);
343 const int ix_hi(ix_ctr +
int((highX - xx) /
m_wref) + 2);
344 const int ix_lo(ix_ctr -
int((xx - lowX) /
m_wref) - 2);
346 const int iy_hi(iy_ctr +
int((highY - yy) /
m_wref) + 2);
347 const int iy_lo(iy_ctr -
int((yy - lowY) /
m_wref) - 2);
349 for (
int kx(ix_lo); kx <= ix_hi; ++kx) {
350 if (kx > 0 && kx <= (
int)
m_nref) {
351 for (
int ky(iy_lo); ky <= iy_hi; ++ky) {
352 if (ky > 0 && ky <= (
int)m_nref) {
376 if (0 !=
id.rawId() &&
nullptr !=
getGeometry(
id)) {
378 const int iPhi(1 +
int(phi) % 360);
379 const int iz(
id.
zside());
380 if (!
m_borderMgr.load(std::memory_order_acquire)) {
383 bool exchanged =
m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
389 ptrVec->reserve(720);
390 for (
unsigned int i(0);
i != 720; ++
i) {
391 const int kz(360 >
i ? -1 : 1);
392 const int iEta(kz * 85);
393 const int iEtam1(kz * 84);
394 const int iEtam2(kz * 83);
395 const int jPhi(
i % 360 + 1);
397 olist[0] =
EBDetId(iEta, jPhi);
400 olist[3] =
EBDetId(iEtam1, jPhi);
405 olist[8] =
EBDetId(iEtam2, jPhi);
406 ptrVec->emplace_back(&olist);
408 bool exchanged =
m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
412 ptr = (*ptrVec)[(iPhi - 1) + (0 > iz ? 0 : 360)];
424 const unsigned int cellIndex(
EEDetId(detId).denseIndex());
430 if (!
m_check.load(std::memory_order_acquire)) {
434 if (
nullptr != cell) {
435 sum += fabs(cell->getPosition().z());
439 m_check.store(
true, std::memory_order_release);
447 return (
m_cellVec.size() < index ||
nullptr == cell->
param() ?
nullptr : cell);
static EEDetId detIdFromDenseIndex(uint32_t din)
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
double degrees(double radiants)
def degrees
CaloCellGeometry::Pt3DVec Pt3DVec
std::set< DetId > DetIdSet
bool present(const DetId &id) const override
is this detid present in the geometry?
~EcalEndcapGeometry() override
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
CaloCellGeometry::Pt3D Pt3D
Geom::Phi< T > phi() const
CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
std::vector< Pt3D > Pt3DVec
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
CCGFloat avgAbsZFrontFaceCenter() const
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
static unsigned int alignmentTransformIndexLocal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
HepGeom::Plane3D< CCGFloat > Pl3D
unsigned int yindex(CCGFloat y, CCGFloat z) const
CaloCellGeometry::CCGFloat CCGFloat
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
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
CaloCellGeometry::Pt3DVec Pt3DVec
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
std::vector< OrderedListOfEBDetId * > VecOrdListEBDetIdPtr
const OrderedListOfEBDetId * getClosestBarrelCells(EEDetId id) const
static const std::string B
HepGeom::Plane3D< CCGFloat > Pl3D
unsigned int xindex(CCGFloat x, CCGFloat z) const
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void addValidID(const DetId &id)
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()
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...
EZArrayFL< EBDetId > OrderedListOfEBDetId
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
DetId getClosestCell(const GlobalPoint &r) const override
EEDetId gId(float x, float y, float 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
void initializeParms() override