CMS 3D CMS Logo

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

#include <HGCalNumberingScheme.h>

Public Member Functions

uint32_t getUnitID (int layer, int module, int cell, int iz, const G4ThreeVector &pos, double &wt)
 assigns the det id to a hit More...
 
 HGCalNumberingScheme (const HGCalDDDConstants &hgc, const DetId::Detector &det, const std::string &name)
 
 ~HGCalNumberingScheme ()
 

Private Member Functions

void checkPosition (uint32_t index, const G4ThreeVector &pos, bool matchOnly, bool debug) const
 
 HGCalNumberingScheme ()=delete
 

Private Attributes

DetId::Detector det_
 
const HGCalDDDConstantshgcons_
 
const HGCalGeometryMode::GeometryMode mode_
 
std::string name_
 

Detailed Description

Definition at line 16 of file HGCalNumberingScheme.h.

Constructor & Destructor Documentation

◆ HGCalNumberingScheme() [1/2]

HGCalNumberingScheme::HGCalNumberingScheme ( const HGCalDDDConstants hgc,
const DetId::Detector det,
const std::string &  name 
)

◆ ~HGCalNumberingScheme()

HGCalNumberingScheme::~HGCalNumberingScheme ( )

Definition at line 28 of file HGCalNumberingScheme.cc.

28  {
29 #ifdef EDM_ML_DEBUG
30  edm::LogVerbatim("HGCSim") << "Deleting HGCalNumberingScheme";
31 #endif
32 }

◆ HGCalNumberingScheme() [2/2]

HGCalNumberingScheme::HGCalNumberingScheme ( )
privatedelete

Member Function Documentation

◆ checkPosition()

void HGCalNumberingScheme::checkPosition ( uint32_t  index,
const G4ThreeVector &  pos,
bool  matchOnly,
bool  debug 
) const
private

Definition at line 109 of file HGCalNumberingScheme.cc.

109  {
110  std::pair<float, float> xy;
111  bool ok(false);
112  double z1(0), tolR(12.0), tolZ(1.0);
113  int lay(-1);
114  if (index == 0) {
115  } else if (DetId(index).det() == DetId::HGCalHSi) {
117  lay = id.layer();
118  xy = hgcons_.locateCell(lay, id.waferU(), id.waferV(), id.cellU(), id.cellV(), false, true);
119  z1 = hgcons_.waferZ(lay, false);
120  ok = true;
121  tolR = 12.0;
122  tolZ = 1.0;
123  } else if (DetId(index).det() == DetId::HGCalHSc) {
125  lay = id.layer();
126  xy = hgcons_.locateCellTrap(lay, id.ietaAbs(), id.iphi(), false);
127  z1 = hgcons_.waferZ(lay, false);
128  ok = true;
129  tolR = 50.0;
130  tolZ = 5.0;
131  }
132  if (ok) {
133  double r1 = std::sqrt(xy.first * xy.first + xy.second * xy.second);
134  double r2 = pos.perp();
135  double z2 = std::abs(pos.z());
136  std::pair<double, double> zrange = hgcons_.rangeZ(false);
137  std::pair<double, double> rrange = hgcons_.rangeR(z2, false);
138  bool match = (std::abs(r1 - r2) < tolR) && (std::abs(z1 - z2) < tolZ);
139  bool inok = ((r2 >= rrange.first) && (r2 <= rrange.second) && (z2 >= zrange.first) && (z2 <= zrange.second));
140  bool outok = ((r1 >= rrange.first) && (r1 <= rrange.second) && (z1 >= zrange.first) && (z1 <= zrange.second));
141  std::string ck = (((r1 < rrange.first - tolR) || (r1 > rrange.second + tolR) || (z1 < zrange.first - tolZ) ||
142  (z1 > zrange.second + tolZ))
143  ? "***** ERROR *****"
144  : "");
145  if (matchOnly && match)
146  ck = "";
147  if (!(match && inok && outok) || debug) {
148  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme::Detector " << det_ << " Layer " << lay << " R " << r2 << ":"
149  << r1 << ":" << rrange.first << ":" << rrange.second << " Z " << z2 << ":" << z1 << ":"
150  << zrange.first << ":" << zrange.second << " Match " << match << ":" << inok << ":"
151  << outok << " " << ck;
152  edm::LogVerbatim("HGCSim") << "Original " << pos.x() << ":" << pos.y() << " return " << xy.first << ":"
153  << xy.second;
154  if (DetId(index).det() == DetId::HGCalHSi) {
155  double wt = 0, xx = ((pos.z() > 0) ? pos.x() : -pos.x());
156  int waferU, waferV, cellU, cellV, waferType;
157  hgcons_.waferFromPosition(xx, pos.y(), lay, waferU, waferV, cellU, cellV, waferType, wt, true);
158  xy = hgcons_.locateCell(lay, waferU, waferV, cellU, cellV, false, true, true);
159  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme " << HGCSiliconDetId(index) << " position " << xy.first
160  << ":" << xy.second;
161  }
162  }
163  }
164 }

