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 (const DetId &id)
 
 HGCalDetId (ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell)
 
 HGCalDetId (uint32_t rawid)
 
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 (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
constexpr DetId (uint32_t id)
 Create an id from a raw number. 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.

6 : DetId() {}

◆ 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) {}

◆ 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.

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 }

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

◆ HGCalDetId() [4/4]

HGCalDetId::HGCalDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 33 of file HGCalDetId.cc.

33 { id_ = gen.rawId(); }

References DetId::id_.

Member Function Documentation

◆ cell()

int HGCalDetId::cell ( ) const
inline

◆ geometryCell()

HGCalDetId HGCalDetId::geometryCell ( ) const
inline

Converter for a geometry cell id

Definition at line 34 of file HGCalDetId.h.

34 { return id_ & kHGCalMaskCell; }

References DetId::id_, and kHGCalMaskCell.

◆ 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.

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 }

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().

◆ layer()

int HGCalDetId::layer ( ) const
inline

get the layer #

Definition at line 46 of file HGCalDetId.h.

46 { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }

References DetId::id_, kHGCalLayerMask, and kHGCalLayerOffset.

Referenced by HGCalRecHitValidation::analyze(), HGCalDigiValidation::analyze(), HGCalTBAnalyzer::analyzeRecHits(), HGCalTBAnalyzer::analyzeSimHits(), HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromTriggerCell(), HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell(), hgcal::RecHitTools::getLayer(), HGCalTriggerGeometryHexLayerBasedImp1::getModuleFromTriggerCell(), HGCalTriggerGeometryV9Imp1::getModuleFromTriggerCell(), HGCalTriggerGeometryHexLayerBasedImp1::getNeighborsFromTriggerCell(), HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell(), HGCalTriggerGeometryHexLayerBasedImp1::getOrderedTriggerCellsFromModule(), HGCalTriggerGeometryV9Imp1::getOrderedTriggerCellsFromModule(), HGCalTriggerGeometryV9Imp2::getOrderedTriggerCellsFromModule(), hgcal::RecHitTools::getSiThickness(), HGCalGeometry::getSummary(), HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellFromCell(), HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellsFromModule(), HGCalTriggerGeometryV9Imp1::getTriggerCellsFromModule(), HGCalTriggerGeometryV9Imp2::getTriggerCellsFromModule(), geometryXMLparser.DTAlignable::index(), geometryXMLparser.CSCAlignable::index(), HGCalTriggerTools::layer(), HGCalTriggerGeometryV9Imp2::layerWithOffset(), HGCalTriggerGeometryHexLayerBasedImp1::layerWithOffset(), and HGCalTriggerGeometryV9Imp1::layerWithOffset().

◆ operator=()

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

Assignment from a generic cell id

Definition at line 35 of file HGCalDetId.cc.

35  {
36  id_ = gen.rawId();
37  return (*this);
38 }

References DetId::id_.

◆ wafer()

int HGCalDetId::wafer ( ) const
inline

◆ waferType()

int HGCalDetId::waferType ( ) const
inline

◆ zside()

int HGCalDetId::zside ( ) const
inline

Member Data Documentation

◆ kHGCalCellMask

const int HGCalDetId::kHGCalCellMask = 0xFF
static

◆ kHGCalCellOffset

const int HGCalDetId::kHGCalCellOffset = 0
static

◆ kHGCalLayerMask

const int HGCalDetId::kHGCalLayerMask = 0x1F
static

◆ kHGCalLayerOffset

const int HGCalDetId::kHGCalLayerOffset = 19
static

◆ 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

◆ kHGCalWaferTypeMask

const int HGCalDetId::kHGCalWaferTypeMask = 0x1
static

◆ kHGCalWaferTypeOffset

const int HGCalDetId::kHGCalWaferTypeOffset = 18
static

◆ 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.

HGCalDetId::kHGCalWaferTypeMask
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:15
HGCalDetId::kHGCalWaferOffset
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HGCalDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCalDetId.h:19
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
HGCalDetId::kHGCalMaskCell
static const int kHGCalMaskCell
Definition: HGCalDetId.h:20
HGCalDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCalDetId.h:18
HGCalDetId::kHGCalWaferMask
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
gen
Definition: PythiaDecays.h:13
HGCEE
Definition: ForwardSubdetector.h:8
HGCalDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:16
DetId::id_
uint32_t id_
Definition: DetId.h:69
HGCalDetId::kHGCalWaferTypeOffset
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
HGCalDetId::wafer
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
HGCalDetId::kHGCalCellMask
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
HGCalDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCalDetId.h:17
HGCalDetId::kHGCalCellOffset
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
DetId::DetId
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38
HGCHEF
Definition: ForwardSubdetector.h:9
DetId::Forward
Definition: DetId.h:30
HGCalDetId::cell
int cell() const
get the absolute value of the cell #'s in x and y
Definition: HGCalDetId.h:37
HGCHEB
Definition: ForwardSubdetector.h:10