CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
}
 

Public Member Functions

uint32_t denseIndex () const
 
 ESDetId ()
 
 ESDetId (uint32_t rawid)
 
 ESDetId (int strip, int ixs, int iys, int plane, int iz)
 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 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

Id:
ESDetId.h,v 1.6 2007/05/29 17:32:05 meridian Exp

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 69 of file ESDetId.h.

69  { kXYMAX=1072,
70  kXYMIN= 1,
71  kXMAX = 40,
72  kYMAX = 40,
73  kXMIN = 1,
74  kYMIN = 1,
75  // now normalize to A-D notation for ease of use
76  kNa =IZ_NUM,
77  kNb =PLANE_MAX - PLANE_MIN + 1,
78  kNc =kXYMAX - kXYMIN + 1,
79  kNd =ISTRIP_MAX - ISTRIP_MIN + 1,
80  kLd =kNd,
81  kLc =kLd*kNc,
82  kLb =kLc*kNb,
83  kLa =kLb*kNa } ;
static const int ISTRIP_MAX
Definition: ESDetId.h:62
static const int PLANE_MIN
Definition: ESDetId.h:63
static const int PLANE_MAX
Definition: ESDetId.h:64
static const int IZ_NUM
Definition: ESDetId.h:65
static const int ISTRIP_MIN
Definition: ESDetId.h:61
anonymous enum
Enumerator
kSizeForDenseIndexing 

Definition at line 95 of file ESDetId.h.

Constructor & Destructor Documentation

ESDetId::ESDetId ( )

Constructor of a null id

Definition at line 6 of file ESDetId.cc.

Referenced by unhashIndex().

