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) 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::HGCalNumberingScheme ( const HGCalDDDConstants hgc,
const DetId::Detector det,
const std::string &  name 
)

Definition at line 11 of file HGCalNumberingScheme.cc.

References det_, and name_.

13  :
14  hgcons_(hgc), mode_(hgc.geomMode()), det_(det), name_(name) {
15 #ifdef EDM_ML_DEBUG
16  edm::LogVerbatim("HGCSim") << "Creating HGCalNumberingScheme for " << name_
17  << " Det " << det_;
18 #endif
19 }
const HGCalGeometryMode::GeometryMode mode_
const HGCalDDDConstants & hgcons_
HGCalGeometryMode::GeometryMode geomMode() const
HGCalNumberingScheme::~HGCalNumberingScheme ( )

Definition at line 21 of file HGCalNumberingScheme.cc.

21  {
22 #ifdef EDM_ML_DEBUG
23  edm::LogVerbatim("HGCSim") << "Deleting HGCalNumberingScheme";
24 #endif
25 }
HGCalNumberingScheme::HGCalNumberingScheme ( )
privatedelete

Member Function Documentation

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

Definition at line 89 of file HGCalNumberingScheme.cc.

References funct::abs(), det_, pfClusterIsolation_cfi::drMax, dzMax, DetId::HGCalHSc, DetId::HGCalHSi, hgcons_, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellTrap(), match(), convertSQLiteXML::ok, diffTwoXMLs::r1, diffTwoXMLs::r2, HGCalDDDConstants::rangeR(), HGCalDDDConstants::rangeZ(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalDDDConstants::waferFromPosition(), HGCalDDDConstants::waferZ(), geometryCSVtoXML::xx, and geometryCSVtoXML::xy.

Referenced by getUnitID().

90  {
91 
92  std::pair<float,float> xy;
93  bool ok(false);
94  double z1(0), drMax(10.0), dzMax(1.0);
95  int lay(-1);
96  if (index == 0) {
97  } else if (DetId(index).det() == DetId::HGCalHSi) {
99  lay= id.layer();
100  xy = hgcons_.locateCell(lay,id.waferU(),id.waferV(),id.cellU(),
101  id.cellV(),false,true);
102  z1 = hgcons_.waferZ(lay,false);
103  ok = true;
104  drMax = 10.0; dzMax = 1.0;
105  } else if (DetId(index).det() == DetId::HGCalHSc) {
107  lay= id.layer();
108  xy = hgcons_.locateCellTrap(lay,id.ietaAbs(),id.iphi(),false);
109  z1 = hgcons_.waferZ(lay,false);
110  ok = true;
111  drMax = 50.0; dzMax = 5.0;
112  }
113  if (ok) {
114  double r1 = std::sqrt(xy.first*xy.first+xy.second*xy.second);
115  double r2 = pos.perp();
116  double z2 = std::abs(pos.z());
117  std::pair<double,double> zrange = hgcons_.rangeZ(false);
118  std::pair<double,double> rrange = hgcons_.rangeR(z2,false);
119  bool match= (std::abs(r1-r2) < drMax) && (std::abs(z1-z2) < dzMax);
120  bool inok = ((r2 >= rrange.first) && (r2 <= rrange.second) &&
121  (z2 >= zrange.first) && (z2 <= zrange.second));
122  bool outok= ((r1 >= rrange.first) && (r1 <= rrange.second) &&
123  (z1 >= zrange.first) && (z1 <= zrange.second));
124  std::string ck = (((r1 < rrange.first-10.0) || (r1 > rrange.second+10.0) ||
125  (z1 < zrange.first-5.0) || (z1 > zrange.second+5.0)) ?
126  "***** ERROR *****" : "");
127  if (!(match && inok && outok)) {
128  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme::Detector " << det_
129  << " Layer " << lay << " R " << r2 << ":"
130  << r1 << ":" << rrange.first << ":"
131  << rrange.second << " Z " << z2 << ":" << z1
132  << ":" << zrange.first << ":" << zrange.second
133  << " Match " << match << ":" << inok << ":"
134  << outok << " " << ck;
135  edm::LogVerbatim("HGCSim") << "Original " << pos.x() << ":" << pos.y()
136  << " return " << xy.first << ":" << xy.second;
137  if (DetId(index).det() == DetId::HGCalHSi) {
138  double wt=0, xx = ((pos.z() > 0) ? pos.x() : -pos.x());
139  int waferU,waferV,cellU,cellV,waferType;
140  hgcons_.waferFromPosition(xx,pos.y(),lay,waferU,waferV,cellU,
141  cellV,waferType,wt,true);
142  xy = hgcons_.locateCell(lay,waferU,waferV,cellU,cellV,false,true,true);
143  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme "
144  << HGCSiliconDetId(index) << " position "
145  << xy.first << ":" << xy.second;
146  }
147  }
148  }
149 }
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
const HGCalDDDConstants & hgcons_
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::pair< double, double > rangeR(double z, bool reco) const
std::pair< double, double > rangeZ(bool reco) const
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double waferZ(int layer, bool reco) const
Definition: DetId.h:18
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
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 27 of file HGCalNumberingScheme.cc.

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

29  {
30  // module is the copy number of the wafer as placed in the layer
31  uint32_t index(0);
32  wt = 1.0;
35  int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0);
36  if (cell >= 0) {
37  waferType = module/1000000;
38  waferU = module%100;
39  if ((module/10000)%10 > 0) waferU = -waferU;
40  waferV = (module/100)%100;
41  if ((module/100000)%10 > 0) waferV = -waferV;
42  cellU = cell%100;
43  cellV = (cell/100)%100;
44  } else if (mode_ == HGCalGeometryMode::Hexagon8Full) {
45  double xx = (pos.z() > 0) ? pos.x() : -pos.x();
46  hgcons_.waferFromPosition(xx,pos.y(),layer,waferU,waferV,cellU,
47  cellV,waferType,wt);
48  }
49  if (waferType >= 0) {
50  index = HGCSiliconDetId(det_,iz,waferType,layer,waferU,waferV,
51  cellU,cellV).rawId();
52 #ifdef EDM_ML_DEBUG
53  edm::LogVerbatim("HGCSim") << "OK WaferType " << waferType << " Wafer "
54  << waferU << ":" << waferV << " Cell "
55  << cellU << ":" << cellV;
56  } else {
57  edm::LogVerbatim("HGCSim") << "Bad WaferType " << waferType;
58 #endif
59  }
60  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
61  std::array<int,3> id = hgcons_.assignCellTrap(pos.x(),pos.y(),pos.z(),
62  layer,false);
63  if (id[2] >= 0) {
64  index = HGCScintillatorDetId(id[2], layer, iz*id[0], id[1]).rawId();
65 #ifdef EDM_ML_DEBUG
66  edm::LogVerbatim("HGCSim") << "Radius/Phi " << id[0] << ":" << id[1]
67  << " Type " << id[2] << " Layer|iz "
68  << layer << ":" << iz << " "
70  } else {
71  edm::LogVerbatim("HGCSim") << "Radius/Phi " << id[0] << ":" << id[1]
72  << " Type " << id[2] << " Layer|iz " << layer
73  << ":" << iz;
74 #endif
75  }
76 
77  }
78 #ifdef EDM_ML_DEBUG
79  edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme::i/p " << det_ << ":"
80  << layer << ":" << module << ":" << cell << ":"
81  << iz << ":" << pos.x() << ":" << pos.y() << ":"
82  << pos.z() << " ID " << std::hex << index
83  << std::dec << " wt " << wt;
85 #endif
86  return index;
87 }
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
const HGCalGeometryMode::GeometryMode mode_
const HGCalDDDConstants & hgcons_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
void checkPosition(uint32_t index, const G4ThreeVector &pos) const
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
Definition: vlib.h:208

Member Data Documentation

DetId::Detector HGCalNumberingScheme::det_
private

Definition at line 37 of file HGCalNumberingScheme.h.

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

const HGCalDDDConstants& HGCalNumberingScheme::hgcons_
private

Definition at line 35 of file HGCalNumberingScheme.h.

Referenced by checkPosition(), and getUnitID().

const HGCalGeometryMode::GeometryMode HGCalNumberingScheme::mode_
private

Definition at line 36 of file HGCalNumberingScheme.h.

Referenced by getUnitID().

std::string HGCalNumberingScheme::name_
private

Definition at line 38 of file HGCalNumberingScheme.h.

Referenced by HGCalNumberingScheme().