CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes
HGCalTestNumbering Class Reference

#include <HGCalTestNumbering.h>

Public Member Functions

 HGCalTestNumbering ()
 
virtual ~HGCalTestNumbering ()
 

Static Public Member Functions

static bool isValidHexagon (int subdet, int z, int lay, int wafer, int celltyp, int cell)
 
static bool isValidSquare (int z, int lay, int sec, int subsec, int cell)
 
static uint32_t packHexagonIndex (int subdet, int z, int lay, int wafer, int celltyp, int cell)
 
static uint32_t packSquareIndex (int z, int lay, int sec, int subsec, int cell)
 
static void unpackHexagonIndex (const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
 
static void unpackSquareIndex (const uint32_t &idx, int &z, int &lay, int &sec, int &subsec, int &cell)
 

Static Public Attributes

static const int kHGCalCellHMask = 0xFF
 
static const int kHGCalCellHOffset = 0
 
static const int kHGCalCellSMask = 0xFFFF
 
static const int kHGCalCellSOffset = 0
 
static const int kHGCalCellTypHMask = 0x1
 
static const int kHGCalCellTypHOffset = 8
 
static const int kHGCalLayerHMask = 0x7F
 
static const int kHGCalLayerHOffset = 19
 
static const int kHGCalLayerSMask = 0x7F
 
static const int kHGCalLayerSOffset = 24
 
static const int kHGCalSectorSMask = 0x7F
 
static const int kHGCalSectorSOffset = 16
 
static const int kHGCalSubdetHMask = 0x7
 
static const int kHGCalSubdetHOffset = 27
 
static const int kHGCalSubSectorSMask = 0x1
 
static const int kHGCalSubSectorSOffset = 23
 
static const int kHGCalWaferHMask = 0x3FF
 
static const int kHGCalWaferHOffset = 9
 
static const int kHGCalZsideHMask = 0x1
 
static const int kHGCalZsideHOffset = 26
 
static const int kHGCalZsideSMask = 0x1
 
static const int kHGCalZsideSOffset = 31
 

Detailed Description

Definition at line 9 of file HGCalTestNumbering.h.

Constructor & Destructor Documentation

◆ HGCalTestNumbering()

HGCalTestNumbering::HGCalTestNumbering ( )
inline

Definition at line 34 of file HGCalTestNumbering.h.

34 {}

◆ ~HGCalTestNumbering()

virtual HGCalTestNumbering::~HGCalTestNumbering ( )
inlinevirtual

Definition at line 35 of file HGCalTestNumbering.h.

35 {}

Member Function Documentation

◆ isValidHexagon()

bool HGCalTestNumbering::isValidHexagon ( int  subdet,
int  z,
int  lay,
int  wafer,
int  celltyp,
int  cell 
)
static

Definition at line 68 of file HGCalTestNumbering.cc.

References kHGCalCellHMask, kHGCalCellTypHMask, kHGCalLayerSMask, kHGCalSubdetHMask, and kHGCalWaferHMask.

Referenced by packHexagonIndex().

68  {
69  if (cell > kHGCalCellHMask || celltyp > kHGCalCellTypHMask || wafer > kHGCalWaferHMask || lay > kHGCalLayerSMask ||
70  subdet > kHGCalSubdetHMask) {
71  edm::LogWarning("HGCSim") << "[HGCalTestNumbering] request for new id for layer=" << lay << " zp=" << zp
72  << " wafer=" << wafer << " celltyp=" << celltyp << " cell=" << cell
73  << " for subdet=" << subdet
74  << " has one or more fields out of bounds and will be reset *****";
75  return false;
76  }
77  return true;
78 }
static const int kHGCalWaferHMask
static const int kHGCalCellHMask
static const int kHGCalSubdetHMask
static const int kHGCalCellTypHMask
Log< level::Warning, false > LogWarning
static const int kHGCalLayerSMask

◆ isValidSquare()

bool HGCalTestNumbering::isValidSquare ( int  z,
int  lay,
int  sec,
int  subsec,
int  cell 
)
static

Definition at line 56 of file HGCalTestNumbering.cc.

References gather_cfg::cout, kHGCalCellSMask, kHGCalLayerSMask, kHGCalSectorSMask, kHGCalSubSectorSMask, and fileinputsource_cfi::sec.

Referenced by packSquareIndex().

56  {
57  if (cell > kHGCalCellSMask || sec > kHGCalSectorSMask || subsec > kHGCalSubSectorSMask || lay > kHGCalLayerSMask) {
58 #ifdef EDM_ML_DEBUG
59  std::cout << "[HGCalTestNumbering] request for new id for layer=" << lay << " zp=" << zp << " sector=" << sec
60  << " subsec=" << subsec << " cell=" << cell << " has one or more fields out of bounds and will be reset"
61  << std::endl;
62 #endif
63  return false;
64  }
65  return true;
66 }
static const int kHGCalSubSectorSMask
static const int kHGCalCellSMask
static const int kHGCalSectorSMask
static const int kHGCalLayerSMask

◆ packHexagonIndex()

uint32_t HGCalTestNumbering::packHexagonIndex ( int  subdet,
int  z,
int  lay,
int  wafer,
int  celltyp,
int  cell 
)
static

Definition at line 22 of file HGCalTestNumbering.cc.

References isValidHexagon(), kHGCalCellHMask, kHGCalCellHOffset, kHGCalCellTypHMask, kHGCalCellTypHOffset, kHGCalLayerHMask, kHGCalLayerHOffset, kHGCalSubdetHMask, kHGCalSubdetHOffset, kHGCalWaferHMask, kHGCalWaferHOffset, kHGCalZsideHMask, and kHGCalZsideHOffset.

Referenced by HGCalTB23Analyzer::analyzeSimHits(), HGCalTBAnalyzer::analyzeSimHits(), and HGCNumberingScheme::getUnitID().

22  {
23  if (!HGCalTestNumbering::isValidHexagon(subdet, zp, lay, wafer, celltyp, cell)) {
24  subdet = zp = lay = wafer = celltyp = cell = 0;
25  }
26 
27  uint32_t rawid = 0;
28  rawid |= ((cell & kHGCalCellHMask) << kHGCalCellHOffset);
29  rawid |= ((celltyp & kHGCalCellTypHMask) << kHGCalCellTypHOffset);
30  rawid |= ((wafer & kHGCalWaferHMask) << kHGCalWaferHOffset);
31  rawid |= ((lay & kHGCalLayerHMask) << kHGCalLayerHOffset);
32  if (zp > 0)
33  rawid |= ((zp & kHGCalZsideHMask) << kHGCalZsideHOffset);
34  rawid |= ((subdet & kHGCalSubdetHMask) << kHGCalSubdetHOffset);
35  return rawid;
36 }
static const int kHGCalZsideHMask
static const int kHGCalWaferHMask
static const int kHGCalZsideHOffset
static const int kHGCalCellHMask
static const int kHGCalSubdetHMask
static bool isValidHexagon(int subdet, int z, int lay, int wafer, int celltyp, int cell)
static const int kHGCalLayerHOffset
static const int kHGCalCellHOffset
static const int kHGCalLayerHMask
static const int kHGCalWaferHOffset
static const int kHGCalCellTypHMask
static const int kHGCalCellTypHOffset
static const int kHGCalSubdetHOffset

◆ packSquareIndex()

uint32_t HGCalTestNumbering::packSquareIndex ( int  z,
int  lay,
int  sec,
int  subsec,
int  cell 
)
static

Definition at line 5 of file HGCalTestNumbering.cc.

References isValidSquare(), kHGCalCellSMask, kHGCalCellSOffset, kHGCalLayerSMask, kHGCalLayerSOffset, kHGCalSectorSMask, kHGCalSectorSOffset, kHGCalSubSectorSMask, kHGCalSubSectorSOffset, kHGCalZsideSMask, kHGCalZsideSOffset, and fileinputsource_cfi::sec.

5  {
6  if (!HGCalTestNumbering::isValidSquare(zp, lay, sec, subsec, lay)) {
7  zp = lay = sec = subsec = cell = 0;
8  }
9 
10  uint32_t rawid = 0;
11  rawid |= ((cell & kHGCalCellSMask) << kHGCalCellSOffset);
12  rawid |= ((sec & kHGCalSectorSMask) << kHGCalSectorSOffset);
13  if (subsec < 0)
14  subsec = 0;
15  rawid |= ((subsec & kHGCalSubSectorSMask) << kHGCalSubSectorSOffset);
16  rawid |= ((lay & kHGCalLayerSMask) << kHGCalLayerSOffset);
17  if (zp > 0)
18  rawid |= ((zp & kHGCalZsideSMask) << kHGCalZsideSOffset);
19  return rawid;
20 }
static const int kHGCalSubSectorSMask
static const int kHGCalCellSMask
static const int kHGCalZsideSMask
static const int kHGCalLayerSOffset
static const int kHGCalSectorSMask
static const int kHGCalZsideSOffset
static bool isValidSquare(int z, int lay, int sec, int subsec, int cell)
static const int kHGCalSubSectorSOffset
static const int kHGCalCellSOffset
static const int kHGCalLayerSMask
static const int kHGCalSectorSOffset

◆ unpackHexagonIndex()

void HGCalTestNumbering::unpackHexagonIndex ( const uint32_t &  idx,
int &  subdet,
int &  z,
int &  lay,
int &  wafer,
int &  celltyp,
int &  cell 
)
static

Definition at line 46 of file HGCalTestNumbering.cc.

References heavyIonCSV_trainingSettings::idx, kHGCalCellHMask, kHGCalCellHOffset, kHGCalCellTypHMask, kHGCalCellTypHOffset, kHGCalLayerHMask, kHGCalLayerHOffset, kHGCalSubdetHMask, kHGCalSubdetHOffset, kHGCalWaferHMask, kHGCalWaferHOffset, kHGCalZsideHMask, and kHGCalZsideHOffset.

Referenced by HGCalTimingAnalyzer::analyzeSimHits(), HGCalTB23Analyzer::analyzeSimHits(), HGCalTBAnalyzer::analyzeSimHits(), CaloParticleDebugger::fillSimHits(), CaloTruthAccumulator::fillSimHits(), HGCNumberingScheme::getUnitID(), and HGCSD::setDetUnitId().

47  {
52  zp = ((idx >> kHGCalZsideHOffset) & kHGCalZsideHMask ? 1 : -1);
54 }
static const int kHGCalZsideHMask
static const int kHGCalWaferHMask
static const int kHGCalZsideHOffset
static const int kHGCalCellHMask
static const int kHGCalSubdetHMask
static const int kHGCalLayerHOffset
static const int kHGCalCellHOffset
static const int kHGCalLayerHMask
static const int kHGCalWaferHOffset
static const int kHGCalCellTypHMask
static const int kHGCalCellTypHOffset
static const int kHGCalSubdetHOffset

◆ unpackSquareIndex()

void HGCalTestNumbering::unpackSquareIndex ( const uint32_t &  idx,
int &  z,
int &  lay,
int &  sec,
int &  subsec,
int &  cell 
)
static

Definition at line 38 of file HGCalTestNumbering.cc.

References heavyIonCSV_trainingSettings::idx, kHGCalCellSMask, kHGCalCellSOffset, kHGCalLayerSMask, kHGCalLayerSOffset, kHGCalSectorSMask, kHGCalSectorSOffset, kHGCalSubSectorSMask, kHGCalSubSectorSOffset, kHGCalZsideSMask, kHGCalZsideSOffset, and fileinputsource_cfi::sec.

38  {
40  subsec = ((idx >> kHGCalSubSectorSOffset) & kHGCalSubSectorSMask ? 1 : -1);
43  zp = ((idx >> kHGCalZsideSOffset) & kHGCalZsideSMask ? 1 : -1);
44 }
static const int kHGCalSubSectorSMask
static const int kHGCalCellSMask
static const int kHGCalZsideSMask
static const int kHGCalLayerSOffset
static const int kHGCalSectorSMask
static const int kHGCalZsideSOffset
static const int kHGCalSubSectorSOffset
static const int kHGCalCellSOffset
static const int kHGCalLayerSMask
static const int kHGCalSectorSOffset

Member Data Documentation

◆ kHGCalCellHMask

const int HGCalTestNumbering::kHGCalCellHMask = 0xFF
static

Definition at line 23 of file HGCalTestNumbering.h.

Referenced by isValidHexagon(), packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalCellHOffset

const int HGCalTestNumbering::kHGCalCellHOffset = 0
static

Definition at line 22 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalCellSMask

const int HGCalTestNumbering::kHGCalCellSMask = 0xFFFF
static

Definition at line 12 of file HGCalTestNumbering.h.

Referenced by isValidSquare(), packSquareIndex(), and unpackSquareIndex().

◆ kHGCalCellSOffset

const int HGCalTestNumbering::kHGCalCellSOffset = 0
static

Definition at line 11 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

◆ kHGCalCellTypHMask

const int HGCalTestNumbering::kHGCalCellTypHMask = 0x1
static

Definition at line 25 of file HGCalTestNumbering.h.

Referenced by isValidHexagon(), packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalCellTypHOffset

const int HGCalTestNumbering::kHGCalCellTypHOffset = 8
static

Definition at line 24 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalLayerHMask

const int HGCalTestNumbering::kHGCalLayerHMask = 0x7F
static

Definition at line 29 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalLayerHOffset

const int HGCalTestNumbering::kHGCalLayerHOffset = 19
static

Definition at line 28 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalLayerSMask

const int HGCalTestNumbering::kHGCalLayerSMask = 0x7F
static

◆ kHGCalLayerSOffset

const int HGCalTestNumbering::kHGCalLayerSOffset = 24
static

Definition at line 17 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

◆ kHGCalSectorSMask

const int HGCalTestNumbering::kHGCalSectorSMask = 0x7F
static

Definition at line 14 of file HGCalTestNumbering.h.

Referenced by isValidSquare(), packSquareIndex(), and unpackSquareIndex().

◆ kHGCalSectorSOffset

const int HGCalTestNumbering::kHGCalSectorSOffset = 16
static

Definition at line 13 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

◆ kHGCalSubdetHMask

const int HGCalTestNumbering::kHGCalSubdetHMask = 0x7
static

Definition at line 33 of file HGCalTestNumbering.h.

Referenced by isValidHexagon(), packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalSubdetHOffset

const int HGCalTestNumbering::kHGCalSubdetHOffset = 27
static

Definition at line 32 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalSubSectorSMask

const int HGCalTestNumbering::kHGCalSubSectorSMask = 0x1
static

Definition at line 16 of file HGCalTestNumbering.h.

Referenced by isValidSquare(), packSquareIndex(), and unpackSquareIndex().

◆ kHGCalSubSectorSOffset

const int HGCalTestNumbering::kHGCalSubSectorSOffset = 23
static

Definition at line 15 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

◆ kHGCalWaferHMask

const int HGCalTestNumbering::kHGCalWaferHMask = 0x3FF
static

Definition at line 27 of file HGCalTestNumbering.h.

Referenced by isValidHexagon(), packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalWaferHOffset

const int HGCalTestNumbering::kHGCalWaferHOffset = 9
static

Definition at line 26 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalZsideHMask

const int HGCalTestNumbering::kHGCalZsideHMask = 0x1
static

Definition at line 31 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalZsideHOffset

const int HGCalTestNumbering::kHGCalZsideHOffset = 26
static

Definition at line 30 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

◆ kHGCalZsideSMask

const int HGCalTestNumbering::kHGCalZsideSMask = 0x1
static

Definition at line 20 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

◆ kHGCalZsideSOffset

const int HGCalTestNumbering::kHGCalZsideSOffset = 31
static

Definition at line 19 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().