CMS 3D CMS Logo

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() [1/4]

HGCalDetId::HGCalDetId ( )

Create a null cellid

Definition at line 6 of file HGCalDetId.cc.

Referenced by geometryCell().

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

◆ HGCalDetId() [2/4]

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() [3/4]

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 cell(), gather_cfg::cout, DetId::id_, kHGCalCellMask, kHGCalCellOffset, kHGCalLayerMask, kHGCalLayerOffset, kHGCalWaferMask, kHGCalWaferOffset, kHGCalWaferTypeMask, kHGCalWaferTypeOffset, kHGCalZsideMask, kHGCalZsideOffset, and wafer().

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 }
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
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 cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:37
static const int kHGCalZsideMask
Definition: HGCalDetId.h:19
uint32_t id_
Definition: DetId.h:69
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
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() [4/4]

HGCalDetId::HGCalDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 33 of file HGCalDetId.cc.

References DetId::id_.

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

Member Function Documentation

◆ cell()

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(), HGCalDetId(), hgcal::RecHitTools::isHalfCell(), and isValid().

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

◆ geometryCell()

HGCalDetId HGCalDetId::geometryCell ( ) const
inline

Converter for a geometry cell id

Definition at line 34 of file HGCalDetId.h.

References HGCalDetId(), DetId::id_, and kHGCalMaskCell.

Referenced by HGCalTBGeometry::getGeometryDetId(), and HGCalGeometry::getGeometryDetId().

34 { return HGCalDetId(id_ & static_cast<uint32_t>(kHGCalMaskCell)); }
static const int kHGCalMaskCell
Definition: HGCalDetId.h:20
uint32_t id_
Definition: DetId.h:69

◆ isForward()

bool HGCalDetId::isForward ( ) const
inline

Definition at line 53 of file HGCalDetId.h.

53 { return true; }

◆ isHGCal()

bool HGCalDetId::isHGCal ( ) const
inline

consistency check : no bits left => no overhead

Definition at line 52 of file HGCalDetId.h.

52 { return true; }

◆ isValid()

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 cell(), gather_cfg::cout, HGCEE, HGCHEB, HGCHEF, kHGCalCellMask, kHGCalLayerMask, kHGCalWaferMask, kHGCalWaferTypeMask, convertSQLiteXML::ok, and wafer().

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 }
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
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 cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:37
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13

◆ layer()

int HGCalDetId::layer ( ) const
inline

◆ operator=()

HGCalDetId & HGCalDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 35 of file HGCalDetId.cc.

References DetId::id_.

35  {
36  id_ = gen.rawId();
37  return (*this);
38 }
uint32_t id_
Definition: DetId.h:69

◆ wafer()

int HGCalDetId::wafer ( ) const
inline

◆ waferType()

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

◆ zside()

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

◆ kHGCalCellMask

const int HGCalDetId::kHGCalCellMask = 0xFF
static

◆ kHGCalCellOffset

const int HGCalDetId::kHGCalCellOffset = 0
static

Definition at line 10 of file HGCalDetId.h.

Referenced by HGCalDetId().

◆ kHGCalLayerMask

const int HGCalDetId::kHGCalLayerMask = 0x1F
static

◆ kHGCalLayerOffset

const int HGCalDetId::kHGCalLayerOffset = 19
static

Definition at line 16 of file HGCalDetId.h.

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

◆ kHGCalMaskCell

const int HGCalDetId::kHGCalMaskCell = 0xFFFBFF00
static

Definition at line 20 of file HGCalDetId.h.

Referenced by geometryCell().

◆ kHGCalWaferMask

const int HGCalDetId::kHGCalWaferMask = 0x3FF
static

◆ kHGCalWaferOffset

const int HGCalDetId::kHGCalWaferOffset = 8
static

Definition at line 12 of file HGCalDetId.h.

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

◆ kHGCalWaferTypeMask

const int HGCalDetId::kHGCalWaferTypeMask = 0x1
static

Definition at line 15 of file HGCalDetId.h.

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

◆ kHGCalWaferTypeOffset

const int HGCalDetId::kHGCalWaferTypeOffset = 18
static

Definition at line 14 of file HGCalDetId.h.

Referenced by HGCalDetId(), and waferType().

◆ kHGCalZsideMask

const int HGCalDetId::kHGCalZsideMask = 0x1
static

Definition at line 19 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().

◆ kHGCalZsideOffset

const int HGCalDetId::kHGCalZsideOffset = 24
static

Definition at line 18 of file HGCalDetId.h.

Referenced by HGCalDetId(), and zside().

◆ Undefined

const HGCalDetId HGCalDetId::Undefined
static

Definition at line 56 of file HGCalDetId.h.