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, Forward =6
}
 

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

Member Enumeration Documentation

anonymous enum
Enumerator
Subdet 

Definition at line 17 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 82 of file ESDetId.h.

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

Definition at line 108 of file ESDetId.h.

Constructor & Destructor Documentation

ESDetId::ESDetId ( )
inline

Constructor of a null id

Definition at line 19 of file ESDetId.h.

Referenced by unhashIndex().

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

Constructor from a raw value

Definition at line 21 of file ESDetId.h.

21 : 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 25 of file ESDetId.h.

References DetId::id_, and verify().

25  :
27  id_ |= (strip&0x3F) |
28  ((ixs&0x3F)<<6) |
29  ((iys&0x3F)<<12) |
30  (((plane-1)&0x1)<<18) |
31  ((iz>0)?(1<<19):(0))
32  ;
33  if (doverify) verify(strip, ixs, iys, plane, iz);
34  }
int strip() const
Definition: ESDetId.h:52
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:18
uint32_t id_
Definition: DetId.h:55
int plane() const
Definition: ESDetId.h:46
ESDetId::ESDetId ( const DetId id)

constructor from a generic DetId

Definition at line 6 of file ESDetId.cc.

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

7 {
8  if( !gen.null() &&
9  ( gen.det() != Ecal ||
10  gen.subdetId() != EcalPreshower ) )
11  {
12  throw cms::Exception("InvalidDetId");
13  }
14  id_ = gen.rawId() ;
15 }
uint32_t id_
Definition: DetId.h:55

Member Function Documentation

uint32_t ESDetId::denseIndex ( ) const
inline

Definition at line 56 of file ESDetId.h.

References hashedIndex().

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

Definition at line 60 of file ESDetId.h.

References unhashIndex().

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

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

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

Definition at line 69 of file ESDetId.cc.

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

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

70 {
71  const int ia ( 1 == zside() ? 2 : 1 ) ;
72  const int ib ( plane() ) ;
73  const int ix ( six() ) ;
74  const int iy ( siy() ) ;
75  const int ic ( 1 == ib ?
76  hxy1[ ix - 1 ][ iy - 1 ] :
77  hxy2[ ix - 1 ][ iy - 1 ] ) ;
78  const int id ( strip() ) ;
79 
80  return ( ( ia - 1 )*kLb +
81  ( ib - 1 )*kLc +
82  ( ic - 1 )*kLd +
83  id - 1 ) ;
84 }
int strip() const
Definition: ESDetId.h:52
int ib
Definition: cuy.py:660
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:102
int six() const
Definition: ESDetId.h:48
int siy() const
Definition: ESDetId.h:50
int zside() const
Definition: ESDetId.h:44
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:98
int plane() const
Definition: ESDetId.h:46
ESDetId & ESDetId::operator= ( const DetId id)

assignment from a generic DetId

Definition at line 56 of file ESDetId.cc.

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

57 {
58  if (!gen.null() &&
59  ( gen.det() != Ecal ||
60  gen.subdetId() != EcalPreshower ) )
61  {
62  throw cms::Exception("InvalidDetId");
63  }
64  id_=gen.rawId();
65  return *this;
66 }
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 42 of file ESDetId.h.

References DetId::subdetId().

