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 ()
 
 HGCalDetId (uint32_t rawid)
 
 HGCalDetId (ForwardSubdetector subdet, int zp, int lay, int mod, int subsec, 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 sector () const
 get the sector # More...
 
int subsector () const
 get the degree subsector 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 mod, int subsec, int cell)
 

Static Public Attributes

static const int kHGCalCellMask = 0xFFFF
 
static const int kHGCalCellOffset = 0
 
static const int kHGCalLayerMask = 0x7F
 
static const int kHGCalLayerOffset = 24
 
static const int kHGCalSectorMask = 0x7F
 
static const int kHGCalSectorOffset = 16
 
static const int kHGCalSubSectorMask = 0x1
 
static const int kHGCalSubSectorOffset = 23
 
static const int kHGCalZsideMask = 0x1
 
static const int kHGCalZsideOffset = 31
 
- 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  mod,
int  subsec,
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, kHGCalSectorMask, kHGCalSectorOffset, kHGCalSubSectorMask, kHGCalSubSectorOffset, kHGCalZsideMask, and kHGCalZsideOffset.

12  : DetId(Forward,subdet) {
13 
14  if (cell > kHGCalCellMask || sec>kHGCalSectorMask ||
15  subsec > kHGCalSubSectorMask || lay>kHGCalLayerMask ) {
16 #ifdef DebugLog
17  std::cout << "[HGCalDetId] request for new id for layer=" << lay
18  << " @ zp=" << zp
19  << " sector=" << sec
20  << " subsec=" << subsec
21  << " cell=" << cell
22  << " for subdet=" << subdet
23  << " has one or more fields out of bounds and will be reset"
24  << std::endl;
25 #endif
26  cell=0; sec=0; subsec=0; lay=0;
27  }
28  uint32_t rawid=0;
29  rawid |= ((cell & kHGCalCellMask) << kHGCalCellOffset);
30  rawid |= ((sec & kHGCalSectorMask) << kHGCalSectorOffset);
31  if (subsec<0) subsec=0;
32  rawid |= ((subsec & kHGCalSubSectorMask) << kHGCalSubSectorOffset);
33  rawid |= ((lay & kHGCalLayerMask) << kHGCalLayerOffset);
34  if (zp>0) rawid |= ((zp & kHGCalZsideMask) << kHGCalZsideOffset);
35  id_ = rawid;
36 }
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:18
static const int kHGCalLayerMask
Definition: HGCalDetId.h:19
static const int kHGCalSubSectorMask
Definition: HGCalDetId.h:17
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 kHGCalSectorOffset
Definition: HGCalDetId.h:14
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:35
uint32_t id_
Definition: DetId.h:55
tuple cout
Definition: gather_cfg.py:121
static const int kHGCalZsideOffset
Definition: HGCalDetId.h:20
static const int kHGCalSubSectorOffset
Definition: HGCalDetId.h:16
static const int kHGCalSectorMask
Definition: HGCalDetId.h:15
HGCalDetId::HGCalDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 38 of file HGCalDetId.cc.

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

38  {
39  id_ = gen.rawId();
40 }
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 35 of file HGCalDetId.h.

References DetId::id_, and kHGCalCellMask.

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

Definition at line 51 of file HGCalDetId.h.

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

consistency check : no bits left => no overhead

Definition at line 50 of file HGCalDetId.h.

50 { return true; }
bool HGCalDetId::isValid ( ForwardSubdetector  subdet,
int  zp,
int  lay,
int  mod,
int  subsec,
int  cell 
)
static

Definition at line 47 of file HGCalDetId.cc.

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

Referenced by HGCNumberingScheme::getUnitID(), and core.AutoHandle.AutoHandle::ReallyLoad().

48  {
49  bool ok = ((subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB) &&
50  (cell >= 0 && cell <= kHGCalCellMask) &&
51  (mod >= 1 && mod <= kHGCalSectorMask) &&
52  (subsec == 0 || subsec == 1) &&
53  (lay >= 0 && lay <= kHGCalLayerMask) &&
54  (zp == -1 || zp == 1));
55 #ifdef DebugLog
56  if (!ok)
57  std::cout << "HGCalDetId: subdet " << subdet << ":"
58  << (subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB)
59  << " Cell " << cell << ":" << (cell >= 0 && cell <= 0xffff)
60  << " Module " << mod << ":" << (mod >= 1 && mod <= 0x7f)
61  << " SubSector " << subsec << ":" << (subsec == 0 || subsec == 1)
62  << " Layer " << lay << ":" << (lay >= 0 && lay <= 0x7f)
63  << " zp " << zp << ":" << (zp == -1 || zp == 1) << std::endl;
64 #endif
65  return ok;
66 }
static const int kHGCalLayerMask
Definition: HGCalDetId.h:19
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:35
tuple cout
Definition: gather_cfg.py:121
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
static const int kHGCalSectorMask
Definition: HGCalDetId.h:15
int HGCalDetId::layer ( ) const
inline

get the layer #

Definition at line 44 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 42 of file HGCalDetId.cc.

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

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

get the sector #

Definition at line 38 of file HGCalDetId.h.

References DetId::id_, kHGCalSectorMask, and kHGCalSectorOffset.

Referenced by geometryXMLparser.DTAlignable::index().

static const int kHGCalSectorOffset
Definition: HGCalDetId.h:14
uint32_t id_
Definition: DetId.h:55
static const int kHGCalSectorMask
Definition: HGCalDetId.h:15
int HGCalDetId::subsector ( ) const
inline

get the degree subsector

Definition at line 41 of file HGCalDetId.h.

References DetId::id_, kHGCalSubSectorMask, and kHGCalSubSectorOffset.

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

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

Definition at line 47 of file HGCalDetId.h.

References DetId::id_, kHGCalZsideMask, and kHGCalZsideOffset.

47 { 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 = 0xFFFF
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 = 0x7F
static

Definition at line 19 of file HGCalDetId.h.

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

const int HGCalDetId::kHGCalLayerOffset = 24
static

Definition at line 18 of file HGCalDetId.h.

Referenced by HGCalDetId(), and layer().

const int HGCalDetId::kHGCalSectorMask = 0x7F
static

Definition at line 15 of file HGCalDetId.h.

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

const int HGCalDetId::kHGCalSectorOffset = 16
static

Definition at line 14 of file HGCalDetId.h.

Referenced by HGCalDetId(), and sector().

const int HGCalDetId::kHGCalSubSectorMask = 0x1
static

Definition at line 17 of file HGCalDetId.h.

Referenced by HGCalDetId(), and subsector().

const int HGCalDetId::kHGCalSubSectorOffset = 23
static

Definition at line 16 of file HGCalDetId.h.

Referenced by HGCalDetId(), and subsector().

const int HGCalDetId::kHGCalZsideMask = 0x1
static

Definition at line 21 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().

const int HGCalDetId::kHGCalZsideOffset = 31
static

Definition at line 20 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().