test
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
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 10 of file HGCalTestNumbering.h.

Constructor & Destructor Documentation

HGCalTestNumbering::HGCalTestNumbering ( )
inline

Definition at line 36 of file HGCalTestNumbering.h.

36 {}
virtual HGCalTestNumbering::~HGCalTestNumbering ( )
inlinevirtual

Definition at line 37 of file HGCalTestNumbering.h.

37 {}

Member Function Documentation

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

Definition at line 83 of file HGCalTestNumbering.cc.

References gather_cfg::cout, kHGCalCellHMask, kHGCalCellTypHMask, kHGCalLayerSMask, kHGCalSubdetHMask, and kHGCalWaferHMask.

Referenced by packHexagonIndex().

84  {
85 
86  if (cell > kHGCalCellHMask || celltyp>kHGCalCellTypHMask ||
87  wafer > kHGCalWaferHMask || lay>kHGCalLayerSMask ||
88  subdet > kHGCalSubdetHMask) {
89 #ifdef DebugLog
90  std::cout << "[HGCalTestNumbering] request for new id for layer=" << lay
91  << " zp=" << zp
92  << " wafer=" << wafer
93  << " celltyp=" << celltyp
94  << " cell=" << cell
95  << " for subdet=" << subdet
96  << " has one or more fields out of bounds and will be reset"
97  << std::endl;
98 #endif
99  return false;
100  }
101  return true;
102 }
static const int kHGCalWaferHMask
static const int kHGCalCellHMask
static const int kHGCalSubdetHMask
static const int kHGCalCellTypHMask
tuple cout
Definition: gather_cfg.py:145
static const int kHGCalLayerSMask
bool HGCalTestNumbering::isValidSquare ( int  z,
int  lay,
int  sec,
int  subsec,
int  cell 
)
static

Definition at line 64 of file HGCalTestNumbering.cc.

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

Referenced by packSquareIndex().

65  {
66 
67  if (cell > kHGCalCellSMask || sec>kHGCalSectorSMask ||
68  subsec > kHGCalSubSectorSMask || lay>kHGCalLayerSMask ) {
69 #ifdef DebugLog
70  std::cout << "[HGCalTestNumbering] request for new id for layer=" << lay
71  << " zp=" << zp
72  << " sector=" << sec
73  << " subsec=" << subsec
74  << " cell=" << cell
75  << " has one or more fields out of bounds and will be reset"
76  << std::endl;
77 #endif
78  return false;
79  }
80  return true;
81 }
static const int kHGCalSubSectorSMask
static const int kHGCalCellSMask
static const int kHGCalSectorSMask
tuple cout
Definition: gather_cfg.py:145
static const int kHGCalLayerSMask
uint32_t HGCalTestNumbering::packHexagonIndex ( int  subdet,
int  z,
int  lay,
int  wafer,
int  celltyp,
int  cell 
)
static

Definition at line 23 of file HGCalTestNumbering.cc.

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

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

25  {
26 
27  if (!HGCalTestNumbering::isValidHexagon(subdet,zp,lay,wafer,celltyp,cell)) {
28  subdet = zp = lay = wafer = celltyp = cell = 0;
29  }
30 
31  uint32_t rawid=0;
32  rawid |= ((cell & kHGCalCellHMask) << kHGCalCellHOffset);
33  rawid |= ((celltyp& kHGCalCellTypHMask) << kHGCalCellTypHOffset);
34  rawid |= ((wafer & kHGCalWaferHMask) << kHGCalWaferHOffset);
35  rawid |= ((lay & kHGCalLayerHMask) << kHGCalLayerHOffset);
36  if (zp>0) rawid |= ((zp & kHGCalZsideHMask) << kHGCalZsideHOffset);
37  rawid |= ((subdet & kHGCalSubdetHMask) << kHGCalSubdetHOffset);
38  return rawid;
39 }
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
uint32_t HGCalTestNumbering::packSquareIndex ( int  z,
int  lay,
int  sec,
int  subsec,
int  cell 
)
static

Definition at line 6 of file HGCalTestNumbering.cc.

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

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalSimHitValidation::defineGeometry(), and HGCNumberingScheme::getUnitID().

7  {
8 
9  if (!HGCalTestNumbering::isValidSquare(zp, lay, sec, subsec,lay)) {
10  zp = lay = sec = subsec = cell = 0;
11  }
12 
13  uint32_t rawid=0;
14  rawid |= ((cell & kHGCalCellSMask) << kHGCalCellSOffset);
15  rawid |= ((sec & kHGCalSectorSMask) << kHGCalSectorSOffset);
16  if (subsec<0) subsec=0;
17  rawid |= ((subsec & kHGCalSubSectorSMask) << kHGCalSubSectorSOffset);
18  rawid |= ((lay & kHGCalLayerSMask) << kHGCalLayerSOffset);
19  if (zp>0) rawid |= ((zp & kHGCalZsideSMask) << kHGCalZsideSOffset);
20  return rawid;
21 }
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
void HGCalTestNumbering::unpackHexagonIndex ( const uint32_t &  idx,
int &  subdet,
int &  z,
int &  lay,
int &  wafer,
int &  celltyp,
int &  cell 
)
static

