CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Static Private Attributes
ESDetId Class Reference

#include <ESDetId.h>

Inheritance diagram for ESDetId:
DetId

Public Types

enum  { Subdet = EcalPreshower }
 
enum  { kSizeForDenseIndexing = kLa }
 
- Public Types inherited from DetId
enum  Detector {
  Tracker = 1, Muon = 2, Ecal = 3, Hcal = 4,
  Calo = 5, Forward = 6, VeryForward = 7, HGCalEE = 8,
  HGCalHSi = 9, HGCalHSc = 10, HGCalTrigger = 11
}
 

Public Member Functions

uint32_t denseIndex () const
 
 ESDetId ()
 
 ESDetId (uint32_t rawid)
 
 ESDetId (int strip, int ixs, int iys, int plane, int iz, bool doverify=false)
 constructor from strip, ix, iy, plane, and iz More...
 
 ESDetId (const DetId &id)
 
int hashedIndex () const
 get a compact index for arrays [TODO: NEEDS WORK] More...
 
ESDetIdoperator= (const DetId &id)
 
int plane () const
 
int six () const
 
int siy () const
 
int strip () const
 
EcalSubdetector subdet () const
 get the subdetector More...
 
int zside () const
 
- Public Member Functions inherited from DetId
constexpr Detector det () const
 get the detector field from this detid More...
 
constexpr DetId ()
 Create an empty or null id (also for persistence) More...
 
constexpr DetId (uint32_t id)
 Create an id from a raw number. More...
 
constexpr DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
constexpr bool null () const
 is this a null id ? More...
 
constexpr operator uint32_t () const
 
constexpr bool operator!= (DetId id) const
 inequality More...
 
constexpr uint32_t operator() () const
 
constexpr bool operator< (DetId id) const
 comparison More...
 
constexpr bool operator== (DetId id) const
 equality More...
 
constexpr uint32_t rawId () const
 get the raw id More...
 
constexpr int subdetId () const
 get the contents of the subdetector field (not cast into any detector's numbering enum) More...
 

Static Public Member Functions

static ESDetId detIdFromDenseIndex (uint32_t din)
 
static ESDetId unhashIndex (int hi)
 get a DetId from a compact index for arrays More...
 
static bool validDenseIndex (uint32_t din)
 
static bool validDetId (int istrip, int ixs, int iys, int iplane, int iz)
 check if a valid index combination More...
 
static bool validHashIndex (int hi)
 
static void verify (int istrip, int ixs, int iys, int iplane, int iz)
 

Static Public Attributes

static const int ISTRIP_MAX = 32
 
static const int ISTRIP_MIN = 1
 
static const int IX_MAX = 40
 
static const int IX_MIN = 1
 
static const int IY_MAX = 40
 
static const int IY_MIN = 1
 
static const int IZ_NUM = 2
 
static const int PLANE_MAX = 2
 
static const int PLANE_MIN = 1
 
- Static Public Attributes inherited from DetId
static const int kDetMask = 0xF
 
static const int kDetOffset = 28
 
static const int kSubdetMask = 0x7
 
static const int kSubdetOffset = 25
 

Private Types

enum  {
  kXYMAX = 1072, kXYMIN = 1, kXMAX = 40, kYMAX = 40,
  kXMIN = 1, kYMIN = 1, kNa = IZ_NUM, kNb = PLANE_MAX - PLANE_MIN + 1,
  kNc = kXYMAX - kXYMIN + 1, kNd = ISTRIP_MAX - ISTRIP_MIN + 1, kLd = kNd, kLc = kLd * kNc,
  kLb = kLc * kNb, kLa = kLb * kNa
}
 

Static Private Attributes

static const unsigned short hx1 [kXYMAX]
 
static const unsigned short hx2 [kXYMAX]
 
static const unsigned short hxy1 [kXMAX][kYMAX]
 
static const unsigned short hxy2 [kXMAX][kYMAX]
 
static const unsigned short hy1 [kXYMAX]
 
static const unsigned short hy2 [kXYMAX]
 

Additional Inherited Members

- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

Det id for a preshower (endcap) strip

Definition at line 15 of file ESDetId.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Subdet 

Definition at line 17 of file ESDetId.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kXYMAX 
kXYMIN 
kXMAX 
kYMAX 
kXMIN 
kYMIN 
kNa 
kNb 
kNc 
kNd 
kLd 
kLc 
kLb 
kLa 

Definition at line 75 of file ESDetId.h.

75  {
76  kXYMAX = 1072,
77  kXYMIN = 1,
78  kXMAX = 40,
79  kYMAX = 40,
80  kXMIN = 1,
81  kYMIN = 1,
82  // now normalize to A-D notation for ease of use
83  kNa = IZ_NUM,
84  kNb = PLANE_MAX - PLANE_MIN + 1,
85  kNc = kXYMAX - kXYMIN + 1,
86  kNd = ISTRIP_MAX - ISTRIP_MIN + 1,
87  kLd = kNd,
88  kLc = kLd * kNc,
89  kLb = kLc * kNb,
90  kLa = kLb * kNa
91  };
static const int ISTRIP_MAX
Definition: ESDetId.h:69
static const int PLANE_MIN
Definition: ESDetId.h:70
static const int PLANE_MAX
Definition: ESDetId.h:71
static const int IZ_NUM
Definition: ESDetId.h:72
static const int ISTRIP_MIN
Definition: ESDetId.h:68

◆ anonymous enum

anonymous enum
Enumerator
kSizeForDenseIndexing 

Definition at line 102 of file ESDetId.h.

Constructor & Destructor Documentation

◆ ESDetId() [1/4]

ESDetId::ESDetId ( )
inline

Constructor of a null id

Definition at line 19 of file ESDetId.h.

Referenced by unhashIndex().

19 {}

◆ ESDetId() [2/4]

ESDetId::ESDetId ( uint32_t  rawid)
inline

Constructor from a raw value

Definition at line 21 of file ESDetId.h.

21 : DetId(rawid) {}
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

◆ ESDetId() [3/4]

ESDetId::ESDetId ( int  strip,
int  ixs,
int  iys,
int  plane,
int  iz,
bool  doverify = false 
)
inline

constructor from strip, ix, iy, plane, and iz

Definition at line 24 of file ESDetId.h.

References DetId::id_, plane(), strip(), verify(), and testProducerWithPsetDescEmpty_cfi::x1.

25  id_ |= (strip & 0x3F) | ((ixs & 0x3F) << 6) | ((iys & 0x3F) << 12) | (((plane - 1) & 0x1) << 18) |
26  ((iz > 0) ? (1 << 19) : (0));
27  if (doverify)
28  verify(strip, ixs, iys, plane, iz);
29  }
static void verify(int istrip, int ixs, int iys, int iplane, int iz)
Definition: ESDetId.cc:6
int plane() const
Definition: ESDetId.h:41
uint32_t id_
Definition: DetId.h:69
int strip() const
Definition: ESDetId.h:47
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

