CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
EcalEndcapGeometry Class Referencefinal

#include <EcalEndcapGeometry.h>

Inheritance diagram for EcalEndcapGeometry:
CaloSubdetectorGeometry

Public Types

enum  { k_NumberOfCellsForCorners = EEDetId::kSizeForDenseIndexing }
 
enum  { k_NumberOfShapes = 1 }
 
enum  { k_NumberOfParametersPerShape = 11 }
 
typedef EcalEndcapGeometryRecord AlignedRecord
 
typedef EEAlignmentRcd AlignmentRecord
 
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< TruncatedPyramidCellVec
 
typedef EEDetId DetIdType
 
typedef IdealGeometryRecord IdealRecord
 
typedef EcalEndcapNumberingScheme NumberingScheme
 
typedef EZArrayFL< EBDetIdOrderedListOfEBDetId
 
typedef PEcalEndcapRcd PGeometryRecord
 
typedef CaloCellGeometry::Pt3D Pt3D
 
typedef CaloCellGeometry::Pt3DVec Pt3DVec
 
typedef std::vector< OrderedListOfEBDetId * > VecOrdListEBDetIdPtr
 
- Public Types inherited from CaloSubdetectorGeometry
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< std::shared_ptr< const CaloCellGeometry > > CellSet
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< CCGFloatDimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< CCGFloatTrVec
 

Public Member Functions

CCGFloat avgAbsZFrontFaceCenter () const
 
 EcalEndcapGeometry ()
 
CaloSubdetectorGeometry::DetIdSet getCells (const GlobalPoint &r, double dR) const override
 Get a list of all cells within a dR of the given cell. More...
 
const OrderedListOfEBDetIdgetClosestBarrelCells (EEDetId id) const
 
DetId getClosestCell (const GlobalPoint &r) const override
 
int getNumberOfCrystalPerModule () const
 
int getNumberOfModules () const
 
void initializeParms () override
 
void newCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
 
unsigned int numberOfParametersPerShape () const override
 
unsigned int numberOfShapes () const override
 
bool present (const DetId &id) const override
 is this detid present in the geometry? More...
 
void setNumberOfCrystalPerModule (const int nncrys)
 
void setNumberOfModules (const int nnmods)
 
 ~EcalEndcapGeometry () override
 
- Public Member Functions inherited from CaloSubdetectorGeometry
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
 CaloSubdetectorGeometry (const CaloSubdetectorGeometry &)=delete
 avoid copies More...
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
CCGFloat deltaEta (const DetId &detId) const
 
CCGFloat deltaPhi (const DetId &detId) const
 
virtual void fillDefaultNamedParameters () const
 
virtual CellSet getCellSet (const GlobalPoint &r, double dR) const
 
