CMS 3D CMS Logo

HGCalDDDConstants.cc
Go to the documentation of this file.
2 
16 
17 #include <algorithm>
18 #include <iterator>
19 #include <functional>
20 #include <numeric>
21 
22 //#define EDM_ML_DEBUG
23 using namespace geant_units::operators;
24 
26  : hgpar_(hp), sqrt3_(std::sqrt(3.0)) {
27  mode_ = hgpar_->mode_;
29 #ifdef EDM_ML_DEBUG
30  edm::LogVerbatim("HGCalGeom") << "Mode " << mode_ << " FullAndPart " << fullAndPart_;
31 #endif
32  if (waferHexagon6() || waferHexagon8()) {
34  hexside_ = 2.0 * rmax_ * tan30deg_;
35 #ifdef EDM_ML_DEBUG
36  edm::LogVerbatim("HGCalGeom") << "rmax_ " << rmax_ << ":" << hexside_ << " CellSize "
39 #endif
40  }
41  // init maps and constants
42  modHalf_ = 0;
44  for (int simreco = 0; simreco < 2; ++simreco) {
45  tot_layers_[simreco] = layersInit((bool)simreco);
46  max_modules_layer_[simreco].resize(tot_layers_[simreco] + 1);
47  for (unsigned int layer = 1; layer <= tot_layers_[simreco]; ++layer) {
48  max_modules_layer_[simreco][layer] = modulesInit(layer, (bool)simreco);
49  if (simreco == 1) {
50  modHalf_ += max_modules_layer_[simreco][layer];
52 #ifdef EDM_ML_DEBUG
53  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with " << max_modules_layer_[simreco][layer] << ":"
54  << modHalf_ << " modules in RECO";
55  } else {
56  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with " << max_modules_layer_[simreco][layer]
57  << " modules in SIM";
58 #endif
59  }
60  }
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HGCalGeom") << "SimReco " << simreco << " with " << tot_layers_[simreco] << " Layers";
63 #endif
64  }
65  tot_wafers_ = wafers();
66 
67 #ifdef EDM_ML_DEBUG
68  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants initialized for " << name << " with " << layers(false) << ":"
69  << layers(true) << " layers, " << wafers() << ":" << 2 * modHalf_
70  << " wafers with maximum " << maxWafersPerLayer_ << " per layer and "
71  << "maximum of " << maxCells(false) << ":" << maxCells(true) << " cells";
72 #endif
73  if (waferHexagon6() || waferHexagon8()) {
74  int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
75  for (unsigned int i = 0; i < getTrFormN(); ++i) {
76  int lay0 = getTrForm(i).lay;
77  int wmin(9999999), wmax(-9999999), kount(0);
78  for (int wafer = 0; wafer < sectors(); ++wafer) {
79  bool waferIn = waferInLayer(wafer, lay0, true);
80  if (waferHexagon8()) {
81  int kndx = HGCalWaferIndex::waferIndex(lay0,
84  waferIn_[kndx] = waferIn;
85  }
86  if (waferIn) {
87  int waferU = ((waferHexagon6()) ? wafer : HGCalWaferIndex::waferU(hgpar_->waferCopy_[wafer]));
88  if (waferU < wmin)
89  wmin = waferU;
90  if (waferU > wmax)
91  wmax = waferU;
92  ++kount;
93  }
94  }
95  if (wminT > wmin)
96  wminT = wmin;
97  if (wmaxT < wmax)
98  wmaxT = wmax;
99  if (kount1 < kount)
100  kount1 = kount;
101  kount2 += kount;
102 #ifdef EDM_ML_DEBUG
103  int lay1 = getIndex(lay0, true).first;
104  edm::LogVerbatim("HGCalGeom") << "Index " << i << " Layer " << lay0 << ":" << lay1 << " Wafer " << wmin << ":"
105  << wmax << ":" << kount;
106 #endif
107  HGCWaferParam a1{{wmin, wmax, kount}};
108  waferLayer_[lay0] = a1;
109  }
110  waferMax_ = std::array<int, 4>{{wminT, wmaxT, kount1, kount2}};
111 #ifdef EDM_ML_DEBUG
112  edm::LogVerbatim("HGCalGeom") << "Overall wafer statistics: " << wminT << ":" << wmaxT << ":" << kount1 << ":"
113  << kount2;
114 #endif
115  }
116 }
117 
119 
120 std::pair<int, int> HGCalDDDConstants::assignCell(float x, float y, int lay, int subSec, bool reco) const {
121  const auto& index = getIndex(lay, reco);
122  if (index.first < 0)
123  return std::make_pair(-1, -1);
124  if (waferHexagon6()) {
125  float xx = (reco) ? x : HGCalParameters::k_ScaleFromDDD * x;
126  float yy = (reco) ? y : HGCalParameters::k_ScaleFromDDD * y;
127 
128  // First the wafer
129  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
130  if (wafer < 0 || wafer >= (int)(hgpar_->waferTypeT_.size())) {
131  edm::LogWarning("HGCalGeom") << "Wafer no. out of bound for " << wafer << ":" << (hgpar_->waferTypeT_).size()
132  << ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size()
133  << " ***** ERROR *****";
134  return std::make_pair(-1, -1);
135  } else {
136  // Now the cell
137  xx -= hgpar_->waferPosX_[wafer];
138  yy -= hgpar_->waferPosY_[wafer];
139  if (hgpar_->waferTypeT_[wafer] == 1)
140  return std::make_pair(wafer,
141  cellHex(xx,
142  yy,
145  hgpar_->cellFineY_));
146  else
147  return std::make_pair(wafer,
148  cellHex(xx,
149  yy,
152  hgpar_->cellCoarseY_));
153  }
154  } else {
155  return std::make_pair(-1, -1);
156  }
157 }
158 
159 std::array<int, 5> HGCalDDDConstants::assignCellHex(float x, float y, int lay, bool reco) const {
160  int waferU(0), waferV(0), waferType(-1), cellU(0), cellV(0);
161  if (waferHexagon8()) {
162  double xx = (reco) ? HGCalParameters::k_ScaleToDDD * x : x;
163  double yy = (reco) ? HGCalParameters::k_ScaleToDDD * y : y;
164  double wt(1.0);
165  waferFromPosition(xx, yy, lay, waferU, waferV, cellU, cellV, waferType, wt);
166  }
167  return std::array<int, 5>{{waferU, waferV, waferType, cellU, cellV}};
168 }
169 
170 std::array<int, 3> HGCalDDDConstants::assignCellTrap(float x, float y, float z, int layer, bool reco) const {
171  int irad(-1), iphi(-1), type(-1);
172  const auto& indx = getIndex(layer, reco);
173  if (indx.first < 0)
174  return std::array<int, 3>{{irad, iphi, type}};
175  double xx = (z > 0) ? x : -x;
176  double r = (reco ? std::sqrt(x * x + y * y) : HGCalParameters::k_ScaleFromDDD * std::sqrt(x * x + y * y));
177  double phi = (r == 0. ? 0. : std::atan2(y, xx));
178  if (phi < 0)
179  phi += (2.0 * M_PI);
181  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(), hgpar_->radiusLayer_[type].end(), r);
182  irad = (int)(ir - hgpar_->radiusLayer_[type].begin());
183  irad = std::clamp(irad, hgpar_->iradMinBH_[indx.first], hgpar_->iradMaxBH_[indx.first]);
184  iphi = 1 + (int)(phi / indx.second);
185 #ifdef EDM_ML_DEBUG
186  edm::LogVerbatim("HGCalGeom") << "assignCellTrap Input " << x << ":" << y << ":" << z << ":" << layer << ":" << reco
187  << " x|r " << xx << ":" << r << " phi " << phi << " o/p " << irad << ":" << iphi << ":"
188  << type;
189 #endif
190  return std::array<int, 3>{{irad, iphi, type}};
191 }
192 
193 std::pair<double, double> HGCalDDDConstants::cellEtaPhiTrap(int type, int irad) const {
194  double dr(0), df(0);
195  if (tileTrapezoid()) {
196  double r = 0.5 * ((hgpar_->radiusLayer_[type][irad - 1] + hgpar_->radiusLayer_[type][irad]));
197  dr = (hgpar_->radiusLayer_[type][irad] - hgpar_->radiusLayer_[type][irad - 1]);
198  df = r * hgpar_->cellSize_[type];
199  }
200  return std::make_pair(dr, df);
201 }
202 
203 bool HGCalDDDConstants::cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const {
204  const auto& indx = getIndex(lay, true);
205  if (indx.first >= 0) {
206  if (waferHexagon8() || waferHexagon6()) {
207  const auto& xy = ((waferHexagon8()) ? locateCell(lay, waferU, waferV, cellU, cellV, reco, true, false)
208  : locateCell(cellU, lay, waferU, reco));
209  double rpos = sqrt(xy.first * xy.first + xy.second * xy.second);
210  return ((rpos >= hgpar_->rMinLayHex_[indx.first]) && (rpos <= hgpar_->rMaxLayHex_[indx.first]));
211  } else {
212  return true;
213  }
214  } else {
215  return false;
216  }
217 }
218 
220  double thick(-1);
221  int type = waferType(layer, waferU, waferV, false);
222  if (type >= 0) {
223  if (waferHexagon8()) {
224  thick = 10000.0 * hgpar_->cellThickness_[type]; // cm to micron
225  } else if (waferHexagon6()) {
226  thick = 100.0 * (type + 1); // type = 1,2,3 for 100,200,300 micron
227  }
228  }
229  return thick;
230 }
231 
233  int indx = ((waferHexagon8()) ? ((type >= 1) ? 1 : 0) : ((type == 1) ? 1 : 0));
234  double cell = (tileTrapezoid() ? 0.5 * hgpar_->cellSize_[indx]
236  return cell;
237 }
238 
239 HGCalTypes::CellType HGCalDDDConstants::cellType(int type, int cellU, int cellV) const {
240  // type=0: in the middle; 1..6: the edges clocwise from bottom left;
241  // =11..16: the corners clockwise from bottom
242  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
243  if (cellU == 0) {
244  if (cellV == 0)
246  else if (cellV - cellU == N - 1)
248  else
250  } else if (cellV == 0) {
251  if (cellU - cellV == N)
253  else
255  } else if (cellU - cellV == N) {
256  if (cellU == 2 * N - 1)
258  else
260  } else if (cellU == 2 * N - 1) {
261  if (cellV == 2 * N - 1)
263  else
265  } else if (cellV == 2 * N - 1) {
266  if (cellV - cellU == N - 1)
268  else
270  } else if (cellV - cellU == N - 1) {
272  } else if ((cellU > 2 * N - 1) || (cellV > 2 * N - 1) || (cellV >= (cellU + N)) || (cellU > (cellV + N))) {
274  } else {
276  }
277 }
278 
279 double HGCalDDDConstants::distFromEdgeHex(double x, double y, double z) const {
280  // Assming the point is within a hexagonal plane of the wafer, calculate
281  // the shortest distance from the edge
282  if (z < 0)
283  x = -x;
284  double dist(0);
285  // Input x, y in Geant4 unit and transformed to CMSSW standard
288  if (waferHexagon8()) {
289  int ll = layerIndex(getLayer(z, false), false);
290  xx -= hgpar_->xLayerHex_[ll];
291  yy -= hgpar_->yLayerHex_[ll];
292  }
293  int sizew = (int)(hgpar_->waferPosX_.size());
294  int wafer = sizew;
295  // Transform to the local coordinate frame of the wafer first
296  for (int k = 0; k < sizew; ++k) {
297  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
298  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
299  if ((dx <= rmax_) && (dy <= hexside_) && ((dy <= 0.5 * hexside_) || (dx * tan30deg_ <= (hexside_ - dy)))) {
300  wafer = k;
301  xx -= hgpar_->waferPosX_[k];
302  yy -= hgpar_->waferPosY_[k];
303  break;
304  }
305  }
306  // Look at only one quarter (both x,y are positive)
307  if (wafer < sizew) {
308  if (std::abs(yy) < 0.5 * hexside_) {
309  dist = rmax_ - std::abs(xx);
310  } else {
311  dist = 0.5 * ((rmax_ - std::abs(xx)) - sqrt3_ * (std::abs(yy) - 0.5 * hexside_));
312  }
313  } else {
314  dist = 0;
315  }
317 #ifdef EDM_ML_DEBUG
318  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeHex: Local " << xx << ":" << yy << " wafer " << wafer << " flag "
319  << (wafer < sizew) << " Distance " << rmax_ << ":" << (rmax_ - std::abs(xx)) << ":"
320  << (std::abs(yy) - 0.5 * hexside_) << ":" << 0.5 * hexside_ << ":" << dist;
321 #endif
322  return dist;
323 }
324 
325 double HGCalDDDConstants::distFromEdgeTrap(double x, double y, double z) const {
326  // Assming the point is within the eta-phi plane of the scintillator tile,
327  // calculate the shortest distance from the edge
328  int lay = getLayer(z, false);
329  double xx = (z < 0) ? -x : x;
330  int indx = layerIndex(lay, false);
331  double r = HGCalParameters::k_ScaleFromDDD * std::sqrt(x * x + y * y);
332  double phi = (r == 0. ? 0. : std::atan2(y, xx));
333  if (phi < 0)
334  phi += (2.0 * M_PI);
335  int type = hgpar_->scintType(lay);
336  double cell = hgpar_->scintCellSize(lay);
337  // Compare with the center of the tile find distances along R and also phi
338  // Take the smaller value
339  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(), hgpar_->radiusLayer_[type].end(), r);
340  int irad = (int)(ir - hgpar_->radiusLayer_[type].begin());
341  irad = std::clamp(irad, hgpar_->iradMinBH_[indx], hgpar_->iradMaxBH_[indx]);
342  int iphi = 1 + (int)(phi / cell);
343  double dphi = std::max(0.0, (0.5 * cell - std::abs(phi - (iphi - 0.5) * cell)));
344  double dist = std::min((r - hgpar_->radiusLayer_[type][irad - 1]), (hgpar_->radiusLayer_[type][irad] - r));
345 #ifdef EDM_ML_DEBUG
346  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeTrap: Global " << x << ":" << y << ":" << z << " Layer " << lay
347  << " Index " << indx << ":" << type << " xx " << xx << " R " << r << ":" << irad << ":"
348  << hgpar_->radiusLayer_[type][irad - 1] << ":" << hgpar_->radiusLayer_[type][irad]
349  << " Phi " << phi << ":" << iphi << ":" << (iphi - 0.5) * cell << " cell " << cell
350  << " Dphi " << dphi << " Dist " << dist << ":" << r * dphi;
351 #endif
352  return HGCalParameters::k_ScaleToDDD * std::min(r * dphi, dist);
353 }
354 
355 int HGCalDDDConstants::getLayer(double z, bool reco) const {
356  // Get the layer # from the gloabl z coordinate
357  unsigned int k = 0;
359  const auto& zLayerHex = hgpar_->zLayerHex_;
360  auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(), [&k, &zz, &zLayerHex](double zLayer) {
361  ++k;
362  return zz < 0.5 * (zLayerHex[k - 1] + zLayerHex[k]);
363  });
364  int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) : k;
365  if (waferHexagon6() && reco) {
366  int indx = layerIndex(lay, false);
367  if (indx >= 0)
368  lay = hgpar_->layerGroupO_[indx];
369  } else {
370  lay += (hgpar_->firstLayer_ - 1);
371  }
372  return lay;
373 }
374 
375 HGCalParameters::hgtrap HGCalDDDConstants::getModule(unsigned int indx, bool hexType, bool reco) const {
377  if (hexType) {
378  if (indx >= hgpar_->waferTypeL_.size())
379  edm::LogWarning("HGCalGeom") << "Wafer no. out bound for index " << indx << ":" << (hgpar_->waferTypeL_).size()
380  << ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size()
381  << " ***** ERROR *****";
382  unsigned int type =
383  ((indx < hgpar_->waferTypeL_.size()) ? hgpar_->waferTypeL_[indx] - 1 : HGCSiliconDetId::HGCalCoarseThick);
384  mytr = hgpar_->getModule(type, reco);
385  } else {
386  mytr = hgpar_->getModule(indx, reco);
387  }
388  return mytr;
389 }
390 
391 std::vector<HGCalParameters::hgtrap> HGCalDDDConstants::getModules() const {
392  std::vector<HGCalParameters::hgtrap> mytrs;
393  for (unsigned int k = 0; k < hgpar_->moduleLayR_.size(); ++k)
394  mytrs.emplace_back(hgpar_->getModule(k, true));
395  return mytrs;
396 }
397 
398 int HGCalDDDConstants::getPhiBins(int lay) const { return (tileTrapezoid() ? hgpar_->scintCells(lay) : 0); }
399 
400 std::pair<int, int> HGCalDDDConstants::getREtaRange(int lay) const {
401  int irmin(0), irmax(0);
402  if (tileTrapezoid()) {
403  int indx = layerIndex(lay, false);
404  if ((indx >= 0) && (indx < static_cast<int>(hgpar_->iradMinBH_.size()))) {
405  irmin = hgpar_->iradMinBH_[indx];
406  irmax = hgpar_->iradMaxBH_[indx];
407  }
408  }
409  return std::make_pair(irmin, irmax);
410 }
411 
412 std::vector<HGCalParameters::hgtrform> HGCalDDDConstants::getTrForms() const {
413  std::vector<HGCalParameters::hgtrform> mytrs;
414  for (unsigned int k = 0; k < hgpar_->trformIndex_.size(); ++k)
415  mytrs.emplace_back(hgpar_->getTrForm(k));
416  return mytrs;
417 }
418 
420  // Get the module type for scinitllator
421  if (tileTrapezoid()) {
422  return hgpar_->scintType(layer);
423  } else {
424  return -1;
425  }
426 }
427 
429  // Get the module type for a silicon wafer
430  if (waferHexagon8()) {
432  return ((itr == hgpar_->typesInLayers_.end() ? 2 : hgpar_->waferTypeL_[itr->second]));
433  } else {
434  return -1;
435  }
436 }
437 
438 bool HGCalDDDConstants::isHalfCell(int waferType, int cell) const {
439  if (waferType < 1 || cell < 0)
440  return false;
441  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
442 }
443 
444 bool HGCalDDDConstants::isValidHex(int lay, int mod, int cell, bool reco) const {
445  // Check validity for a layer|wafer|cell of pre-TDR version
446  bool result(false), resultMod(false);
447  int cellmax(0);
448  if (waferHexagon6()) {
449  int32_t copyNumber = hgpar_->waferCopy_[mod];
450  result = ((lay > 0 && lay <= (int)(layers(reco))));
451  if (result) {
452  const int32_t lay_idx = reco ? (lay - 1) * 3 + 1 : lay;
453  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
454  auto moditr = the_modules.find(copyNumber);
455  result = resultMod = (moditr != the_modules.end());
456 #ifdef EDM_ML_DEBUG
457  if (!result)
458  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":" << lay_idx << " Copy " << copyNumber
459  << ":" << mod << " Flag " << result;
460 #endif
461  if (result) {
462  if (moditr->second >= 0) {
463  if (mod >= (int)(hgpar_->waferTypeT_.size()))
464  edm::LogWarning("HGCalGeom") << "Module no. out of bound for " << mod << " to be compared with "
465  << (hgpar_->waferTypeT_).size() << " ***** ERROR *****";
466  cellmax = ((hgpar_->waferTypeT_[mod] - 1 == HGCSiliconDetId::HGCalFine) ? (int)(hgpar_->cellFineX_.size())
467  : (int)(hgpar_->cellCoarseX_.size()));
468  result = (cell >= 0 && cell <= cellmax);
469  } else {
470  result = isValidCell(lay_idx, mod, cell);
471  }
472  }
473  }
474  }
475 
476 #ifdef EDM_ML_DEBUG
477  if (!result)
478  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":"
479  << (lay > 0 && (lay <= (int)(layers(reco)))) << " Module " << mod << ":" << resultMod
480  << " Cell " << cell << ":" << cellmax << ":" << (cell >= 0 && cell <= cellmax) << ":"
481  << maxCells(reco);
482 #endif
483  return result;
484 }
485 
486 bool HGCalDDDConstants::isValidHex8(int layer, int modU, int modV, bool fullAndPart) const {
487  // Check validity for a layer|wafer|cell of post-TDR version
488  int indx = HGCalWaferIndex::waferIndex(layer, modU, modV);
489  auto itr = hgpar_->typesInLayers_.find(indx);
490 #ifdef EDM_ML_DEBUG
491  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferType " << layer << ":" << modU << ":" << modV
492  << ":" << indx << " Test " << (itr != hgpar_->typesInLayers_.end());
493 #endif
494  if (itr == hgpar_->typesInLayers_.end())
495  return false;
496 
497  if (fullAndPart_) {
498  auto ktr = hgpar_->waferInfoMap_.find(indx);
499 #ifdef EDM_ML_DEBUG
500  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferInfoMap " << layer << ":" << modU << ":"
501  << modV << ":" << indx << " Test " << (ktr != hgpar_->waferInfoMap_.end());
502 #endif
503  if (ktr == hgpar_->waferInfoMap_.end())
504  return false;
505  } else {
506  auto jtr = waferIn_.find(indx);
507 #ifdef EDM_ML_DEBUG
508  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferIn " << jtr->first << ":" << jtr->second;
509 #endif
510  if (!(jtr->second))
511  return false;
512  }
513 
514  if (fullAndPart || fullAndPart_) {
515  auto ktr = hgpar_->waferTypes_.find(indx);
516  if (ktr != hgpar_->waferTypes_.end()) {
517  if (hgpar_->waferMaskMode_ > 0) {
518  if (ktr->second.first == HGCalTypes::WaferOut)
519  return false;
520  } else {
521  if (ktr->second.first < HGCalTypes::WaferCornerMin)
522  return false;
523  }
524  }
525  }
526  return true;
527 }
528 
529 bool HGCalDDDConstants::isValidHex8(int layer, int modU, int modV, int cellU, int cellV, bool fullAndPart) const {
530  // First check validity for a layer|wafer| of post TDR version
531  if (!isValidHex8(layer, modU, modV, fullAndPart))
532  return false;
533  int indx = HGCalWaferIndex::waferIndex(layer, modU, modV);
534  auto itr = hgpar_->typesInLayers_.find(indx);
535  int type = hgpar_->waferTypeL_[itr->second];
536  int N = ((hgpar_->waferTypeL_[itr->second] == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_);
537 #ifdef EDM_ML_DEBUG
538  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:Cell " << cellU << ":" << cellV << ":" << N
539  << " Tests " << (cellU >= 0) << ":" << (cellU < 2 * N) << ":" << (cellV >= 0) << ":"
540  << (cellV < 2 * N) << ":" << ((cellV - cellU) < N) << ":" << ((cellU - cellV) <= N);
541 #endif
542  if ((cellU < 0) || (cellU >= 2 * N) || (cellV < 0) || (cellV >= 2 * N))
543  return false;
544  if (((cellV - cellU) >= N) || ((cellU - cellV) > N))
545  return false;
546 
547  return isValidCell8(layer, modU, modV, cellU, cellV, type);
548 }
549 
550 bool HGCalDDDConstants::isValidTrap(int layer, int irad, int iphi) const {
551  // Check validity for a layer|eta|phi of scintillator
552  const auto& indx = getIndex(layer, true);
553  if (indx.first < 0)
554  return false;
555  return ((irad >= hgpar_->iradMinBH_[indx.first]) && (irad <= hgpar_->iradMaxBH_[indx.first]) && (iphi > 0) &&
556  (iphi <= hgpar_->scintCells(layer)));
557 }
558 
559 int HGCalDDDConstants::lastLayer(bool reco) const { return (hgpar_->firstLayer_ + tot_layers_[(int)reco] - 1); }
560 
561 unsigned int HGCalDDDConstants::layers(bool reco) const { return tot_layers_[(int)reco]; }
562 
563 int HGCalDDDConstants::layerIndex(int lay, bool reco) const {
564  int ll = lay - hgpar_->firstLayer_;
565  if (ll < 0 || ll >= (int)(hgpar_->layerIndex_.size()))
566  return -1;
567  if (waferHexagon6()) {
568  if (reco && ll >= (int)(hgpar_->depthIndex_.size()))
569  return -1;
570  return (reco ? hgpar_->depthLayerF_[ll] : hgpar_->layerIndex_[ll]);
571  } else {
572  return (hgpar_->layerIndex_[ll]);
573  }
574 }
575 
576 unsigned int HGCalDDDConstants::layersInit(bool reco) const {
577  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
578 }
579 
580 std::pair<float, float> HGCalDDDConstants::locateCell(int cell, int lay, int type, bool reco) const {
581  // type refers to wafer # for hexagon cell
582  float x(999999.), y(999999.);
583  const auto& index = getIndex(lay, reco);
584  int i = index.first;
585  if (i < 0)
586  return std::make_pair(x, y);
587  if (waferHexagon6()) {
588  x = hgpar_->waferPosX_[type];
589  y = hgpar_->waferPosY_[type];
590 #ifdef EDM_ML_DEBUG
591  float x0(x), y0(y);
592 #endif
594  x += hgpar_->cellFineX_[cell];
595  y += hgpar_->cellFineY_[cell];
596  } else {
597  x += hgpar_->cellCoarseX_[cell];
598  y += hgpar_->cellCoarseY_[cell];
599  }
600 #ifdef EDM_ML_DEBUG
601  edm::LogVerbatim("HGCalGeom") << "LocateCell (Wafer) " << x0 << ":" << y0 << " Final " << x << ":" << y;
602 #endif
603  if (!reco) {
606  }
607  }
608  return std::make_pair(x, y);
609 }
610 
611 std::pair<float, float> HGCalDDDConstants::locateCell(
612  int lay, int waferU, int waferV, int cellU, int cellV, bool reco, bool all, bool debug) const {
613  float x(0), y(0);
614  int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
615  auto itr = hgpar_->typesInLayers_.find(indx);
616  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 : hgpar_->waferTypeL_[itr->second]);
617 #ifdef EDM_ML_DEBUG
618  if (debug) {
619  edm::LogVerbatim("HGCalGeom") << "LocateCell " << lay << ":" << waferU << ":" << waferV << ":" << indx << ":"
620  << (itr == hgpar_->typesInLayers_.end()) << ":" << type;
621  }
622 #endif
623  int kndx = cellV * 100 + cellU;
624  if (type == 0) {
625  auto ktr = hgpar_->cellFineIndex_.find(kndx);
626  if (ktr != hgpar_->cellFineIndex_.end()) {
627  x = hgpar_->cellFineX_[ktr->second];
628  y = hgpar_->cellFineY_[ktr->second];
629  }
630 #ifdef EDM_ML_DEBUG
631  if (debug)
632  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
633  << (ktr != hgpar_->cellFineIndex_.end());
634 #endif
635  } else {
636  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
637  if (ktr != hgpar_->cellCoarseIndex_.end()) {
638  x = hgpar_->cellCoarseX_[ktr->second];
639  y = hgpar_->cellCoarseY_[ktr->second];
640  }
641 #ifdef EDM_ML_DEBUG
642  if (debug)
643  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
644  << (ktr != hgpar_->cellCoarseIndex_.end());
645 #endif
646  }
647  if (!reco) {
650  }
651  if (all) {
652  const auto& xy = waferPosition(lay, waferU, waferV, reco, debug);
653  x += xy.first;
654  y += xy.second;
655 #ifdef EDM_ML_DEBUG
656  if (debug)
657  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << ":" << xy.first << ":" << xy.second;
658 #endif
659  }
660  return std::make_pair(x, y);
661 }
662 
663 std::pair<float, float> HGCalDDDConstants::locateCell(const HGCSiliconDetId& id, bool debug) const {
664  int lay(id.layer());
665  double r = 0.5 * (hgpar_->waferSize_ + hgpar_->sensorSeparation_);
666  double R = 2.0 * r / sqrt3_;
667  int ncells = (id.type() == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
668  int n2 = ncells / 2;
669  auto xyoff = geomTools_.shiftXY(hgpar_->layerCenter_[lay - 1], (2.0 * r));
670  double xpos = xyoff.first + ((-2 * id.waferU() + id.waferV()) * r);
671  double ypos = xyoff.second + (1.5 * id.waferV() * R);
672  if (debug)
673  edm::LogVerbatim("HGCalGeom") << "LocateCell " << id << " Lay " << lay << " r:R " << r << ":" << R << " N "
674  << ncells << ":" << n2 << " Off " << xyoff.first << ":" << xyoff.second << " Pos "
675  << xpos << ":" << ypos;
676  double R1 = hgpar_->waferSize_ / (3.0 * ncells);
677  double r1 = 0.5 * R1 * sqrt3_;
678  xpos += ((1.5 * (id.cellV() - ncells) + 1.0) * R1);
679  ypos += ((id.cellU() - 0.5 * id.cellV() - n2) * 2 * r1);
680  if (debug)
681  edm::LogVerbatim("HGCalGeom") << "LocateCell r1:R1 " << r1 << ":" << R1 << " dx:dy "
682  << ((1.5 * (id.cellV() - ncells) + 1.0) * R1) << ":"
683  << ((id.cellU() - 0.5 * id.cellV() - n2) * 2 * r1) << " Pos " << xpos << ":" << ypos;
684  return std::make_pair(xpos * id.zside(), ypos);
685 }
686 
687 std::pair<float, float> HGCalDDDConstants::locateCell(const HGCScintillatorDetId& id, bool debug) const {
688  int lay(id.layer()), iphi(id.iphi()), ir(id.iradiusAbs());
689  double phi = (iphi - 0.5) * hgpar_->scintCellSize(lay);
690  int type = (id.type() > 0) ? 1 : 0;
691  double r = (((ir + 1) < static_cast<int>(hgpar_->radiusLayer_[type].size()))
692  ? (0.5 * (hgpar_->radiusLayer_[type][ir] + hgpar_->radiusLayer_[type][ir - 1]))
693  : (1.5 * hgpar_->radiusLayer_[type][ir] - 0.5 * hgpar_->radiusLayer_[type][ir - 1]));
694  if (debug)
695  edm::LogVerbatim("HGCalGeom") << "LocateCell lay:ir:iphi:type " << lay << ":" << ir << ":" << iphi << ":" << type
696  << " r:phi " << r << ":" << convertRadToDeg(phi) << " x:y "
697  << (r * cos(phi) * id.zside()) << ":" << (r * sin(phi));
698  return std::make_pair(r * cos(phi) * id.zside(), r * sin(phi));
699 }
700 
701 std::pair<float, float> HGCalDDDConstants::locateCellHex(int cell, int wafer, bool reco) const {
702  float x(0), y(0);
703  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
704  x = hgpar_->cellFineX_[cell];
705  y = hgpar_->cellFineY_[cell];
706  } else {
707  x = hgpar_->cellCoarseX_[cell];
708  y = hgpar_->cellCoarseY_[cell];
709  }
710  if (!reco) {
713  }
714  return std::make_pair(x, y);
715 }
716 
717 std::pair<float, float> HGCalDDDConstants::locateCellTrap(int lay, int irad, int iphi, bool reco) const {
718  float x(0), y(0);
719  const auto& indx = getIndex(lay, reco);
720  if (indx.first >= 0) {
721  int ir = std::abs(irad);
722  int type = hgpar_->scintType(lay);
723  double phi = (iphi - 0.5) * indx.second;
724  double z = hgpar_->zLayerHex_[indx.first];
725  double r = 0.5 * (hgpar_->radiusLayer_[type][ir - 1] + hgpar_->radiusLayer_[type][ir]);
726  std::pair<double, double> range = rangeR(z, true);
727 #ifdef EDM_ML_DEBUG
728  edm::LogVerbatim("HGCalGeom") << "locateCellTrap:: Input " << lay << ":" << irad << ":" << iphi << ":" << reco
729  << " IR " << ir << ":" << hgpar_->iradMinBH_[indx.first] << ":"
730  << hgpar_->iradMaxBH_[indx.first] << " Type " << type << " Z " << indx.first << ":"
731  << z << " phi " << phi << " R " << r << ":" << range.first << ":" << range.second;
732 #endif
734  r = std::max(range.first, std::min(r, range.second));
735  x = r * std::cos(phi);
736  y = r * std::sin(phi);
737  if (irad < 0)
738  x = -x;
739  }
740  if (!reco) {
743  }
744  return std::make_pair(x, y);
745 }
746 
747 bool HGCalDDDConstants::maskCell(const DetId& detId, int corners) const {
748  bool mask(false);
749  if (corners > 2 && corners <= (int)(HGCalParameters::k_CornerSize)) {
750  if (waferHexagon8()) {
751  int N(0), layer(0), waferU(0), waferV(0), u(0), v(0);
752  if (detId.det() == DetId::Forward) {
753  HFNoseDetId id(detId);
754  N = getUVMax(id.type());
755  layer = id.layer();
756  waferU = id.waferU();
757  waferV = id.waferV();
758  u = id.cellU();
759  v = id.cellV();
760  } else {
761  HGCSiliconDetId id(detId);
762  N = getUVMax(id.type());
763  layer = id.layer();
764  waferU = id.waferU();
765  waferV = id.waferV();
766  u = id.cellU();
767  v = id.cellV();
768  }
770  auto itr = hgpar_->waferTypes_.find(wl);
771 #ifdef EDM_ML_DEBUG
772  edm::LogVerbatim("HGCalGeom") << "MaskCell: Layer " << layer << " Wafer " << waferU << ":" << waferV << " Index "
773  << wl << ":" << (itr != hgpar_->waferTypes_.end());
774 #endif
775  if (itr != hgpar_->waferTypes_.end()) {
776  if ((itr->second).second <= HGCalWaferMask::k_OffsetRotation)
777  mask = HGCalWaferMask::maskCell(u, v, N, (itr->second).first, (itr->second).second, corners);
778  else
779  mask = !(HGCalWaferMask::goodCell(
780  u, v, N, (itr->second).first, ((itr->second).second - HGCalWaferMask::k_OffsetRotation)));
781  }
782  }
783  }
784  return mask;
785 }
786 
788  int cells(0);
789  for (unsigned int i = 0; i < layers(reco); ++i) {
790  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
791  if (cells < maxCells(lay, reco))
792  cells = maxCells(lay, reco);
793  }
794  return cells;
795 }
796 
797 int HGCalDDDConstants::maxCells(int lay, bool reco) const {
798  const auto& index = getIndex(lay, reco);
799  if (index.first < 0)
800  return 0;
801  if (waferHexagon6()) {
802  unsigned int cells(0);
803  for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
804  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
805  unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine) ? (hgpar_->cellFineX_.size())
806  : (hgpar_->cellCoarseX_.size());
807  if (cell > cells)
808  cells = cell;
809  }
810  }
811  return (int)(cells);
812  } else if (waferHexagon8()) {
813  int cells(0);
814  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
815  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
819  : hgpar_->waferTypeL_[itr->second]);
821  cells = std::max(cells, 3 * N * N);
822  }
823  }
824  return cells;
825  } else if (tileTrapezoid()) {
826  return hgpar_->scintCells(index.first + hgpar_->firstLayer_);
827  } else {
828  return 0;
829  }
830 }
831 
832 int HGCalDDDConstants::maxRows(int lay, bool reco) const {
833  int kymax(0);
834  const auto& index = getIndex(lay, reco);
835  int i = index.first;
836  if (i < 0)
837  return kymax;
838  if (waferHexagon6()) {
839  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
841  int ky = ((hgpar_->waferCopy_[k]) / 100) % 100;
842  if (ky > kymax)
843  kymax = ky;
844  }
845  }
846  } else if (waferHexagon8()) {
847  kymax = 1 + 2 * hgpar_->waferUVMaxLayer_[index.first];
848  }
849  return kymax;
850 }
851 
852 int HGCalDDDConstants::modifyUV(int uv, int type1, int type2) const {
853  // Modify u/v for transition of type1 to type2
854  return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2));
855 }
856 
857 int HGCalDDDConstants::modules(int lay, bool reco) const {
858  if (getIndex(lay, reco).first < 0)
859  return 0;
860  else
861  return max_modules_layer_[(int)reco][lay];
862 }
863 
864 int HGCalDDDConstants::modulesInit(int lay, bool reco) const {
865  int nmod(0);
866  const auto& index = getIndex(lay, reco);
867  if (index.first < 0)
868  return nmod;
869  if (!tileTrapezoid()) {
870  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
871  if (waferInLayerTest(k, index.first, hgpar_->defineFull_))
872  ++nmod;
873  }
874  } else {
875  nmod = 1 + hgpar_->lastModule_[index.first] - hgpar_->firstModule_[index.first];
876  }
877  return nmod;
878 }
879 
880 double HGCalDDDConstants::mouseBite(bool reco) const {
882 }
883 
885  int cells(0);
886  unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size();
887  for (unsigned k = 0; k < nlayer; ++k) {
888  std::vector<int> ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco);
889  cells = std::accumulate(ncells.begin(), ncells.end(), cells);
890  }
891  return cells;
892 }
893 
894 std::vector<int> HGCalDDDConstants::numberCells(int lay, bool reco) const {
895  const auto& index = getIndex(lay, reco);
896  int i = index.first;
897  std::vector<int> ncell;
898  if (i >= 0) {
899  if (waferHexagon6()) {
900  for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
902  unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine)
903  ? (hgpar_->cellFineX_.size())
904  : (hgpar_->cellCoarseX_.size());
905  ncell.emplace_back((int)(cell));
906  }
907  }
908  } else if (tileTrapezoid()) {
909  int nphi = hgpar_->scintCells(lay);
910  for (int k = hgpar_->firstModule_[i]; k <= hgpar_->lastModule_[i]; ++k)
911  ncell.emplace_back(nphi);
912  } else {
913  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
914  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
915  int cell = numberCellsHexagon(lay,
918  true);
919  ncell.emplace_back(cell);
920  }
921  }
922  }
923  }
924  return ncell;
925 }
926 
928  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
929  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine)
930  return (int)(hgpar_->cellFineX_.size());
931  else
932  return (int)(hgpar_->cellCoarseX_.size());
933  } else {
934  return 0;
935  }
936 }
937 
938 int HGCalDDDConstants::numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const {
940  int type =
941  ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]);
942  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
943  if (flag)
944  return (3 * N * N);
945  else
946  return N;
947 }
948 
949 std::pair<double, double> HGCalDDDConstants::rangeR(double z, bool reco) const {
950  double rmin(0), rmax(0), zz(0);
951  if (hgpar_->detectorType_ > 0) {
953  if (hgpar_->detectorType_ <= 2) {
955  } else {
956  rmin = HGCalGeomTools::radius(
958  }
959  if ((hgpar_->detectorType_ == 2) && (zz >= hgpar_->zLayerHex_[hgpar_->firstMixedLayer_ - 1])) {
960  rmax = HGCalGeomTools::radius(
962  } else {
964  }
965  }
966  if (!reco) {
969  }
970 #ifdef EDM_ML_DEBUG
971  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeR: " << z << ":" << zz << " R " << rmin << ":" << rmax;
972 #endif
973  return std::make_pair(rmin, rmax);
974 }
975 
976 std::pair<double, double> HGCalDDDConstants::rangeRLayer(int lay, bool reco) const {
977  double rmin(0), rmax(0);
978  const auto& index = getIndex(lay, reco);
979  if (index.first >= 0 && index.first < static_cast<int>(hgpar_->rMinLayHex_.size())) {
980  rmin = hgpar_->rMinLayHex_[index.first];
981  rmax = hgpar_->rMaxLayHex_[index.first];
982  }
983  if (!reco) {
986  }
987 #ifdef EDM_ML_DEBUG
988  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeR: " << lay << ":" << index.first << " R " << rmin << ":"
989  << rmax;
990 #endif
991  return std::make_pair(rmin, rmax);
992 }
993 
994 std::pair<double, double> HGCalDDDConstants::rangeZ(bool reco) const {
995  double zmin = (hgpar_->zLayerHex_[0] - hgpar_->waferThick_);
996  double zmax = (hgpar_->zLayerHex_[hgpar_->zLayerHex_.size() - 1] + hgpar_->waferThick_);
997 #ifdef EDM_ML_DEBUG
998  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeZ: " << zmin << ":" << zmax << ":" << hgpar_->waferThick_;
999 #endif
1000  if (!reco) {
1003  }
1004  return std::make_pair(zmin, zmax);
1005 }
1006 
1007 std::pair<int, int> HGCalDDDConstants::rowColumnWafer(int wafer) const {
1008  int row(0), col(0);
1009  if (wafer < (int)(hgpar_->waferCopy_.size())) {
1010  int copy = hgpar_->waferCopy_[wafer];
1013  ;
1014  }
1015  return std::make_pair(row, col);
1016 }
1017 
1018 std::pair<int, int> HGCalDDDConstants::simToReco(int cell, int lay, int mod, bool half) const {
1019  if (!waferHexagon6()) {
1020  return std::make_pair(cell, lay);
1021  } else {
1022  const auto& index = getIndex(lay, false);
1023  int i = index.first;
1024  if (i < 0) {
1025  edm::LogWarning("HGCalGeom") << "Wrong Layer # " << lay << " not in the list ***** ERROR *****";
1026  return std::make_pair(-1, -1);
1027  }
1028  if (mod >= (int)(hgpar_->waferTypeL_).size()) {
1029  edm::LogWarning("HGCalGeom") << "Invalid Wafer # " << mod << "should be < " << (hgpar_->waferTypeL_).size()
1030  << " ***** ERROR *****";
1031  return std::make_pair(-1, -1);
1032  }
1033  int depth(-1);
1034  int kx = cell;
1035  int type = hgpar_->waferTypeL_[mod];
1036  if (type == 1) {
1037  depth = hgpar_->layerGroup_[i];
1038  } else if (type == 2) {
1039  depth = hgpar_->layerGroupM_[i];
1040  } else {
1041  depth = hgpar_->layerGroupO_[i];
1042  }
1043  return std::make_pair(kx, depth);
1044  }
1045 }
1046 
1048  const int ncopies = hgpar_->waferCopy_.size();
1049  int wafer(ncopies);
1050  bool result(false);
1051  for (int k = 0; k < ncopies; ++k) {
1052  if (copy == hgpar_->waferCopy_[k]) {
1053  wafer = k;
1054  result = true;
1055  break;
1056  }
1057  }
1058  if (!result) {
1059  wafer = -1;
1060 #ifdef EDM_ML_DEBUG
1061  edm::LogVerbatim("HGCalGeom") << "Cannot find " << copy << " in a list of " << ncopies << " members";
1062  for (int k = 0; k < ncopies; ++k)
1063  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << hgpar_->waferCopy_[k];
1064 #endif
1065  }
1066 #ifdef EDM_ML_DEBUG
1067  edm::LogVerbatim("HGCalGeom") << "WaferFromCopy " << copy << ":" << wafer << ":" << result;
1068 #endif
1069  return wafer;
1070 }
1071 
1072 void HGCalDDDConstants::waferFromPosition(const double x, const double y, int& wafer, int& icell, int& celltyp) const {
1073  // Input x, y in Geant4 unit and transformed to CMSSW standard
1076  int size_ = (int)(hgpar_->waferCopy_.size());
1077  wafer = size_;
1078  for (int k = 0; k < size_; ++k) {
1079  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
1080  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
1081  if (dx <= rmax_ && dy <= hexside_) {
1082  if ((dy <= 0.5 * hexside_) || (dx * tan30deg_ <= (hexside_ - dy))) {
1083  wafer = k;
1084  celltyp = hgpar_->waferTypeT_[k];
1085  xx -= hgpar_->waferPosX_[k];
1086  yy -= hgpar_->waferPosY_[k];
1087  break;
1088  }
1089  }
1090  }
1091  if (wafer < size_) {
1092  if (celltyp - 1 == HGCSiliconDetId::HGCalFine)
1093  icell = cellHex(
1095  else
1096  icell = cellHex(xx,
1097  yy,
1100  hgpar_->cellCoarseY_);
1101  } else {
1102  wafer = -1;
1103 #ifdef EDM_ML_DEBUG
1104  edm::LogWarning("HGCalGeom") << "Cannot get wafer type corresponding to " << x << ":" << y << " " << xx << ":"
1105  << yy;
1106 #endif
1107  }
1108 #ifdef EDM_ML_DEBUG
1109  edm::LogVerbatim("HGCalGeom") << "Position " << x << ":" << y << " Wafer " << wafer << ":" << size_ << " XX " << xx
1110  << ":" << yy << " Cell " << icell << " Type " << celltyp;
1111 #endif
1112 }
1113 
1115  const double y,
1116  const int layer,
1117  int& waferU,
1118  int& waferV,
1119  int& cellU,
1120  int& cellV,
1121  int& celltype,
1122  double& wt,
1123  bool debug) const {
1124  int ll = layer - hgpar_->firstLayer_;
1127  waferU = waferV = 1 + hgpar_->waferUVMax_;
1128  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
1129  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
1130  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
1131  if (dx <= rmax_ && dy <= hexside_) {
1132  if ((dy <= 0.5 * hexside_) || (dx * tan30deg_ <= (hexside_ - dy))) {
1138  } else {
1140  celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick
1141  : hgpar_->waferTypeL_[itr->second]);
1142  }
1143 #ifdef EDM_ML_DEBUG
1144  if (debug)
1145  edm::LogVerbatim("HGCalGeom") << "WaferFromPosition:: Input " << layer << ":" << ll << ":"
1146  << hgpar_->firstLayer_ << ":" << x << ":" << y << ":" << hgpar_->xLayerHex_[ll]
1147  << ":" << hgpar_->yLayerHex_[ll] << ":" << xx << ":" << yy << " compared with "
1148  << hgpar_->waferPosX_[k] << ":" << hgpar_->waferPosY_[k] << " difference " << dx
1149  << ":" << dy << ":" << dx * tan30deg_ << ":" << (hexside_ - dy)
1150  << " comparator " << rmax_ << ":" << hexside_ << " wafer " << waferU << ":"
1151  << waferV << ":" << celltype;
1152 #endif
1153  xx -= hgpar_->waferPosX_[k];
1154  yy -= hgpar_->waferPosY_[k];
1155  break;
1156  }
1157  }
1158  }
1159  if ((std::abs(waferU) <= hgpar_->waferUVMax_) && (celltype >= 0)) {
1160  cellHex(xx, yy, celltype, cellU, cellV, debug);
1161  wt = ((celltype < 2) ? (hgpar_->cellThickness_[celltype] / hgpar_->waferThick_) : 1.0);
1162  } else {
1163  cellU = cellV = 2 * hgpar_->nCellsFine_;
1164  wt = 1.0;
1165  celltype = -1;
1166  }
1167 #ifdef EDM_ML_DEBUG
1168  if (celltype < 0) {
1171  edm::LogVerbatim("HGCalGeom") << "waferFromPosition: Bad type for X " << x << ":" << x1 << ":" << xx << " Y " << y
1172  << ":" << y1 << ":" << yy << " Wafer " << waferU << ":" << waferV << " Cell " << cellU
1173  << ":" << cellV;
1174  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
1175  double dx = std::abs(x1 - hgpar_->waferPosX_[k]);
1176  double dy = std::abs(y1 - hgpar_->waferPosY_[k]);
1177  edm::LogVerbatim("HGCalGeom") << "Wafer [" << k << "] Position (" << hgpar_->waferPosX_[k] << ", "
1178  << hgpar_->waferPosY_[k] << ") difference " << dx << ":" << dy << ":"
1179  << dx * tan30deg_ << ":" << hexside_ - dy << " Paramerers " << rmax_ << ":"
1180  << hexside_;
1181  }
1182  }
1183 #endif
1184 }
1185 
1186 bool HGCalDDDConstants::waferInLayer(int wafer, int lay, bool reco) const {
1187  const auto& indx = getIndex(lay, reco);
1188  if (indx.first < 0)
1189  return false;
1190  return waferInLayerTest(wafer, indx.first, hgpar_->defineFull_);
1191 }
1192 
1193 bool HGCalDDDConstants::waferFullInLayer(int wafer, int lay, bool reco) const {
1194  const auto& indx = getIndex(lay, reco);
1195  if (indx.first < 0)
1196  return false;
1197  return waferInLayerTest(wafer, indx.first, false);
1198 }
1199 
1200 std::pair<double, double> HGCalDDDConstants::waferParameters(bool reco) const {
1201  if (reco)
1202  return std::make_pair(rmax_, hexside_);
1203  else
1205 }
1206 
1207 std::pair<double, double> HGCalDDDConstants::waferPosition(int wafer, bool reco) const {
1208  double xx(0), yy(0);
1209  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
1210  xx = hgpar_->waferPosX_[wafer];
1211  yy = hgpar_->waferPosY_[wafer];
1212  }
1213  if (!reco) {
1216  }
1217  return std::make_pair(xx, yy);
1218 }
1219 
1220 std::pair<double, double> HGCalDDDConstants::waferPosition(
1221  int lay, int waferU, int waferV, bool reco, bool debug) const {
1222  int ll = lay - hgpar_->firstLayer_;
1223  double x = hgpar_->xLayerHex_[ll];
1224  double y = hgpar_->yLayerHex_[ll];
1225 #ifdef EDM_ML_DEBUG
1226  if (debug)
1227  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << ":" << ll << " Shift " << hgpar_->xLayerHex_[ll] << ":"
1228  << hgpar_->yLayerHex_[ll];
1229 #endif
1230  if (!reco) {
1233  }
1234 
1235  const auto& xy = waferPosition(waferU, waferV, reco);
1236  x += xy.first;
1237  y += xy.second;
1238 #ifdef EDM_ML_DEBUG
1239  if (debug)
1240  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << ":" << xy.first << ":" << xy.second;
1241 #endif
1242  return std::make_pair(x, y);
1243 }
1244 
1245 int HGCalDDDConstants::waferType(DetId const& id, bool fromFile) const {
1246  int type(1);
1247  if (waferHexagon8()) {
1248  if (fromFile && (waferFileSize() > 0)) {
1249  int layer(0), waferU(0), waferV(0);
1250  if (id.det() != DetId::Forward) {
1251  HGCSiliconDetId hid(id);
1252  layer = hid.layer();
1253  waferU = hid.waferU();
1254  waferV = hid.waferV();
1255  } else {
1256  HFNoseDetId hid(id);
1257  layer = hid.layer();
1258  waferU = hid.waferU();
1259  waferV = hid.waferV();
1260  }
1262  if (itr != hgpar_->waferInfoMap_.end())
1263  type = (itr->second).type;
1264  } else {
1265  type = ((id.det() != DetId::Forward) ? HGCSiliconDetId(id).type() : HFNoseDetId(id).type());
1266  }
1267  } else if (waferHexagon6()) {
1268  type = waferTypeL(HGCalDetId(id).wafer()) - 1;
1269  }
1270  return type;
1271 }
1272 
1273 int HGCalDDDConstants::waferType(int layer, int waferU, int waferV, bool fromFile) const {
1275  if (waferHexagon8()) {
1276  if (fromFile && (waferFileSize() > 0)) {
1278  if (itr != hgpar_->waferInfoMap_.end())
1279  type = (itr->second).type;
1280  } else {
1282  if (itr != hgpar_->typesInLayers_.end())
1283  type = hgpar_->waferTypeL_[itr->second];
1284  }
1285  } else if (waferHexagon6()) {
1286  if ((waferU >= 0) && (waferU < (int)(hgpar_->waferTypeL_.size())))
1287  type = (hgpar_->waferTypeL_[waferU] - 1);
1288  }
1289  return type;
1290 }
1291 
1292 std::tuple<int, int, int> HGCalDDDConstants::waferType(HGCSiliconDetId const& id, bool fromFile) const {
1293  const auto& index = HGCalWaferIndex::waferIndex(id.layer(), id.waferU(), id.waferV());
1294  int type(-1), part(-1), orient(-1);
1295  if (fromFile && (waferFileSize() > 0)) {
1296  auto itr = hgpar_->waferInfoMap_.find(index);
1297  if (itr != hgpar_->waferInfoMap_.end()) {
1298  type = (itr->second).type;
1299  part = (itr->second).part;
1300  orient = (itr->second).orient;
1301  }
1302  } else {
1303  auto ktr = hgpar_->typesInLayers_.find(index);
1304  if (ktr != hgpar_->typesInLayers_.end())
1305  type = hgpar_->waferTypeL_[ktr->second];
1306  auto itr = hgpar_->waferTypes_.find(index);
1307  if (itr != hgpar_->waferTypes_.end()) {
1308  if ((itr->second).second < HGCalWaferMask::k_OffsetRotation) {
1309  orient = (itr->second).second;
1310  if ((itr->second).first == HGCalGeomTools::k_allCorners) {
1312  } else if ((itr->second).first == HGCalGeomTools::k_fiveCorners) {
1314  } else if ((itr->second).first == HGCalGeomTools::k_fourCorners) {
1316  } else if ((itr->second).first == HGCalGeomTools::k_threeCorners) {
1318  }
1319  } else {
1320  part = (itr->second).first;
1321  orient = ((itr->second).second - HGCalWaferMask::k_OffsetRotation);
1322  }
1323  } else {
1325  orient = 0;
1326  }
1327  }
1328  return std::make_tuple(type, part, orient);
1329 }
1330 
1332  int layer, int waferU, int waferV, bool fromFile, bool debug) const {
1333  int type(HGCalTypes::WaferOut), rotn(0);
1335  bool withinList(true);
1336  if (fromFile && (waferFileSize() > 0)) {
1337  auto itr = hgpar_->waferInfoMap_.find(wl);
1338  withinList = (itr != hgpar_->waferInfoMap_.end());
1339  if (withinList) {
1340  type = (itr->second).part;
1341  rotn = (itr->second).orient;
1342  }
1343  } else {
1344  auto itr = hgpar_->waferTypes_.find(wl);
1345  if (waferHexagon8()) {
1346  withinList = (itr != hgpar_->waferTypes_.end());
1347  if (withinList) {
1348  if ((itr->second).second < HGCalWaferMask::k_OffsetRotation) {
1349  rotn = (itr->second).second;
1350  if ((itr->second).first == HGCalGeomTools::k_allCorners) {
1352  } else if ((itr->second).first == HGCalGeomTools::k_fiveCorners) {
1354  } else if ((itr->second).first == HGCalGeomTools::k_fourCorners) {
1356  } else if ((itr->second).first == HGCalGeomTools::k_threeCorners) {
1358  }
1359  } else {
1360  type = (itr->second).first;
1361  rotn = ((itr->second).second - HGCalWaferMask::k_OffsetRotation);
1362  }
1363  } else {
1365  rotn = HGCalTypes::WaferCorner0;
1366  }
1367  }
1368  }
1369 #ifdef EDM_ML_DEBUG
1370  if (debug)
1371  edm::LogVerbatim("HGCalGeom") << "waferTypeRotation: Layer " << layer << " Wafer " << waferU << ":" << waferV
1372  << " Index " << std::hex << wl << std::dec << ":" << withinList << " Type " << type
1373  << " Rotation " << rotn;
1374 #endif
1375  return std::make_pair(type, rotn);
1376 }
1377 
1379  bool type(false);
1380  if (waferHexagon8()) {
1382  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1383  } else if (waferHexagon6()) {
1384  int wl = HGCalWaferIndex::waferIndex(layer, waferU, 0, true);
1385  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1386  }
1387  return type;
1388 }
1389 
1390 double HGCalDDDConstants::waferZ(int lay, bool reco) const {
1391  const auto& index = getIndex(lay, reco);
1392  if (index.first < 0)
1393  return 0;
1394  else
1396 }
1397 
1399  int wafer(0);
1400  if (!tileTrapezoid()) {
1401  for (unsigned int i = 0; i < layers(true); ++i) {
1402  int lay = hgpar_->depth_[i];
1403  wafer += modules(lay, true);
1404  }
1405  } else {
1406  wafer = (int)(hgpar_->moduleLayR_.size());
1407  }
1408  return wafer;
1409 }
1410 
1411 int HGCalDDDConstants::wafers(int layer, int type) const {
1412  int wafer(0);
1413  if (!tileTrapezoid()) {
1414  auto itr = waferLayer_.find(layer);
1415  if (itr != waferLayer_.end()) {
1416  unsigned ity = (type > 0 && type <= 2) ? type : 0;
1417  wafer = (itr->second)[ity];
1418  }
1419  } else {
1420  const auto& index = getIndex(layer, true);
1421  wafer = 1 + hgpar_->lastModule_[index.first] - hgpar_->firstModule_[index.first];
1422  }
1423  return wafer;
1424 }
1425 
1427  double xx, double yy, const double& cellR, const std::vector<double>& posX, const std::vector<double>& posY) const {
1428  int num(0);
1429  const double tol(0.00001);
1430  double cellY = 2.0 * cellR * tan30deg_;
1431  for (unsigned int k = 0; k < posX.size(); ++k) {
1432  double dx = std::abs(xx - posX[k]);
1433  double dy = std::abs(yy - posY[k]);
1434  if (dx <= (cellR + tol) && dy <= (cellY + tol)) {
1435  double xmax = (dy <= 0.5 * cellY) ? cellR : (cellR - (dy - 0.5 * cellY) / tan30deg_);
1436  if (dx <= (xmax + tol)) {
1437  num = k;
1438  break;
1439  }
1440  }
1441  }
1442  return num;
1443 }
1444 
1445 void HGCalDDDConstants::cellHex(double xloc, double yloc, int cellType, int& cellU, int& cellV, bool debug) const {
1446  int N = (cellType == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1447  double Rc = 2 * rmax_ / (3 * N);
1448  double rc = 0.5 * Rc * sqrt3_;
1449  double v0 = ((xloc / Rc - 1.0) / 1.5);
1450  int cv0 = (v0 > 0) ? (N + (int)(v0 + 0.5)) : (N - (int)(-v0 + 0.5));
1451  double u0 = (0.5 * yloc / rc + 0.5 * cv0);
1452  int cu0 = (u0 > 0) ? (N / 2 + (int)(u0 + 0.5)) : (N / 2 - (int)(-u0 + 0.5));
1453  cu0 = std::max(0, std::min(cu0, 2 * N - 1));
1454  cv0 = std::max(0, std::min(cv0, 2 * N - 1));
1455  if (cv0 - cu0 >= N)
1456  cv0 = cu0 + N - 1;
1457 #ifdef EDM_ML_DEBUG
1458  if (debug)
1459  edm::LogVerbatim("HGCalGeom") << "cellHex: input " << xloc << ":" << yloc << ":" << cellType << " parameter " << rc
1460  << ":" << Rc << " u0 " << u0 << ":" << cu0 << " v0 " << v0 << ":" << cv0;
1461 #endif
1462  bool found(false);
1463  static constexpr int shift[3] = {0, 1, -1};
1464  for (int i1 = 0; i1 < 3; ++i1) {
1465  cellU = cu0 + shift[i1];
1466  for (int i2 = 0; i2 < 3; ++i2) {
1467  cellV = cv0 + shift[i2];
1468  if (((cellV - cellU) < N) && ((cellU - cellV) <= N) && (cellU >= 0) && (cellV >= 0) && (cellU < 2 * N) &&
1469  (cellV < 2 * N)) {
1470  double xc = (1.5 * (cellV - N) + 1.0) * Rc;
1471  double yc = (2 * cellU - cellV - N) * rc;
1472  if ((std::abs(yloc - yc) <= rc) && (std::abs(xloc - xc) <= Rc) &&
1473  ((std::abs(xloc - xc) <= 0.5 * Rc) || (std::abs(yloc - yc) <= sqrt3_ * (Rc - std::abs(xloc - xc))))) {
1474 #ifdef EDM_ML_DEBUG
1475  if (debug)
1476  edm::LogVerbatim("HGCalGeom")
1477  << "cellHex: local " << xc << ":" << yc << " difference " << std::abs(xloc - xc) << ":"
1478  << std::abs(yloc - yc) << ":" << sqrt3_ * (Rc - std::abs(yloc - yc)) << " comparator " << rc << ":"
1479  << Rc << " (u,v) = (" << cellU << "," << cellV << ")";
1480 #endif
1481  found = true;
1482  break;
1483  }
1484  }
1485  }
1486  if (found)
1487  break;
1488  }
1489  if (!found) {
1490  cellU = cu0;
1491  cellV = cv0;
1492  }
1493 }
1494 
1495 std::pair<int, float> HGCalDDDConstants::getIndex(int lay, bool reco) const {
1496  int indx = layerIndex(lay, reco);
1497  if (indx < 0)
1498  return std::make_pair(-1, 0);
1499  float cell(0);
1500  if (waferHexagon6()) {
1501  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1502  } else {
1503  if (waferHexagon8()) {
1504  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1505  } else {
1506  cell = hgpar_->scintCellSize(lay);
1507  }
1508  }
1509  return std::make_pair(indx, cell);
1510 }
1511 
1513  int ll(-1);
1514  if (waferHexagon6() && reco) {
1515  ll = static_cast<int>(std::find(hgpar_->depthLayerF_.begin(), hgpar_->depthLayerF_.end(), index) -
1516  hgpar_->depthLayerF_.begin());
1517  if (ll == static_cast<int>(hgpar_->depthLayerF_.size()))
1518  ll = -1;
1519  } else {
1520  ll = static_cast<int>(std::find(hgpar_->layerIndex_.begin(), hgpar_->layerIndex_.end(), index) -
1521  hgpar_->layerIndex_.begin());
1522  if (ll == static_cast<int>(hgpar_->layerIndex_.size()))
1523  ll = -1;
1524  }
1525 #ifdef EDM_ML_DEBUG
1526  edm::LogVerbatim("HGCalGeom") << "LayerFromIndex for " << index << ":" << reco << ":" << waferHexagon6() << " is"
1527  << ll << ":" << (ll + hgpar_->firstLayer_);
1528 #endif
1529  return ((ll < 0) ? ll : (ll + hgpar_->firstLayer_));
1530 }
1531 
1532 bool HGCalDDDConstants::isValidCell(int lay, int wafer, int cell) const {
1533  // Calculate the position of the cell
1534  // Works for options HGCalHexagon/HGCalHexagonFull
1535  double x = hgpar_->waferPosX_[wafer];
1536  double y = hgpar_->waferPosY_[wafer];
1537  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
1538  x += hgpar_->cellFineX_[cell];
1539  y += hgpar_->cellFineY_[cell];
1540  } else {
1541  x += hgpar_->cellCoarseX_[cell];
1542  y += hgpar_->cellCoarseY_[cell];
1543  }
1544  double rr = sqrt(x * x + y * y);
1545  bool result = ((rr >= hgpar_->rMinLayHex_[lay - 1]) && (rr <= hgpar_->rMaxLayHex_[lay - 1]) &&
1546  (wafer < (int)(hgpar_->waferPosX_.size())));
1547 #ifdef EDM_ML_DEBUG
1548  if (!result)
1549  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << wafer << ":" << cell << " Position " << x << ":" << y
1550  << ":" << rr << " Compare Limits " << hgpar_->rMinLayHex_[lay - 1] << ":"
1551  << hgpar_->rMaxLayHex_[lay - 1] << " Flag " << result;
1552 #endif
1553  return result;
1554 }
1555 
1556 bool HGCalDDDConstants::isValidCell8(int lay, int waferU, int waferV, int cellU, int cellV, int type) const {
1557  float x(0), y(0);
1558  int kndx = cellV * 100 + cellU;
1559  if (type == 0) {
1560  auto ktr = hgpar_->cellFineIndex_.find(kndx);
1561  if (ktr != hgpar_->cellFineIndex_.end()) {
1562  x = hgpar_->cellFineX_[ktr->second];
1563  y = hgpar_->cellFineY_[ktr->second];
1564  }
1565 #ifdef EDM_ML_DEBUG
1566  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
1567  << (ktr != hgpar_->cellFineIndex_.end());
1568 #endif
1569  } else {
1570  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
1571  if (ktr != hgpar_->cellCoarseIndex_.end()) {
1572  x = hgpar_->cellCoarseX_[ktr->second];
1573  y = hgpar_->cellCoarseY_[ktr->second];
1574  }
1575 #ifdef EDM_ML_DEBUG
1576  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
1577  << (ktr != hgpar_->cellCoarseIndex_.end());
1578 #endif
1579  }
1580  const auto& xy = waferPosition(lay, waferU, waferV, true, false);
1581  x += xy.first;
1582  y += xy.second;
1583 #ifdef EDM_ML_DEBUG
1584  edm::LogVerbatim("HGCalGeom") << "With wafer (" << waferU << "," << waferV << ") " << x << ":" << y;
1585 #endif
1586  double rr = sqrt(x * x + y * y);
1587  int ll = lay - hgpar_->firstLayer_;
1588  bool result = ((rr >= hgpar_->rMinLayHex_[ll]) && (rr <= hgpar_->rMaxLayHex_[ll]));
1589 #ifdef EDM_ML_DEBUG
1590  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << ll << ":" << waferU << ":" << waferV << ":" << cellU << ":"
1591  << cellV << " Position " << x << ":" << y << ":" << rr << " Compare Limits "
1592  << hgpar_->rMinLayHex_[ll] << ":" << hgpar_->rMaxLayHex_[ll] << " Flag " << result;
1593 #endif
1595  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1596  auto partn = waferTypeRotation(lay, waferU, waferV, false, false);
1597  result = HGCalWaferMask::goodCell(cellU, cellV, N, partn.first, partn.second);
1598  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << waferU << ":" << waferV << ":" << cellU << ":" << cellV
1599  << " N " << N << " part " << partn.first << ":" << partn.second << " Result "
1600  << result;
1601  }
1602  return result;
1603 }
1604 
1605 int32_t HGCalDDDConstants::waferIndex(int wafer, int index) const {
1606  int layer = layerFromIndex(index, true);
1610 #ifdef EDM_ML_DEBUG
1611  edm::LogVerbatim("HGCalGeom") << "WaferIndex for " << wafer << ":" << index << " (" << layer << ":" << waferU << ":"
1612  << waferV << ") " << indx;
1613 #endif
1614  return indx;
1615 }
1616 
1617 bool HGCalDDDConstants::waferInLayerTest(int wafer, int lay, bool full) const {
1618  bool in = (waferHexagon6()) ? true : false;
1619  if (!in) {
1620  double xpos = hgpar_->waferPosX_[wafer] + hgpar_->xLayerHex_[lay];
1621  double ypos = hgpar_->waferPosY_[wafer] + hgpar_->yLayerHex_[lay];
1622  std::pair<int, int> corner = HGCalGeomTools::waferCorner(
1623  xpos, ypos, rmax_, hexside_, hgpar_->rMinLayHex_[lay], hgpar_->rMaxLayHex_[lay], in);
1624  in = (full ? (corner.first > 0) : (corner.first == (int)(HGCalParameters::k_CornerSize)));
1625  if (in && fullAndPart_) {
1626  int indx = waferIndex(wafer, lay);
1627  in = (hgpar_->waferInfoMap_.find(indx) != hgpar_->waferInfoMap_.end());
1628 #ifdef EDM_ML_DEBUG
1629  if (!in)
1630  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay << " wafer " << wafer << " index " << indx
1631  << "( " << HGCalWaferIndex::waferLayer(indx) << ", "
1632  << HGCalWaferIndex::waferU(indx) << ", " << HGCalWaferIndex::waferV(indx)
1633  << ") in " << in;
1634 #endif
1635  }
1636 #ifdef EDM_ML_DEBUG
1637  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay << " wafer " << wafer << " R-limits "
1638  << hgpar_->rMinLayHex_[lay] << ":" << hgpar_->rMaxLayHex_[lay] << " Corners "
1639  << corner.first << ":" << corner.second << " In " << in;
1640 #endif
1641  }
1642  return in;
1643 }
1644 
1645 std::pair<double, double> HGCalDDDConstants::waferPosition(int waferU, int waferV, bool reco) const {
1646  double xx(0), yy(0);
1647  int indx = HGCalWaferIndex::waferIndex(0, waferU, waferV);
1648  auto itr = hgpar_->wafersInLayers_.find(indx);
1649  if (itr != hgpar_->wafersInLayers_.end()) {
1650  xx = hgpar_->waferPosX_[itr->second];
1651  yy = hgpar_->waferPosY_[itr->second];
1652  }
1653  if (!reco) {
1656  }
1657  return std::make_pair(xx, yy);
1658 }
1659 
1661 
HGCalGeomTools::k_allCorners
static constexpr int k_allCorners
Definition: HGCalGeomTools.h:13
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
DDAxes::y
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
HGCalDDDConstants::tot_wafers_
int32_t tot_wafers_
Definition: HGCalDDDConstants.h:234
HGCalParameters::cellCoarseHalf_
std::vector< bool > cellCoarseHalf_
Definition: HGCalParameters.h:127
HGCalGeomTools::waferCorner
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
Definition: HGCalGeomTools.cc:229
cms::cuda::wmax
__host__ __device__ V V wmax
Definition: HistoContainer.h:136
V0Monitor_cff.v0
v0
Definition: V0Monitor_cff.py:7
mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
HGCalGeometryMode::TrapezoidFile
Definition: HGCalGeometryMode.h:33
HGCalDDDConstants::tan30deg_
constexpr static double tan30deg_
Definition: HGCalDDDConstants.h:229
HGCalParameters::moduleCellS_
std::vector< double > moduleCellS_
Definition: HGCalParameters.h:82
HGCalParameters::firstLayer_
int firstLayer_
Definition: HGCalParameters.h:172
MessageLogger.h
HGCScintillatorDetId.h
HGCalDDDConstants::waferFromPosition
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
Definition: HGCalDDDConstants.cc:1072
HGCalDDDConstants::maxWafersPerLayer_
int32_t maxWafersPerLayer_
Definition: HGCalDDDConstants.h:237
HGCalWaferMask::goodCell
static bool goodCell(int u, int v, int N, int type, int rotn)
Definition: HGCalWaferMask.cc:108
HGCalDDDConstants::cellHex
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
Definition: HGCalDDDConstants.cc:1426
HGCalDDDConstants::rangeZ
std::pair< double, double > rangeZ(bool reco) const
Definition: HGCalDDDConstants.cc:994
HGCalDDDConstants::sqrt3_
const double sqrt3_
Definition: HGCalDDDConstants.h:230
HGCalDDDConstants::modulesInit
int modulesInit(int lay, bool reco) const
Definition: HGCalDDDConstants.cc:864
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
HGCalParameters::zLayerHex_
std::vector< double > zLayerHex_
Definition: HGCalParameters.h:112
HGCalDDDConstants::waferIn_
std::unordered_map< int32_t, bool > waferIn_
Definition: HGCalDDDConstants.h:240
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
HGCalDDDConstants::isValidCell
bool isValidCell(int layindex, int wafer, int cell) const
Definition: HGCalDDDConstants.cc:1532
LaserClient_cfi.wl
wl
Definition: LaserClient_cfi.py:46
HGCalParameters::moduleCellR_
std::vector< double > moduleCellR_
Definition: HGCalParameters.h:89
HGCalParameters::zFrontMin_
std::vector< double > zFrontMin_
Definition: HGCalParameters.h:139
HGCalDDDConstants::locateCellTrap
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
Definition: HGCalDDDConstants.cc:717
HGCalParameters::getModule
hgtrap getModule(unsigned int k, bool reco) const
Definition: HGCalParameters.cc:35
min
T min(T a, T b)
Definition: MathUtil.h:58
HGCalDDDConstants::isValidHex
bool isValidHex(int lay, int mod, int cell, bool reco) const
Definition: HGCalDDDConstants.cc:444
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
HGCalWaferMask.h
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
HGCalParameters::rMaxLayHex_
std::vector< double > rMaxLayHex_
Definition: HGCalParameters.h:114
HGCalParameters::cellFineY_
std::vector< double > cellFineY_
Definition: HGCalParameters.h:121
HFNoseDetId::layer
int layer() const
get the layer #
Definition: HFNoseDetId.h:56
HGCalGeometryMode.h
HGCalDDDConstants::cellEtaPhiTrap
std::pair< double, double > cellEtaPhiTrap(int type, int irad) const
Definition: HGCalDDDConstants.cc:193
HGCalTypes::WaferThree
Definition: HGCalTypes.h:57
HGCalTypes::WaferFull
Definition: HGCalTypes.h:50
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
cuy.col
col
Definition: cuy.py:1010
HGCalDDDConstants::rangeRLayer
std::pair< double, double > rangeRLayer(int lay, bool reco) const
Definition: HGCalDDDConstants.cc:976
HGCalDDDConstants::waferZ
double waferZ(int layer, bool reco) const
Definition: HGCalDDDConstants.cc:1390
HGCalDDDConstants::getREtaRange
std::pair< int, int > getREtaRange(int lay) const
Definition: HGCalDDDConstants.cc:400
HGCalParameters::k_CornerSize
static constexpr uint32_t k_CornerSize
Definition: HGCalParameters.h:44
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
HGCSiliconDetId.h
HGCalWaferIndex::waferU
int32_t waferU(const int32_t index)
Definition: HGCalWaferIndex.cc:27
HGCalDDDConstants::waferHexagon8
bool waferHexagon8() const
Definition: HGCalDDDConstants.h:142
HGCalParameters::slopeTop_
std::vector< double > slopeTop_
Definition: HGCalParameters.h:168
HGCalDDDConstants::waferFullInLayer
bool waferFullInLayer(int wafer, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:1193
HGCalParameters::layerIndex_
std::vector< int > layerIndex_
Definition: HGCalParameters.h:104
HGCalDDDConstants::distFromEdgeTrap
double distFromEdgeTrap(double x, double y, double z) const
Definition: HGCalDDDConstants.cc:325
HGCalWaferIndex::waferIndex
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
Definition: HGCalWaferIndex.cc:4
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:48
cells
const caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple cms::cuda::AtomicPairCounter const GPUCACell *__restrict__ cells
Definition: CAHitNtupletGeneratorKernelsImpl.h:33
typelookup.h
HGCalParameters::yLayerHex_
std::vector< double > yLayerHex_
Definition: HGCalParameters.h:111
HGCalParameters::scintCellSize
double scintCellSize(const int layer) const
Definition: HGCalParameters.h:67
HGCalTypes::CellType::TopLeftEdge
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
HGCalParameters::nCellsCoarse_
int nCellsCoarse_
Definition: HGCalParameters.h:143
HGCalParameters::wafersInLayers_
wafer_map wafersInLayers_
Definition: HGCalParameters.h:176
HGCalParameters::waferSize_
double waferSize_
Definition: HGCalParameters.h:144
HGCalTypes::WaferOut
Definition: HGCalTypes.h:58
HGCalTypes::WaferCornerMin
static constexpr int32_t WaferCornerMin
Definition: HGCalTypes.h:61
HGCalGeomTools::shiftXY
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
Definition: HGCalGeomTools.cc:176
full
Definition: GenABIO.cc:168
DDAxes::x
HFNoseDetId.h
HGCalDDDConstants::assignCellHex
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:159
HGCalGeometryMode::Hexagon8Module
Definition: HGCalGeometryMode.h:34
HGCalDDDConstants::getPhiBins
int getPhiBins(int lay) const
Definition: HGCalDDDConstants.cc:398
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
geant_units::operators
Definition: GeantUnits.h:18
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HGCalParameters::moduleLayR_
std::vector< int > moduleLayR_
Definition: HGCalParameters.h:83
HGCalDDDConstants::getTypeHex
int getTypeHex(int layer, int waferU, int waferV) const
Definition: HGCalDDDConstants.cc:428
HGCalDDDConstants::isHalfCell
bool isHalfCell(int waferType, int cell) const
Definition: HGCalDDDConstants.cc:438
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HGCalParameters::waferUVMaxLayer_
std::vector< int > waferUVMaxLayer_
Definition: HGCalParameters.h:149
HGCalTypes::WaferFive
Definition: HGCalTypes.h:51
HFNoseDetId
Definition: HFNoseDetId.h:22
HGCalParameters::iradMaxBH_
std::vector< int > iradMaxBH_
Definition: HGCalParameters.h:164
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
HGCalDDDConstants::waferParameters
std::pair< double, double > waferParameters(bool reco) const
Definition: HGCalDDDConstants.cc:1200
HGCalTypes::CellType::TopRightEdge
HGCalDDDConstants::lastLayer
int lastLayer(bool reco) const
Definition: HGCalDDDConstants.cc:559
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
HGCalTypes::CellType::UndefinedType
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
HGCalDDDConstants::max_modules_layer_
Simrecovecs max_modules_layer_
Definition: HGCalDDDConstants.h:236
HGCSiliconDetId::HGCalCoarseThick
Definition: HGCSiliconDetId.h:24
HGCalDDDConstants::geomTools_
HGCalGeomTools geomTools_
Definition: HGCalDDDConstants.h:223
HGCalDDDConstants
Definition: HGCalDDDConstants.h:27
HGCalParameters::waferPosY_
std::vector< double > waferPosY_
Definition: HGCalParameters.h:119
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HGCalDDDConstants::layerFromIndex
int layerFromIndex(int index, bool reco) const
Definition: HGCalDDDConstants.cc:1512
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HGCalParameters::sensorSeparation_
double sensorSeparation_
Definition: HGCalParameters.h:146
HFNoseDetId::waferU
int waferU() const
Definition: HFNoseDetId.h:75
DetId
Definition: DetId.h:17
HGCalDDDConstants::waferTypeRotation
std::pair< int, int > waferTypeRotation(int layer, int waferU, int waferV, bool fromFile=false, bool debug=false) const
Definition: HGCalDDDConstants.cc:1331
HGCalDDDConstants::isValidHex8
bool isValidHex8(int lay, int waferU, int waferV, bool fullAndPart=false) const
Definition: HGCalDDDConstants.cc:486
nphi
const int nphi
Definition: CMTRawAnalyzer.h:424
HGCalTypes::CellType::BottomCorner
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
HGCalDDDConstants::waferType
int waferType(DetId const &id, bool fromFile=false) const
Definition: HGCalDDDConstants.cc:1245
HGCalDDDConstants::waferHexagon6
bool waferHexagon6() const
Definition: HGCalDDDConstants.h:139
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
debug
#define debug
Definition: HDRShower.cc:19
part
part
Definition: HCALResponse.h:20
HGCalParameters::trformIndex_
std::vector< uint32_t > trformIndex_
Definition: HGCalParameters.h:90
HGCalDDDConstants::simToReco
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
Definition: HGCalDDDConstants.cc:1018
HGCalDDDConstants::isValidCell8
bool isValidCell8(int lay, int waferU, int waferV, int cellU, int cellV, int type) const
Definition: HGCalDDDConstants.cc:1556
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HGCalDDDConstants::mode_
HGCalGeometryMode::GeometryMode mode_
Definition: HGCalDDDConstants.h:232
HGCalWaferIndex.h
trackingPlots.hp
hp
Definition: trackingPlots.py:1230
HGCalParameters::radiusLayer_
std::vector< double > radiusLayer_[2]
Definition: HGCalParameters.h:162
HGCalParameters::cellFineHalf_
std::vector< bool > cellFineHalf_
Definition: HGCalParameters.h:123
HGCalDDDConstants::maxCells
int maxCells(bool reco) const
Definition: HGCalDDDConstants.cc:787
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
HGCalParameters::layerGroup_
std::vector< int > layerGroup_
Definition: HGCalParameters.h:105
HGCalParameters::radiusMixBoundary_
std::vector< double > radiusMixBoundary_
Definition: HGCalParameters.h:158
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalParameters::waferPosX_
std::vector< double > waferPosX_
Definition: HGCalParameters.h:118
HGCalDDDConstants::waferInLayer
bool waferInLayer(int wafer, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:1186
HGCalParameters::waferUVMax_
int waferUVMax_
Definition: HGCalParameters.h:148
DDAxes::z
HGCalDDDConstants::HGCalDDDConstants
HGCalDDDConstants(const HGCalParameters *hp, const std::string &name)
Definition: HGCalDDDConstants.cc:25
HGCalWaferType.h
HGCalDDDConstants::layerIndex
int layerIndex(int lay, bool reco) const
Definition: HGCalDDDConstants.cc:563
N
#define N
Definition: blowfish.cc:9
HGCalWaferIndex::waferV
int32_t waferV(const int32_t index)
Definition: HGCalWaferIndex.cc:32
HGCalParameters::rMinLayHex_
std::vector< double > rMinLayHex_
Definition: HGCalParameters.h:113
RecoTauValidation_cfi.posX
posX
Definition: RecoTauValidation_cfi.py:288
HGCalWaferType::getType
int getType(double xpos, double ypos, double zpos)
Definition: HGCalWaferType.cc:36
HGCalDDDConstants::waferFileSize
unsigned int waferFileSize() const
Definition: HGCalDDDConstants.h:154
HGCalDDDConstants::wafers
int wafers() const
Definition: HGCalDDDConstants.cc:1398
HGCalTypes::CellType
CellType
Definition: HGCalTypes.h:12
HGCalParameters::typesInLayers_
wafer_map typesInLayers_
Definition: HGCalParameters.h:177
HGCalParameters::getTrForm
hgtrform getTrForm(unsigned int k) const
Definition: HGCalParameters.cc:108
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HGCalParameters::waferCopy_
std::vector< int > waferCopy_
Definition: HGCalParameters.h:115
HGCalDDDConstants::rangeR
std::pair< double, double > rangeR(double z, bool reco) const
Definition: HGCalDDDConstants.cc:949
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
HGCalParameters::iradMinBH_
std::vector< int > iradMinBH_
Definition: HGCalParameters.h:163
HGCalDDDConstants::assignCell
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
Definition: HGCalDDDConstants.cc:120
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
HGCalTypes::getUnpackedU
static int32_t getUnpackedU(int id)
Definition: HGCalTypes.cc:16
HGCSiliconDetId::HGCalFine
Definition: HGCSiliconDetId.h:24
HGCalDDDConstants::mouseBite
double mouseBite(bool reco) const
Definition: HGCalDDDConstants.cc:880
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalParameters::cellSize_
std::vector< double > cellSize_
Definition: HGCalParameters.h:75
HGCalDDDConstants::tileTrapezoid
bool tileTrapezoid() const
Definition: HGCalDDDConstants.h:112
HGCalParameters::mouseBite_
double mouseBite_
Definition: HGCalParameters.h:147
HGCalDDDConstants::cellInLayer
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:203
HGCalParameters::nCellsFine_
int nCellsFine_
Definition: HGCalParameters.h:142
HGCalParameters::firstModule_
std::vector< int > firstModule_
Definition: HGCalParameters.h:166
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
HGCalDDDConstants::hexside_
double hexside_
Definition: HGCalDDDConstants.h:231
HFNoseDetId::type
int type() const
get the type
Definition: HFNoseDetId.h:50
HGCalDDDConstants::waferLayer_
std::map< int, HGCWaferParam > waferLayer_
Definition: HGCalDDDConstants.h:238
HGCalDDDConstants::modHalf_
int32_t modHalf_
Definition: HGCalDDDConstants.h:234
HGCalDDDConstants::numberCells
int numberCells(bool reco) const
Definition: HGCalDDDConstants.cc:884
HGCalParameters::depth_
std::vector< int > depth_
Definition: HGCalParameters.h:107
HGCalGeometryMode::TrapezoidModule
Definition: HGCalGeometryMode.h:35
HGCalParameters::rMaxFront_
std::vector< double > rMaxFront_
Definition: HGCalParameters.h:170
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HGCalParameters::cellFineIndex_
wafer_map cellFineIndex_
Definition: HGCalParameters.h:122
HGCalDDDConstants::getIndex
std::pair< int, float > getIndex(int lay, bool reco) const
Definition: HGCalDDDConstants.cc:1495
HGCalParameters::mode_
HGCalGeometryMode::GeometryMode mode_
Definition: HGCalParameters.h:137
GeantUnits.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HGCalParameters::cellCoarseY_
std::vector< double > cellCoarseY_
Definition: HGCalParameters.h:125
recoMuon::in
Definition: RecoMuonEnumerators.h:6
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
HGCalTypes::getUnpackedV
static int32_t getUnpackedV(int id)
Definition: HGCalTypes.cc:22
HGCalWaferMask::k_OffsetRotation
static constexpr int k_OffsetRotation
Definition: HGCalWaferMask.h:37
HGCalDDDConstants::layers
unsigned int layers(bool reco) const
Definition: HGCalDDDConstants.cc:561
HGCalParameters::scintType
int scintType(const int layer) const
Definition: HGCalParameters.h:68
createfilelist.int
int
Definition: createfilelist.py:10
cms::cuda::wmin
__host__ __device__ V wmin
Definition: HistoContainer.h:136
HGCalParameters::scintCells
int scintCells(const int layer) const
Definition: HGCalParameters.h:66
HGCalParameters::layerGroupO_
std::vector< int > layerGroupO_
Definition: HGCalParameters.h:129
HGCalDDDConstants::getTrForms
std::vector< HGCalParameters::hgtrform > getTrForms() const
Definition: HGCalDDDConstants.cc:412
HGCalDDDConstants::getTypeTrap
int getTypeTrap(int layer) const
Definition: HGCalDDDConstants.cc:419
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
HGCalTypes::CellType::TopLeftCorner
HGCalDDDConstants::cellSizeHex
double cellSizeHex(int type) const
Definition: HGCalDDDConstants.cc:232
HGCalTypes::CellType::LeftEdge
PVValHelper::dy
Definition: PVValidationHelpers.h:50
HGCalParameters::layerGroupM_
std::vector< int > layerGroupM_
Definition: HGCalParameters.h:128
HGCalDDDConstants::cellThickness
double cellThickness(int layer, int waferU, int waferV) const
Definition: HGCalDDDConstants.cc:219
HGCalDDDConstants::sectors
int sectors() const
Definition: HGCalDDDConstants.h:109
HGCalParameters::waferR_
double waferR_
Definition: HGCalParameters.h:134
HGCalDDDConstants::isValidTrap
bool isValidTrap(int lay, int ieta, int iphi) const
Definition: HGCalDDDConstants.cc:550
HGCalDDDConstants::getUVMax
int getUVMax(int type) const
Definition: HGCalDDDConstants.h:71
HGCalGeomTools::k_fiveCorners
static constexpr int k_fiveCorners
Definition: HGCalGeomTools.h:14
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
HGCalParameters::waferThick_
double waferThick_
Definition: HGCalParameters.h:145
HGCalDDDConstants::rmax_
double rmax_
Definition: HGCalDDDConstants.h:231
HGCalParameters::hgtrform::lay
int lay
Definition: HGCalParameters.h:53
HGCalTypes::CellType::TopCorner
HGCalDDDConstants::rowColumnWafer
std::pair< int, int > rowColumnWafer(const int wafer) const
Definition: HGCalDDDConstants.cc:1007
HGCalDDDConstants::waferVirtual
bool waferVirtual(int layer, int waferU, int waferV) const
Definition: HGCalDDDConstants.cc:1378
HGCalDDDConstants::getTrForm
HGCalParameters::hgtrform getTrForm(unsigned int k) const
Definition: HGCalDDDConstants.h:66
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
HGCalDDDConstants::getModules
std::vector< HGCalParameters::hgtrap > getModules() const
Definition: HGCalDDDConstants.cc:391
HGCalParameters::k_ScaleFromDDD
static constexpr double k_ScaleFromDDD
Definition: HGCalParameters.h:36
HGCalParameters::waferTypeT_
std::vector< int > waferTypeT_
Definition: HGCalParameters.h:117
HGCalDDDConstants::waferMax_
std::array< int, 4 > waferMax_
Definition: HGCalDDDConstants.h:239
HGCalTypes::CellType::BottomRightCorner
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HGCalDDDConstants::tot_layers_
std::array< uint32_t, 2 > tot_layers_
Definition: HGCalDDDConstants.h:235
HGCalDDDConstants::numberCellsHexagon
int numberCellsHexagon(int wafer) const
Definition: HGCalDDDConstants.cc:927
HGCalParameters
Definition: HGCalParameters.h:14
HGCalDDDConstants::assignCellTrap
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:170
HGCalParameters::k_ScaleToDDD
static constexpr double k_ScaleToDDD
Definition: HGCalParameters.h:37
DDAxes::phi
HGCalDetId
Definition: HGCalDetId.h:8
HGCalGeomTools.h
HGCalWaferIndex::waferLayer
int32_t waferLayer(const int32_t index)
Definition: HGCalWaferIndex.cc:23
HGCalGeomTools::radius
static void radius(double zf, double zb, std::vector< double > const &zFront1, std::vector< double > const &rFront1, std::vector< double > const &slope1, std::vector< double > const &zFront2, std::vector< double > const &rFront2, std::vector< double > const &slope2, int flag, std::vector< double > &zz, std::vector< double > &rin, std::vector< double > &rout)
Definition: HGCalGeomTools.cc:11
HGCalParameters::detectorType_
int detectorType_
Definition: HGCalParameters.h:72
HGCalDetId.h
HGCalDDDConstants::cellType
HGCalTypes::CellType cellType(int type, int waferU, int waferV) const
Definition: HGCalDDDConstants.cc:239
std
Definition: JetResolutionObject.h:76
HGCalParameters::waferMaskMode_
int waferMaskMode_
Definition: HGCalParameters.h:179
HGCalDDDConstants::locateCellHex
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
Definition: HGCalDDDConstants.cc:701
HGCalTypes::CellType::BottomLeftCorner
HGCalParameters::waferInfoMap_
waferInfo_map waferInfoMap_
Definition: HGCalParameters.h:181
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
hgcalPerformanceValidation.df
df
Definition: hgcalPerformanceValidation.py:733
HGCalParameters::slopeMin_
std::vector< double > slopeMin_
Definition: HGCalParameters.h:138
HGCalParameters::depthIndex_
std::vector< int > depthIndex_
Definition: HGCalParameters.h:108
hgcalPerformanceValidation.orient
orient
Definition: hgcalPerformanceValidation.py:733
HGCalParameters::defineFull_
bool defineFull_
Definition: HGCalParameters.h:150
HGCalParameters::xLayerHex_
std::vector< double > xLayerHex_
Definition: HGCalParameters.h:110
HGCalTypes::CellType::RightEdge
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
HGCalParameters::waferTypes_
waferT_map waferTypes_
Definition: HGCalParameters.h:178
HGCalTypes::CellType::BottomRightEdge
HGCalDDDConstants::waferPosition
std::pair< double, double > waferPosition(int wafer, bool reco) const
Definition: HGCalDDDConstants.cc:1207
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
HGCalTypes::WaferHalf
Definition: HGCalTypes.h:54
dt_dqm_sourceclient_common_cff.reco
reco
Definition: dt_dqm_sourceclient_common_cff.py:110
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
genVertex_cff.x
x
Definition: genVertex_cff.py:12
HGCalParameters::layerCenter_
std::vector< int > layerCenter_
Definition: HGCalParameters.h:175
HGCalParameters::rMinFront_
std::vector< double > rMinFront_
Definition: HGCalParameters.h:140
HGCalDDDConstants::maxRows
int maxRows(int lay, bool reco) const
Definition: HGCalDDDConstants.cc:832
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
HGCalGeometryMode::Hexagon8File
Definition: HGCalGeometryMode.h:32
HGCalParameters::lastModule_
std::vector< int > lastModule_
Definition: HGCalParameters.h:167
HGCalDDDConstants::modules
int modules(int lay, bool reco) const
Definition: HGCalDDDConstants.cc:857
HGCSiliconDetId::type
int type() const
get the type
Definition: HGCSiliconDetId.h:51
HGCalParameters::cellFineX_
std::vector< double > cellFineX_
Definition: HGCalParameters.h:120
HGCSiliconDetId::waferU
int waferU() const
Definition: HGCSiliconDetId.h:76
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HGCalDDDConstants::distFromEdgeHex
double distFromEdgeHex(double x, double y, double z) const
Definition: HGCalDDDConstants.cc:279
TCMET_cfi.corner
corner
Definition: TCMET_cfi.py:34
Exception.h
HGCalParameters::cellThickness_
std::vector< double > cellThickness_
Definition: HGCalParameters.h:151
HGCalParameters::firstMixedLayer_
int firstMixedLayer_
Definition: HGCalParameters.h:173
HGCalDDDConstants::getLayer
int getLayer(double z, bool reco) const
Definition: HGCalDDDConstants.cc:355
HGCalTypes::CellType::CentralType
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HGCalDDDConstants::waferTypeL
int waferTypeL(int wafer) const
Definition: HGCalDDDConstants.h:196
HGCalParameters::waferTypeL_
std::vector< int > waferTypeL_
Definition: HGCalParameters.h:116
HGCalParameters::cellCoarseX_
std::vector< double > cellCoarseX_
Definition: HGCalParameters.h:124
HGCalDDDConstants::~HGCalDDDConstants
~HGCalDDDConstants()
Definition: HGCalDDDConstants.cc:118
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCalDDDConstants.h
HGCalParameters::layer_
std::vector< int > layer_
Definition: HGCalParameters.h:103
HGCalDDDConstants::getTrFormN
unsigned int getTrFormN() const
Definition: HGCalDDDConstants.h:67
HFNoseDetId::waferV
int waferV() const
Definition: HFNoseDetId.h:78
HGCalDDDConstants::fullAndPart_
bool fullAndPart_
Definition: HGCalDDDConstants.h:233
HGCalDDDConstants::layersInit
unsigned int layersInit(bool reco) const
Definition: HGCalDDDConstants.cc:576
HGCalDDDConstants::locateCell
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
Definition: HGCalDDDConstants.cc:580
HGCalParameters::cellCoarseIndex_
wafer_map cellCoarseIndex_
Definition: HGCalParameters.h:126
DetId::Forward
Definition: DetId.h:30
HGCalParameters::depthLayerF_
std::vector< int > depthLayerF_
Definition: HGCalParameters.h:109
HGCalTypes.h
HGCalDDDConstants::waferIndex
int32_t waferIndex(int wafer, int index) const
Definition: HGCalDDDConstants.cc:1605
HGCalParameters::zFrontTop_
std::vector< double > zFrontTop_
Definition: HGCalParameters.h:169
HGCalParameters::hgtrap
Definition: HGCalParameters.h:47
edm::Log
Definition: MessageLogger.h:70
HGCalDDDConstants::modifyUV
int modifyUV(int uv, int type1, int type2) const
Definition: HGCalDDDConstants.cc:852
dttmaxenums::R
Definition: DTTMax.h:29
HGCalDDDConstants::waferFromCopy
int waferFromCopy(int copy) const
Definition: HGCalDDDConstants.cc:1047
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCalGeomTools::k_fourCorners
static constexpr int k_fourCorners
Definition: HGCalGeomTools.h:15
PVValHelper::dx
Definition: PVValidationHelpers.h:49
HGCalDDDConstants::hgpar_
const HGCalParameters * hgpar_
Definition: HGCalDDDConstants.h:228
HGCalDDDConstants::maskCell
bool maskCell(const DetId &id, int corners) const
Definition: HGCalDDDConstants.cc:747
HGCalWaferMask::maskCell
static bool maskCell(int u, int v, int N, int ncor, int fcor, int corners)
Definition: HGCalWaferMask.cc:11
HGCalTypes::CellType::BottomLeftEdge
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
RecoTauValidation_cfi.posY
posY
Definition: RecoTauValidation_cfi.py:289
HGCalDDDConstants::HGCWaferParam
std::array< int, 3 > HGCWaferParam
Definition: HGCalDDDConstants.h:227
HGCSiliconDetId::waferV
int waferV() const
Definition: HGCSiliconDetId.h:77
HGCalDDDConstants::waferInLayerTest
bool waferInLayerTest(int wafer, int lay, bool full) const
Definition: HGCalDDDConstants.cc:1617
HGCalGeomTools::k_threeCorners
static constexpr int k_threeCorners
Definition: HGCalGeomTools.h:16
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
HGCalTypes::CellType::TopRightCorner
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
HGCSiliconDetId::layer
int layer() const
get the layer #
Definition: HGCSiliconDetId.h:57
HGCalTypes::WaferCorner0
Definition: HGCalTypes.h:30
HGCalDDDConstants::getModule
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
Definition: HGCalDDDConstants.cc:375
HGCalParameters::copiesInLayers_
layer_map copiesInLayers_
Definition: HGCalParameters.h:141