CMS 3D CMS Logo

HFNoseNumberingScheme.cc
Go to the documentation of this file.
1 // File: HFNoseNumberingScheme.cc
3 // Description: Numbering scheme for HFNose detector
7 #include <iostream>
8 
9 //#define EDM_ML_DEBUG
10 
12  hgcons_(hgc), mode_(hgc.geomMode()) {
13 #ifdef EDM_ML_DEBUG
14  edm::LogVerbatim("HGCSim") << "Creating HFNoseNumberingScheme";
15 #endif
16 }
17 
18 uint32_t HFNoseNumberingScheme::getUnitID(int layer, int module, int cell,
19  int iz, const G4ThreeVector &pos,
20  double& wt) {
21  // module is the copy number of the wafer as placed in the layer
22  uint32_t index(0);
23  wt = 1.0;
24  int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0);
25  if (cell >= 0) {
26  waferType = module/1000000;
27  waferU = module%100;
28  if ((module/10000)%10 > 0) waferU = -waferU;
29  waferV = (module/100)%100;
30  if ((module/100000)%10 > 0) 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,
36  cellV,waferType,wt);
37  }
38  if (waferType >= 0) {
39  index = HFNoseDetId(iz,waferType,layer,waferU,waferV,cellU,cellV).rawId();
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HFNSim") << "OK WaferType " << waferType << " Wafer "
42  << waferU << ":" << waferV << " Cell "
43  << cellU << ":" << cellV;
44  } else {
45  edm::LogVerbatim("HFNSim") << "Bad WaferType " << waferType;
46 #endif
47  }
48 #ifdef EDM_ML_DEBUG
49  edm::LogVerbatim("HFNSim") << "HFNoseNumberingScheme::i/p " << layer << ":"
50  << module << ":" << cell << ":" << iz << ":"
51  << pos.x() << ":" << pos.y() << ":" << pos.z()
52  << " ID " << std::hex << index << std::dec
53  << " wt " << wt;
54 #endif
55  return index;
56 }
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
uint32_t getUnitID(int layer, int module, int cell, int iz, const G4ThreeVector &pos, double &wt)
assigns the det id to a hit
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
HFNoseNumberingScheme()=delete
const HGCalGeometryMode::GeometryMode mode_
const HGCalDDDConstants & hgcons_
Definition: vlib.h:208