virtual std::shared_ptr< const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
virtual void getSummary (TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
 
virtual const std::vector< DetId > & getValidDetIds (DetId::Detector det=DetId::Detector(0), int subdet=0) const
 Get a list of valid detector ids (for the given subdetector) More...
 
virtual unsigned int numberOfTransformParms () const
 
CaloSubdetectorGeometryoperator= (const CaloSubdetectorGeometry &)=delete
 
ParMgrparMgr ()
 
const ParMgrparMgrConst () const
 
ParVecVecparVecVec ()
 
const ParVecVecparVecVec () const
 
virtual bool valid (const DetId &id) const
 
virtual ~CaloSubdetectorGeometry ()
 The base class DOES assume that it owns the CaloCellGeometry objects. More...
 

Static Public Member Functions

static unsigned int alignmentTransformIndexGlobal (const DetId &id)
 
static unsigned int alignmentTransformIndexLocal (const DetId &id)
 
static std::string dbString ()
 
static DetId detIdFromLocalAlignmentIndex (unsigned int iLoc)
 
static std::string hitString ()
 
static void localCorners (Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
 
static unsigned int numberOfAlignments ()
 
static std::string producerTag ()
 

Protected Member Functions

const CaloCellGeometrygetGeometryRawPtr (uint32_t index) const override
 
- Protected Member Functions inherited from CaloSubdetectorGeometry
void addValidID (const DetId &id)
 
virtual std::shared_ptr< const CaloCellGeometrycellGeomPtr (uint32_t index) const
 
virtual unsigned int indexFor (const DetId &id) const
 
virtual unsigned int sizeForDenseIndex (const DetId &id) const
 

Private Member Functions

EEDetId gId (float x, float y, float z) const
 
unsigned int xindex (CCGFloat x, CCGFloat z) const
 
unsigned int yindex (CCGFloat y, CCGFloat z) const
 

Static Private Member Functions

static int myPhi (int i)
 

Private Attributes

int _nncrys
 number of crystals per module More...
 
int _nnmods
 number of modules More...
 
CCGFloat m_avgZ
 
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
 
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
 
CellVec m_cellVec
 
std::atomic< bool > m_check
 
CCGFloat m_del
 
unsigned int m_nref
 
CCGFloat m_wref
 
CCGFloat m_xhi [2]
 
CCGFloat m_xlo [2]
 
CCGFloat m_xoff [2]
 
CCGFloat m_yhi [2]
 
CCGFloat m_ylo [2]
 
CCGFloat m_yoff [2]
 
CCGFloat zeN
 
CCGFloat zeP
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloSubdetectorGeometry
static CCGFloat deltaR (const GlobalPoint &p1, const GlobalPoint &p2)
 
- Protected Attributes inherited from CaloSubdetectorGeometry
ParVecVec m_parVecVec
 
std::vector< DetIdm_validIds
 

Detailed Description

Definition at line 20 of file EcalEndcapGeometry.h.

Member Typedef Documentation

◆ AlignedRecord

Definition at line 29 of file EcalEndcapGeometry.h.

◆ AlignmentRecord

Definition at line 30 of file EcalEndcapGeometry.h.

◆ CCGFloat

Definition at line 24 of file EcalEndcapGeometry.h.

◆ CellVec

Definition at line 22 of file EcalEndcapGeometry.h.

◆ DetIdType

Definition at line 39 of file EcalEndcapGeometry.h.

◆ IdealRecord

Definition at line 28 of file EcalEndcapGeometry.h.

◆ NumberingScheme

Definition at line 37 of file EcalEndcapGeometry.h.

◆ OrderedListOfEBDetId

Definition at line 33 of file EcalEndcapGeometry.h.

◆ PGeometryRecord

Definition at line 31 of file EcalEndcapGeometry.h.

◆ Pt3D

Definition at line 25 of file EcalEndcapGeometry.h.

◆ Pt3DVec

Definition at line 26 of file EcalEndcapGeometry.h.

◆ VecOrdListEBDetIdPtr

Definition at line 35 of file EcalEndcapGeometry.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

◆ anonymous enum

anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 43 of file EcalEndcapGeometry.h.

◆ anonymous enum

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 45 of file EcalEndcapGeometry.h.

Constructor & Destructor Documentation

◆ EcalEndcapGeometry()

EcalEndcapGeometry::EcalEndcapGeometry ( void  )

Definition at line 17 of file EcalEndcapGeometry.cc.

References m_xhi, m_xlo, m_xoff, m_yhi, m_ylo, and m_yoff.

18  : _nnmods(316),
19  _nncrys(25),
20  zeP(0.),
21  zeN(0.),
22  m_wref(0.),
23  m_del(0.),
24  m_nref(0),
25  m_borderMgr(nullptr),
26  m_borderPtrVec(nullptr),
27  m_avgZ(-1),
28  m_check(false),
30  m_xlo[0] = 999.;
31  m_xlo[1] = 999.;
32  m_xhi[0] = -999.;
33  m_xhi[1] = -999.;
34  m_ylo[0] = 999.;
35  m_ylo[1] = 999.;
36  m_yhi[0] = -999.;
37  m_yhi[1] = -999.;
38  m_xoff[0] = 0.;
39  m_xoff[1] = 0.;
40  m_yoff[0] = 0.;
41  m_yoff[1] = 0.;
42 }
int _nncrys
number of crystals per module
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
int _nnmods
number of modules
std::atomic< bool > m_check

◆ ~EcalEndcapGeometry()

EcalEndcapGeometry::~EcalEndcapGeometry ( )
override

Definition at line 44 of file EcalEndcapGeometry.cc.

References m_borderMgr, m_borderPtrVec, and findQualityFiles::v.

44  {
45  if (m_borderPtrVec) {
46  auto ptr = m_borderPtrVec.load(std::memory_order_acquire);
47  for (auto& v : (*ptr)) {
48  delete v;
49  v = nullptr;
50  }
51  delete m_borderPtrVec.load();
52  }
53  delete m_borderMgr.load();
54 }
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec

Member Function Documentation

◆ alignmentTransformIndexGlobal()

unsigned int EcalEndcapGeometry::alignmentTransformIndexGlobal ( const DetId id)
static

Definition at line 69 of file EcalEndcapGeometry.cc.

References DetId::Ecal.

69  {
70  return (unsigned int)DetId::Ecal - 1;
71 }

◆ alignmentTransformIndexLocal()

unsigned int EcalEndcapGeometry::alignmentTransformIndexLocal ( const DetId id)
static

Definition at line 56 of file EcalEndcapGeometry.cc.

References cms::cuda::assert(), CaloGenericDetId::isEE(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), and ecaldqm::zside().

56  {
57  const CaloGenericDetId gid(id);
58 
59  assert(gid.isEE());
60  unsigned int index(EEDetId(id).ix() / 51 + (EEDetId(id).zside() < 0 ? 0 : 2));
61 
62  return index;
63 }
int zside(DetId const &)
assert(be >=bs)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)