Definition at line 53 of file HGCalTestNumbering.cc.

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

Referenced by HGCGeometryValidation::analyze(), HGCalHitValidation::analyze(), HGCalSimHitValidation::analyzeHits(), HGCalTBAnalyzer::analyzeSimHits(), and CaloTruthAccumulator::fillSimHits().

55  {
56  cell = (idx>>kHGCalCellHOffset)&kHGCalCellHMask;
58  wafer = (idx>>kHGCalWaferHOffset)&kHGCalWaferHMask;
60  zp = ((idx>>kHGCalZsideHOffset) & kHGCalZsideHMask ? 1 : -1);
61  subdet = (idx>>kHGCalSubdetHOffset)&kHGCalSubdetHMask;
62 }
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
void HGCalTestNumbering::unpackSquareIndex ( const uint32_t &  idx,
int &  z,
int &  lay,
int &  sec,
int &  subsec,
int &  cell 
)
static

Definition at line 41 of file HGCalTestNumbering.cc.

References kHGCalCellSMask, kHGCalCellSOffset, kHGCalLayerSMask, kHGCalLayerSOffset, kHGCalSectorSMask, kHGCalSectorSOffset, kHGCalSubSectorSMask, kHGCalSubSectorSOffset, kHGCalZsideSMask, and kHGCalZsideSOffset.

Referenced by HGCalSimHitValidation::analyzeHits().

43  {
44 
45  cell = (idx>>kHGCalCellSOffset)&kHGCalCellSMask;
46  subsec = ((idx>>kHGCalSubSectorSOffset)&kHGCalSubSectorSMask ? 1 : -1);
49  zp = ((idx>>kHGCalZsideSOffset) & kHGCalZsideSMask ? 1 : -1);
50 }
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

const int HGCalTestNumbering::kHGCalCellHMask = 0xFF
static

Definition at line 25 of file HGCalTestNumbering.h.

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

const int HGCalTestNumbering::kHGCalCellHOffset = 0
static

Definition at line 24 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalCellSMask = 0xFFFF
static

Definition at line 14 of file HGCalTestNumbering.h.

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

const int HGCalTestNumbering::kHGCalCellSOffset = 0
static

Definition at line 13 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

const int HGCalTestNumbering::kHGCalCellTypHMask = 0x1
static

Definition at line 27 of file HGCalTestNumbering.h.

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

const int HGCalTestNumbering::kHGCalCellTypHOffset = 8
static

Definition at line 26 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalLayerHMask = 0x7F
static

Definition at line 31 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalLayerHOffset = 19
static

Definition at line 30 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalLayerSMask = 0x7F
static
const int HGCalTestNumbering::kHGCalLayerSOffset = 24
static

Definition at line 19 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

const int HGCalTestNumbering::kHGCalSectorSMask = 0x7F
static

Definition at line 16 of file HGCalTestNumbering.h.

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

const int HGCalTestNumbering::kHGCalSectorSOffset = 16
static

Definition at line 15 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

const int HGCalTestNumbering::kHGCalSubdetHMask = 0x7
static

Definition at line 35 of file HGCalTestNumbering.h.

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

const int HGCalTestNumbering::kHGCalSubdetHOffset = 27
static

Definition at line 34 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalSubSectorSMask = 0x1
static

Definition at line 18 of file HGCalTestNumbering.h.

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

const int HGCalTestNumbering::kHGCalSubSectorSOffset = 23
static

Definition at line 17 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

const int HGCalTestNumbering::kHGCalWaferHMask = 0x3FF
static

Definition at line 29 of file HGCalTestNumbering.h.

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

const int HGCalTestNumbering::kHGCalWaferHOffset = 9
static

Definition at line 28 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalZsideHMask = 0x1
static

Definition at line 33 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalZsideHOffset = 26
static

Definition at line 32 of file HGCalTestNumbering.h.

Referenced by packHexagonIndex(), and unpackHexagonIndex().

const int HGCalTestNumbering::kHGCalZsideSMask = 0x1
static

Definition at line 22 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().

const int HGCalTestNumbering::kHGCalZsideSOffset = 31
static

Definition at line 21 of file HGCalTestNumbering.h.

Referenced by packSquareIndex(), and unpackSquareIndex().