References funct::abs(), debug, det_, DetId::HGCalHSc, DetId::HGCalHSi, hgcons_, LEDCalibrationChannels::iphi, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellTrap(), match(), convertSQLiteXML::ok, diffTwoXMLs::r1, diffTwoXMLs::r2, HGCalDDDConstants::rangeR(), HGCalDDDConstants::rangeZ(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalDDDConstants::waferFromPosition(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), HGCalDDDConstants::waferZ(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, testProducerWithPsetDescEmpty_cfi::z2, and TkClusParameters_cff::zrange.

Referenced by getUnitID().

◆ getUnitID()

uint32_t HGCalNumberingScheme::getUnitID ( int  layer,
int  module,
int  cell,
int  iz,
const G4ThreeVector &  pos,
double &  wt 
)

assigns the det id to a hit

Definition at line 34 of file HGCalNumberingScheme.cc.

34  {
35  // module is the copy number of the wafer as placed in the layer
36  uint32_t index(0);
37  wt = 1.0;
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme:: input Layer " << layer << " Module " << module << " Cell "
40  << cell << " iz " << iz << " Position " << pos;
41 #endif
42  if (hgcons_.waferHexagon8()) {
43  int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0);
44  if (cell >= 0) {
48  cellU = HGCalTypes::getUnpackedCellU(cell);
49  cellV = HGCalTypes::getUnpackedCellV(cell);
50  } else if (mode_ != HGCalGeometryMode::Hexagon8) {
51  double xx = (pos.z() > 0) ? pos.x() : -pos.x();
52  hgcons_.waferFromPosition(xx, pos.y(), layer, waferU, waferV, cellU, cellV, waferType, wt);
53  }
54  if (waferType >= 0) {
56  int type = hgcons_.waferType(layer, waferU, waferV, true);
57  if (type != waferType) {
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme:: " << name_ << " Layer|u|v|Index|module|cell " << layer
60  << ":" << waferU << ":" << waferV << ":"
62  << ":" << cell << " has a type mismatch " << waferType << ":" << type;
63 #endif
65  waferType = type;
66  }
67  }
68  index = HGCSiliconDetId(det_, iz, waferType, layer, waferU, waferV, cellU, cellV).rawId();
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HGCSim") << "OK WaferType " << waferType << " Wafer " << waferU << ":" << waferV << " Cell "
71  << cellU << ":" << cellV;
72  } else {
73  edm::LogVerbatim("HGCSim") << "Bad WaferType " << waferType << " for Layer:u:v " << layer << ":" << waferU << ":"
74  << waferV;
75 #endif
76  }
77  } else if (hgcons_.tileTrapezoid()) {
78  std::array<int, 3> id = hgcons_.assignCellTrap(pos.x(), pos.y(), pos.z(), layer, false);
79  if (id[2] >= 0) {
80  std::pair<int, int> typm = hgcons_.tileType(layer, id[0], 0);
81  HGCScintillatorDetId detId(id[2], layer, iz * id[0], id[1], false, 0);
82  if (typm.first >= 0) {
83  detId.setType(typm.first);
84  detId.setSiPM(typm.second);
85  }
86  index = detId.rawId();
87 #ifdef EDM_ML_DEBUG
88  int lay = layer + hgcons_.getLayerOffset();
89  edm::LogVerbatim("HGCSim") << "Radius/Phi " << id[0] << ":" << id[1] << " Type " << id[2] << ":" << typm.first
90  << " SiPM " << typm.second << ":" << hgcons_.tileSiPM(typm.second) << " Layer "
91  << layer << ":" << lay << " z " << iz << " " << detId;
92  } else {
93  edm::LogVerbatim("HGCSim") << "Radius/Phi " << id[0] << ":" << id[1] << " Type " << id[2] << " Layer|iz " << layer
94  << ":" << iz << " ERROR";
95 #endif
96  }
97  }
98 #ifdef EDM_ML_DEBUG
99  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme::i/p " << det_ << ":" << layer << ":" << module << ":" << cell
100  << ":" << iz << ":" << pos.x() << ":" << pos.y() << ":" << pos.z() << " ID " << std::hex
101  << index << std::dec << " wt " << wt;
102  bool matchOnly = (mode_ == HGCalGeometryMode::Hexagon8Module) ? true : false;
103  bool debug = (mode_ == HGCalGeometryMode::Hexagon8Module) ? true : false;
104  checkPosition(index, pos, matchOnly, debug);
105 #endif
106  return index;
107 }

