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 ()=delete
 
 ~HFNoseNumberingScheme ()
 

Private Member Functions

void checkPosition (uint32_t index, const G4ThreeVector &pos) const
 

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 12 of file HFNoseNumberingScheme.cc.

12  : hgcons_(hgc), mode_(hgc.geomMode()) {
13 #ifdef EDM_ML_DEBUG
14  edm::LogVerbatim("HGCSim") << "Creating HFNoseNumberingScheme";
15 #endif
16 }
Log< level::Info, true > LogVerbatim
const HGCalGeometryMode::GeometryMode mode_
const HGCalDDDConstants & hgcons_

◆ HFNoseNumberingScheme() [2/2]

HFNoseNumberingScheme::HFNoseNumberingScheme ( )
delete

◆ ~HFNoseNumberingScheme()

HFNoseNumberingScheme::~HFNoseNumberingScheme ( )
inline

Definition at line 18 of file HFNoseNumberingScheme.h.

18 {}

Member Function Documentation

◆ checkPosition()

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

Definition at line 53 of file HFNoseNumberingScheme.cc.

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(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), HGCalDDDConstants::waferZ(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, testProducerWithPsetDescEmpty_cfi::z2, OfflinePixel3DPrimaryVertices_cfi::zrange, and ecaldqm::zside().

Referenced by getUnitID().

53  {
54  std::pair<float, float> xy;
55  bool ok(false);
56  double z1(0), tolR(10.0), tolZ(1.0);
57  int lay(-1);
58  if (index == 0) {
59  } else if ((DetId(index).det() == DetId::Forward) && (DetId(index).subdetId() == static_cast<int>(HFNose))) {
61  lay = id.layer();
63  id.zside(), lay, id.waferU(), id.waferV(), id.cellU(), id.cellV(), false, true, false, false);
64  z1 = hgcons_.waferZ(lay, false);
65  ok = true;
66  }
67  if (ok) {
68  double r1 = std::sqrt(xy.first * xy.first + xy.second * xy.second);
69  double r2 = pos.perp();
70  double z2 = std::abs(pos.z());
71  std::pair<double, double> zrange = hgcons_.rangeZ(false);
72  std::pair<double, double> rrange = hgcons_.rangeR(z2, false);
73  bool match = (std::abs(r1 - r2) < tolR) && (std::abs(z1 - z2) < tolZ);
74  bool inok = ((r2 >= rrange.first) && (r2 <= rrange.second) && (z2 >= zrange.first) && (z2 <= zrange.second));
75  bool outok = ((r1 >= rrange.first) && (r1 <= rrange.second) && (z1 >= zrange.first) && (z1 <= zrange.second));
76  std::string ck = (((r1 < rrange.first - tolR) || (r1 > rrange.second + tolR) || (z1 < zrange.first - tolZ) ||
77  (z1 > zrange.second + tolZ))
78  ? "***** ERROR *****"
79  : "");
80  if (!(match && inok && outok)) {
81  edm::LogVerbatim("HGCSim") << "HFNoseNumberingScheme::Detector " << DetId(index).det() << " Layer " << lay
82  << " R " << r2 << ":" << r1 << ":" << rrange.first << ":" << rrange.second << " Z "
83  << z2 << ":" << z1 << ":" << zrange.first << ":" << zrange.second << " Match " << match
84  << ":" << inok << ":" << outok << " " << ck;
85  edm::LogVerbatim("HGCSim") << "Original " << pos.x() << ":" << pos.y() << " return " << xy.first << ":"
86  << xy.second;
87  if ((DetId(index).det() == DetId::Forward) && (DetId(index).subdetId() == static_cast<int>(HFNose))) {
88  int zside = (pos.z() > 0) ? 1 : -1;
89  double wt = 0, xx = (zside * pos.x());
90  int waferU, waferV, cellU, cellV, waferType;
91  hgcons_.waferFromPosition(xx, pos.y(), zside, lay, waferU, waferV, cellU, cellV, waferType, wt, false, true);
92  xy = hgcons_.locateCell(zside, lay, waferU, waferV, cellU, cellV, false, true, false, true);
93  edm::LogVerbatim("HGCSim") << "HFNoseNumberingScheme " << HFNoseDetId(index) << " position " << xy.first << ":"
94  << xy.second;
95  }
96  }
97  }
98 }
double waferZ(int layer, bool reco) const
Log< level::Info, true > LogVerbatim
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
std::pair< double, double > rangeZ(bool reco) const
int32_t waferU(const int32_t index)
int zside(DetId const &)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< double, double > rangeR(double z, bool reco) const
Definition: DetId.h:17
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
const HGCalDDDConstants & hgcons_
int32_t waferV(const int32_t index)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

◆ 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 18 of file HFNoseNumberingScheme.cc.

References checkPosition(), TauDecayModes::dec, HGCalTypes::getUnpackedCellU(), HGCalTypes::getUnpackedCellV(), HGCalTypes::getUnpackedType(), HGCalTypes::getUnpackedU(), HGCalTypes::getUnpackedV(), HGCalGeometryMode::Hexagon8Full, hgcons_, nano_mu_digi_cff::layer, mode_, DetId::rawId(), HGCalDDDConstants::waferFromPosition(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), geometryCSVtoXML::xx, and ecaldqm::zside().

19  {
20  // module is the copy number of the wafer as placed in the layer
21  uint32_t index(0);
22  wt = 1.0;
23  int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0);
24  if (cell >= 0) {
28  cellU = HGCalTypes::getUnpackedCellU(cell);
29  cellV = HGCalTypes::getUnpackedCellV(cell);
30  } else if (mode_ == HGCalGeometryMode::Hexagon8Full) {
31  int zside = (pos.z() > 0) ? 1 : -1;
32  double xx = zside * pos.x();
33  hgcons_.waferFromPosition(xx, pos.y(), zside, layer, waferU, waferV, cellU, cellV, waferType, wt, false, false);
34  }
35  if (waferType >= 0) {
36  index = HFNoseDetId(iz, waferType, layer, waferU, waferV, cellU, cellV).rawId();
37 #ifdef EDM_ML_DEBUG
38  edm::LogVerbatim("HFNSim") << "OK WaferType " << waferType << " Wafer " << waferU << ":" << waferV << " Cell "
39  << cellU << ":" << cellV;
40  } else {
41  edm::LogVerbatim("HFNSim") << "Bad WaferType " << waferType;
42 #endif
43  }
44 #ifdef EDM_ML_DEBUG
45  edm::LogVerbatim("HFNSim") << "HFNoseNumberingScheme::i/p " << layer << ":" << module << ":" << cell << ":" << iz
46  << ":" << pos.x() << ":" << pos.y() << ":" << pos.z() << " ID " << std::hex << index
47  << std::dec << " wt " << wt;
49 #endif
50  return index;
51 }
Log< level::Info, true > LogVerbatim
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
static int32_t getUnpackedCellU(int id)
Definition: HGCalTypes.cc:32
static int32_t getUnpackedU(int id)
Definition: HGCalTypes.cc:16
int32_t waferU(const int32_t index)
static int32_t getUnpackedV(int id)
Definition: HGCalTypes.cc:22
int zside(DetId const &)
void checkPosition(uint32_t index, const G4ThreeVector &pos) const
static int32_t getUnpackedType(int id)
Definition: HGCalTypes.cc:14
const HGCalGeometryMode::GeometryMode mode_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static int32_t getUnpackedCellV(int id)
Definition: HGCalTypes.cc:34
const HGCalDDDConstants & hgcons_
int32_t waferV(const int32_t index)

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().