6  : DetId()
7 {
8 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
ESDetId::ESDetId ( uint32_t  rawid)

Constructor from a raw value

Definition at line 10 of file ESDetId.cc.

10  :
11  DetId( rawid )
12 {
13 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
ESDetId::ESDetId ( int  strip,
int  ixs,
int  iys,
int  plane,
int  iz 
)

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

Definition at line 15 of file ESDetId.cc.

References edm::hlt::Exception, hxy1, hxy2, DetId::id_, and validDetId().

19  :
21 {
22  if( !validDetId( strip, ixs, iys, plane, iz) )
23  throw cms::Exception("InvalidDetId")
24  << "ESDetId: Cannot create object. Indexes out of bounds \n"
25  << " strip = " << strip << " x = " << ixs << " y = " << iys << "\n"
26  << " plane = " << plane << " z = " << iz
27  << " hxy = " << (1==plane?hxy1[ixs-1][iys-1]:hxy2[ixs-1][iys-1])
28  << "\n";
29 
30  id_ |=
31  (strip&0x3F) |
32  ((ixs&0x3F)<<6) |
33  ((iys&0x3F)<<12) |
34  (((plane-1)&0x1)<<18) |
35  ((iz>0)?(1<<19):(0));
36 }
int strip() const
Definition: ESDetId.h:41
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:89
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:85
uint32_t id_
Definition: DetId.h:57
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:50
int plane() const
Definition: ESDetId.h:35
ESDetId::ESDetId ( const DetId id)

constructor from a generic DetId

Definition at line 38 of file ESDetId.cc.

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

39 {
40  if( !gen.null() &&
41  ( gen.det() != Ecal ||
42  gen.subdetId() != EcalPreshower ) )
43  {
44  throw cms::Exception("InvalidDetId");
45  }
46  id_ = gen.rawId() ;
47 }
uint32_t id_
Definition: DetId.h:57

Member Function Documentation

uint32_t ESDetId::denseIndex ( ) const
inline

Definition at line 45 of file ESDetId.h.

References hashedIndex().

Referenced by EcalPreshowerGeometry::getClosestCellInPlane().

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

Definition at line 49 of file ESDetId.h.

References unhashIndex().

Referenced by CaloGenericDetId::CaloGenericDetId().

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

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

Definition at line 85 of file ESDetId.cc.

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

Referenced by denseIndex().

86 {
87  const int ia ( 1 == zside() ? 2 : 1 ) ;
88  const int ib ( plane() ) ;
89  const int ix ( six() ) ;
90  const int iy ( siy() ) ;
91  const int ic ( 1 == ib ?
92  hxy1[ ix - 1 ][ iy - 1 ] :
93  hxy2[ ix - 1 ][ iy - 1 ] ) ;
94  const int id ( strip() ) ;
95 
96  return ( ( ia - 1 )*kLb +
97  ( ib - 1 )*kLc +
98  ( ic - 1 )*kLd +
99  id - 1 ) ;
100 }
int strip() const
Definition: ESDetId.h:41
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:89
int six() const
Definition: ESDetId.h:37
int siy() const
Definition: ESDetId.h:39
int zside() const
Definition: ESDetId.h:33
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:85
int plane() const
Definition: ESDetId.h:35
ESDetId & ESDetId::operator= ( const DetId id)

assignment from a generic DetId

Definition at line 72 of file ESDetId.cc.

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

73 {
74  if (!gen.null() &&
75  ( gen.det() != Ecal ||
76  gen.subdetId() != EcalPreshower ) )
77  {
78  throw cms::Exception("InvalidDetId");
79  }
80  id_=gen.rawId();
81  return *this;
82 }
uint32_t id_
Definition: DetId.h:57
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 31 of file ESDetId.h.

References DetId::subdetId().

31 { 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:39
EcalSubdetector
ESDetId ESDetId::unhashIndex ( int  hi)
static

get a DetId from a compact index for arrays

Definition at line 103 of file ESDetId.cc.

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

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

104 {
105  if( validHashIndex( hi ) )
106  {
107  const int id ( hi%kLd + 1 ) ;
108  const int nd ( hi - id + 1 ) ;
109  const int ic ( ( nd%kLc )/kLd + 1 ) ;
110  const int nc ( nd - ( ic - 1 )*kLd ) ;
111  const int ib ( ( nc%kLb )/kLc + 1 ) ;
112  const int nb ( nc - ( ib - 1 )*kLc ) ;
113  const int ia ( nb/kLb + 1 );// + 1 ) ;
114 
115  const int st ( id ) ;
116  const int pl ( ib ) ;
117  int ix ;
118  int iy ;
119  const int ic1 ( ic - 1 ) ;
120  if( 1 == pl )
121  {
122  ix = hx1[ ic1 ] ;
123  iy = hy1[ ic1 ] ;
124  }
125  else
126  {
127  ix = hx2[ ic1 ] ;
128  iy = hy2[ ic1 ] ;
129  }
130  const int iz ( 1 == ia ? -1 : 1 ) ;
131 
132  return ESDetId( st, ix, iy, pl, iz ) ;
133  }
134  else
135  {
136  return ESDetId() ;
137  }
138 }
static const unsigned short hy2[kXYMAX]
Definition: ESDetId.h:91
static const unsigned short hy1[kXYMAX]
Definition: ESDetId.h:87
ESDetId()
Definition: ESDetId.cc:6
static const unsigned short hx2[kXYMAX]
Definition: ESDetId.h:90
static const unsigned short hx1[kXYMAX]
Definition: ESDetId.h:86
static bool validHashIndex(int hi)
Definition: ESDetId.h:53
static bool ESDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 47 of file ESDetId.h.

References validHashIndex().

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

check if a valid index combination

Definition at line 50 of file ESDetId.cc.

References 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(), ESDetId(), EcalPreshowerGeometry::getClosestCellInPlane(), EcalPreshowerTopology::incrementIx(), EcalPreshowerTopology::incrementIy(), EcalPreshowerTopology::incrementIz(), CaloGenericDetId::validDetId(), and ESUnpacker::word2digi().

55 {
56  return ( !( ( istrip < ISTRIP_MIN ) ||
57  ( istrip > ISTRIP_MAX ) ||
58  ( ixs < IX_MIN ) ||
59  ( ixs > IX_MAX ) ||
60  ( iys < IY_MIN ) ||
61  ( iys > IY_MAX ) ||
62  ( abs( iz ) != 1 ) ||
63  ( iplane < PLANE_MIN ) ||
64  ( iplane > PLANE_MAX ) ||
65  ( ( 1 == iplane ) &&
66  0 == hxy1[ixs-1][iys-1] ) ||
67  ( ( 2 == iplane ) &&
68  0 == hxy2[ixs-1][iys-1] ) ) ) ;
69 }
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:89
static const int IY_MAX
Definition: ESDetId.h:60
#define abs(x)
Definition: mlp_lapack.h:159
static const int ISTRIP_MAX
Definition: ESDetId.h:62
static const int PLANE_MIN
Definition: ESDetId.h:63
static const int PLANE_MAX
Definition: ESDetId.h:64
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:85
static const int IY_MIN
Definition: ESDetId.h:58
static const int IX_MAX
Definition: ESDetId.h:59
static const int ISTRIP_MIN
Definition: ESDetId.h:61
static const int IX_MIN
Definition: ESDetId.h:57
static bool ESDetId::validHashIndex ( int  hi)
inlinestatic

Definition at line 53 of file ESDetId.h.

References kSizeForDenseIndexing.

Referenced by unhashIndex(), and validDenseIndex().

int ESDetId::zside ( ) const
inline

Member Data Documentation

const unsigned short ESDetId::hx1
staticprivate

Definition at line 86 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hx2
staticprivate

Definition at line 90 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hxy1
staticprivate

Definition at line 85 of file ESDetId.h.

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

const unsigned short ESDetId::hxy2
staticprivate

Definition at line 89 of file ESDetId.h.

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

const unsigned short ESDetId::hy1
staticprivate

Definition at line 87 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hy2
staticprivate

Definition at line 91 of file ESDetId.h.

Referenced by 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 65 of file ESDetId.h.

const int ESDetId::PLANE_MAX =2
static

Definition at line 64 of file ESDetId.h.

Referenced by validDetId().

const int ESDetId::PLANE_MIN =1
static

Definition at line 63 of file ESDetId.h.

Referenced by validDetId().