◆ ESDetId() [4/4]

ESDetId::ESDetId ( const DetId id)
inline

constructor from a generic DetId

Definition at line 107 of file ESDetId.h.

References DetId::Ecal, EcalPreshower, and Exception.

107  : DetId(gen) {
108 #ifdef EDM_ML_DEBUG
109  if (!gen.null() && (gen.det() != Ecal || gen.subdetId() != EcalPreshower)) {
110  throw cms::Exception("InvalidDetId");
111  }
112 #endif
113 }
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

Member Function Documentation

◆ denseIndex()

uint32_t ESDetId::denseIndex ( ) const
inline

Definition at line 51 of file ESDetId.h.

References hashedIndex().

51 { return hashedIndex(); }
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
Definition: ESDetId.cc:21

◆ detIdFromDenseIndex()

static ESDetId ESDetId::detIdFromDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 55 of file ESDetId.h.

References cropTnPTrees::din, and unhashIndex().

Referenced by CaloGenericDetId::CaloGenericDetId(), and ESHitResponse::ESHitResponse().

55 { return unhashIndex(din); }
static ESDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: ESDetId.cc:32

◆ hashedIndex()

int ESDetId::hashedIndex ( ) const

get a compact index for arrays [TODO: NEEDS WORK]

Definition at line 21 of file ESDetId.cc.

References hxy1, hxy2, cuy::ib, l1ctLayer2EG_cff::id, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), kLb, kLc, kLd, plane(), six(), siy(), strip(), and zside().

Referenced by denseIndex(), and ESRecHitSimAlgo::reconstruct().

21  {
22  const int ia(1 == zside() ? 2 : 1);
23  const int ib(plane());
24  const int ix(six());
25  const int iy(siy());
26  const int ic(1 == ib ? hxy1[ix - 1][iy - 1] : hxy2[ix - 1][iy - 1]);
27  const int id(strip());
28 
29  return ((ia - 1) * kLb + (ib - 1) * kLc + (ic - 1) * kLd + id - 1);
30 }
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:97
int zside() const
Definition: ESDetId.h:39
int plane() const
Definition: ESDetId.h:41
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:93
int siy() const
Definition: ESDetId.h:45
int six() const
Definition: ESDetId.h:43
int strip() const
Definition: ESDetId.h:47
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
ib
Definition: cuy.py:661

