CMS 3D CMS Logo

HGCalDDDConstants.cc
Go to the documentation of this file.
2 
10 
11 #include "CLHEP/Units/GlobalPhysicalConstants.h"
12 #include "CLHEP/Units/GlobalSystemOfUnits.h"
13 
14 #include <functional>
15 #include <numeric>
16 
17 //#define EDM_ML_DEBUG
18 
19 static const int maxType = 2;
20 static const int minType = 0;
21 
23  const std::string& name) : hgpar_(hp),
24  sqrt3_(std::sqrt(3.0)) {
25  mode_ = hgpar_->mode_;
31  std::cos(30.0*CLHEP::deg));
32  hexside_ = 2.0 * rmax_ * tan30deg_;
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "rmax_ " << rmax_ << ":" << hexside_
35  << " CellSize " << 0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[0]
37 #endif
38  }
39  // init maps and constants
40  modHalf_ = 0;
42  for (int simreco = 0; simreco < 2; ++simreco) {
43  tot_layers_[simreco] = layersInit((bool)simreco);
44  max_modules_layer_[simreco].resize(tot_layers_[simreco]+1);
45  for (unsigned int layer=1; layer <= tot_layers_[simreco]; ++layer) {
46  max_modules_layer_[simreco][layer] = modulesInit(layer,(bool)simreco);
47  if (simreco == 1) {
48  modHalf_ += max_modules_layer_[simreco][layer];
50  max_modules_layer_[simreco][layer]);
51 #ifdef EDM_ML_DEBUG
52  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with "
53  << max_modules_layer_[simreco][layer]
54  << ":" << modHalf_ << " modules";
55 #endif
56  }
57  }
58  }
59  tot_wafers_ = wafers();
60 
61  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants initialized for "
62  << name << " with " << layers(false) << ":"
63  << layers(true) << " layers, " << wafers()
64  << ":" << 2*modHalf_ << " wafers with maximum "
65  << maxWafersPerLayer_ << " per layer and "
66  << "maximum of " << maxCells(false) << ":"
67  << maxCells(true) << " cells";
68 
73  int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
74  for (unsigned int i=0; i<getTrFormN(); ++i) {
75  int lay0 = getTrForm(i).lay;
76  int wmin(9999999), wmax(-9999999), kount(0);
77  for (int wafer=0; wafer<sectors(); ++wafer) {
78  bool waferIn = waferInLayer(wafer,lay0,true);
82  waferIn_[kndx] = waferIn;
83  }
84  if (waferIn) {
85  int waferU = (((mode_ == HGCalGeometryMode::Hexagon) ||
88  if (waferU < wmin) wmin = waferU;
89  if (waferU > wmax) wmax = waferU;
90  ++kount;
91  }
92  }
93  if (wminT > wmin) wminT = wmin;
94  if (wmaxT < wmax) wmaxT = wmax;
95  if (kount1 < kount) kount1= kount;
96  kount2 += kount;
97 #ifdef EDM_ML_DEBUG
98  int lay1 = getIndex(lay0,true).first;
99  edm::LogVerbatim("HGCalGeom") << "Index " << i << " Layer " << lay0
100  << ":" << lay1 << " Wafer " << wmin
101  << ":" << wmax << ":" << kount;
102 #endif
103  HGCWaferParam a1{ {wmin,wmax,kount} };
104  waferLayer_[lay0] = a1;
105  }
106  waferMax_ = std::array<int,4>{ {wminT,wmaxT,kount1,kount2} };
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("HGCalGeom") << "Overall wafer statistics: " << wminT
109  << ":" << wmaxT << ":" << kount1 << ":"
110  << kount2;
111 #endif
112  }
113 }
114 
116 
117 std::pair<int,int> HGCalDDDConstants::assignCell(float x, float y, int lay,
118  int subSec, bool reco) const {
119  const auto & index = getIndex(lay, reco);
120  if (index.first < 0) return std::make_pair(-1,-1);
123  float xx = (reco) ? x : HGCalParameters::k_ScaleFromDDD*x;
124  float yy = (reco) ? y : HGCalParameters::k_ScaleFromDDD*y;
125 
126  //First the wafer
127  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
128  if (wafer < 0 || wafer >= (int)(hgpar_->waferTypeT_.size())) {
129  edm::LogWarning("HGCalGeom") << "Wafer no. out of bound for " << wafer
130  << ":" << (hgpar_->waferTypeT_).size()
131  << ":" << (hgpar_->waferPosX_).size()
132  << ":" << (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,cellHex(xx, yy,
143  else
144  return std::make_pair(wafer,cellHex(xx, yy,
147  }
148  } else {
149  return std::make_pair(-1,-1);
150  }
151 }
152 
153 std::array<int,5> HGCalDDDConstants::assignCellHex(float x, float y, int lay,
154  bool reco) const {
155  int waferU(0), waferV(0), waferType(-1), cellU(0), cellV(0);
158  double xx = (reco) ? HGCalParameters::k_ScaleToDDD*x : x;
159  double yy = (reco) ? HGCalParameters::k_ScaleToDDD*y : y;
160  double wt(1.0);
161  waferFromPosition(xx,yy,lay,waferU,waferV,cellU,cellV,waferType,wt);
162  }
163  return std::array<int,5>{ {waferU,waferV,waferType,cellU,cellV} };
164 }
165 
166 std::array<int,3> HGCalDDDConstants::assignCellTrap(float x, float y,
167  float z, int layer,
168  bool reco) const {
169 
170  int ieta(-1), iphi(-1), type(-1);
171  const auto & indx = getIndex(layer,reco);
172  if (indx.first < 0) return std::array<int,3>{ {ieta,iphi,type} };
173  double xx = (z > 0) ? x : -x;
174  double zz = (reco ? hgpar_->zLayerHex_[indx.first] :
176  double r = std::sqrt(x*x+y*y+zz*zz);
177  double theta = (r == 0. ? 0. : std::acos(std::max(std::min(zz/r,1.0),-1.0)));
178  double stheta= std::sin(theta);
179  double phi = (r*stheta == 0. ? 0. : std::atan2(y,xx));
180  if (phi < 0) phi += (2.0*M_PI);
181  double eta = (std::abs(stheta) == 1.? 0. : -std::log(std::abs(std::tan(0.5*theta))) );
182  ieta = 1 + (int)((std::abs(eta)-hgpar_->etaMinBH_)/indx.second);
183  iphi = 1 + (int)(phi/indx.second);
184  type = scintType(indx.second);
185 #ifdef EDM_ML_DEBUG
186  edm::LogVerbatim("HGCalGeom") << "assignCellTrap Input " << x << ":" << y
187  << ":" << z << ":" << layer << ":" << reco
188  << " x|z|r " << xx << ":" << zz << ":" << r
189  << " theta|phi " << theta << ":" << stheta
190  << ":" << phi << " o/p " << ieta << ":"
191  << iphi << ":" << type;
192 #endif
193  return std::array<int,3>{ {ieta,iphi,type} };
194 }
195 
196 bool HGCalDDDConstants::cellInLayer(int waferU, int waferV, int cellU,
197  int cellV, int lay, bool reco) const {
198  const auto & indx = getIndex(lay,true);
199  if (indx.first >= 0) {
204  const auto & xy = ((mode_ == HGCalGeometryMode::Hexagon8) ||
206  locateCell(lay, waferU, waferV, cellU, cellV, reco, true) :
207  locateCell(cellU, lay, waferU, reco);
208  double rpos = sqrt(xy.first*xy.first + xy.second*xy.second);
209  return ((rpos >= hgpar_->rMinLayHex_[indx.first]) &&
210  (rpos <= hgpar_->rMaxLayHex_[indx.first]));
211  } else {
212  return true;
213  }
214  } else {
215  return false;
216  }
217 }
218 
219 double HGCalDDDConstants::cellThickness(int layer, int waferU,
220  int waferV) const {
221 
222  double thick(-1);
225  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
226  int type = ((itr == hgpar_->typesInLayers_.end() ? maxType :
227  hgpar_->waferTypeL_[itr->second]));
228  thick = 10000.0*hgpar_->cellThickness_[type];
229  } else if ((mode_ == HGCalGeometryMode::Hexagon) ||
231  int type = (((waferU>=0)&&(waferU<(int)(hgpar_->waferTypeL_.size()))) ?
232  hgpar_->waferTypeL_[waferU] : minType);
233  thick = 100.0*type;
234  }
235  return thick;
236 }
237 
239  int indx = (((mode_ == HGCalGeometryMode::Hexagon8) ||
241  ((type >= 1) ? 1 : 0) : ((type == 1) ? 0 : 1));
242  double cell = (0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[indx]);
243  return cell;
244 }
245 
246 double HGCalDDDConstants::distFromEdgeHex(double x, double y, double z) const {
247 
248  if (z < 0) x = -x;
249  double dist(0);
250  //Input x, y in Geant4 unit and transformed to CMSSW standard
253  int sizew = (int)(hgpar_->waferPosX_.size());
254  int wafer = sizew;
255  for (int k=0; k<sizew; ++k) {
256  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
257  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
258  if (dx <= rmax_ && dy <= hexside_ &&
259  ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy)))) {
260  wafer = k;
261  xx -= hgpar_->waferPosX_[k];
262  yy -= hgpar_->waferPosY_[k];
263  break;
264  }
265  }
266  if (wafer < sizew) {
267  if (std::abs(yy) < 0.5*hexside_) {
268  dist = rmax_ - std::abs(xx);
269  } else {
270  dist = 0.5*((rmax_-std::abs(xx))-sqrt3_*(std::abs(yy)-0.5*hexside_));
271  }
272  } else {
273  dist = 0;
274  }
276 #ifdef EDM_ML_DEBUG
277  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeHex: Local " << xx << ":"
278  << yy << " wafer " << wafer << " flag "
279  << (wafer < sizew) << " Distance " << rmax_
280  << ":" << (rmax_-std::abs(xx)) << ":"
281  << (std::abs(yy)-0.5*hexside_) << ":"
282  << 0.5*hexside_ << ":" << dist;
283 #endif
284  return dist;
285 }
286 
287 double HGCalDDDConstants::distFromEdgeTrap(double x, double y, double z) const {
288 
289  int lay = getLayer(z,false);
290  double xx = (z < 0) ? -x : x;
291  int indx = layerIndex(lay,false);
293  double r = std::sqrt(x*x+y*y+zz*zz);
294  double theta = (r == 0. ? 0. : std::acos(std::max(std::min(zz/r,1.0),-1.0)));
295  double stheta= std::sin(theta);
296  double phi = (r*stheta == 0. ? 0. : std::atan2(y,xx));
297  if (phi < 0) phi += (2.0*M_PI);
298  double eta = (std::abs(stheta) == 1.0 ? 0. : -std::log(std::abs(std::tan(0.5*theta))) );
299  double cell = hgpar_->dPhiEtaBH_[indx];
300  int ieta = 1 + (int)((std::abs(eta)-hgpar_->etaMinBH_)/cell);
301  int iphi = 1 + (int)(phi/cell);
302  double rr = std::sqrt(x*x+y*y);
303  double dphi = std::max(0.0,(0.5*cell-std::abs(phi-(iphi-0.5)*cell)));
304  double dist = ((eta > hgpar_->etaMinBH_+(ieta-0.5)*cell) ?
305  (rr - zz/std::sinh(hgpar_->etaMinBH_+ieta*cell)) :
306  (zz/std::sinh(hgpar_->etaMinBH_+(ieta-1)*cell) - rr));
307 #ifdef EDM_ML_DEBUG
308  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeTrap: Global " << x << ":"
309  << y << ":" << z << " Layer " << lay
310  << " Index " << indx << " xx|zz " << xx << ":"
311  << zz << " Eta " << eta << ":"<< ieta << ":"
312  << (hgpar_->etaMinBH_+(ieta-0.5)*cell)
313  << " Phi " << phi << ":" << iphi << ":"
314  << (iphi-0.5)*cell << " cell " << cell << " R "
315  << rr << " Dphi " << dphi << " Dist " << dist
316  << ":" << rr*dphi << ":"
317  << rr-zz/std::sinh(hgpar_->etaMinBH_+ieta*cell)
318  << ":" << zz/std::sinh(hgpar_->etaMinBH_+(ieta-1)*cell)-rr;
319 #endif
320  return std::min(rr*dphi,dist);
321 }
322 
323 int HGCalDDDConstants::getLayer(double z, bool reco) const {
324 
325  unsigned int k = 0;
326  double zz = (reco ? std::abs(z) :
328  const auto& zLayerHex = hgpar_->zLayerHex_;
329  std::find_if(zLayerHex.begin()+1,zLayerHex.end(),[&k,&zz,&zLayerHex](double zLayer){ ++k; return zz < 0.5*(zLayerHex[k-1]+zLayerHex[k]);});
330  int lay = k;
331  if (((mode_ == HGCalGeometryMode::Hexagon) ||
333  int indx = layerIndex(lay,false);
334  if (indx >= 0) lay = hgpar_->layerGroup_[indx];
335  } else {
336  lay += (hgpar_->firstLayer_ - 1);
337  }
338  return lay;
339 }
340 
342  bool hexType,
343  bool reco) const {
344 
346  if (hexType) {
347  if (indx >= hgpar_->waferTypeL_.size())
348  edm::LogWarning("HGCalGeom") << "Wafer no. out bound for index " << indx
349  << ":" << (hgpar_->waferTypeL_).size()
350  << ":" << (hgpar_->waferPosX_).size()
351  << ":" << (hgpar_->waferPosY_).size()
352  << " ***** ERROR *****";
353  unsigned int type = (indx < hgpar_->waferTypeL_.size()) ?
354  hgpar_->waferTypeL_[indx] : 3;
355  if (type > 0) --type;
356  mytr = hgpar_->getModule(type, reco);
357  } else {
358  mytr = hgpar_->getModule(indx,reco);
359  }
360  return mytr;
361 }
362 
363 std::vector<HGCalParameters::hgtrap> HGCalDDDConstants::getModules() const {
364 
365  std::vector<HGCalParameters::hgtrap> mytrs;
366  for (unsigned int k=0; k<hgpar_->moduleLayR_.size(); ++k)
367  mytrs.emplace_back(hgpar_->getModule(k,true));
368  return mytrs;
369 }
370 
371 std::vector<HGCalParameters::hgtrform> HGCalDDDConstants::getTrForms() const {
372 
373  std::vector<HGCalParameters::hgtrform> mytrs;
374  for (unsigned int k=0; k<hgpar_->trformIndex_.size(); ++k)
375  mytrs.emplace_back(hgpar_->getTrForm(k));
376  return mytrs;
377 }
378 
379 int HGCalDDDConstants::getTypeTrap(int layer) const {
380 
382  return ((hgpar_->nPhiBinBH_[layerIndex(layer,true)] == hgpar_->nCellsFine_)
383  ? 0 : 1);
384  } else {
385  return -1;
386  }
387 }
388 
389 int HGCalDDDConstants::getTypeHex(int layer, int waferU, int waferV) const {
390 
393  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
394  return ((itr == hgpar_->typesInLayers_.end() ? 2 :
395  hgpar_->waferTypeL_[itr->second]));
396  } else {
397  return -1;
398  }
399 }
400 
401 bool HGCalDDDConstants::isHalfCell(int waferType, int cell) const {
402  if (waferType < 1 || cell < 0) return false;
403  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
404 }
405 
406 bool HGCalDDDConstants::isValidHex(int lay, int mod, int cell,
407  bool reco) const {
408 
409  bool result(false), resultMod(false);
410  int cellmax(0);
413  int32_t copyNumber = hgpar_->waferCopy_[mod];
414  result = ((lay > 0 && lay <= (int)(layers(reco))));
415  if (result) {
416  const int32_t lay_idx = reco ? (lay-1)*3 + 1 : lay;
417  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
418  auto moditr = the_modules.find(copyNumber);
419  result = resultMod = (moditr != the_modules.end());
420 #ifdef EDM_ML_DEBUG
421  if (!result)
422  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay
423  << ":" << lay_idx << " Copy "
424  << copyNumber << ":" << mod
425  << " Flag " << result;
426 #endif
427  if (result) {
428  if (moditr->second >= 0) {
429  if (mod >= (int)(hgpar_->waferTypeT_.size()))
430  edm::LogWarning("HGCalGeom") << "Module no. out of bound for "
431  << mod << " to be compared with "
432  << (hgpar_->waferTypeT_).size()
433  << " ***** ERROR *****";
434  cellmax = (hgpar_->waferTypeT_[mod]==1) ?
435  (int)(hgpar_->cellFineX_.size()) : (int)(hgpar_->cellCoarseX_.size());
436  result = (cell >=0 && cell <= cellmax);
437  } else {
438  result = isValidCell(lay_idx, mod, cell);
439  }
440  }
441  }
442  }
443 
444 #ifdef EDM_ML_DEBUG
445  if (!result)
446  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":"
447  << (lay > 0 && (lay <= (int)(layers(reco))))
448  << " Module " << mod << ":" << resultMod
449  << " Cell " << cell << ":" << cellmax << ":"
450  << (cell >=0 && cell <= cellmax)
451  << ":" << maxCells(reco);
452 #endif
453  return result;
454 }
455 
456 bool HGCalDDDConstants::isValidHex8(int layer, int modU, int modV, int cellU,
457  int cellV) const {
458  int indx = HGCalWaferIndex::waferIndex(layer,modU,modV);
459  auto itr = hgpar_->typesInLayers_.find(indx);
460  if (itr == hgpar_->typesInLayers_.end()) return false;
461  auto jtr = waferIn_.find(indx);
462  if (!(jtr->second)) return false;
463  int N = ((hgpar_->waferTypeL_[itr->second] == 0) ? hgpar_->nCellsFine_ :
465  if ((cellU >= 0) && (cellU < 2*N) && (cellV >= 0) && (cellV < 2*N)) {
466  return (((cellV-cellU) < N) && ((cellU-cellV) <= N));
467  } else {
468  return false;
469  }
470 }
471 
472 bool HGCalDDDConstants::isValidTrap(int layer, int ieta, int iphi) const {
473  const auto & indx = getIndex(layer,true);
474  if (indx.first < 0) return false;
475  return ((ieta >= hgpar_->iEtaMinBH_[indx.first]) &&
476  (ieta <= (hgpar_->iEtaMinBH_[indx.first]+
477  hgpar_->lastModule_[indx.first]-
478  hgpar_->firstModule_[indx.first])) &&
479  (iphi > 0) && (iphi <= hgpar_->nPhiBinBH_[indx.first]));
480 }
481 
482 unsigned int HGCalDDDConstants::layers(bool reco) const {
483  return tot_layers_[(int)reco];
484 }
485 
486 int HGCalDDDConstants::layerIndex(int lay, bool reco) const {
487  int ll = lay - hgpar_->firstLayer_;
488  if (ll<0 || ll>=(int)(hgpar_->layerIndex_.size())) return -1;
491  if (reco && ll>=(int)(hgpar_->depthIndex_.size())) return -1;
492  return (reco ? hgpar_->depthLayerF_[ll] : hgpar_->layerIndex_[ll]);
493  } else {
494  return (hgpar_->layerIndex_[ll]);
495  }
496 }
497 
498 unsigned int HGCalDDDConstants::layersInit(bool reco) const {
499  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
500 }
501 
502 std::pair<float,float> HGCalDDDConstants::locateCell(int cell, int lay,
503  int type, bool reco) const {
504  // type refers to wafer # for hexagon cell
505  float x(999999.), y(999999.);
506  const auto & index = getIndex(lay, reco);
507  int i = index.first;
508  if (i < 0) return std::make_pair(x,y);
511  x = hgpar_->waferPosX_[type];
512  y = hgpar_->waferPosY_[type];
513  if (hgpar_->waferTypeT_[type] == 1) {
514  x += hgpar_->cellFineX_[cell];
515  y += hgpar_->cellFineY_[cell];
516  } else {
517  x += hgpar_->cellCoarseX_[cell];
518  y += hgpar_->cellCoarseY_[cell];
519  }
520  if (!reco) {
523  }
524  }
525  return std::make_pair(x,y);
526 }
527 
528 std::pair<float,float> HGCalDDDConstants::locateCell(int lay, int waferU,
529  int waferV, int cellU,
530  int cellV, bool reco,
531  bool all) const {
532 
533  float x(0), y(0);
534  int indx = HGCalWaferIndex::waferIndex(lay,waferU,waferV);
535  auto itr = hgpar_->typesInLayers_.find(indx);
536  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
537  hgpar_->waferTypeL_[itr->second]);
538  int kndx = cellV*100 + cellU;
539  if (type == 0) {
540  auto ktr = hgpar_->cellFineIndex_.find(kndx);
541  if (ktr != hgpar_->cellFineIndex_.end()) {
542  x = hgpar_->cellFineX_[ktr->second];
543  y = hgpar_->cellFineY_[ktr->second];
544  }
545  } else {
546  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
547  if (ktr != hgpar_->cellCoarseIndex_.end()) {
548  x = hgpar_->cellCoarseX_[ktr->second];
549  y = hgpar_->cellCoarseY_[ktr->second];
550  }
551  }
552  if (!reco) {
555  }
556  if (all) {
557  const auto & xy = waferPosition(waferU, waferV, reco);
558  x += xy.first;
559  y += xy.second;
560  }
561  return std::make_pair(x,y);
562 }
563 
564 std::pair<float,float> HGCalDDDConstants::locateCellHex(int cell, int wafer,
565  bool reco) const {
566  float x(0), y(0);
567  if (hgpar_->waferTypeT_[wafer] == 1) {
568  x = hgpar_->cellFineX_[cell];
569  y = hgpar_->cellFineY_[cell];
570  } else {
571  x = hgpar_->cellCoarseX_[cell];
572  y = hgpar_->cellCoarseY_[cell];
573  }
574  if (!reco) {
577  }
578  return std::make_pair(x,y);
579 }
580 
581 std::pair<float,float> HGCalDDDConstants::locateCellTrap(int lay, int ieta,
582  int iphi, bool reco) const {
583 
584  float x(0), y(0);
585  const auto & indx = getIndex(lay,reco);
586  if (indx.first >= 0) {
587  ieta = std::abs(ieta);
588  double eta = hgpar_->etaMinBH_ + (ieta-0.5)*indx.second;
589  double phi = (iphi-0.5)*indx.second;
590  double z = hgpar_->zLayerHex_[indx.first];
591  double r = z*std::tan(2.0*std::atan(std::exp(-eta)));
592  x = r*std::cos(phi);
593  y = r*std::sin(phi);
594  }
595  if (!reco) {
598  }
599  return std::make_pair(x,y);
600 }
601 
603 
604  int cells(0);
605  for (unsigned int i = 0; i<layers(reco); ++i) {
606  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
607  if (cells < maxCells(lay, reco)) cells = maxCells(lay, reco);
608  }
609  return cells;
610 }
611 
612 int HGCalDDDConstants::maxCells(int lay, bool reco) const {
613 
614  const auto & index = getIndex(lay, reco);
615  if (index.first < 0) return 0;
618  unsigned int cells(0);
619  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
620  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
621  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
622  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
623  if (cell > cells) cells = cell;
624  }
625  }
626  return (int)(cells);
627  } else if ((mode_ == HGCalGeometryMode::Hexagon8) ||
629  int cells(0);
630  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
631  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
633  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
634  hgpar_->waferTypeL_[itr->second]);
635  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
636  cells = std::max(cells,3*N*N);
637  }
638  }
639  return cells;
640  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
641  return hgpar_->nPhiBinBH_[index.first];
642  } else {
643  return 0;
644  }
645 }
646 
647 int HGCalDDDConstants::maxRows(int lay, bool reco) const {
648 
649  int kymax(0);
650  const auto & index = getIndex(lay, reco);
651  int i = index.first;
652  if (i < 0) return kymax;
655  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
657  int ky = ((hgpar_->waferCopy_[k])/100)%100;
658  if (ky > kymax) kymax = ky;
659  }
660  }
661  } else if ((mode_ == HGCalGeometryMode::Hexagon8) ||
663  kymax = 1+2*hgpar_->waferUVMaxLayer_[index.first];
664  }
665  return kymax;
666 }
667 
668 int HGCalDDDConstants::modules(int lay, bool reco) const {
669  if (getIndex(lay,reco).first < 0) return 0;
670  else return max_modules_layer_[(int)reco][lay];
671 }
672 
673 int HGCalDDDConstants::modulesInit(int lay, bool reco) const {
674  int nmod(0);
675  const auto & index = getIndex(lay, reco);
676  if (index.first < 0) return nmod;
678  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
679  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) ++nmod;
680  }
681  } else {
682  nmod = 1+hgpar_->lastModule_[index.first]-hgpar_->firstModule_[index.first];
683  }
684  return nmod;
685 }
686 
687 double HGCalDDDConstants::mouseBite(bool reco) const {
688 
690 }
691 
693 
694  int cells(0);
695  unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size();
696  for (unsigned k=0; k<nlayer; ++k) {
697  std::vector<int> ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco);
698  cells = std::accumulate(ncells.begin(),ncells.end(),cells);
699  }
700  return cells;
701 }
702 
703 std::vector<int> HGCalDDDConstants::numberCells(int lay, bool reco) const {
704 
705  const auto & index = getIndex(lay, reco);
706  int i = index.first;
707  std::vector<int> ncell;
708  if (i >= 0) {
711  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
713  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
714  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
715  ncell.emplace_back((int)(cell));
716  }
717  }
718  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
719  int nphi = hgpar_->nPhiBinBH_[i];
720  for (int k=hgpar_->firstModule_[i]; k<=hgpar_->lastModule_[i]; ++k)
721  ncell.emplace_back(nphi);
722  } else {
723  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
724  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
725  int cell = numberCellsHexagon(lay,
728  true);
729  ncell.emplace_back(cell);
730  }
731  }
732  }
733  }
734  return ncell;
735 }
736 
738 
739  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
740  if (hgpar_->waferTypeT_[wafer]==1)
741  return (int)(hgpar_->cellFineX_.size());
742  else
743  return (int)(hgpar_->cellCoarseX_.size());
744  } else {
745  return 0;
746  }
747 }
748 
749 int HGCalDDDConstants::numberCellsHexagon(int lay, int waferU, int waferV,
750  bool flag) const {
751  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(lay,waferU,waferV));
752  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
753  hgpar_->waferTypeL_[itr->second]);
754  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
755  if (flag) return (3*N*N);
756  else return N;
757 }
758 
759 std::pair<int,int> HGCalDDDConstants::rowColumnWafer(int wafer) const {
760  int row(0), col(0);
761  if (wafer < (int)(hgpar_->waferCopy_.size())) {
762  int copy = hgpar_->waferCopy_[wafer];
763  col = copy%100;
764  if ((copy/10000)%10 != 0) col = -col;
765  row = (copy/100)%100;
766  if ((copy/100000)%10 != 0) row = -row;
767  }
768  return std::make_pair(row,col);
769 }
770 
771 std::pair<int,int> HGCalDDDConstants::simToReco(int cell, int lay, int mod,
772  bool half) const {
773 
776  return std::make_pair(cell,lay);
777  } else {
778  const auto & index = getIndex(lay, false);
779  int i = index.first;
780  if (i < 0) {
781  edm::LogWarning("HGCalGeom") << "Wrong Layer # " << lay
782  << " not in the list ***** ERROR *****";
783  return std::make_pair(-1,-1);
784  }
785  if (mod >= (int)(hgpar_->waferTypeL_).size()) {
786  edm::LogWarning("HGCalGeom") << "Invalid Wafer # " << mod
787  << "should be < "
788  << (hgpar_->waferTypeL_).size()
789  << " ***** ERROR *****";
790  return std::make_pair(-1,-1);
791  }
792  int depth(-1);
793  int kx = cell;
794  int type = hgpar_->waferTypeL_[mod];
795  if (type == 1) {
796  depth = hgpar_->layerGroup_[i];
797  } else if (type == 2) {
798  depth = hgpar_->layerGroupM_[i];
799  } else {
800  depth = hgpar_->layerGroupO_[i];
801  }
802  return std::make_pair(kx,depth);
803  }
804 }
805 
807  const int ncopies = hgpar_->waferCopy_.size();
808  int wafer(ncopies);
809  bool result(false);
810  for (int k=0; k<ncopies; ++k) {
811  if (copy == hgpar_->waferCopy_[k]) {
812  wafer = k;
813  result = true;
814  break;
815  }
816  }
817  if (!result) {
818  wafer = -1;
819 #ifdef EDM_ML_DEBUG
820  edm::LogVerbatim("HGCalGeom") << "Cannot find " << copy << " in a list of "
821  << ncopies << " members";
822  for (int k=0; k<ncopies; ++k)
823  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << hgpar_->waferCopy_[k];
824 #endif
825  }
826  return wafer;
827 }
828 
829 void HGCalDDDConstants::waferFromPosition(const double x, const double y,
830  int& wafer, int& icell,
831  int& celltyp) const {
832  //Input x, y in Geant4 unit and transformed to CMSSW standard
835  int size_ = (int)(hgpar_->waferCopy_.size());
836  wafer = size_;
837  for (int k=0; k<size_; ++k) {
838  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
839  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
840  if (dx <= rmax_ && dy <= hexside_) {
841  if ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy))) {
842  wafer = k;
843  celltyp = hgpar_->waferTypeT_[k];
844  xx -= hgpar_->waferPosX_[k];
845  yy -= hgpar_->waferPosY_[k];
846  break;
847  }
848  }
849  }
850  if (wafer < size_) {
851  if (celltyp == 1)
852  icell = cellHex(xx, yy, 0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[0],
854  else
857  } else {
858  wafer = -1;
859 #ifdef EDM_ML_DEBUG
860  edm::LogWarning("HGCalGeom") << "Cannot get wafer type corresponding to "
861  << x << ":" << y << " " << xx << ":" << yy;
862 #endif
863  }
864 #ifdef EDM_ML_DEBUG
865  edm::LogVerbatim("HGCalGeom") << "Position " << x << ":" << y << " Wafer "
866  << wafer << ":" << size_ << " XX " << xx << ":"
867  << yy << " Cell " << icell << " Type " << celltyp;
868 #endif
869 }
870 
871 void HGCalDDDConstants::waferFromPosition(const double x, const double y,
872  const int layer, int& waferU,
873  int& waferV, int& cellU, int& cellV,
874  int& celltype, double& wt) const {
875 
878  waferU = waferV = 1+hgpar_->waferUVMax_;
879  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
880  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
881  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
882  if (dx <= rmax_ && dy <= hexside_) {
883  if ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy))) {
886  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
887  celltype = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
888  hgpar_->waferTypeL_[itr->second]);
889  xx -= hgpar_->waferPosX_[k];
890  yy -= hgpar_->waferPosY_[k];
891  break;
892  }
893  }
894  }
895  if (std::abs(waferU) <= hgpar_->waferUVMax_) {
896  cellHex(xx, yy, celltype, cellU, cellV);
897  wt = ((celltype < 2) ?
898  (hgpar_->cellThickness_[celltype]/hgpar_->waferThick_) : 1.0);
899  } else {
900  cellU = cellV = 2*hgpar_->nCellsFine_;
901  wt = 1.0;
902  celltype =-1;
903  }
904 #ifdef EDM_ML_DEBUG
905  if (celltype < 0) {
907  double y1(HGCalParameters::k_ScaleFromDDD*y);
908  edm::LogVerbatim("HGCalGeom") << "waferFromPosition: Bad type for X "
909  << x << ":" << x1 << ":" << xx << " Y " << y
910  << ":" << y1 << ":" << yy << " Wafer "
911  << waferU << ":" << waferV << " Cell "
912  << cellU << ":" << cellV;
913  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
914  double dx = std::abs(x1-hgpar_->waferPosX_[k]);
915  double dy = std::abs(y1-hgpar_->waferPosY_[k]);
916  edm::LogVerbatim("HGCalGeom") << "Wafer [" << k << "] Position ("
917  << hgpar_->waferPosX_[k] << ", "
918  << hgpar_->waferPosY_[k] << ") difference "
919  << dx << ":" << dy << ":" << dx*tan30deg_
920  << ":" << hexside_-dy << " Paramerers "
921  << rmax_ << ":" << hexside_;
922  }
923  }
924 #endif
925 }
926 
927 bool HGCalDDDConstants::waferInLayer(int wafer, int lay, bool reco) const {
928 
929  const auto & indx = getIndex(lay, reco);
930  if (indx.first < 0) return false;
931  return waferInLayerTest(wafer,indx.first,hgpar_->defineFull_);
932 }
933 
934 bool HGCalDDDConstants::waferFullInLayer(int wafer, int lay, bool reco) const {
935  const auto & indx = getIndex(lay, reco);
936  if (indx.first < 0) return false;
937  return waferInLayerTest(wafer,indx.first,false);
938 }
939 
940 std::pair<double,double> HGCalDDDConstants::waferPosition(int wafer,
941  bool reco) const {
942 
943  double xx(0), yy(0);
944  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
945  xx = hgpar_->waferPosX_[wafer];
946  yy = hgpar_->waferPosY_[wafer];
947  }
948  if (!reco) {
951  }
952  return std::make_pair(xx,yy);
953 }
954 
955 std::pair<double,double> HGCalDDDConstants::waferPosition(int waferU,
956  int waferV,
957  bool reco) const {
958 
959  double xx(0), yy(0);
960  int indx = HGCalWaferIndex::waferIndex(0,waferU,waferV);
961  auto itr = hgpar_->wafersInLayers_.find(indx);
962  if (itr != hgpar_->wafersInLayers_.end()) {
963  xx = hgpar_->waferPosX_[itr->second];
964  yy = hgpar_->waferPosY_[itr->second];
965  }
966  if (!reco) {
969  }
970  return std::make_pair(xx,yy);
971 }
972 
973 int HGCalDDDConstants::waferType(DetId const& id) const {
974 
975  int type(1);
978  type = 1 + HGCSiliconDetId(id).type();
979  } else if ((mode_ == HGCalGeometryMode::Hexagon) ||
981  type = waferTypeL(HGCalDetId(id).wafer());
982  }
983  return type;
984 }
985 
986 double HGCalDDDConstants::waferZ(int lay, bool reco) const {
987  const auto & index = getIndex(lay, reco);
988  if (index.first < 0) return 0;
989  else return (reco ? hgpar_->zLayerHex_[index.first] :
991 }
992 
994 
995  int wafer(0);
997  for (unsigned int i = 0; i<layers(true); ++i) {
998  int lay = hgpar_->depth_[i];
999  wafer += modules(lay, true);
1000  }
1001  } else {
1002  wafer = (int)(hgpar_->moduleLayR_.size());
1003  }
1004  return wafer;
1005 }
1006 
1007 int HGCalDDDConstants::wafers(int layer, int type) const {
1008 
1009  int wafer(0);
1011  auto itr = waferLayer_.find(layer);
1012  if (itr != waferLayer_.end()) {
1013  unsigned ity = (type > 0 && type <= 2) ? type : 0;
1014  wafer = (itr->second)[ity];
1015  }
1016  } else {
1017  const auto & index = getIndex(layer, true);
1018  wafer = 1+hgpar_->lastModule_[index.first]-hgpar_->firstModule_[index.first];
1019  }
1020  return wafer;
1021 }
1022 
1023 int HGCalDDDConstants::cellHex(double xx, double yy,
1024  const double& cellR,
1025  const std::vector<double>& posX,
1026  const std::vector<double>& posY) const {
1027  int num(0);
1028  const double tol(0.00001);
1029  double cellY = 2.0*cellR*tan30deg_;
1030  for (unsigned int k=0; k<posX.size(); ++k) {
1031  double dx = std::abs(xx - posX[k]);
1032  double dy = std::abs(yy - posY[k]);
1033  if (dx <= (cellR+tol) && dy <= (cellY+tol)) {
1034  double xmax = (dy<=0.5*cellY) ? cellR : (cellR-(dy-0.5*cellY)/tan30deg_);
1035  if (dx <= (xmax+tol)) {
1036  num = k;
1037  break;
1038  }
1039  }
1040  }
1041  return num;
1042 }
1043 
1044 void HGCalDDDConstants::cellHex(double xloc, double yloc, int cellType,
1045  int& cellU, int& cellV) const {
1046  int N = (cellType == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1047  double Rc = 2*rmax_/(3*N);
1048  double rc = 0.5*Rc*sqrt3_;
1049  double v0 = ((xloc/Rc -1.0)/1.5);
1050  int cv0 = (v0 > 0) ? (N + (int)(v0+0.5)) : (N - (int)(-v0+0.5));
1051  double u0 = (0.5*yloc/rc+0.5*cv0);
1052  int cu0 = (u0 > 0) ? (N/2 + (int)(u0+0.5)) : (N/2 - (int)(-u0+0.5));
1053  bool found(false);
1054  static const int shift[3] = {0,1,-1};
1055  for (int i1=0; i1<3; ++i1) {
1056  cellU = cu0 + shift[i1];
1057  for (int i2=0; i2<3; ++i2) {
1058  cellV = cv0 + shift[i2];
1059  double xc = (1.5*(cellV-N)+1.0)*Rc;
1060  double yc = (2*cellU-cellV-N)*rc;
1061  if (((std::abs(xloc-xc) <= rc) && (std::abs(yloc-yc) <= 0.5*Rc)) ||
1062  ((std::abs(yloc-yc) <= Rc) &&
1063  (std::abs(xloc-xc) <= sqrt3_*std::abs(yloc-yc-Rc)))) {
1064  found = true; break;
1065  }
1066  }
1067  if (found) break;
1068  }
1069  if (!found) { cellU = cu0; cellV = cv0; }
1070 }
1071 
1072 std::pair<int,float> HGCalDDDConstants::getIndex(int lay, bool reco) const {
1073 
1074  int indx = layerIndex(lay,reco);
1075  if (indx<0) return std::make_pair(-1,0);
1076  float cell(0);
1077  if ((mode_ == HGCalGeometryMode::Hexagon) ||
1079  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1080  } else {
1083  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1084  } else {
1085  cell = hgpar_->dPhiEtaBH_[indx];
1086  }
1087  }
1088  return std::make_pair(indx,cell);
1089 }
1090 
1091 bool HGCalDDDConstants::isValidCell(int lay, int wafer, int cell) const {
1092 
1093  // Calculate the position of the cell
1094  // Works for options HGCalHexagon/HGCalHexagonFull
1095  double x = hgpar_->waferPosX_[wafer];
1096  double y = hgpar_->waferPosY_[wafer];
1097  if (hgpar_->waferTypeT_[wafer] == 1) {
1098  x += hgpar_->cellFineX_[cell];
1099  y += hgpar_->cellFineY_[cell];
1100  } else {
1101  x += hgpar_->cellCoarseX_[cell];
1102  y += hgpar_->cellCoarseY_[cell];
1103  }
1104  double rr = sqrt(x*x+y*y);
1105  bool result = ((rr >= hgpar_->rMinLayHex_[lay-1]) &&
1106  (rr <= hgpar_->rMaxLayHex_[lay-1]) &&
1107  (wafer < (int)(hgpar_->waferPosX_.size())));
1108 #ifdef EDM_ML_DEBUG
1109  if (!result)
1110  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << wafer << ":"
1111  << cell << " Position " << x << ":" << y
1112  << ":" << rr << " Compare Limits "
1113  << hgpar_->rMinLayHex_[lay-1] << ":"
1114  << hgpar_->rMaxLayHex_[lay-1]
1115  << " Flag " << result;
1116 #endif
1117  return result;
1118 }
1119 
1120 bool HGCalDDDConstants::waferInLayerTest(int wafer, int lay, bool full) const {
1121 
1122  const double waferX = hgpar_->waferPosX_[wafer];
1123  const double waferY = hgpar_->waferPosY_[wafer];
1125  xc[0] = waferX+rmax_; yc[0] = waferY-0.5*hexside_;
1126  xc[1] = waferX+rmax_; yc[1] = waferY+0.5*hexside_;
1127  xc[2] = waferX; yc[2] = waferY+hexside_;
1128  xc[3] = waferX-rmax_; yc[3] = waferY+0.5*hexside_;
1129  xc[4] = waferX+rmax_; yc[4] = waferY-0.5*hexside_;
1130  xc[5] = waferX; yc[5] = waferY-hexside_;
1131  bool cornerOne(false), cornerAll(true);
1132  for (unsigned int k=0; k<HGCalParameters::k_CornerSize; ++k) {
1133  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
1134  if ((rpos >= hgpar_->rMinLayHex_[lay]) &&
1135  (rpos <= hgpar_->rMaxLayHex_[lay])) cornerOne = true;
1136  else cornerAll = false;
1137  }
1138  bool in = full ? cornerOne : cornerAll;
1139 #ifdef EDM_ML_DEBUG
1140  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay
1141  << " wafer " << wafer << " R-limits "
1142  << hgpar_->rMinLayHex_[lay] << ":"
1143  << hgpar_->rMaxLayHex_[lay] << " Corners "
1144  << cornerOne << ":" << cornerAll << " In "
1145  << in;
1146 #endif
1147  return in;
1148 }
1149 
1151 
size
Write out results.
bool isHalfCell(int waferType, int cell) const
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< int > layer_
std::vector< int > iEtaMinBH_
std::vector< int > depthLayerF_
bool isValidTrap(int lay, int ieta, int iphi) const
std::vector< int > depth_
std::vector< double > moduleCellR_
int getTypeTrap(int layer) const
wafer_map cellFineIndex_
layer_map copiesInLayers_
int getLayer(double z, bool reco) const
std::vector< HGCalParameters::hgtrap > getModules() const
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
std::array< uint32_t, 2 > tot_layers_
def copy(args, dbName)
std::map< int, HGCWaferParam > waferLayer_
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
std::vector< int > moduleLayR_
double cellSizeHex(int type) const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
Simrecovecs max_modules_layer_
double cellThickness(int layer, int waferU, int waferV) const
unsigned int layersInit(bool reco) const
static int32_t waferV(const int32_t index)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
std::array< int, 4 > waferMax_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
int maxRows(int lay, bool reco) const
Geom::Theta< T > theta() const
int getTypeHex(int layer, int waferU, int waferV) const
std::vector< double > cellFineY_
bool waferInLayerTest(int wafer, int lay, bool full) const
int modulesInit(int lay, bool reco) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::vector< uint32_t > trformIndex_
bool isValidHex(int lay, int mod, int cell, bool reco) const
std::vector< int > layerGroupM_
HGCalGeometryMode::GeometryMode mode_
HGCalGeometryMode::GeometryMode mode_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
int layerIndex(int lay, bool reco) const
std::vector< int > nPhiBinBH_
wafer_map wafersInLayers_
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
std::vector< double > cellCoarseX_
int modules(int lay, bool reco) const
std::vector< int > firstModule_
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
unsigned int getTrFormN() const
double distFromEdgeTrap(double x, double y, double z) const
unsigned int layers(bool reco) const
bool isValidHex8(int lay, int modU, int modV, int cellU, int cellV) const
int numberCellsHexagon(int wafer) const
std::vector< double > cellSize_
std::vector< int > waferUVMaxLayer_
std::vector< HGCalParameters::hgtrform > getTrForms() const
std::vector< int > layerIndex_
double mouseBite(bool reco) const
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
hgtrform getTrForm(unsigned int k) const
int type() const
get the type
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< int, float > getIndex(int lay, bool reco) const
static double k_ScaleFromDDD
HGCalDDDConstants(const HGCalParameters *hp, const std::string &name)
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: GenABIO.cc:180
hgtrap getModule(unsigned int k, bool reco) const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unordered_map< int32_t, bool > waferIn_
static int32_t waferU(const int32_t index)
bool isValidCell(int layindex, int wafer, int cell) const
int waferTypeL(int wafer) const
T min(T a, T b)
Definition: MathUtil.h:58
int sectors() const
std::vector< double > rMinLayHex_
int scintType(const float dPhi) const
std::pair< int, int > rowColumnWafer(const int wafer) const
std::vector< double > zLayerHex_
double waferZ(int layer, bool reco) const
#define M_PI
int k[5][pyjets_maxn]
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:96
int waferType(DetId const &id) const
static const int maxType
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
Definition: DetId.h:18
std::vector< int > lastModule_
int waferFromCopy(int copy) const
#define N
Definition: blowfish.cc:9
std::vector< double > cellThickness_
std::vector< int > layerGroup_
std::vector< double > moduleCellS_
static double k_ScaleToDDD
int numberCells(bool reco) const
wafer_map cellCoarseIndex_
bool waferFullInLayer(int wafer, int lay, bool reco) const
std::vector< double > cellFineX_
wafer_map typesInLayers_
std::vector< int > layerGroupO_
static const int minType
fixed size matrix
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco) const
std::vector< int > waferCopy_
col
Definition: cuy.py:1009
static unsigned int const shift
std::vector< int > depthIndex_
std::pair< double, double > waferPosition(int wafer, bool reco) const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
const HGCalParameters * hgpar_
std::vector< double > dPhiEtaBH_
int maxCells(bool reco) const
std::vector< double > waferPosX_
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > waferTypeL_
static double tan30deg_
double distFromEdgeHex(double x, double y, double z) const
std::array< int, 3 > HGCWaferParam
bool waferInLayer(int wafer, int lay, bool reco) const