42 { 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 87 of file ESDetId.cc.

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

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

88 {
89  if( validHashIndex( hi ) )
90  {
91  const int id ( hi%kLd + 1 ) ;
92  const int nd ( hi - id + 1 ) ;
93  const int ic ( ( nd%kLc )/kLd + 1 ) ;
94  const int nc ( nd - ( ic - 1 )*kLd ) ;
95  const int ib ( ( nc%kLb )/kLc + 1 ) ;
96  const int nb ( nc - ( ib - 1 )*kLc ) ;
97  const int ia ( nb/kLb + 1 );// + 1 ) ;
98 
99  const int st ( id ) ;
100  const int pl ( ib ) ;
101  int ix ;
102  int iy ;
103  const int ic1 ( ic - 1 ) ;
104  if( 1 == pl )
105  {
106  ix = hx1[ ic1 ] ;
107  iy = hy1[ ic1 ] ;
108  }
109  else
110  {
111  ix = hx2[ ic1 ] ;
112  iy = hy2[ ic1 ] ;
113  }
114  const int iz ( 1 == ia ? -1 : 1 ) ;
115 
116  return ESDetId( st, ix, iy, pl, iz ) ;
117  }
118  else
119  {
120  return ESDetId() ;
121  }
122 }
int ib
Definition: cuy.py:660
static const unsigned short hy2[kXYMAX]
Definition: ESDetId.h:104
static const unsigned short hy1[kXYMAX]
Definition: ESDetId.h:100
ESDetId()
Definition: ESDetId.h:19
static const unsigned short hx2[kXYMAX]
Definition: ESDetId.h:103
static const unsigned short hx1[kXYMAX]
Definition: ESDetId.h:99
static bool validHashIndex(int hi)
Definition: ESDetId.h:64
static bool ESDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 58 of file ESDetId.h.

References validHashIndex().

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

check if a valid index combination

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

39 {
40  return ( !( ( istrip < ISTRIP_MIN ) ||
41  ( istrip > ISTRIP_MAX ) ||
42  ( ixs < IX_MIN ) ||
43  ( ixs > IX_MAX ) ||
44  ( iys < IY_MIN ) ||
45  ( iys > IY_MAX ) ||
46  ( abs( iz ) != 1 ) ||
47  ( iplane < PLANE_MIN ) ||
48  ( iplane > PLANE_MAX ) ||
49  ( ( 1 == iplane ) &&
50  0 == hxy1[ixs-1][iys-1] ) ||
51  ( ( 2 == iplane ) &&
52  0 == hxy2[ixs-1][iys-1] ) ) ) ;
53 }
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:102
static const int IY_MAX
Definition: ESDetId.h:73
static const int ISTRIP_MAX
Definition: ESDetId.h:75
static const int PLANE_MIN
Definition: ESDetId.h:76
static const int PLANE_MAX
Definition: ESDetId.h:77
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:98
static const int IY_MIN
Definition: ESDetId.h:71
static const int IX_MAX
Definition: ESDetId.h:72
static const int ISTRIP_MIN
Definition: ESDetId.h:74
static const int IX_MIN
Definition: ESDetId.h:70
static bool ESDetId::validHashIndex ( int  hi)
inlinestatic

Definition at line 64 of file ESDetId.h.

References kSizeForDenseIndexing.

Referenced by unhashIndex(), and validDenseIndex().

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

Definition at line 18 of file ESDetId.cc.

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

Referenced by ESDetId().

23 {
24  if( !validDetId( strip, ixs, iys, plane, iz) )
25  throw cms::Exception("InvalidDetId")
26  << "ESDetId: Cannot create object. Indexes out of bounds \n"
27  << " strip = " << strip << " x = " << ixs << " y = " << iys << "\n"
28  << " plane = " << plane << " z = " << iz
29  << " hxy = " << (1==plane?hxy1[ixs-1][iys-1]:hxy2[ixs-1][iys-1])
30  << "\n";
31 }
int strip() const
Definition: ESDetId.h:52
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:102
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:98
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:34
int plane() const
Definition: ESDetId.h:46
int ESDetId::zside ( ) const
inline

Member Data Documentation

const unsigned short ESDetId::hx1
staticprivate

Definition at line 99 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hx2
staticprivate

Definition at line 103 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hxy1
staticprivate

Definition at line 98 of file ESDetId.h.

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

const unsigned short ESDetId::hxy2
staticprivate

Definition at line 102 of file ESDetId.h.

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

const unsigned short ESDetId::hy1
staticprivate

Definition at line 100 of file ESDetId.h.

Referenced by unhashIndex().

const unsigned short ESDetId::hy2
staticprivate

Definition at line 104 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 78 of file ESDetId.h.

const int ESDetId::PLANE_MAX =2
static

Definition at line 77 of file ESDetId.h.

Referenced by validDetId().

const int ESDetId::PLANE_MIN =1
static

Definition at line 76 of file ESDetId.h.

Referenced by validDetId().