◆ operator=()

ESDetId & ESDetId::operator= ( const DetId id)
inline

assignment from a generic DetId

Definition at line 115 of file ESDetId.h.

References DetId::Ecal, EcalPreshower, Exception, and DetId::id_.

115  {
116 #ifdef EDM_ML_DEBUG
117  if (!gen.null() && (gen.det() != Ecal || gen.subdetId() != EcalPreshower)) {
118  throw cms::Exception("InvalidDetId");
119  }
120 #endif
121  id_ = gen.rawId();
122  return *this;
123 }
uint32_t id_
Definition: DetId.h:69

◆ plane()

int ESDetId::plane ( ) const
inline

◆ six()

int ESDetId::six ( ) const
inline

◆ siy()

int ESDetId::siy ( ) const
inline

◆ strip()

int ESDetId::strip ( ) const
inline

◆ subdet()

EcalSubdetector ESDetId::subdet ( ) const
inline

get the subdetector

Definition at line 37 of file ESDetId.h.

References DetId::subdetId().

37 { return EcalSubdetector(subdetId()); }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
EcalSubdetector

◆ unhashIndex()

ESDetId ESDetId::unhashIndex ( int  hi)
static

get a DetId from a compact index for arrays

Definition at line 32 of file ESDetId.cc.

References ESDetId(), hx1, hx2, hy1, hy2, cuy::ib, l1ctLayer2EG_cff::id, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), kLb, kLc, kLd, and validHashIndex().

Referenced by detIdFromDenseIndex(), and ESTrivialConditionRetriever::getChannelStatusFromConfiguration().

32  {
33  if (validHashIndex(hi)) {
34  const int id(hi % kLd + 1);
35  const int nd(hi - id + 1);
36  const int ic((nd % kLc) / kLd + 1);
37  const int nc(nd - (ic - 1) * kLd);
38  const int ib((nc % kLb) / kLc + 1);
39  const int nb(nc - (ib - 1) * kLc);
40  const int ia(nb / kLb + 1); // + 1 ) ;
41 
42  const int st(id);
43  const int pl(ib);
44  int ix;
45  int iy;
46  const int ic1(ic - 1);
47  if (1 == pl) {
48  ix = hx1[ic1];
49  iy = hy1[ic1];
50  } else {
51  ix = hx2[ic1];
52  iy = hy2[ic1];
53  }
54  const int iz(1 == ia ? -1 : 1);
55 
56  return ESDetId(st, ix, iy, pl, iz);
57  } else {
58  return ESDetId();
59  }
60 }
static const unsigned short hy2[kXYMAX]
Definition: ESDetId.h:99
static const unsigned short hy1[kXYMAX]
Definition: ESDetId.h:95
Definition: EPCuts.h:4
ESDetId()
Definition: ESDetId.h:19
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
static const unsigned short hx2[kXYMAX]
Definition: ESDetId.h:98
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
static const unsigned short hx1[kXYMAX]
Definition: ESDetId.h:94
static bool validHashIndex(int hi)
Definition: ESDetId.h:59
ib
Definition: cuy.py:661

◆ validDenseIndex()

static bool ESDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 53 of file ESDetId.h.

References cropTnPTrees::din, and validHashIndex().

53 { return validHashIndex(din); }
static bool validHashIndex(int hi)
Definition: ESDetId.h:59

◆ validDetId()

bool ESDetId::validDetId ( int  istrip,
int  ixs,
int  iys,
int  iplane,
int  iz 
)
static

check if a valid index combination

Definition at line 15 of file ESDetId.cc.

References funct::abs(), hxy1, hxy2, ISTRIP_MAX, ISTRIP_MIN, IX_MAX, IX_MIN, IY_MAX, IY_MIN, PLANE_MAX, and PLANE_MIN.

Referenced by EcalPreshowerTopology::decrementIx(), EcalPreshowerTopology::decrementIy(), EcalPreshowerTopology::decrementIz(), EcalPreshowerGeometry::getClosestCellInPlane(), EcalPreshowerTopology::incrementIx(), EcalPreshowerTopology::incrementIy(), EcalPreshowerTopology::incrementIz(), StoreESCondition::readESChannelStatusFromFile(), StoreESCondition::readESIntercalibConstantsFromFile(), StoreESCondition::readESPedestalsFromFile(), CaloGenericDetId::validDetId(), verify(), and ESUnpacker::word2digi().

