test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ESDetId.h
Go to the documentation of this file.
1 #ifndef ECALDETID_ESDETID_H
2 #define ECALDETID_ESDETID_H
3 
4 #include <iosfwd>
7 
14 class ESDetId : public DetId {
15  public:
16 
17  enum { Subdet = EcalPreshower } ;
19  ESDetId(){}
21  ESDetId( uint32_t rawid ) : DetId( rawid ) {}
22 
23 
25  ESDetId(int strip, int ixs, int iys, int plane, int iz, bool doverify=false) :
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  }
35 
37  ESDetId(const DetId& id);
39  ESDetId& operator=(const DetId& id);
40 
44  int zside() const { return (id_&0x80000)?(1):(-1); }
46  int plane() const { return ((id_>>18)&0x1)+1; }
48  int six() const { return (id_>>6)&0x3F; }
50  int siy() const { return (id_>>12)&0x3F; }
52  int strip() const { return (id_&0x3F); }
54  int hashedIndex() const ;
55 
56  uint32_t denseIndex() const { return hashedIndex() ; }
57 
58  static bool validDenseIndex( uint32_t din ) { return validHashIndex( din ) ; }
59 
60  static ESDetId detIdFromDenseIndex( uint32_t din ) { return unhashIndex( din ) ; }
61 
63  static ESDetId unhashIndex( int hi ) ;
64  static bool validHashIndex( int hi ) { return ( hi < kSizeForDenseIndexing ) ; }
66  static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz) ;
67  static void verify(int istrip, int ixs, int iys, int iplane, int iz) ;
68 
69 
70  static const int IX_MIN=1;
71  static const int IY_MIN=1;
72  static const int IX_MAX=40;
73  static const int IY_MAX=40;
74  static const int ISTRIP_MIN=1;
75  static const int ISTRIP_MAX=32;
76  static const int PLANE_MIN=1;
77  static const int PLANE_MAX=2;
78  static const int IZ_NUM=2;
79 
80  private :
81 
82  enum { 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
91  kNc =kXYMAX - kXYMIN + 1,
93  kLd =kNd,
96  kLa =kLb*kNa } ;
97 
98  static const unsigned short hxy1[ kXMAX ][ kYMAX ] ;
99  static const unsigned short hx1[ kXYMAX ] ;
100  static const unsigned short hy1[ kXYMAX ] ;
101 
102  static const unsigned short hxy2[ kXMAX ][ kYMAX ] ;
103  static const unsigned short hx2[ kXYMAX ] ;
104  static const unsigned short hy2[ kXYMAX ] ;
105 
106  public:
107 
109 
110 };
111 
112 std::ostream& operator<<(std::ostream&,const ESDetId& id);
113 
114 inline
115 ESDetId::ESDetId( const DetId& gen ) : 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 }
126 
127 inline
128 ESDetId&
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 }
142 
143 
144 #endif
static bool validDenseIndex(uint32_t din)
Definition: ESDetId.h:58
int strip() const
Definition: ESDetId.h:52
ESDetId(uint32_t rawid)
Definition: ESDetId.h:21
ESDetId(int strip, int ixs, int iys, int plane, int iz, bool doverify=false)
constructor from strip, ix, iy, plane, and iz
Definition: ESDetId.h:25
static const unsigned short hy2[kXYMAX]
Definition: ESDetId.h:104
static const unsigned short hxy2[kXMAX][kYMAX]
Definition: ESDetId.h:102
static const unsigned short hy1[kXYMAX]
Definition: ESDetId.h:100
static const int IY_MAX
Definition: ESDetId.h:73
int six() const
Definition: ESDetId.h:48
static const int ISTRIP_MAX
Definition: ESDetId.h:75
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
ESDetId & operator=(const DetId &id)
Definition: ESDetId.h:129
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
static const int PLANE_MIN
Definition: ESDetId.h:76
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static void verify(int istrip, int ixs, int iys, int iplane, int iz)
Definition: ESDetId.cc:6
int siy() const
Definition: ESDetId.h:50
static const int PLANE_MAX
Definition: ESDetId.h:77
ESDetId()
Definition: ESDetId.h:19
int zside() const
Definition: ESDetId.h:44
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static ESDetId detIdFromDenseIndex(uint32_t din)
Definition: ESDetId.h:60
uint32_t denseIndex() const
Definition: ESDetId.h:56
static const unsigned short hxy1[kXMAX][kYMAX]
Definition: ESDetId.h:98
Definition: DetId.h:18
static const int IY_MIN
Definition: ESDetId.h:71
static const int IZ_NUM
Definition: ESDetId.h:78
static const unsigned short hx2[kXYMAX]
Definition: ESDetId.h:103
uint32_t id_
Definition: DetId.h:55
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:22
bool null() const
is this a null id ?
Definition: DetId.h:45
static const int IX_MAX
Definition: ESDetId.h:72
int plane() const
Definition: ESDetId.h:46
static ESDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: ESDetId.cc:62
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
EcalSubdetector
EcalSubdetector subdet() const
get the subdetector
Definition: ESDetId.h:42
static const unsigned short hx1[kXYMAX]
Definition: ESDetId.h:99
static const int ISTRIP_MIN
Definition: ESDetId.h:74
static bool validHashIndex(int hi)
Definition: ESDetId.h:64
static const int IX_MIN
Definition: ESDetId.h:70
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
Definition: ESDetId.cc:44