◆ avgAbsZFrontFaceCenter()

CCGFloat EcalEndcapGeometry::avgAbsZFrontFaceCenter ( ) const

Definition at line 435 of file EcalEndcapGeometry.cc.

References CaloSubdetectorGeometry::cellGeomPtr(), mps_fire::i, m_avgZ, m_cellVec, and m_check.

435  {
436  if (!m_check.load(std::memory_order_acquire)) {
437  CCGFloat sum(0);
438  for (unsigned int i(0); i != m_cellVec.size(); ++i) {
439  auto cell = cellGeomPtr(i);
440  if (nullptr != cell) {
441  sum += fabs(cell->getPosition().z());
442  }
443  }
444  m_avgZ = sum / m_cellVec.size();
445  m_check.store(true, std::memory_order_release);
446  }
447  return m_avgZ;
448 }
CaloCellGeometry::CCGFloat CCGFloat
std::atomic< bool > m_check
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const

◆ dbString()

static std::string EcalEndcapGeometry::dbString ( )
inlinestatic

Definition at line 47 of file EcalEndcapGeometry.h.

47 { return "PEcalEndcapRcd"; }

◆ detIdFromLocalAlignmentIndex()

DetId EcalEndcapGeometry::detIdFromLocalAlignmentIndex ( unsigned int  iLoc)
static

Definition at line 65 of file EcalEndcapGeometry.cc.

Referenced by FakeCaloAlignmentEP::produceEEAli(), and TestCaloAlignmentEP::produceEEAli().

65  {
66  return EEDetId(20 + 50 * (iLoc % 2), 50, 2 * (iLoc / 2) - 1);
67 }

◆ getCells()

CaloSubdetectorGeometry::DetIdSet EcalEndcapGeometry::getCells ( const GlobalPoint r,
double  dR 
) const
overridevirtual

Get a list of all cells within a dR of the given cell.

The default implementation makes a loop over all cell geometries. Cleverer implementations are suggested to use rough conversions between eta/phi and ieta/iphi and test on the boundaries.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 313 of file EcalEndcapGeometry.cc.

References funct::abs(), reco::deltaR2(), HGC3DClusterGenMatchSelector_cfi::dR, ALPAKA_ACCELERATOR_NAMESPACE::dR2(), PVValHelper::eta, CaloCellGeometry::etaPos(), CaloSubdetectorGeometry::getCells(), l1ctLayer2EG_cff::id, m_cellVec, m_nref, M_PI, m_wref, m_xhi, m_xlo, m_yhi, m_ylo, phi, CaloCellGeometry::phiPos(), alignCSCRings::r, corrVsCorr::rx, corrVsCorr::ry, funct::tan(), EEDetId::validDetId(), xindex(), geometryCSVtoXML::xx, yindex(), geometryCSVtoXML::yy, zeP, and geometryCSVtoXML::zz.

313  {
314  CaloSubdetectorGeometry::DetIdSet dis; // return object
315  if (0.000001 < dR) {
316  if (dR > M_PI / 2.) // this code assumes small dR
317  {
318  dis = CaloSubdetectorGeometry::getCells(r, dR); // base class version
319  } else {
320  const float dR2(dR * dR);
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());
326  const float fac(std::abs(zeP / rz));
327  const float xx(rx * fac); // xyz at endcap z
328  const float yy(ry * fac);
329  const float zz(rz * fac);
330 
331  const float xang(std::atan(xx / zz));
332  const float lowX(zz > 0 ? zz * std::tan(xang - dR) : zz * std::tan(xang + dR));
333  const float highX(zz > 0 ? zz * std::tan(xang + dR) : zz * std::tan(xang - dR));
334  const float yang(std::atan(yy / zz));
335  const float lowY(zz > 0 ? zz * std::tan(yang - dR) : zz * std::tan(yang + dR));
336  const float highY(zz > 0 ? zz * std::tan(yang + dR) : zz * std::tan(yang - dR));
337 
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]);
342 
343  if (lowX < refxhi && // proceed if any possible overlap with the endcap
344  lowY < refyhi && highX > refxlo && highY > refylo) {
345  const int ix_ctr(xindex(xx, rz));
346  const int iy_ctr(yindex(yy, rz));
347  const int iz(rz > 0 ? 1 : -1);
348 
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);
351 
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);
354 
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) {
359  if (EEDetId::validDetId(kx, ky, iz)) // reject invalid ids
360  {
361  const EEDetId id(kx, ky, iz);
362  const CaloCellGeometry* cell(&m_cellVec[id.denseIndex()]);
363  const float eta(cell->etaPos());
364  const float phi(cell->phiPos());
365  if (reco::deltaR2(eta, phi, reta, rphi) < dR2)
366  dis.insert(id);
367  }
368  }
369  }
370  }
371  }
372  }
373  }
374  }
375  return dis;
376 }
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)
unsigned int yindex(CCGFloat y, CCGFloat z) const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int xindex(CCGFloat x, CCGFloat z) const
#define M_PI
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248

