CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes
HGCalDetId Class Reference

#include <HGCalDetId.h>

Inheritance diagram for HGCalDetId:
DetId

Public Member Functions

int cell () const
 get the absolute value of the cell #'s in x and y More...
 
HGCalDetId geometryCell () const
 
 HGCalDetId ()
 
 HGCalDetId (uint32_t rawid)
 
 HGCalDetId (ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell)
 
 HGCalDetId (const DetId &id)
 
bool isForward () const
 
bool isHGCal () const
 consistency check : no bits left => no overhead More...
 
int layer () const
 get the layer # More...
 
HGCalDetIdoperator= (const DetId &id)
 
int wafer () const
 get the wafer # More...
 
int waferType () const
 get the wafer type More...
 
int zside () const
 get the z-side of the cell (1/-1) More...
 
- 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 bool isValid (ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell)
 

Static Public Attributes

static const int kHGCalCellMask = 0xFF
 
static const int kHGCalCellOffset = 0
 
static const int kHGCalLayerMask = 0x1F
 
static const int kHGCalLayerOffset = 19
 
static const int kHGCalMaskCell = 0xFFFFFF00
 
static const int kHGCalWaferMask = 0x3FF
 
static const int kHGCalWaferOffset = 8
 
static const int kHGCalWaferTypeMask = 0x1
 
static const int kHGCalWaferTypeOffset = 18
 
static const int kHGCalZsideMask = 0x1
 
static const int kHGCalZsideOffset = 24
 
static const HGCalDetId Undefined
 
- Static Public Attributes inherited from DetId
static const int kDetOffset = 28
 
static const int kSubdetOffset = 25
 

Additional Inherited Members

- Public Types inherited from DetId
enum  Detector {
  Tracker =1, Muon =2, Ecal =3, Hcal =4,
  Calo =5, Forward =6
}
 
- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

Definition at line 9 of file HGCalDetId.h.

Constructor & Destructor Documentation

HGCalDetId::HGCalDetId ( )

Create a null cellid

Definition at line 6 of file HGCalDetId.cc.

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

Create cellid from raw id (0=invalid tower id)

Definition at line 9 of file HGCalDetId.cc.

