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 (const DetId &id)
 
 ESDetId (int strip, int ixs, int iys, int plane, int iz, bool doverify=false)
 constructor from strip, ix, iy, plane, and iz More...
 
 ESDetId (uint32_t rawid)
 
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 (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
constexpr DetId (uint32_t id)
 Create an id from a raw number. 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.

17 { Subdet = EcalPreshower };

◆ 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  };

◆ 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.

19 {}

Referenced by unhashIndex().

◆ 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) {}

◆ 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.

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  }

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

◆ ESDetId() [4/4]

ESDetId::ESDetId ( const DetId id)
inline

constructor from a generic DetId

Definition at line 107 of file ESDetId.h.

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 }

References DetId::Ecal, EcalPreshower, and Exception.

Member Function Documentation

◆ denseIndex()

uint32_t ESDetId::denseIndex ( ) const
inline

Definition at line 51 of file ESDetId.h.

51 { return hashedIndex(); }

References hashedIndex().

◆ detIdFromDenseIndex()

static ESDetId ESDetId::detIdFromDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 55 of file ESDetId.h.

55 { return unhashIndex(din); }

References cropTnPTrees::din, and unhashIndex().

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

◆ hashedIndex()

int ESDetId::hashedIndex ( ) const

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

Definition at line 21 of file ESDetId.cc.

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 }

References hxy1, hxy2, cuy::ib, triggerObjects_cff::id, kLb, kLc, kLd, plane(), six(), siy(), strip(), and zside().

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

◆ operator=()

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

assignment from a generic DetId

Definition at line 115 of file ESDetId.h.

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 }

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

◆ 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.

37 { return EcalSubdetector(subdetId()); }

References DetId::subdetId().

◆ unhashIndex()

ESDetId ESDetId::unhashIndex ( int  hi)
static

get a DetId from a compact index for arrays

Definition at line 32 of file ESDetId.cc.

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 }

References ESDetId(), hx1, hx2, hy1, hy2, cuy::ib, triggerObjects_cff::id, kLb, kLc, kLd, and validHashIndex().

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

◆ validDenseIndex()

static bool ESDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 53 of file ESDetId.h.

53 { return validHashIndex(din); }

References cropTnPTrees::din, and validHashIndex().

◆ validDetId()

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

◆ validHashIndex()

static bool ESDetId::validHashIndex ( int  hi)
inlinestatic

Definition at line 59 of file ESDetId.h.

59 { return (hi < kSizeForDenseIndexing); }

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.

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 }

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

Referenced by ESDetId().

◆ 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().

ESDetId::ISTRIP_MIN
static const int ISTRIP_MIN
Definition: ESDetId.h:68
ESDetId::kLd
Definition: ESDetId.h:87
ESDetId::hxy1
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:93
ESDetId::strip
int strip() const
Definition: ESDetId.h:47
ESDetId::kXMAX
Definition: ESDetId.h:78
ESDetId::ESDetId
ESDetId()
Definition: ESDetId.h:19
ESDetId::hashedIndex
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
Definition: ESDetId.cc:21
EcalSubdetector
EcalSubdetector
Definition: EcalSubdetector.h:10
ESDetId::kLa
Definition: ESDetId.h:90
ESDetId::kXYMIN
Definition: ESDetId.h:77
ESDetId::IY_MIN
static const int IY_MIN
Definition: ESDetId.h:65
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
ESDetId::hx2
static const unsigned short hx2[kXYMAX]
Definition: ESDetId.h:98
ESDetId::PLANE_MIN
static const int PLANE_MIN
Definition: ESDetId.h:70
gen
Definition: PythiaDecays.h:13
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
ESDetId::verify
static void verify(int istrip, int ixs, int iys, int iplane, int iz)
Definition: ESDetId.cc:6
ESDetId::kSizeForDenseIndexing
Definition: ESDetId.h:102
ESDetId::PLANE_MAX
static const int PLANE_MAX
Definition: ESDetId.h:71
ESDetId::kYMIN
Definition: ESDetId.h:81
cropTnPTrees.din
din
Definition: cropTnPTrees.py:30
ESDetId::ISTRIP_MAX
static const int ISTRIP_MAX
Definition: ESDetId.h:69
DetId::id_
uint32_t id_
Definition: DetId.h:69
ESDetId::kNc
Definition: ESDetId.h:85
ESDetId::hy2
static const unsigned short hy2[kXYMAX]
Definition: ESDetId.h:99
ESDetId::hy1
static const unsigned short hy1[kXYMAX]
Definition: ESDetId.h:95
cuy.ib
ib
Definition: cuy.py:661
ESDetId::kXMIN
Definition: ESDetId.h:80
DetId::Ecal
Definition: DetId.h:27
ESDetId::kLc
Definition: ESDetId.h:88
ESDetId::kNa
Definition: ESDetId.h:83
ESDetId::IY_MAX
static const int IY_MAX
Definition: ESDetId.h:67
ESDetId::plane
int plane() const
Definition: ESDetId.h:41
EcalPreshower
Definition: EcalSubdetector.h:10
ESDetId::kNb
Definition: ESDetId.h:84
hi
Definition: EPCuts.h:4
ESDetId::six
int six() const
Definition: ESDetId.h:43
ESDetId::IZ_NUM
static const int IZ_NUM
Definition: ESDetId.h:72
ESDetId::unhashIndex
static ESDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: ESDetId.cc:32
ESDetId::hxy2
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:97
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ESDetId::validDetId
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:15
Exception
Definition: hltDiff.cc:245
ESDetId::kLb
Definition: ESDetId.h:89
ESDetId::kNd
Definition: ESDetId.h:86
ESDetId::validHashIndex
static bool validHashIndex(int hi)
Definition: ESDetId.h:59
ESDetId::siy
int siy() const
Definition: ESDetId.h:45
DetId::DetId
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38
ESDetId::kYMAX
Definition: ESDetId.h:79
ESDetId::hx1
static const unsigned short hx1[kXYMAX]
Definition: ESDetId.h:94
ESDetId::IX_MIN
static const int IX_MIN
Definition: ESDetId.h:64
ESDetId::IX_MAX
static const int IX_MAX
Definition: ESDetId.h:66
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ESDetId::kXYMAX
Definition: ESDetId.h:76
ESDetId::zside
int zside() const
Definition: ESDetId.h:39
ESDetId::Subdet
Definition: ESDetId.h:17