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
}
 

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
Detector det () const
 get the detector field from this detid More...
 
 DetId ()
 Create an empty or null id (also for persistence) More...
 
 DetId (uint32_t id)
 Create an id from a raw number. More...
 
 DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
bool null () const
 is this a null id ? More...
 
 operator uint32_t () const
 
bool operator!= (DetId id) const
 inequality More...
 
uint32_t operator() () const
 
bool operator< (DetId id) const
 comparison More...
 
bool operator== (DetId id) const
 equality More...
 
uint32_t rawId () const
 get the raw id More...
 
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 kDetOffset = 28
 
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
Enumerator
Subdet 

Definition at line 18 of file ESDetId.h.

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

Definition at line 83 of file ESDetId.h.

83  { kXYMAX=1072,
84  kXYMIN= 1,
85  kXMAX = 40,
86  kYMAX = 40,
87  kXMIN = 1,
88  kYMIN = 1,
89  // now normalize to A-D notation for ease of use
90  kNa =IZ_NUM,
91  kNb =PLANE_MAX - PLANE_MIN + 1,
92  kNc =kXYMAX - kXYMIN + 1,
93  kNd =ISTRIP_MAX - ISTRIP_MIN + 1,
94  kLd =kNd,
95  kLc =kLd*kNc,
96  kLb =kLc*kNb,
97  kLa =kLb*kNa } ;
static const int ISTRIP_MAX
Definition: ESDetId.h:76
static const int PLANE_MIN
Definition: ESDetId.h:77
static const int PLANE_MAX
Definition: ESDetId.h:78
static const int IZ_NUM
Definition: ESDetId.h:79
static const int ISTRIP_MIN
Definition: ESDetId.h:75
anonymous enum
Enumerator
kSizeForDenseIndexing 

Definition at line 109 of file ESDetId.h.

Constructor & Destructor Documentation

ESDetId::ESDetId ( )
inline

Constructor of a null id

Definition at line 20 of file ESDetId.h.

Referenced by ESDetId(), and unhashIndex().

20 {}
ESDetId::ESDetId ( uint32_t  rawid)
inline

Constructor from a raw value

Definition at line 22 of file ESDetId.h.

22 : DetId( rawid ) {}
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
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 26 of file ESDetId.h.

References ESDetId(), DetId::id_, operator=(), and verify().

26  :
28  id_ |= (strip&0x3F) |
29  ((ixs&0x3F)<<6) |
30  ((iys&0x3F)<<12) |
31  (((plane-1)&0x1)<<18) |
32  ((iz>0)?(1<<19):(0))
33  ;
34  if (doverify) verify(strip, ixs, iys, plane, iz);
35  }
int strip() const
Definition: ESDetId.h:53
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
static void verify(int istrip, int ixs, int iys, int iplane, int iz)
Definition: ESDetId.cc:6
uint32_t id_
Definition: DetId.h:55
int plane() const
Definition: ESDetId.h:47
ESDetId::ESDetId ( const DetId id)
inline

constructor from a generic DetId

Definition at line 116 of file ESDetId.h.

References DetId::det(), DetId::Ecal, EcalPreshower, Exception, DetId::null(), and DetId::subdetId().