9  : DetId(rawid) {
10 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
HGCalDetId::HGCalDetId ( ForwardSubdetector  subdet,
int  zp,
int  lay,
int  wafertype,
int  wafer,
int  cell 
)

Constructor from subdetector, zplus, layer, module, cell numbers

Definition at line 12 of file HGCalDetId.cc.

References gather_cfg::cout, DetId::id_, kHGCalCellMask, kHGCalCellOffset, kHGCalLayerMask, kHGCalLayerOffset, kHGCalWaferMask, kHGCalWaferOffset, kHGCalWaferTypeMask, kHGCalWaferTypeOffset, kHGCalZsideMask, and kHGCalZsideOffset.

12  : DetId(Forward,subdet) {
13 
14  if (wafertype < 0) wafertype = 0;
15  if (cell>kHGCalCellMask || cell<0 || wafer>kHGCalWaferMask || wafer<0 || wafertype>kHGCalWaferTypeMask || lay>kHGCalLayerMask || lay<0) {
16 #ifdef DebugLog
17  std::cout << "[HGCalDetId] request for new id for"
18  << " layer=" << lay << ":" << kHGCalLayerMask
19  << " @ zp=" << zp
20  << " wafer=" << wafer << ":" << kHGCalWaferMask
21  << " waferType=" << wafertype << ":" << kHGCalWaferTypeMask
22  << " cell=" << cell << ":" << kHGCalCellMask
23  << " for subdet=" << subdet
24  << " has one or more fields out of bounds and will be reset"
25  << std::endl;
26 #endif
27  zp = lay = wafertype = wafer = cell = 0;
28  }
31  id_ |= ((wafertype & kHGCalWaferTypeMask) << kHGCalWaferTypeOffset);
32  id_ |= ((lay & kHGCalLayerMask) << kHGCalLayerOffset);
33  if (zp>0) id_ |= ((zp & kHGCalZsideMask) << kHGCalZsideOffset);
34 }
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:18
static const int kHGCalLayerMask
Definition: HGCalDetId.h:19
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:16
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
static const int kHGCalCellOffset
Definition: HGCalDetId.h:12
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:17
int wafer() const
get the wafer #
Definition: HGCalDetId.h:42
static const int kHGCalZsideMask
Definition: HGCalDetId.h:21
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:39
uint32_t id_
Definition: DetId.h:55
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
tuple cout
Definition: gather_cfg.py:145
static const int kHGCalZsideOffset
Definition: HGCalDetId.h:20
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
HGCalDetId::HGCalDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 36 of file HGCalDetId.cc.

References DetId::id_, and DetId::rawId().

36  {
37  id_ = gen.rawId();
38 }
uint32_t id_
Definition: DetId.h:55

Member Function Documentation

int HGCalDetId::cell ( ) const
inline

get the absolute value of the cell #'s in x and y

Definition at line 39 of file HGCalDetId.h.

References DetId::id_, and kHGCalCellMask.

39 { return id_&kHGCalCellMask; }
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
uint32_t id_
Definition: DetId.h:55
HGCalDetId HGCalDetId::geometryCell ( ) const
inline

Converter for a geometry cell id

Definition at line 36 of file HGCalDetId.h.

References DetId::id_, and kHGCalMaskCell.

Referenced by HGCalGeometry::getGeometry(), HGCalGeometry::indexFor(), and HGCalGeometry::newCell().

36 {return id_&kHGCalMaskCell;}
static const int kHGCalMaskCell
Definition: HGCalDetId.h:22
uint32_t id_
Definition: DetId.h:55
bool HGCalDetId::isForward ( ) const
inline

Definition at line 55 of file HGCalDetId.h.

55 { return true; }
bool HGCalDetId::isHGCal ( ) const
inline

consistency check : no bits left => no overhead

Definition at line 54 of file HGCalDetId.h.

54 { return true; }
bool HGCalDetId::isValid ( ForwardSubdetector  subdet,
int  zp,
int  lay,
int  wafertype,
int  wafer,
int  cell 
)
static

Definition at line 45 of file HGCalDetId.cc.

References gather_cfg::cout, HGCEE, HGCHEB, HGCHEF, kHGCalCellMask, kHGCalLayerMask, kHGCalWaferMask, kHGCalWaferTypeMask, and convertSQLiteXML::ok.

Referenced by core.AutoHandle.AutoHandle::ReallyLoad().

45  {
46 
47  bool ok = ((subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB) &&
48  (cell >= 0 && cell <= kHGCalCellMask) &&
49  (wafer >= 0 && wafer <= kHGCalWaferMask) &&
50  (wafertype <= kHGCalWaferTypeMask) &&
51  (lay >= 0 && lay <= kHGCalLayerMask) &&
52  (zp == -1 || zp == 1));
53 #ifdef DebugLog
54  if (!ok)
55  std::cout << "HGCalDetId: subdet " << subdet << ":"
56  << (subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB)
57  << " Cell " << cell << ":" << (cell >= 0 && cell <= kHGCalCellMask)
58  << " Wafer " << wafer << ":" << (wafer >= 0 && wafer <= kHGCalWaferMask)
59  << " WaferType " << wafertype << ":" << (wafertype <= kHGCalWaferTypeMask)
60  << " Layer " << lay << ":" << (lay >= 0 && lay <= kHGCalLayerMask)
61  << " zp " << zp << ":" << (zp == -1 || zp == 1) << std::endl;
62 #endif
63  return ok;
64 }
static const int kHGCalLayerMask
Definition: HGCalDetId.h:19
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:17
int wafer() const
get the wafer #
Definition: HGCalDetId.h:42
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:39
tuple cout
Definition: gather_cfg.py:145
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
int HGCalDetId::layer ( ) const
inline

get the layer #

Definition at line 48 of file HGCalDetId.h.

References DetId::id_, kHGCalLayerMask, and kHGCalLayerOffset.

Referenced by geometryXMLparser.DTAlignable::index(), and geometryXMLparser.CSCAlignable::index().

static const int kHGCalLayerOffset
Definition: HGCalDetId.h:18
static const int kHGCalLayerMask
Definition: HGCalDetId.h:19
uint32_t id_
Definition: DetId.h:55
HGCalDetId & HGCalDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 40 of file HGCalDetId.cc.

References DetId::id_, and DetId::rawId().

40  {
41  id_ = gen.rawId();
42  return (*this);
43 }
uint32_t id_
Definition: DetId.h:55
int HGCalDetId::wafer ( ) const
inline

get the wafer #

Definition at line 42 of file HGCalDetId.h.

References DetId::id_, kHGCalWaferMask, and kHGCalWaferOffset.

uint32_t id_
Definition: DetId.h:55
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
int HGCalDetId::waferType ( ) const
inline

get the wafer type

Definition at line 45 of file HGCalDetId.h.

References DetId::id_, kHGCalWaferTypeMask, and kHGCalWaferTypeOffset.

45 { return ((id_>>kHGCalWaferTypeOffset)&kHGCalWaferTypeMask ? 1 : -1); }
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:16
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:17
uint32_t id_
Definition: DetId.h:55
int HGCalDetId::zside ( ) const
inline

get the z-side of the cell (1/-1)

Definition at line 51 of file HGCalDetId.h.

References DetId::id_, kHGCalZsideMask, and kHGCalZsideOffset.

51 { return ((id_>>kHGCalZsideOffset) & kHGCalZsideMask ? 1 : -1); }
static const int kHGCalZsideMask
Definition: HGCalDetId.h:21
uint32_t id_
Definition: DetId.h:55
static const int kHGCalZsideOffset
Definition: HGCalDetId.h:20

Member Data Documentation

const int HGCalDetId::kHGCalCellMask = 0xFF
static

Definition at line 13 of file HGCalDetId.h.

Referenced by cell(), HGCalDetId(), and isValid().

const int HGCalDetId::kHGCalCellOffset = 0
static

Definition at line 12 of file HGCalDetId.h.

Referenced by HGCalDetId().

const int HGCalDetId::kHGCalLayerMask = 0x1F
static

Definition at line 19 of file HGCalDetId.h.

Referenced by HGCalDetId(), isValid(), and layer().

const int HGCalDetId::kHGCalLayerOffset = 19
static

Definition at line 18 of file HGCalDetId.h.

Referenced by HGCalDetId(), and layer().

const int HGCalDetId::kHGCalMaskCell = 0xFFFFFF00
static

Definition at line 22 of file HGCalDetId.h.

Referenced by geometryCell().

const int HGCalDetId::kHGCalWaferMask = 0x3FF
static

Definition at line 15 of file HGCalDetId.h.

Referenced by HGCalDetId(), isValid(), and wafer().

const int HGCalDetId::kHGCalWaferOffset = 8
static

Definition at line 14 of file HGCalDetId.h.

Referenced by HGCalDetId(), and wafer().

const int HGCalDetId::kHGCalWaferTypeMask = 0x1
static

Definition at line 17 of file HGCalDetId.h.

Referenced by HGCalDetId(), isValid(), and waferType().

const int HGCalDetId::kHGCalWaferTypeOffset = 18
static

Definition at line 16 of file HGCalDetId.h.

Referenced by HGCalDetId(), and waferType().

const int HGCalDetId::kHGCalZsideMask = 0x1
static

Definition at line 21 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().

const int HGCalDetId::kHGCalZsideOffset = 24
static

Definition at line 20 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().

const HGCalDetId HGCalDetId::Undefined
static

Definition at line 59 of file HGCalDetId.h.