◆ getClosestBarrelCells()

const EcalEndcapGeometry::OrderedListOfEBDetId * EcalEndcapGeometry::getClosestBarrelCells ( EEDetId  id) const

Definition at line 378 of file EcalEndcapGeometry.cc.

References degrees(), CaloSubdetectorGeometry::getGeometry(), mps_fire::i, l1tPhase2CaloJetEmulator_cfi::iEta, m_borderMgr, m_borderPtrVec, myPhi(), phi, nano_mu_digi_cff::rawId, and ecaldqm::zside().

Referenced by spr::simpleMove(), and PFECALHashNavigator::stdsimplemove().

378  {
379  OrderedListOfEBDetId* ptr(nullptr);
380  auto ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
381  if (!ptrVec) {
382  if (0 != id.rawId() && nullptr != getGeometry(id)) {
383  const float phi(370. + getGeometry(id)->getPosition().phi().degrees());
384  const int iPhi(1 + int(phi) % 360);
385  const int iz(id.zside());
386  if (!m_borderMgr.load(std::memory_order_acquire)) {
387  EZMgrFL<EBDetId>* expect = nullptr;
388  auto ptrMgr = new EZMgrFL<EBDetId>(720 * 9, 9);
389  bool exchanged = m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
390  if (!exchanged)
391  delete ptrMgr;
392  }
393  VecOrdListEBDetIdPtr* expect = nullptr;
394  auto ptrVec = new VecOrdListEBDetIdPtr();
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);
402  OrderedListOfEBDetId& olist(*new OrderedListOfEBDetId(m_borderMgr.load(std::memory_order_acquire)));
403  olist[0] = EBDetId(iEta, jPhi);
404  olist[1] = EBDetId(iEta, myPhi(jPhi + 1));
405  olist[2] = EBDetId(iEta, myPhi(jPhi - 1));
406  olist[3] = EBDetId(iEtam1, jPhi);
407  olist[4] = EBDetId(iEtam1, myPhi(jPhi + 1));
408  olist[5] = EBDetId(iEtam1, myPhi(jPhi - 1));
409  olist[6] = EBDetId(iEta, myPhi(jPhi + 2));
410  olist[7] = EBDetId(iEta, myPhi(jPhi - 2));
411  olist[8] = EBDetId(iEtam2, jPhi);
412  ptrVec->emplace_back(&olist);
413  }
414  bool exchanged = m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
415  if (!exchanged)
416  delete ptrVec;
417  ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
418  ptr = (*ptrVec)[(iPhi - 1) + (0 > iz ? 0 : 360)];
419  }
420  }
421  return ptr;
422 }
double degrees(double radiants)
def degrees
int zside(DetId const &)
std::atomic< EZMgrFL< EBDetId > * > m_borderMgr
std::atomic< VecOrdListEBDetIdPtr * > m_borderPtrVec
std::vector< OrderedListOfEBDetId * > VecOrdListEBDetIdPtr
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 int myPhi(int i)
Definition: EZMgrFL.h:8
EZArrayFL< EBDetId > OrderedListOfEBDetId

◆ getClosestCell()

DetId EcalEndcapGeometry::getClosestCell ( const GlobalPoint r) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 216 of file EcalEndcapGeometry.cc.