15  {
16  return (!((istrip < ISTRIP_MIN) || (istrip > ISTRIP_MAX) || (ixs < IX_MIN) || (ixs > IX_MAX) || (iys < IY_MIN) ||
17  (iys > IY_MAX) || (abs(iz) != 1) || (iplane < PLANE_MIN) || (iplane > PLANE_MAX) ||
18  ((1 == iplane) && 0 == hxy1[ixs - 1][iys - 1]) || ((2 == iplane) && 0 == hxy2[ixs - 1][iys - 1])));
19 }
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:97
static const int IY_MAX
Definition: ESDetId.h:67
static const int ISTRIP_MAX
Definition: ESDetId.h:69
static const int PLANE_MIN
Definition: ESDetId.h:70
static const int PLANE_MAX
Definition: ESDetId.h:71
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:93
static const int IY_MIN
Definition: ESDetId.h:65
static const int IX_MAX
Definition: ESDetId.h:66
static const int ISTRIP_MIN
Definition: ESDetId.h:68
static const int IX_MIN
Definition: ESDetId.h:64

◆ validHashIndex()

static bool ESDetId::validHashIndex ( int  hi)
inlinestatic

Definition at line 59 of file ESDetId.h.

References kSizeForDenseIndexing.

Referenced by unhashIndex(), and validDenseIndex().

◆ verify()

void ESDetId::verify ( int  istrip,
int  ixs,
int  iys,
int  iplane,
int  iz 
)
static

Definition at line 6 of file ESDetId.cc.

References Exception, hxy1, hxy2, plane(), strip(), and validDetId().

Referenced by ESDetId().

6  {
7  if (!validDetId(strip, ixs, iys, plane, iz))
8  throw cms::Exception("InvalidDetId") << "ESDetId: Cannot create object. Indexes out of bounds \n"
9  << " strip = " << strip << " x = " << ixs << " y = " << iys << "\n"
10  << " plane = " << plane << " z = " << iz
11  << " hxy = " << (1 == plane ? hxy1[ixs - 1][iys - 1] : hxy2[ixs - 1][iys - 1])
12  << "\n";
13 }
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:97
int plane() const
Definition: ESDetId.h:41
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:93
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:15
int strip() const
Definition: ESDetId.h:47

◆ zside()

int ESDetId::zside ( ) const
inline

Member Data Documentation

◆ hx1

const unsigned short ESDetId::hx1
staticprivate

Definition at line 94 of file ESDetId.h.

Referenced by unhashIndex().

◆ hx2

const unsigned short ESDetId::hx2
staticprivate

Definition at line 98 of file ESDetId.h.

Referenced by unhashIndex().

◆ hxy1

const unsigned short ESDetId::hxy1
staticprivate

Definition at line 93 of file ESDetId.h.

Referenced by hashedIndex(), validDetId(), and verify().

◆ hxy2

const unsigned short ESDetId::hxy2
staticprivate

Definition at line 97 of file ESDetId.h.

Referenced by hashedIndex(), validDetId(), and verify().

◆ hy1

const unsigned short ESDetId::hy1
staticprivate

Definition at line 95 of file ESDetId.h.

Referenced by unhashIndex().

◆ hy2

const unsigned short ESDetId::hy2
staticprivate

Definition at line 99 of file ESDetId.h.

Referenced by unhashIndex().

◆ ISTRIP_MAX

const int ESDetId::ISTRIP_MAX = 32
static

◆ ISTRIP_MIN

const int ESDetId::ISTRIP_MIN = 1
static

◆ IX_MAX

const int ESDetId::IX_MAX = 40
static

◆ IX_MIN

const int ESDetId::IX_MIN = 1
static

◆ IY_MAX

const int ESDetId::IY_MAX = 40
static

◆ IY_MIN

const int ESDetId::IY_MIN = 1
static

◆ IZ_NUM

const int ESDetId::IZ_NUM = 2
static

Definition at line 72 of file ESDetId.h.

Referenced by StoreESCondition::readESPedestalsFromFile().

◆ PLANE_MAX

const int ESDetId::PLANE_MAX = 2
static

Definition at line 71 of file ESDetId.h.

Referenced by StoreESCondition::readESPedestalsFromFile(), and validDetId().

◆ PLANE_MIN

const int ESDetId::PLANE_MIN = 1
static

Definition at line 70 of file ESDetId.h.

Referenced by StoreESCondition::readESPedestalsFromFile(), and validDetId().