CMS 3D CMS Logo

HGCNumberingScheme.cc
Go to the documentation of this file.
1 // File: HGCNumberingScheme.cc
3 // Description: Numbering scheme for High Granularity Calorimeter
10 
12 
13 #include "CLHEP/Units/GlobalSystemOfUnits.h"
14 #include <iostream>
15 
16 //#define EDM_ML_DEBUG
17 
19  edm::LogVerbatim("HGCSim") << "Creating HGCNumberingScheme for " << name;
20 }
21 
22 HGCNumberingScheme::~HGCNumberingScheme() { edm::LogVerbatim("HGCSim") << "Deleting HGCNumberingScheme"; }
23 
25  ForwardSubdetector subdet, int layer, int module, int cell, int iz, const G4ThreeVector& pos) {
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 }
68 
69 int HGCNumberingScheme::assignCell(float x, float y, int layer) {
70  std::pair<int, int> phicell = hgcons_.assignCell(x, y, layer, 0, false);
71  return phicell.second;
72 }
73 
74 std::pair<float, float> HGCNumberingScheme::getLocalCoords(int cell, int layer) {
75  return hgcons_.locateCell(cell, layer, 0, false);
76 }
DDAxes::y
MessageLogger.h
HGCalDDDConstants::waferFromPosition
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
Definition: HGCalDDDConstants.cc:1070
HGCNumberingScheme.h
HGCalDDDConstants::isValidHex
bool isValidHex(int lay, int mod, int cell, bool reco) const
Definition: HGCalDDDConstants.cc:444
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCalDDDConstants::geomMode
HGCalGeometryMode::GeometryMode geomMode() const
Definition: HGCalDDDConstants.h:53
HGCalGeometryMode.h
pos
Definition: PixelAliasList.h:18
HGCalTestNumbering::unpackHexagonIndex
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
Definition: HGCalTestNumbering.cc:47
HGCNumberingScheme::assignCell
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
Definition: HGCNumberingScheme.cc:69
DDAxes::x
HGCalDDDConstants
Definition: HGCalDDDConstants.h:26
hgc_digi
Definition: HGCDigitizerTypes.h:10
FastMath.h
HGCNumberingScheme::getUnitID
uint32_t getUnitID(ForwardSubdetector subdet, int layer, int module, int cell, int iz, const G4ThreeVector &pos)
assigns the det id to a hit
Definition: HGCNumberingScheme.cc:24
HGCalDDDConstants::assignCell
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
Definition: HGCalDDDConstants.cc:120
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCNumberingScheme::getLocalCoords
std::pair< float, float > getLocalCoords(int cell, int layer)
inverts the cell number in a trapezoid surface to local coordinates
Definition: HGCNumberingScheme.cc:74
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
HGCalTestNumbering::packHexagonIndex
static uint32_t packHexagonIndex(int subdet, int z, int lay, int wafer, int celltyp, int cell)
Definition: HGCalTestNumbering.cc:23
HGCNumberingScheme::~HGCNumberingScheme
~HGCNumberingScheme()
Definition: HGCNumberingScheme.cc:22
HGCalGeometryMode::Hexagon
Definition: HGCalGeometryMode.h:27
HGCalGeometryMode::HexagonFull
Definition: HGCalGeometryMode.h:28
HGCalDetId.h
HGCNumberingScheme::hgcons_
const HGCalDDDConstants & hgcons_
Definition: HGCNumberingScheme.h:38
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
genVertex_cff.x
x
Definition: genVertex_cff.py:12
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HGCalDDDConstants::locateCell
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
Definition: HGCalDDDConstants.cc:580
HGCNumberingScheme::HGCNumberingScheme
HGCNumberingScheme()=delete
HGCalDDDConstants::waferFromCopy
int waferFromCopy(int copy) const
Definition: HGCalDDDConstants.cc:1045
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCalTestNumbering.h