CMS 3D CMS Logo

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

#include <HFNoseNumberingScheme.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...
 
 HFNoseNumberingScheme (const HGCalDDDConstants &hgc)
 
 ~HFNoseNumberingScheme ()
 

Private Member Functions

void checkPosition (uint32_t index, const G4ThreeVector &pos) const
 
 HFNoseNumberingScheme ()=delete
 

Private Attributes

const HGCalDDDConstantshgcons_
 
const HGCalGeometryMode::GeometryMode mode_
 

Detailed Description

Definition at line 14 of file HFNoseNumberingScheme.h.

Constructor & Destructor Documentation

◆ HFNoseNumberingScheme() [1/2]

HFNoseNumberingScheme::HFNoseNumberingScheme ( const HGCalDDDConstants hgc)

Definition at line 11 of file HFNoseNumberingScheme.cc.

11  : hgcons_(hgc), mode_(hgc.geomMode()) {
12 #ifdef EDM_ML_DEBUG
13  edm::LogVerbatim("HGCSim") << "Creating HFNoseNumberingScheme";
14 #endif
15 }

◆ ~HFNoseNumberingScheme()

HFNoseNumberingScheme::~HFNoseNumberingScheme ( )
inline

Definition at line 17 of file HFNoseNumberingScheme.h.

17 {}

◆ HFNoseNumberingScheme() [2/2]

HFNoseNumberingScheme::HFNoseNumberingScheme ( )
privatedelete

Member Function Documentation

◆ checkPosition()

void HFNoseNumberingScheme::checkPosition ( uint32_t  index,
const G4ThreeVector &  pos 
) const
private

Definition at line 55 of file HFNoseNumberingScheme.cc.

55  {
56  std::pair<float, float> xy;
57  bool ok(false);
58  double z1(0), tolR(10.0), tolZ(1.0);
59  int lay(-1);
60  if (index == 0) {
61  } else if ((DetId(index).det() == DetId::Forward) && (DetId(index).subdetId() == static_cast<int>(HFNose))) {
63  lay = id.layer();
64  xy = hgcons_.locateCell(lay, id.waferU(), id.waferV(), id.cellU(), id.cellV(), false, true);
65  z1 = hgcons_.waferZ(lay, false);
66  ok = true;
67  }
68  if (ok) {
69  double r1 = std::sqrt(xy.first * xy.first + xy.second * xy.second);
70  double r2 = pos.perp();
71  double z2 = std::abs(pos.z());
72  std::pair<double, double> zrange = hgcons_.rangeZ(false);
73  std::pair<double, double> rrange = hgcons_.rangeR(z2, false);
74  bool match = (std::abs(r1 - r2) < tolR) && (std::abs(z1 - z2) < tolZ);
75  bool inok = ((r2 >= rrange.first) && (r2 <= rrange.second) && (z2 >= zrange.first) && (z2 <= zrange.second));
76  bool outok = ((r1 >= rrange.first) && (r1 <= rrange.second) && (z1 >= zrange.first) && (z1 <= zrange.second));
77  std::string ck = (((r1 < rrange.first - tolR) || (r1 > rrange.second + tolR) || (z1 < zrange.first - tolZ) ||
78  (z1 > zrange.second + tolZ))
79  ? "***** ERROR *****"
80  : "");
81  if (!(match && inok && outok)) {
82  edm::LogVerbatim("HGCSim") << "HFNoseNumberingScheme::Detector " << DetId(index).det() << " Layer " << lay
83  << " R " << r2 << ":" << r1 << ":" << rrange.first << ":" << rrange.second << " Z "
84  << z2 << ":" << z1 << ":" << zrange.first << ":" << zrange.second << " Match " << match
85  << ":" << inok << ":" << outok << " " << ck;
86  edm::LogVerbatim("HGCSim") << "Original " << pos.x() << ":" << pos.y() << " return " << xy.first << ":"
87  << xy.second;
88  if ((DetId(index).det() == DetId::Forward) && (DetId(index).subdetId() == static_cast<int>(HFNose))) {
89  double wt = 0, xx = ((pos.z() > 0) ? pos.x() : -pos.x());
90  int waferU, waferV, cellU, cellV, waferType;
91  hgcons_.waferFromPosition(xx, pos.y(), lay, waferU, waferV, cellU, cellV, waferType, wt, true);
92  xy = hgcons_.locateCell(lay, waferU, waferV, cellU, cellV, false, true, true);
93  edm::LogVerbatim("HGCSim") << "HFNoseNumberingScheme " << HFNoseDetId(index) << " position " << xy.first << ":"
94  << xy.second;
95  }
96  }
97  }
98 }

