CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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
constexpr Detector det () const
 get the detector field from this detid More...
 
constexpr DetId ()
 Create an empty or null id (also for persistence) More...
 
constexpr DetId (uint32_t id)
 Create an id from a raw number. More...
 
constexpr DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
constexpr bool null () const
 is this a null id ? More...
 
constexpr operator uint32_t () const
 
constexpr bool operator!= (DetId id) const
 inequality More...
 
constexpr uint32_t operator() () const
 
constexpr bool operator< (DetId id) const
 comparison More...
 
constexpr bool operator== (DetId id) const
 equality More...
 
constexpr uint32_t rawId () const
 get the raw id More...
 
constexpr 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 = 0xFFFBFF00
 
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 kDetMask = 0xF
 
static const int kDetOffset = 28
 
static const int kSubdetMask = 0x7
 
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, VeryForward = 7, HGCalEE = 8,
  HGCalHSi = 9, HGCalHSc = 10, HGCalTrigger = 11
}
 
- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

Definition at line 8 of file HGCalDetId.h.

Constructor & Destructor Documentation

HGCalDetId::HGCalDetId ( )

Create a null cellid

Definition at line 6 of file HGCalDetId.cc.

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

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

Definition at line 8 of file HGCalDetId.cc.

8 : DetId(rawid) {}
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38
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 10 of file HGCalDetId.cc.

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

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

Constructor from a generic cell id

Definition at line 33 of file HGCalDetId.cc.

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

33 { id_ = gen.rawId(); }
uint32_t id_
Definition: DetId.h:69

Member Function Documentation

int HGCalDetId::cell ( ) const
inline

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

Definition at line 37 of file HGCalDetId.h.

References DetId::id_, and kHGCalCellMask.

Referenced by HGCalTBAnalyzer::analyzeRecHits(), hgcal::RecHitTools::getCell(), and hgcal::RecHitTools::isHalfCell().

37 { return id_ & kHGCalCellMask; }
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
uint32_t id_
Definition: DetId.h:69
HGCalDetId HGCalDetId::geometryCell ( ) const
inline

Converter for a geometry cell id

Definition at line 34 of file HGCalDetId.h.

References DetId::id_, and kHGCalMaskCell.

Referenced by HGCalGeometry::getGeometryDetId().

34 { return id_ & kHGCalMaskCell; }
static const int kHGCalMaskCell
Definition: HGCalDetId.h:20
uint32_t id_
Definition: DetId.h:69
bool HGCalDetId::isForward ( ) const
inline

Definition at line 53 of file HGCalDetId.h.

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

consistency check : no bits left => no overhead

Definition at line 52 of file HGCalDetId.h.

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

Definition at line 40 of file HGCalDetId.cc.

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

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

40  {
41  bool ok = ((subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB) && (cell >= 0 && cell <= kHGCalCellMask) &&
42  (wafer >= 0 && wafer <= kHGCalWaferMask) && (wafertype <= kHGCalWaferTypeMask) &&
43  (lay >= 0 && lay <= kHGCalLayerMask) && (zp == -1 || zp == 1));
44 #ifdef DebugLog
45  if (!ok)
46  std::cout << "HGCalDetId: subdet " << subdet << ":" << (subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB)
47  << " Cell " << cell << ":" << (cell >= 0 && cell <= kHGCalCellMask) << " Wafer " << wafer << ":"
48  << (wafer >= 0 && wafer <= kHGCalWaferMask) << " WaferType " << wafertype << ":"
49  << (wafertype <= kHGCalWaferTypeMask) << " Layer " << lay << ":" << (lay >= 0 && lay <= kHGCalLayerMask)
50  << " zp " << zp << ":" << (zp == -1 || zp == 1) << std::endl;
51 #endif
52  return ok;
53 }
static const int kHGCalLayerMask
Definition: HGCalDetId.h:17
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:15
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:37
tuple cout
Definition: gather_cfg.py:144
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
int HGCalDetId::layer ( ) const
inline
HGCalDetId & HGCalDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 35 of file HGCalDetId.cc.

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

35  {
36  id_ = gen.rawId();
37  return (*this);
38 }
uint32_t id_
Definition: DetId.h:69
int HGCalDetId::wafer ( ) const
inline
int HGCalDetId::waferType ( ) const
inline

get the wafer type

Definition at line 43 of file HGCalDetId.h.

References DetId::id_, kHGCalWaferTypeMask, and kHGCalWaferTypeOffset.

Referenced by hgcal::RecHitTools::getRadiusToSide(), and hgcal::RecHitTools::isHalfCell().

43 { return ((id_ >> kHGCalWaferTypeOffset) & kHGCalWaferTypeMask ? 1 : -1); }
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:15
uint32_t id_
Definition: DetId.h:69
int HGCalDetId::zside ( ) const
inline

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

Definition at line 49 of file HGCalDetId.h.

References DetId::id_, kHGCalZsideMask, and kHGCalZsideOffset.

Referenced by HGCalTriggerGeometryV9Imp2::getOrderedTriggerCellsFromModule(), HGCalTriggerGeometryV9Imp2::getTriggerCellsFromModule(), and hgcal::RecHitTools::zside().

49 { return ((id_ >> kHGCalZsideOffset) & kHGCalZsideMask ? 1 : -1); }
static const int kHGCalZsideMask
Definition: HGCalDetId.h:19
uint32_t id_
Definition: DetId.h:69
static const int kHGCalZsideOffset
Definition: HGCalDetId.h:18

Member Data Documentation

const int HGCalDetId::kHGCalCellMask = 0xFF
static
const int HGCalDetId::kHGCalCellOffset = 0
static

Definition at line 10 of file HGCalDetId.h.

Referenced by HGCalDetId().

const int HGCalDetId::kHGCalLayerMask = 0x1F
static
const int HGCalDetId::kHGCalLayerOffset = 19
static

Definition at line 16 of file HGCalDetId.h.

Referenced by HGCalDetId(), layer(), and HGCalTriggerGeometryV9Imp2::packLayerModuleId().

const int HGCalDetId::kHGCalMaskCell = 0xFFFBFF00
static

Definition at line 20 of file HGCalDetId.h.

Referenced by geometryCell().

const int HGCalDetId::kHGCalWaferMask = 0x3FF
static
const int HGCalDetId::kHGCalWaferOffset = 8
static

Definition at line 12 of file HGCalDetId.h.

Referenced by HGCalDetId(), HGCalTriggerGeometryV9Imp2::packLayerModuleId(), and wafer().

const int HGCalDetId::kHGCalWaferTypeMask = 0x1
static

Definition at line 15 of file HGCalDetId.h.

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

const int HGCalDetId::kHGCalWaferTypeOffset = 18
static

Definition at line 14 of file HGCalDetId.h.

Referenced by HGCalDetId(), and waferType().

const int HGCalDetId::kHGCalZsideMask = 0x1
static

Definition at line 19 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().

const int HGCalDetId::kHGCalZsideOffset = 24
static

Definition at line 18 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().

const HGCalDetId HGCalDetId::Undefined
static

Definition at line 56 of file HGCalDetId.h.