116  : DetId(gen)
117 {
118 #ifdef EDM_ML_DEBUG
119  if( !gen.null() &&
120  ( gen.det() != Ecal ||
121  gen.subdetId() != EcalPreshower ) )
122  {
123  throw cms::Exception("InvalidDetId");
124  }
125 #endif
126 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26

Member Function Documentation

uint32_t ESDetId::denseIndex ( ) const
inline

Definition at line 57 of file ESDetId.h.

References hashedIndex().

57 { return hashedIndex() ; }
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
Definition: ESDetId.cc:44
static ESDetId ESDetId::detIdFromDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 61 of file ESDetId.h.

References unhashIndex().

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

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

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

Definition at line 44 of file ESDetId.cc.

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

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

45 {
46  const int ia ( 1 == zside() ? 2 : 1 ) ;
47  const int ib ( plane() ) ;
48  const int ix ( six() ) ;
49  const int iy ( siy() ) ;
50  const int ic ( 1 == ib ?
51  hxy1[ ix - 1 ][ iy - 1 ] :
52  hxy2[ ix - 1 ][ iy - 1 ] ) ;
53  const int id ( strip() ) ;
54 
55  return ( ( ia - 1 )*kLb +
56  ( ib - 1 )*kLc +
57  ( ic - 1 )*kLd +
58  id - 1 ) ;
59 }
int strip() const
Definition: ESDetId.h:53
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:103
int six() const
Definition: ESDetId.h:49
int siy() const
Definition: ESDetId.h:51
int zside() const
Definition: ESDetId.h:45
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:99
int plane() const
Definition: ESDetId.h:47
ib
Definition: cuy.py:660
ESDetId & ESDetId::operator= ( const DetId id)
inline

assignment from a generic DetId

Definition at line 130 of file ESDetId.h.

References DetId::det(), DetId::Ecal, EcalPreshower, Exception, DetId::id_, DetId::null(), DetId::rawId(), and DetId::subdetId().

Referenced by ESDetId().

131 {
132 #ifdef EDM_ML_DEBUG
133  if (!gen.null() &&
134  ( gen.det() != Ecal ||
135  gen.subdetId() != EcalPreshower ) )
136  {
137  throw cms::Exception("InvalidDetId");
138  }
139 #endif
140  id_=gen.rawId();
141  return *this;
142 }
uint32_t id_
Definition: DetId.h:55
int ESDetId::plane ( ) const
inline
int ESDetId::six ( ) const
inline
int ESDetId::siy ( ) const
inline
int ESDetId::strip ( ) const
inline
EcalSubdetector ESDetId::subdet ( ) const
inline

get the subdetector

Definition at line 43 of file ESDetId.h.

References DetId::subdetId().

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

get a DetId from a compact index for arrays

Definition at line 62 of file ESDetId.cc.

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

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

63 {
64  if( validHashIndex( hi ) )
65  {
66  const int id ( hi%kLd + 1 ) ;
67  const int nd ( hi - id + 1 ) ;
68  const int ic ( ( nd%kLc )/kLd + 1 ) ;
69  const int nc ( nd - ( ic - 1 )*kLd ) ;
70  const int ib ( ( nc%kLb )/kLc + 1 ) ;
71  const int nb ( nc - ( ib - 1 )*kLc ) ;
72  const int ia ( nb/kLb + 1 );// + 1 ) ;
73 
74  const int st ( id ) ;
75  const int pl ( ib ) ;
76  int ix ;
77  int iy ;
78  const int ic1 ( ic - 1 ) ;
79  if( 1 == pl )
80  {
81  ix = hx1[ ic1 ] ;
82  iy = hy1[ ic1 ] ;
83  }
84  else
85  {
86  ix = hx2[ ic1 ] ;
87  iy = hy2[ ic1 ] ;
88  }
89  const int iz ( 1 == ia ? -1 : 1 ) ;
90 
91  return ESDetId( st, ix, iy, pl, iz ) ;
92  }
93  else
94  {
95  return ESDetId() ;
96  }
97 }
static const unsigned short hy2[kXYMAX]
Definition: ESDetId.h:105
static const unsigned short hy1[kXYMAX]
Definition: ESDetId.h:101
ESDetId()
Definition: ESDetId.h:20
static const unsigned short hx2[kXYMAX]
Definition: ESDetId.h:104
static const unsigned short hx1[kXYMAX]
Definition: ESDetId.h:100
static bool validHashIndex(int hi)
Definition: ESDetId.h:65
ib
Definition: cuy.py:660
static bool ESDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 59 of file ESDetId.h.

References validHashIndex().

59 { return validHashIndex( din ) ; }
static bool validHashIndex(int hi)
Definition: ESDetId.h:65
bool ESDetId::validDetId ( int  istrip,
int  ixs,
int  iys,
int  iplane,
int  iz 
)
static

check if a valid index combination

Definition at line 22 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(), validHashIndex(), verify(), and ESUnpacker::word2digi().

27 {
28  return ( !( ( istrip < ISTRIP_MIN ) ||
29  ( istrip > ISTRIP_MAX ) ||
30  ( ixs < IX_MIN ) ||
31  ( ixs > IX_MAX ) ||
32  ( iys < IY_MIN ) ||
33  ( iys > IY_MAX ) ||
34  ( abs( iz ) != 1 ) ||
35  ( iplane < PLANE_MIN ) ||
36  ( iplane > PLANE_MAX ) ||
37  ( ( 1 == iplane ) &&
38  0 == hxy1[ixs-1][iys-1] ) ||
39  ( ( 2 == iplane ) &&
40  0 == hxy2[ixs-1][iys-1] ) ) ) ;
41 }
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:103
static const int IY_MAX
Definition: ESDetId.h:74
static const int ISTRIP_MAX
Definition: ESDetId.h:76
static const int PLANE_MIN
Definition: ESDetId.h:77
static const int PLANE_MAX
Definition: ESDetId.h:78
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:99
static const int IY_MIN
Definition: ESDetId.h:72
static const int IX_MAX
Definition: ESDetId.h:73
static const int ISTRIP_MIN
Definition: ESDetId.h:75
static const int IX_MIN
Definition: ESDetId.h:71
static bool ESDetId::validHashIndex ( int  hi)
inlinestatic

Definition at line 65 of file ESDetId.h.

References kSizeForDenseIndexing, validDetId(), and verify().

Referenced by unhashIndex(), and validDenseIndex().

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, and validDetId().

Referenced by ESDetId(), and validHashIndex().

11 {
12  if( !validDetId( strip, ixs, iys, plane, iz) )
13  throw cms::Exception("InvalidDetId")
14  << "ESDetId: Cannot create object. Indexes out of bounds \n"
15  << " strip = " << strip << " x = " << ixs << " y = " << iys << "\n"
16  << " plane = " << plane << " z = " << iz
17  << " hxy = " << (1==plane?hxy1[ixs-1][iys-1]:hxy2[ixs-1][iys-1])
18  << "\n";
19 }
int strip() const
Definition: ESDetId.h:53
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:103
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:99
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:22
int plane() const
Definition: ESDetId.h:47
int ESDetId::zside ( ) const
inline

Member Data Documentation

const unsigned short ESDetId::hx1
staticprivate

Definition at line 100 of file ESDetId.h.

Referenced by operator<<(), and unhashIndex().

const unsigned short ESDetId::hx2
staticprivate

Definition at line 104 of file ESDetId.h.

Referenced by operator<<(), and unhashIndex().

const unsigned short ESDetId::hxy1
staticprivate

Definition at line 99 of file ESDetId.h.

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

const unsigned short ESDetId::hxy2
staticprivate

Definition at line 103 of file ESDetId.h.

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

const unsigned short ESDetId::hy1
staticprivate

Definition at line 101 of file ESDetId.h.

Referenced by operator<<(), and unhashIndex().

const unsigned short ESDetId::hy2
staticprivate

Definition at line 105 of file ESDetId.h.

Referenced by operator<<(), and unhashIndex().

const int ESDetId::ISTRIP_MAX =32
static
const int ESDetId::ISTRIP_MIN =1
static
const int ESDetId::IX_MAX =40
static
const int ESDetId::IX_MIN =1
static
const int ESDetId::IY_MAX =40
static
const int ESDetId::IY_MIN =1
static
const int ESDetId::IZ_NUM =2
static

Definition at line 79 of file ESDetId.h.

Referenced by StoreESCondition::readESPedestalsFromFile().

const int ESDetId::PLANE_MAX =2
static

Definition at line 78 of file ESDetId.h.

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

const int ESDetId::PLANE_MIN =1
static

Definition at line 77 of file ESDetId.h.

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