References A, B, correctionTermsCaloMet_cff::C, HLT_2024v13_cff::distance, MillePedeFileConverter_cfg::e, CaloSubdetectorGeometry::getGeometry(), gId(), mps_fire::i, EEDetId::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), EEDetId::iy(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), hltrates_dqm_sourceclient-live_cfg::offset, point, alignCSCRings::r, EEDetId::validDetId(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, PV3DBase< T, PVType, FrameType >::z(), and EEDetId::zside().

Referenced by CaloGeometryHelper::getClosestCell().

216  {
217  try {
218  EEDetId mycellID(gId(r.x(), r.y(), r.z())); // educated guess
219 
220  if (EEDetId::validDetId(mycellID.ix(), mycellID.iy(), mycellID.zside())) {
221  // now get points in convenient ordering
222 
223  Pt3D A;
224  Pt3D B;
225  Pt3D C;
226  Pt3D point(r.x(), r.y(), r.z());
227  // D.K. : equation of plane : AA*x+BB*y+CC*z+DD=0;
228  // finding equation for each edge
229 
230  // ================================================================
231  CCGFloat x, y, z;
232  unsigned offset = 0;
233  int zsign = 1;
234  //================================================================
235 
236  // compute the distance of the point with respect of the 4 crystal lateral planes
237 
238  if (nullptr != getGeometry(mycellID)) {
239  const GlobalPoint& myPosition = getGeometry(mycellID)->getPosition();
240 
241  x = myPosition.x();
242  y = myPosition.y();
243  z = myPosition.z();
244 
245  offset = 0;
246  // This will disappear when Andre has applied his fix
247 
248  if (z > 0) {
249  if (x > 0 && y > 0)
250  offset = 1;
251  else if (x < 0 && y > 0)
252  offset = 2;
253  else if (x > 0 && y < 0)
254  offset = 0;
255  else if (x < 0 && y < 0)
256  offset = 3;
257  zsign = 1;
258  } else {
259  if (x > 0 && y > 0)
260  offset = 3;
261  else if (x < 0 && y > 0)
262  offset = 2;
263  else if (x > 0 && y < 0)
264  offset = 0;
265  else if (x < 0 && y < 0)
266  offset = 1;
267  zsign = -1;
268  }
269  GlobalPoint corners[8];
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)];
273  }
274 
275  CCGFloat SS[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());
280  Pl3D plane(A, B, C);
281  plane.normalize();
282  CCGFloat distance = plane.distance(point);
283  if (corners[0].z() < 0.)
284  distance = -distance;
285  SS[i] = distance;
286  }
287 
288  // Only one move in necessary direction
289 
290  const bool yout(0 > SS[0] * SS[2]);
291  const bool xout(0 > SS[1] * SS[3]);
292 
293  if (yout || xout) {
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());
299  if (EEDetId::validDetId(ix, iy, iz))
300  mycellID = EEDetId(ix, iy, iz);
301  }
302 
303  return mycellID;
304  }
305  return DetId(0);
306  }
307  } catch (cms::Exception& e) {
308  return DetId(0);
309  }
310  return DetId(0);
311 }
Definition: APVGainStruct.h:7
T z() const
Definition: PV3DBase.h:61
CaloCellGeometry::Pt3D Pt3D
HepGeom::Plane3D< CCGFloat > Pl3D
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
CaloCellGeometry::CCGFloat CCGFloat
EEDetId gId(float x, float y, float z) const
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::Pt3D Pt3D
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
Definition: DetId.h:17
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
Definition: APVGainStruct.h:7
*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
Definition: invegas.h:5

◆ getGeometryRawPtr()

const CaloCellGeometry * EcalEndcapGeometry::getGeometryRawPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 450 of file EcalEndcapGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

450  {
451  // Modify the RawPtr class
452  const CaloCellGeometry* cell(&m_cellVec[index]);
453  return (m_cellVec.size() < index || nullptr == cell->param() ? nullptr : cell);
454 }

◆ getNumberOfCrystalPerModule()

int EcalEndcapGeometry::getNumberOfCrystalPerModule ( ) const
inline

Definition at line 58 of file EcalEndcapGeometry.h.

References _nncrys.

58 { return _nncrys; }
int _nncrys
number of crystals per module

◆ getNumberOfModules()

int EcalEndcapGeometry::getNumberOfModules ( ) const
inline

Definition at line 56 of file EcalEndcapGeometry.h.

References _nnmods.

56 { return _nnmods; }
int _nnmods
number of modules

◆ gId()

EEDetId EcalEndcapGeometry::gId ( float  x,
float  y,
float  z 
) const
private

Definition at line 192 of file EcalEndcapGeometry.cc.

References mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), dqmdumpme::k, EEDetId::validDetId(), x, xindex(), y, yindex(), z, zeN, and zeP.

Referenced by getClosestCell().

