CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HGCNumberingScheme Class Reference

#include <HGCNumberingScheme.h>

Public Types

enum  HGCNumberingParameters { HGCCellSize }
 

Public Member Functions

int assignCell (float x, float y, int layer)
 maps a hit position to a sequential cell in a trapezoid surface defined by h,b,t More...
 
std::pair< float, float > getLocalCoords (int cell, int layer)
 inverts the cell number in a trapezoid surface to local coordinates More...
 
uint32_t getUnitID (ForwardSubdetector subdet, int layer, int module, int cell, int iz, const G4ThreeVector &pos)
 assigns the det id to a hit More...
 
 HGCNumberingScheme (const HGCalDDDConstants &hgc, std::string &name)
 
 HGCNumberingScheme ()=delete
 
 ~HGCNumberingScheme ()
 

Private Attributes

const HGCalDDDConstantshgcons_
 

Detailed Description

Definition at line 13 of file HGCNumberingScheme.h.

Member Enumeration Documentation

◆ HGCNumberingParameters

Enumerator
HGCCellSize 

Definition at line 15 of file HGCNumberingScheme.h.

Constructor & Destructor Documentation

◆ HGCNumberingScheme() [1/2]

HGCNumberingScheme::HGCNumberingScheme ( const HGCalDDDConstants hgc,
std::string &  name 
)

Definition at line 18 of file HGCNumberingScheme.cc.

References Skims_PA_cff::name.

18  : hgcons_(hgc) {
19  edm::LogVerbatim("HGCSim") << "Creating HGCNumberingScheme for " << name;
20 }
Log< level::Info, true > LogVerbatim
const HGCalDDDConstants & hgcons_

◆ HGCNumberingScheme() [2/2]

HGCNumberingScheme::HGCNumberingScheme ( )
delete

◆ ~HGCNumberingScheme()

HGCNumberingScheme::~HGCNumberingScheme ( )

Definition at line 22 of file HGCNumberingScheme.cc.

22 { edm::LogVerbatim("HGCSim") << "Deleting HGCNumberingScheme"; }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ assignCell()

int HGCNumberingScheme::assignCell ( float  x,
float  y,
int  layer 
)

maps a hit position to a sequential cell in a trapezoid surface defined by h,b,t

Definition at line 69 of file HGCNumberingScheme.cc.

References HGCalDDDConstants::assignCell(), hgcons_, phase1PixelTopology::layer, x, and y.

69  {
70  std::pair<int, int> phicell = hgcons_.assignCell(x, y, layer, 0, false);
71  return phicell.second;
72 }
constexpr std::array< uint8_t, layerIndexSize > layer
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
const HGCalDDDConstants & hgcons_

◆ getLocalCoords()

std::pair< float, float > HGCNumberingScheme::getLocalCoords ( int  cell,
int  layer 
)

inverts the cell number in a trapezoid surface to local coordinates

Definition at line 74 of file HGCNumberingScheme.cc.

References hgcons_, phase1PixelTopology::layer, and HGCalDDDConstants::locateCell().

74  {
75  return hgcons_.locateCell(cell, layer, 0, false);
76 }
constexpr std::array< uint8_t, layerIndexSize > layer
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
const HGCalDDDConstants & hgcons_

◆ getUnitID()

uint32_t HGCNumberingScheme::getUnitID ( ForwardSubdetector  subdet,
int  layer,
int  module,
int  cell,
int  iz,
const G4ThreeVector &  pos 
)

assigns the det id to a hit

Definition at line 24 of file HGCNumberingScheme.cc.

References TauDecayModes::dec, HGCalDDDConstants::geomMode(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgcons_, HGCalDDDConstants::isValidHex(), phase1PixelTopology::layer, callgraph::module, HGCalTestNumbering::packHexagonIndex(), HGCalTestNumbering::unpackHexagonIndex(), HGCalDDDConstants::waferFromCopy(), HGCalDDDConstants::waferFromPosition(), and ecaldqm::zside().

25  {
26  // module is the copy number of the wafer as placed in the layer
27  int icell(0), celltyp(0), wafer(0);
28  uint32_t index(0);
30  if (cell >= 0) {
31  wafer = hgcons_.waferFromCopy(module);
32  celltyp = cell / 1000;
33  icell = cell % 1000;
34  } else {
35  hgcons_.waferFromPosition(pos.x(), pos.y(), wafer, icell, celltyp);
36  }
37  if (wafer >= 0) {
38  if (celltyp != 1)
39  celltyp = 0;
40  index = HGCalTestNumbering::packHexagonIndex((int)subdet, iz, layer, wafer, celltyp, icell);
41  }
43  wafer = hgcons_.waferFromCopy(module);
44  celltyp = cell / 1000;
45  icell = cell % 1000;
46  if (celltyp != 1)
47  celltyp = 0;
48 
49  index = HGCalTestNumbering::packHexagonIndex((int)subdet, iz, layer, wafer, celltyp, icell);
50  //check if it fits
51  if (!hgcons_.isValidHex(layer, wafer, icell, false)) {
52  index = 0;
53  edm::LogError("HGCSim") << "[HGCNumberingScheme] ID out of bounds :"
54  << " Subdet= " << subdet << " Zside= " << iz << " Layer= " << layer << " Wafer= " << wafer
55  << ":" << module << " CellType= " << celltyp << " Cell= " << icell;
56  }
57  }
58 #ifdef EDM_ML_DEBUG
59  int subd, zside, lay, sector, subsector, cellx;
60  HGCalTestNumbering::unpackHexagonIndex(index, subd, zside, lay, sector, subsector, cellx);
61  edm::LogVerbatim("HGCSim") << "HGCNumberingScheme::i/p " << subdet << ":" << layer << ":" << module << ":" << iz
62  << ":" << wafer << ":" << celltyp << ":" << icell << ":" << std::hex << index << std::dec
63  << " Output " << subd << ":" << lay << ":" << zside << ":" << sector << ":" << subsector
64  << ":" << cellx;
65 #endif
66  return index;
67 }
Log< level::Info, true > LogVerbatim
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
bool isValidHex(int lay, int mod, int cell, bool reco) const
static uint32_t packHexagonIndex(int subdet, int z, int lay, int wafer, int celltyp, int cell)
int zside(DetId const &)
Log< level::Error, false > LogError
HGCalGeometryMode::GeometryMode geomMode() const
constexpr std::array< uint8_t, layerIndexSize > layer
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
const HGCalDDDConstants & hgcons_
int waferFromCopy(int copy) const

Member Data Documentation

◆ hgcons_

const HGCalDDDConstants& HGCNumberingScheme::hgcons_
private

Definition at line 38 of file HGCNumberingScheme.h.

Referenced by assignCell(), getLocalCoords(), and getUnitID().