References HGCalDDDConstants::assignCellTrap(), checkPosition(), debug, TauDecayModes::dec, det_, HGCalDDDConstants::getLayerOffset(), HGCalTypes::getUnpackedCellU(), HGCalTypes::getUnpackedCellV(), HGCalTypes::getUnpackedType(), HGCalTypes::getUnpackedU(), HGCalTypes::getUnpackedV(), HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Module, HGCSiliconDetId::HGCalCoarseThick, hgcons_, phase1PixelTopology::layer, mode_, callgraph::module, name_, DetId::rawId(), HGCScintillatorDetId::setSiPM(), HGCScintillatorDetId::setType(), HGCalDDDConstants::tileSiPM(), HGCalDDDConstants::tileTrapezoid(), HGCalDDDConstants::tileType(), HGCalDDDConstants::waferFromPosition(), HGCalDDDConstants::waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalDDDConstants::waferType(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and geometryCSVtoXML::xx.

Member Data Documentation

◆ det_

DetId::Detector HGCalNumberingScheme::det_
private

Definition at line 32 of file HGCalNumberingScheme.h.

Referenced by checkPosition(), getUnitID(), and HGCalNumberingScheme().

◆ hgcons_

const HGCalDDDConstants& HGCalNumberingScheme::hgcons_
private

Definition at line 30 of file HGCalNumberingScheme.h.

Referenced by checkPosition(), and getUnitID().

◆ mode_

const HGCalGeometryMode::GeometryMode HGCalNumberingScheme::mode_
private

Definition at line 31 of file HGCalNumberingScheme.h.

Referenced by getUnitID(), and HGCalNumberingScheme().

◆ name_

std::string HGCalNumberingScheme::name_
private

Definition at line 33 of file HGCalNumberingScheme.h.

Referenced by getUnitID(), and HGCalNumberingScheme().

HGCalGeometryMode::TrapezoidFile
Definition: HGCalGeometryMode.h:33
TkClusParameters_cff.zrange
zrange
Definition: TkClusParameters_cff.py:7
HGCalDDDConstants::waferFromPosition
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
Definition: HGCalDDDConstants.cc:1089
HGCalDDDConstants::rangeZ
std::pair< double, double > rangeZ(bool reco) const
Definition: HGCalDDDConstants.cc:1011
HGCalDDDConstants::locateCellTrap
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
Definition: HGCalDDDConstants.cc:734
HGCalDDDConstants::getLayerOffset
int getLayerOffset() const
Definition: HGCalDDDConstants.h:56
pos
Definition: PixelAliasList.h:18
HGCalDDDConstants::waferZ
double waferZ(int layer, bool reco) const
Definition: HGCalDDDConstants.cc:1412
HGCalWaferIndex::waferU
int32_t waferU(const int32_t index)
Definition: HGCalWaferIndex.cc:27
HGCalDDDConstants::waferHexagon8
bool waferHexagon8() const
Definition: HGCalDDDConstants.h:143
HGCalWaferIndex::waferIndex
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
Definition: HGCalWaferIndex.cc:4
HGCalGeometryMode::Hexagon8Module
Definition: HGCalGeometryMode.h:34
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
HGCSiliconDetId::HGCalCoarseThick
Definition: HGCSiliconDetId.h:24
hgc_digi
Definition: HGCDigitizerTypes.h:10
testProducerWithPsetDescEmpty_cfi.z2
z2
Definition: testProducerWithPsetDescEmpty_cfi.py:41
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HGCalTypes::getUnpackedCellV
static int32_t getUnpackedCellV(int id)
Definition: HGCalTypes.cc:34
HGCalNumberingScheme::name_
std::string name_
Definition: HGCalNumberingScheme.h:33
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
HGCalDDDConstants::waferType
int waferType(DetId const &id, bool fromFile=false) const
Definition: HGCalDDDConstants.cc:1267
debug
#define debug
Definition: HDRShower.cc:19
HGCalGeometryMode::Trapezoid
Definition: HGCalGeometryMode.h:31
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalDDDConstants::tileType
std::pair< int, int > tileType(int layer, int ring, int phi) const
Definition: HGCalDDDConstants.h:117
HGCalWaferIndex::waferV
int32_t waferV(const int32_t index)
Definition: HGCalWaferIndex.cc:32
HGCalDDDConstants::rangeR
std::pair< double, double > rangeR(double z, bool reco) const
Definition: HGCalDDDConstants.cc:966
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
HGCalTypes::getUnpackedU
static int32_t getUnpackedU(int id)
Definition: HGCalTypes.cc:16
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
HGCalDDDConstants::tileTrapezoid
bool tileTrapezoid() const
Definition: HGCalDDDConstants.h:113
HGCalGeometryMode::TrapezoidModule
Definition: HGCalGeometryMode.h:35
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
HGCalDDDConstants::tileSiPM
int tileSiPM(int sipm) const
Definition: HGCalDDDConstants.h:112
HGCalGeometryMode::Hexagon8Full
Definition: HGCalGeometryMode.h:30
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
HGCalTypes::getUnpackedV
static int32_t getUnpackedV(int id)
Definition: HGCalTypes.cc:22
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
HGCalNumberingScheme::hgcons_
const HGCalDDDConstants & hgcons_
Definition: HGCalNumberingScheme.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
callgraph.module
module
Definition: callgraph.py:61
HGCalDDDConstants::assignCellTrap
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:171
HGCalNumberingScheme::checkPosition
void checkPosition(uint32_t index, const G4ThreeVector &pos, bool matchOnly, bool debug) const
Definition: HGCalNumberingScheme.cc:109
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HGCalTypes::getUnpackedCellU
static int32_t getUnpackedCellU(int id)
Definition: HGCalTypes.cc:32
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DetId::HGCalHSc
Definition: DetId.h:34
HGCalGeometryMode::Hexagon8File
Definition: HGCalGeometryMode.h:32
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HGCalGeometryMode::Hexagon8
Definition: HGCalGeometryMode.h:29
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCalDDDConstants::locateCell
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
Definition: HGCalDDDConstants.cc:596
HGCalNumberingScheme::det_
DetId::Detector det_
Definition: HGCalNumberingScheme.h:32
HGCalNumberingScheme::mode_
const HGCalGeometryMode::GeometryMode mode_
Definition: HGCalNumberingScheme.h:31
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
HGCalTypes::getUnpackedType
static int32_t getUnpackedType(int id)
Definition: HGCalTypes.cc:14