192  {
193  const CCGFloat fac(fabs((0 > z ? zeN : zeP) / z));
194  const unsigned int ix(xindex(x * fac, z));
195  const unsigned int iy(yindex(y * fac, z));
196  const unsigned int iz(z > 0 ? 1 : -1);
197 
198  if (EEDetId::validDetId(ix, iy, iz)) {
199  return EEDetId(ix, iy, iz); // first try is on target
200  } else // try nearby coordinates, spiraling out from center
201  {
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));
206  if (EEDetId::validDetId(ix + jx, iy + jy, iz)) {
207  return EEDetId(ix + jx, iy + jy, iz);
208  }
209  }
210  }
211  }
212  return EEDetId(); // nowhere near any crystal
213 }
unsigned int yindex(CCGFloat y, CCGFloat z) const
CaloCellGeometry::CCGFloat CCGFloat
unsigned int xindex(CCGFloat x, CCGFloat z) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)

◆ hitString()

static std::string EcalEndcapGeometry::hitString ( )
inlinestatic

Definition at line 75 of file EcalEndcapGeometry.h.

75 { return "EcalHitsEE"; }

◆ initializeParms()

void EcalEndcapGeometry::initializeParms ( )
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 73 of file EcalEndcapGeometry.cc.

References CaloSubdetectorGeometry::cellGeomPtr(), EEDetId::detIdFromDenseIndex(), mps_fire::i, EEDetId::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), EEDetId::iy(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), m_cellVec, m_del, m_nref, m_wref, m_xhi, m_xlo, m_xoff, m_yhi, m_ylo, m_yoff, AlCaHLTBitMon_ParallelJobs::p, x, y, z, zeN, zeP, and geometryCSVtoXML::zz.

73  {
74  zeP = 0.;
75  zeN = 0.;
76  unsigned nP = 0;
77  unsigned nN = 0;
78  m_nref = 0;
79 
80  for (uint32_t i(0); i != m_cellVec.size(); ++i) {
81  auto cell = cellGeomPtr(i);
82  if (nullptr != cell) {
83  const CCGFloat z(cell->getPosition().z());
84  if (z > 0.) {
85  zeP += z;
86  ++nP;
87  } else {
88  zeN += z;
89  ++nN;
90  }
92  const unsigned int ix(myId.ix());
93  const unsigned int iy(myId.iy());
94  if (ix > m_nref)
95  m_nref = ix;
96  if (iy > m_nref)
97  m_nref = iy;
98  }
99  }
100  if (0 < nP)
101  zeP /= (CCGFloat)nP;
102  if (0 < nN)
103  zeN /= (CCGFloat)nN;
104 
105  m_xlo[0] = 999;
106  m_xhi[0] = -999;
107  m_ylo[0] = 999;
108  m_yhi[0] = -999;
109  m_xlo[1] = 999;
110  m_xhi[1] = -999;
111  m_ylo[1] = 999;
112  m_yhi[1] = -999;
113  for (uint32_t i(0); i != m_cellVec.size(); ++i) {
114  auto cell = cellGeomPtr(i);
115  if (nullptr != cell) {
116  const GlobalPoint& p(cell->getPosition());
117  const CCGFloat z(p.z());
118  const CCGFloat zz(0 > z ? zeN : zeP);
119  const CCGFloat x(p.x() * zz / z);
120  const CCGFloat y(p.y() * zz / z);
121 
122  if (0 > z && x < m_xlo[0])
123  m_xlo[0] = x;
124  if (0 < z && x < m_xlo[1])
125  m_xlo[1] = x;
126  if (0 > z && y < m_ylo[0])
127  m_ylo[0] = y;
128  if (0 < z && y < m_ylo[1])
129  m_ylo[1] = y;
130 
131  if (0 > z && x > m_xhi[0])
132  m_xhi[0] = x;
133  if (0 < z && x > m_xhi[1])
134  m_xhi[1] = x;
135  if (0 > z && y > m_yhi[0])
136  m_yhi[0] = y;
137  if (0 < z && y > m_yhi[1])
138  m_yhi[1] = y;
139  }
140  }
141 
142  m_xoff[0] = (m_xhi[0] + m_xlo[0]) / 2.;
143  m_xoff[1] = (m_xhi[1] + m_xlo[1]) / 2.;
144  m_yoff[0] = (m_yhi[0] + m_ylo[0]) / 2.;
145  m_yoff[1] = (m_yhi[1] + m_ylo[1]) / 2.;
146 
147  m_del = (m_xhi[0] - m_xlo[0] + m_xhi[1] - m_xlo[1] + m_yhi[0] - m_ylo[0] + m_yhi[1] - m_ylo[1]);
148 
149  if (1 != m_nref)
150  m_wref = m_del / (4. * (m_nref - 1));
151 
152  m_xlo[0] -= m_wref / 2;
153  m_xlo[1] -= m_wref / 2;
154  m_xhi[0] += m_wref / 2;
155  m_xhi[1] += m_wref / 2;
156 
157  m_ylo[0] -= m_wref / 2;
158  m_ylo[1] -= m_wref / 2;
159  m_yhi[0] += m_wref / 2;
160  m_yhi[1] += m_wref / 2;
161 
162  m_del += m_wref;
163 
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("EcalGeom") << "zeP=" << zeP << ", zeN=" << zeN << ", nP=" << nP << ", nN=" << nN;
166 
167  edm::LogVerbatim("EcalGeom") << "xlo[0]=" << m_xlo[0] << ", xlo[1]=" << m_xlo[1] << ", xhi[0]=" << m_xhi[0]
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];
170 
171  edm::LogVerbatim("EcalGeom") << "xoff[0]=" << m_xoff[0] << ", xoff[1]" << m_xoff[1] << ", yoff[0]=" << m_yoff[0]
172  << ", yoff[1]" << m_yoff[1];
173 
174  edm::LogVerbatim("EcalGeom") << "nref=" << m_nref << ", m_wref=" << m_wref;
175 #endif
176 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
Log< level::Info, true > LogVerbatim
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const