References funct::abs(), DetId::det(), DetId::Forward, HFNose, hgcons_, HGCalDDDConstants::locateCell(), match(), convertSQLiteXML::ok, diffTwoXMLs::r1, diffTwoXMLs::r2, HGCalDDDConstants::rangeR(), HGCalDDDConstants::rangeZ(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalDDDConstants::waferFromPosition(), HGCalDDDConstants::waferZ(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, testProducerWithPsetDescEmpty_cfi::z2, and TkClusParameters_cff::zrange.

Referenced by getUnitID().

◆ getUnitID()

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

assigns the det id to a hit

Definition at line 17 of file HFNoseNumberingScheme.cc.

18  {
19  // module is the copy number of the wafer as placed in the layer
20  uint32_t index(0);
21  wt = 1.0;
22  int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0);
23  if (cell >= 0) {
24  waferType = module / 1000000;
25  waferU = module % 100;
26  if ((module / 10000) % 10 > 0)
27  waferU = -waferU;
28  waferV = (module / 100) % 100;
29  if ((module / 100000) % 10 > 0)
30  waferV = -waferV;
31  cellU = cell % 100;
32  cellV = (cell / 100) % 100;
33  } else if (mode_ == HGCalGeometryMode::Hexagon8Full) {
34  double xx = (pos.z() > 0) ? pos.x() : -pos.x();
35  hgcons_.waferFromPosition(xx, pos.y(), layer, waferU, waferV, cellU, cellV, waferType, wt);
36  }
37  if (waferType >= 0) {
38  index = HFNoseDetId(iz, waferType, layer, waferU, waferV, cellU, cellV).rawId();
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HFNSim") << "OK WaferType " << waferType << " Wafer " << waferU << ":" << waferV << " Cell "
41  << cellU << ":" << cellV;
42  } else {
43  edm::LogVerbatim("HFNSim") << "Bad WaferType " << waferType;
44 #endif
45  }
46 #ifdef EDM_ML_DEBUG
47  edm::LogVerbatim("HFNSim") << "HFNoseNumberingScheme::i/p " << layer << ":" << module << ":" << cell << ":" << iz
48  << ":" << pos.x() << ":" << pos.y() << ":" << pos.z() << " ID " << std::hex << index
49  << std::dec << " wt " << wt;
51 #endif
52  return index;
53 }

References checkPosition(), TauDecayModes::dec, HGCalGeometryMode::Hexagon8Full, hgcons_, mode_, DetId::rawId(), HGCalDDDConstants::waferFromPosition(), and geometryCSVtoXML::xx.

Member Data Documentation

◆ hgcons_

const HGCalDDDConstants& HFNoseNumberingScheme::hgcons_
private

Definition at line 28 of file HFNoseNumberingScheme.h.

Referenced by checkPosition(), and getUnitID().

◆ mode_

const HGCalGeometryMode::GeometryMode HFNoseNumberingScheme::mode_
private

Definition at line 29 of file HFNoseNumberingScheme.h.

Referenced by getUnitID().

HFNoseNumberingScheme::checkPosition
void checkPosition(uint32_t index, const G4ThreeVector &pos) const
Definition: HFNoseNumberingScheme.cc:55
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:1060
HGCalDDDConstants::rangeZ
std::pair< double, double > rangeZ(bool reco) const
Definition: HGCalDDDConstants.cc:979
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
pos
Definition: PixelAliasList.h:18
HGCalDDDConstants::waferZ
double waferZ(int layer, bool reco) const
Definition: HGCalDDDConstants.cc:1367
HFNoseNumberingScheme::mode_
const HGCalGeometryMode::GeometryMode mode_
Definition: HFNoseNumberingScheme.h:29
HFNoseDetId
Definition: HFNoseDetId.h:22
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
hgc_digi
Definition: HGCDigitizerTypes.h:10
testProducerWithPsetDescEmpty_cfi.z2
z2
Definition: testProducerWithPsetDescEmpty_cfi.py:41
DetId
Definition: DetId.h:17
HFNose
Definition: ForwardSubdetector.h:11
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalDDDConstants::rangeR
std::pair< double, double > rangeR(double z, bool reco) const
Definition: HGCalDDDConstants.cc:934
HFNoseNumberingScheme::hgcons_
const HGCalDDDConstants & hgcons_
Definition: HFNoseNumberingScheme.h:28
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalGeometryMode::Hexagon8Full
Definition: HGCalGeometryMode.h:25
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
edm::LogVerbatim
Definition: MessageLogger.h:297
module
Definition: vlib.h:198
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
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:577
DetId::Forward
Definition: DetId.h:30
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19