test
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, 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 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:6
uint32_t id_
Definition: DetId.h:55
int plane() const
Definition: ESDetId.h:46
ESDetId::ESDetId ( const DetId id)
inline

constructor from a generic DetId

Definition at line 115 of file ESDetId.h.

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

115  : DetId(gen)
116 {
117 #ifdef EDM_ML_DEBUG
118  if( !gen.null() &&
119  ( gen.det() != Ecal ||
120  gen.subdetId() != EcalPreshower ) )
121  {
122  throw cms::Exception("InvalidDetId");
123  }
124 #endif
125 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###

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:44
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: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, kLb, kLc, kLd, plane(), six(), siy(), strip(), and zside().

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

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: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)
inline

assignment from a generic DetId

Definition at line 129 of file ESDetId.h.

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

130 {
131 #ifdef EDM_ML_DEBUG
132  if (!gen.null() &&
133  ( gen.det() != Ecal ||
134  gen.subdetId() != EcalPreshower ) )
135  {
136  throw cms::Exception("InvalidDetId");
137  }
138 #endif
139  id_=gen.rawId();
140  return *this;
141 }
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
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 62 of file ESDetId.cc.

References ESDetId(), hx1, hx2, hy1, hy2, cuy::ib, 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 }
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 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(), CaloGenericDetId::validDetId(), 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: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 6 of file ESDetId.cc.

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

Referenced by ESDetId().

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: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:22
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().