◆ localCorners()

void EcalEndcapGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)
static

Definition at line 424 of file EcalEndcapGeometry.cc.

References TruncatedPyramid::localCorners().

424  {
426 }
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)

◆ myPhi()

static int EcalEndcapGeometry::myPhi ( int  i)
inlinestaticprivate

Definition at line 102 of file EcalEndcapGeometry.h.

References mps_fire::i.

Referenced by getClosestBarrelCells().

102  {
103  i += 720;
104  return (1 + (i - 1) % 360);
105  }

◆ newCell()

void EcalEndcapGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
overridevirtual

Implements CaloSubdetectorGeometry.

Definition at line 428 of file EcalEndcapGeometry.cc.

References CaloSubdetectorGeometry::addValidID(), CaloSubdetectorGeometry::cornersMgr(), hcalRecHitTable_cff::detId, DeadROC_duringRun::f1, DeadROC_duringRun::f2, and m_cellVec.

429  {
430  const unsigned int cellIndex(EEDetId(detId).denseIndex());
431  m_cellVec[cellIndex] = TruncatedPyramid(cornersMgr(), f1, f2, f3, parm);
432  addValidID(detId);
433 }
void addValidID(const DetId &id)
CaloCellGeometry::CornersMgr * cornersMgr()
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...

◆ numberOfAlignments()

static unsigned int EcalEndcapGeometry::numberOfAlignments ( )
inlinestatic

Definition at line 79 of file EcalEndcapGeometry.h.

Referenced by FakeCaloAlignmentEP::produceEEAli(), and TestCaloAlignmentEP::produceEEAli().

79 { return 4; }

◆ numberOfParametersPerShape()

unsigned int EcalEndcapGeometry::numberOfParametersPerShape ( ) const
inlineoverridevirtual

◆ numberOfShapes()

unsigned int EcalEndcapGeometry::numberOfShapes ( ) const
inlineoverridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 49 of file EcalEndcapGeometry.h.

References k_NumberOfShapes.

◆ present()

bool EcalEndcapGeometry::present ( const DetId id) const
overridevirtual

is this detid present in the geometry?

Reimplemented from CaloSubdetectorGeometry.

Definition at line 456 of file EcalEndcapGeometry.cc.

References DetId::Ecal, EcalEndcap, EEDetId::ix(), EEDetId::iy(), EEDetId::validDetId(), and EEDetId::zside().

Referenced by spr::extraIds().

456  {
457  if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap) {
458  EEDetId eeId(id);
459  if (EEDetId::validDetId(eeId.ix(), eeId.iy(), eeId.zside()))
460  return true;
461  }
462  return false;
463 }
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248

◆ producerTag()

static std::string EcalEndcapGeometry::producerTag ( )
inlinestatic

◆ setNumberOfCrystalPerModule()

void EcalEndcapGeometry::setNumberOfCrystalPerModule ( const int  nncrys)
inline

Definition at line 62 of file EcalEndcapGeometry.h.

References _nncrys.

62 { _nncrys = nncrys; }
int _nncrys
number of crystals per module

◆ setNumberOfModules()

void EcalEndcapGeometry::setNumberOfModules ( const int  nnmods)
inline

Definition at line 60 of file EcalEndcapGeometry.h.

References _nnmods.

60 { _nnmods = nnmods; }
int _nnmods
number of modules

◆ xindex()

unsigned int EcalEndcapGeometry::xindex ( CCGFloat  x,
CCGFloat  z 
) const
private

Definition at line 178 of file EcalEndcapGeometry.cc.

References mps_fire::i, m_nref, m_wref, m_xlo, x, and z.

Referenced by getCells(), and gId().

178  {
179  const CCGFloat xlo(0 > z ? m_xlo[0] : m_xlo[1]);
180  const int i(1 + int((x - xlo) / m_wref));
181 
182  return (1 > i ? 1 : (m_nref < (unsigned int)i ? m_nref : (unsigned int)i));
183 }
CaloCellGeometry::CCGFloat CCGFloat

◆ yindex()

unsigned int EcalEndcapGeometry::yindex ( CCGFloat  y,
CCGFloat  z 
) const
private

Definition at line 185 of file EcalEndcapGeometry.cc.

References mps_fire::i, m_nref, m_wref, m_ylo, y, and z.

Referenced by getCells(), and gId().

185  {
186  const CCGFloat ylo(0 > z ? m_ylo[0] : m_ylo[1]);
187  const int i(1 + int((y - ylo) / m_wref));
188 
189  return (1 > i ? 1 : (m_nref < (unsigned int)i ? m_nref : (unsigned int)i));
190 }
CaloCellGeometry::CCGFloat CCGFloat

Member Data Documentation

◆ _nncrys

int EcalEndcapGeometry::_nncrys
private

number of crystals per module

Definition at line 111 of file EcalEndcapGeometry.h.

Referenced by getNumberOfCrystalPerModule(), and setNumberOfCrystalPerModule().

◆ _nnmods

int EcalEndcapGeometry::_nnmods
private

number of modules

Definition at line 108 of file EcalEndcapGeometry.h.

Referenced by getNumberOfModules(), and setNumberOfModules().

◆ m_avgZ

CCGFloat EcalEndcapGeometry::m_avgZ
mutableprivate

Definition at line 128 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

◆ m_borderMgr

std::atomic<EZMgrFL<EBDetId>*> EcalEndcapGeometry::m_borderMgr
mutableprivate

Definition at line 124 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells(), and ~EcalEndcapGeometry().

◆ m_borderPtrVec

std::atomic<VecOrdListEBDetIdPtr*> EcalEndcapGeometry::m_borderPtrVec
mutableprivate

Definition at line 126 of file EcalEndcapGeometry.h.

Referenced by getClosestBarrelCells(), and ~EcalEndcapGeometry().

◆ m_cellVec

CellVec EcalEndcapGeometry::m_cellVec
private

◆ m_check

std::atomic<bool> EcalEndcapGeometry::m_check
mutableprivate

Definition at line 129 of file EcalEndcapGeometry.h.

Referenced by avgAbsZFrontFaceCenter().

◆ m_del

CCGFloat EcalEndcapGeometry::m_del
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by initializeParms().

◆ m_nref

unsigned int EcalEndcapGeometry::m_nref
private

Definition at line 117 of file EcalEndcapGeometry.h.

Referenced by getCells(), initializeParms(), xindex(), and yindex().

◆ m_wref

CCGFloat EcalEndcapGeometry::m_wref
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by getCells(), initializeParms(), xindex(), and yindex().

◆ m_xhi

CCGFloat EcalEndcapGeometry::m_xhi[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), and initializeParms().

◆ m_xlo

CCGFloat EcalEndcapGeometry::m_xlo[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), initializeParms(), and xindex().

◆ m_xoff

CCGFloat EcalEndcapGeometry::m_xoff[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

◆ m_yhi

CCGFloat EcalEndcapGeometry::m_yhi[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), and initializeParms().

◆ m_ylo

CCGFloat EcalEndcapGeometry::m_ylo[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), getCells(), initializeParms(), and yindex().

◆ m_yoff

CCGFloat EcalEndcapGeometry::m_yoff[2]
private

Definition at line 115 of file EcalEndcapGeometry.h.

Referenced by EcalEndcapGeometry(), and initializeParms().

◆ zeN

CCGFloat EcalEndcapGeometry::zeN
private

Definition at line 113 of file EcalEndcapGeometry.h.

Referenced by gId(), and initializeParms().

◆ zeP

CCGFloat EcalEndcapGeometry::zeP
private

Definition at line 113 of file EcalEndcapGeometry.h.

Referenced by getCells(), gId(), and initializeParms().