CMS 3D CMS Logo

HcalDDDRecConstants.cc
Go to the documentation of this file.
2 
5 
6 #include "CLHEP/Units/GlobalPhysicalConstants.h"
7 #include "CLHEP/Units/GlobalSystemOfUnits.h"
8 
9 //#define EDM_ML_DEBUG
10 
11 enum {kHOSizePreLS1 = 2160, kHFSizePreLS1 = 1728} ;
12 
14  const HcalDDDSimConstants& hc) :
15  hpar(hp), hcons(hc) {
16 
17 #ifdef EDM_ML_DEBUG
18  std::cout << "HcalDDDRecConstants::HcalDDDRecConstants (const HcalParameters* hp) constructor" << std::endl;
19 #endif
20  initialize();
21 }
22 
24 #ifdef EDM_ML_DEBUG
25  std::cout << "HcalDDDRecConstants::destructed!!!" << std::endl;
26 #endif
27 }
28 
29 std::vector<int> HcalDDDRecConstants::getDepth(const unsigned int& eta,
30  const bool& extra) const {
31 
32  if (!extra) {
33  std::vector<HcalParameters::LayerItem>::const_iterator last = hpar->layerGroupEtaRec.begin();
34  for (std::vector<HcalParameters::LayerItem>::const_iterator it = hpar->layerGroupEtaRec.begin(); it != hpar->layerGroupEtaRec.end(); ++it) {
35  if (it->layer == eta + 1) return it->layerGroup;
36  if (it->layer > eta + 1 ) return last->layerGroup;
37  last = it;
38  }
39  return last->layerGroup;
40  } else {
41  std::map<int,int> layers;
42  hcons.ldMap()->getLayerDepth(eta+1, layers);
43  std::vector<int> depths;
44  for (unsigned int lay=0; lay < layers.size(); ++lay)
45  depths.emplace_back(layers[lay+1]);
46  return depths;
47  }
48 }
49 
50 std::vector<int> HcalDDDRecConstants::getDepth(const int& det, const int& phi, const int& zside,
51  const unsigned int& eta) const {
52  std::map<int,int> layers;
53  hcons.ldMap()->getLayerDepth(det, eta+1, phi, zside, layers);
54  if (layers.empty()) {
55  return getDepth(eta, false);
56  } else {
57  std::vector<int> depths;
58  for (unsigned int lay=0; lay < layers.size(); ++lay)
59  depths.emplace_back(layers[lay+1]);
60  return depths;
61  }
62 }
63 
64 std::vector<HcalDDDRecConstants::HcalEtaBin>
65 HcalDDDRecConstants::getEtaBins(const int& itype) const {
66 
67  std::vector<HcalDDDRecConstants::HcalEtaBin> bins;
68  unsigned int type = (itype == 0) ? 0 : 1;
69  HcalSubdetector subdet = HcalSubdetector(type+1);
70  std::vector<int> phiSp;
71  HcalSubdetector subdetSp = HcalSubdetector(hcons.ldMap()->validDet(phiSp));
72  std::map<int,int> layers;
73  for (int iz=0; iz<2; ++iz) {
74  int zside = 2*iz - 1;
75  for (int ieta = iEtaMin[type]; ieta <= iEtaMax[type]; ++ieta) {
76  std::vector<std::pair<int,double> > phis = getPhis(subdet,ieta);
77  std::vector<std::pair<int,double> > phiUse;
78  getLayerDepth(ieta,layers);
79  if (subdet == subdetSp) {
80  for (auto & phi : phis) {
81  if (std::find(phiSp.begin(),phiSp.end(),(zside*phi.first)) ==
82  phiSp.end()){
83  phiUse.emplace_back(phi);
84  }
85  }
86  } else {
87  phiUse.insert(phiUse.end(),phis.begin(),phis.end());
88  }
89  getOneEtaBin(subdet,ieta,zside,phiUse,layers,false,bins);
90  }
91  }
92  if (subdetSp == subdet) {
93  for (int ieta = iEtaMin[type]; ieta <= iEtaMax[type]; ++ieta) {
94  std::vector<std::pair<int,double> > phis = getPhis(subdet,ieta);
95  for (int iz=0; iz<2; ++iz) {
96  int zside = 2*iz - 1;
97  std::vector<std::pair<int,double> > phiUse;
98  for (int i : phiSp) {
99  for (auto & phi : phis) {
100  if (i == zside*phi.first) {
101  phiUse.emplace_back(phi);
102  break;
103  }
104  }
105  }
106  if (!phiUse.empty()) {
107  hcons.ldMap()->getLayerDepth(subdet,ieta,phiUse[0].first,zside,layers);
108  getOneEtaBin(subdet,ieta,zside,phiUse,layers,true,bins);
109  }
110  }
111  }
112  }
113 #ifdef EDM_ML_DEBUG
114  std::cout << "Prepares " << bins.size() << " eta bins for type " << type
115  << std::endl;
116  for (unsigned int i=0; i<bins.size(); ++i) {
117  std::cout << "Bin[" << i << "]: Eta = (" << bins[i].ieta << ":"
118  << bins[i].etaMin << ":" << bins[i].etaMax << "), Zside = "
119  << bins[i].zside << ", phis = (" << bins[i].phis.size() << ":"
120  << bins[i].dphi << ") and " << bins[i].layer.size()
121  << " depths (start) " << bins[i].depthStart << " :";
122  for (unsigned int k=0; k<bins[i].layer.size(); ++k)
123  std::cout << " [" << k << "] " << bins[i].layer[k].first << ":"
124  << bins[i].layer[k].second;
125  std::cout << std::endl << " and Phi sets";
126  for (unsigned int k=0; k<bins[i].phis.size(); ++k)
127  std::cout << " " << bins[i].phis[k].first << ":" <<bins[i].phis[k].second;
128  std::cout << std::endl;
129  }
130 #endif
131  return bins;
132 }
133 
134 std::pair<double,double>
135 HcalDDDRecConstants::getEtaPhi(const int& subdet, const int& ieta, const int& iphi) const {
136  int ietaAbs = (ieta > 0) ? ieta : -ieta;
137  double eta(0), phi(0);
138  if ((subdet == static_cast<int>(HcalBarrel)) ||
139  (subdet == static_cast<int>(HcalEndcap)) ||
140  (subdet == static_cast<int>(HcalOuter))) { // Use Eta Table
141  int unit = hcons.unitPhi(phibin[ietaAbs-1]);
142  int kphi = (unit == 2) ? ((iphi-1)/2 + 1) : iphi;
143  double foff = (ietaAbs <= iEtaMax[0]) ? hpar->phioff[0] : hpar->phioff[1];
144  eta = 0.5*(etaTable[ietaAbs-1]+etaTable[ietaAbs]);
145  phi = foff + (kphi-0.5)*phibin[ietaAbs-1];
146  } else {
147  ietaAbs -= iEtaMin[2];
148  int unit = hcons.unitPhi(hpar->phitable[ietaAbs-1]);
149  int kphi = (unit == 4) ? ((iphi-3)/4 + 1) : ((iphi-1)/2 + 1);
150  double foff = (unit > 2) ? hpar->phioff[4] : hpar->phioff[2];
151  eta = 0.5*(hpar->etaTableHF[ietaAbs-1]+hpar->etaTableHF[ietaAbs]);
152  phi = foff + (kphi-0.5)*hpar->phitable[ietaAbs-1];
153  }
154  if (ieta < 0) eta = -eta;
155  if (phi > M_PI) phi -= (2*M_PI);
156 #ifdef EDM_ML_DEBUG
157  std::cout << "getEtaPhi: subdet|ieta|iphi " << subdet << "|" << ieta << "|"
158  << iphi << " eta|phi " << eta << "|" << phi << std::endl;
159 #endif
160  return std::pair<double,double>(eta,phi);
161 }
162 
164 HcalDDDRecConstants::getHCID(int subdet, int keta, int iphi, int lay,
165  int idepth) const {
166 
167  int ieta = (keta > 0) ? keta : -keta;
168  int zside= (keta > 0) ? 1 : -1;
169  int eta(ieta), phi(iphi), depth(idepth);
170  if ((subdet == static_cast<int>(HcalOuter)) ||
171  ((subdet == static_cast<int>(HcalBarrel)) && (lay > maxLayerHB_+1))) {
172  subdet= static_cast<int>(HcalOuter);
173  depth = 4;
174  } else if (subdet == static_cast<int>(HcalBarrel) ||
175  subdet == static_cast<int>(HcalEndcap)) {
176  eta = ietaMap[ieta-1];
177  int unit = phiUnitS[ieta-1];
178  int phi0 = (iphi-1)/(hpar->phigroup[eta-1]);
179  if (unit == 2) {
180  phi0 = (iphi+1)/2;
181  phi0 = (phi0-1)/(hpar->phigroup[eta-1]);
182  } else if (unit == 4) {
183  phi0 = (iphi+1)/4;
184  phi0 = (phi0-1)/(hpar->phigroup[eta-1]);
185  }
186  ++phi0;
187  unit = hcons.unitPhi(phibin[eta-1]);
188  phi = hcons.phiNumber(phi0,unit);
189  depth = hcons.findDepth(subdet,eta,phi,zside,lay-1);
190  if (depth <= 0) depth = layerGroup(eta-1, lay-1);
191  if (eta == iEtaMin[1]) {
192  if (subdet == static_cast<int>(HcalBarrel)) {
193  if (depth > hcons.getDepthEta16(subdet,phi,zside))
194  depth = hcons.getDepthEta16(subdet,phi,zside);
195  } else {
196  if (depth < hcons.getDepthEta16(subdet,phi,zside))
197  depth = hcons.getDepthEta16(subdet,phi,zside);
198  }
199  } else if (eta == hpar->noff[0] && lay > 1) {
200  int kphi = phi + int((hpar->phioff[3]+0.1)/phibin[eta-1]);
201  kphi = (kphi-1)%4 + 1;
202  if (kphi == 2 || kphi == 3) depth = layerGroup(eta-1, lay-2);
203  } else if (eta == hpar->noff[1] &&
204  depth > hcons.getDepthEta29(phi,zside,0)) {
205  eta -= hcons.getDepthEta29(phi,zside,1);
206  }
207  }
208 #ifdef EDM_ML_DEBUG
209  std::cout << "getHCID: input " << subdet << ":" << ieta << ":" << iphi
210  << ":" << idepth << ":" << lay << " output " << eta << ":" << phi
211  << ":" << depth << std::endl;
212 #endif
213  return HcalDDDRecConstants::HcalID(subdet,eta,phi,depth);
214 }
215 
216 std::vector<HcalDDDRecConstants::HFCellParameters>
218 
219  std::vector<HcalDDDRecConstants::HFCellParameters> cells;
220  unsigned int nEta = hcons.getPhiTableHF().size();
221  if (maxDepth[2] > 0) {
222  for (unsigned int k=0; k<nEta; ++k) {
223  int ieta = iEtaMin[2] + k;
224  int dphi = (int)(0.001 + hcons.getPhiTableHF()[k]/(5.0*CLHEP::deg));
225  int iphi = (dphi == 4) ? 3 : 1;
226  int nphi = 72/dphi;
227  double rMin = hcons.getRTableHF()[nEta-k-1]/CLHEP::cm;
228  double rMax = hcons.getRTableHF()[nEta-k]/CLHEP::cm;
229  HcalDDDRecConstants::HFCellParameters cell1( ieta,1,iphi,dphi,nphi,rMin,rMax);
230  cells.emplace_back(cell1);
231  HcalDDDRecConstants::HFCellParameters cell2(-ieta,1,iphi,dphi,nphi,rMin,rMax);
232  cells.emplace_back(cell2);
233  }
234  }
235  if (maxDepth[2] > 2) {
236  if (!hcons.getIdHF2QIE().empty()) {
237  for (unsigned int k=0; k<hcons.getIdHF2QIE().size(); ++k) {
238  int ieta = hcons.getIdHF2QIE()[k].ieta();
239  int ind = std::abs(ieta) - iEtaMin[2];
240  int dphi = (int)(0.001 + hcons.getPhiTableHF()[ind]/(5.0*CLHEP::deg));
241  int iphi = hcons.getIdHF2QIE()[k].iphi();
242  double rMin = hcons.getRTableHF()[nEta-ind-1]/CLHEP::cm;
243  double rMax = hcons.getRTableHF()[nEta-ind]/CLHEP::cm;
244  HcalDDDRecConstants::HFCellParameters cell1( ieta,3,iphi,dphi,1,rMin,rMax);
245  cells.emplace_back(cell1);
246  }
247  } else {
248  for (unsigned int k=0; k<nEta; ++k) {
249  int ieta = iEtaMin[2] + k;
250  int dphi = (int)(0.001 + hcons.getPhiTableHF()[k]/(5.0*CLHEP::deg));
251  int iphi = (dphi == 4) ? 3 : 1;
252  int nphi = 72/dphi;
253  double rMin = hcons.getRTableHF()[nEta-k-1]/CLHEP::cm;
254  double rMax = hcons.getRTableHF()[nEta-k]/CLHEP::cm;
255  HcalDDDRecConstants::HFCellParameters cell1( ieta,3,iphi,dphi,nphi,rMin,rMax);
256  cells.emplace_back(cell1);
257  HcalDDDRecConstants::HFCellParameters cell2(-ieta,3,iphi,dphi,nphi,rMin,rMax);
258  cells.emplace_back(cell2);
259  }
260  }
261  }
262 #ifdef EDM_ML_DEBUG
263  std::cout << "HcalDDDRecConstants returns " << cells.size()
264  << " HF cell parameters" << std::endl;
265  for (unsigned int k=0; k<cells.size(); ++k)
266  std::cout << "Cell[" << k <<"] : (" << cells[k].ieta <<", "<< cells[k].depth
267  << ", " << cells[k].firstPhi << ", " << cells[k].stepPhi << ", "
268  << cells[k].nPhi << ", " << cells[k].rMin << ", "
269  << cells[k].rMax << ")" << std::endl;
270 #endif
271  return cells;
272 }
273 
274 void HcalDDDRecConstants::getLayerDepth(const int& ieta, std::map<int,int>& layers) const {
275 
276  layers.clear();
277  for (unsigned int l=0; l<layerGroupSize(ieta-1); ++l) {
278  int lay = l + 1;
279  layers[lay] = layerGroup(ieta-1,l);
280  }
281 #ifdef EDM_ML_DEBUG
282  std::cout << "getLayerDepth::Input " << ieta << " Output "
283  << layers.size() << " entries" << std::endl;
284  for (std::map<int,int>::iterator itr=layers.begin(); itr != layers.end();
285  ++itr) std::cout << " [" << itr->first << "] " << itr->second;
286  std::cout << std::endl;
287 #endif
288 }
289 
290 int HcalDDDRecConstants::getLayerFront(const int& idet, const int& ieta,
291  const int& iphi, const int& depth) const {
292  int subdet = (idet == 1) ? 1 : 2;
293  int zside = (ieta > 0) ? 1 : -1;
294  int eta = zside*ieta;
295  int layFront = hcons.ldMap()->getLayerFront(subdet,eta,iphi,zside,depth);
296  if (layFront < 0) {
297  int laymin = hcons.getFrontLayer(subdet, ieta);
298  if (eta == 16 && subdet == 2) {
299  layFront = laymin;
300  } else if (eta <= hpar->etaMax[1]) {
301  for (unsigned int k=0; k<layerGroupSize(eta-1); ++k) {
302  if (depth == (int)layerGroup(eta-1, k)) {
303  if ((int)(k) >= laymin) {
304  layFront = k;
305  break;
306  }
307  }
308  }
309  }
310  }
311 #ifdef EDM_ML_DEBUG
312  std::cout << "getLayerFront::Input " << idet << ":" << ieta << ":"
313  << iphi << ":" << depth << " Output " << layFront << std::endl;
314 #endif
315  return layFront;
316 }
317 
318 int HcalDDDRecConstants::getMaxDepth (const int& itype, const int& ieta,
319  const int& iphi, const int& zside) const {
320 
321  unsigned int type = (itype == 0) ? 0 : 1;
322  int lmax = hcons.getMaxDepth(type+1, ieta, iphi, zside, true);
323  if (lmax < 0) {
324  unsigned int lymax = (type == 0) ? maxLayerHB_+1 : maxLayer_+1;
325  lmax = 0;
326  if (layerGroupSize(ieta-1) > 0) {
327  if (layerGroupSize(ieta-1) < lymax) lymax = layerGroupSize(ieta-1);
328  lmax = (int)(layerGroup(ieta-1, lymax-1));
329  if (type == 0 && ieta == iEtaMax[type]) lmax = hcons.getDepthEta16M(1);
330  if (type == 1 && ieta >= hpar->noff[1]) lmax = hcons.getDepthEta29M(0,false);
331  }
332  }
333 #ifdef EDM_ML_DEBUG
334  std::cout << "getMaxDepth::Input " << itype << ":" << ieta << ":"
335  << iphi << ":" << zside << " Output " << lmax << std::endl;
336 #endif
337  return lmax;
338 }
339 
340 int HcalDDDRecConstants::getMinDepth (const int& itype, const int& ieta,
341  const int& iphi, const int& zside) const {
342 
343  int lmin = hcons.getMinDepth(itype+1, ieta, iphi, zside, true);
344  if (lmin < 0) {
345  if (itype == 2) { // HFn
346  lmin = 1;
347  } else if (itype == 3) { //HO
348  lmin = maxDepth[3];
349  } else {
350  unsigned int type = (itype == 0) ? 0 : 1;
351  if (layerGroupSize(ieta-1) > 0) {
352  if (type == 1 && ieta == iEtaMin[type])
353  lmin = hcons.getDepthEta16M(2);
354  else
355  lmin = (int)(layerGroup(ieta-1, 0));
356  }
357  }
358  }
359  return lmin;
360 }
361 
362 std::vector<std::pair<int,double> >
363 HcalDDDRecConstants::getPhis(const int& subdet, const int& ieta) const {
364 
365  std::vector<std::pair<int,double> > phis;
366  int ietaAbs = (ieta > 0) ? ieta : -ieta;
367  int keta = (subdet != HcalForward) ? etaSimValu[ietaAbs-1].first : ietaAbs;
368  std::pair<double,double> ficons = hcons.getPhiCons(subdet, keta);
369  double fioff = ficons.first;
370  double dphi = (subdet != HcalForward) ? phibin[ietaAbs-1] : ficons.second;
371  int nphi = int((CLHEP::twopi+0.1*dphi)/dphi);
372  int units = hcons.unitPhi(subdet, keta);
373  for (int ifi = 0; ifi < nphi; ++ifi) {
374  double phi =-fioff + (ifi+0.5)*dphi;
375  int iphi = hcons.phiNumber(ifi+1,units);
376  phis.emplace_back(std::pair<int,double>(iphi,phi));
377  }
378 #ifdef EDM_ML_DEBUG
379  std::cout << "getEtaPhi: subdet|ieta|iphi " << subdet << "|" << ieta
380  << " with " << phis.size() << " phi bins" << std::endl;
381  for (unsigned int k=0; k<phis.size(); ++k)
382  std::cout << "[" << k << "] iphi " << phis[k].first << " phi "
383  << phis[k].second/CLHEP::deg << std::endl;
384 #endif
385  return phis;
386 }
387 
388 int HcalDDDRecConstants::getPhiZOne(std::vector<std::pair<int,int>>& phiz) const {
389 
390  phiz.clear();
391  int subdet = hcons.ldMap()->getSubdet();
392  if (subdet > 0) {
393  std::vector<int> phis = hcons.ldMap()->getPhis();
394  for (int k : phis) {
395  int zside = (k > 0) ? 1 : -1;
396  int phi = (k > 0) ? k : -k;
397  phiz.emplace_back(std::pair<int,int>(phi,zside));
398  }
399  }
400 #ifdef EDM_ML_DEBUG
401  std::cout << "Special RBX for detector " << subdet << " with " << phiz.size()
402  << " phi/z bins";
403  for (unsigned int k=0; k<phiz.size(); ++k)
404  std::cout << " [" << k << "] " << phiz[k].first << ":" << phiz[k].second;
405  std::cout << std::endl;
406 #endif
407  return subdet;
408 }
409 
410 double HcalDDDRecConstants::getRZ(const int& subdet, const int& ieta,
411  const int& depth) const {
412 
413  return getRZ(subdet, ieta, 1, depth);
414 }
415 
416 double HcalDDDRecConstants::getRZ(const int& subdet, const int& ieta, const int& iphi,
417  const int& depth) const {
418  int layf = getLayerFront(subdet,ieta,iphi,depth);
419  double rz = (layf < 0) ? 0.0 :
420  ((subdet == static_cast<int>(HcalBarrel)) ? (gconsHB[layf].first) :
421  (gconsHE[layf].first));
422 #ifdef EDM_ML_DEBUG
423  std::cout << "getRZ: subdet|ieta|ipho|depth " << subdet << "|" << ieta << "|"
424  << iphi << "|" << depth << " lay|rz " << layf << "|" << rz
425  << std::endl;
426 #endif
427  return rz;
428 }
429 
430 double HcalDDDRecConstants::getRZ(const int& subdet, const int& layer) const {
431 
432  double rz(0);
433  if (layer > 0 && layer <= (int)(layerGroupSize(0)))
434  rz = ((subdet == static_cast<int>(HcalBarrel)) ? (gconsHB[layer-1].first) :
435  (gconsHE[layer-1].first));
436 #ifdef EDM_ML_DEBUG
437  std::cout << "getRZ: subdet|layer " << subdet << "|" << layer << " rz "
438  << rz << std::endl;
439 #endif
440  return rz;
441 }
442 
443 
444 std::vector<HcalDDDRecConstants::HcalActiveLength>
446 
447  std::vector<HcalDDDRecConstants::HcalActiveLength> actives;
448  std::vector<HcalDDDRecConstants::HcalEtaBin> bins = getEtaBins(type);
449 #ifdef EDM_ML_DEBUG
450  unsigned int kount(0);
451 #endif
452  for (auto & bin : bins) {
453  int ieta = bin.ieta;
454  int zside = bin.zside;
455  int stype = (bin.phis.size() > 4) ? 0 : 1;
456  int layf = getLayerFront(type+1,zside*ieta,bin.phis[0].first,bin.depthStart) + 1;
457  int layl = hcons.getLastLayer(type+1,zside*ieta) + 1;
458  double eta = 0.5*(bin.etaMin+bin.etaMax);
459  double theta = 2*atan(exp(-eta));
460  double scale = 1.0/((type == 0) ? sin(theta) : cos(theta));
461  int depth = bin.depthStart;
462 #ifdef EDM_ML_DEBUG
463  std::cout << "Eta " << ieta << " zside " << zside << " depth " << depth
464  << " Layers " << layf << ":" << layl << ":" << bin.layer.size();
465  for (auto ll : bin.layer) std::cout << " " << ll.first << ":" << ll.second;
466  std::cout << " phi ";
467  for (auto phi : bin.phis) std::cout << " " << phi.first;
468  std::cout << std::endl;
469 #endif
470  for (unsigned int i = 0; i < bin.layer.size(); ++i) {
471  double thick(0);
472  int lmin = (type == 1 && ieta == iEtaMin[1]) ? layf :
473  std::max(bin.layer[i].first,layf);
474  int lmax = std::min(bin.layer[i].second,layl);
475  for (int j = lmin; j <= lmax; ++j) {
476  if (type == 0 || j > 1) {
477  double t = ((type == 0) ? gconsHB[j-1].second : gconsHE[j-1].second);
478  if (t > 0) thick += t;
479  }
480  }
481  thick *= (2.*scale);
482  HcalDDDRecConstants::HcalActiveLength active(ieta,depth,zside,stype,zside*eta,thick);
483  for (auto phi : bin.phis)
484  active.iphis.emplace_back(phi.first);
485  actives.emplace_back(active);
486  ++depth;
487 #ifdef EDM_ML_DEBUG
488  kount++;
489  std::cout << "getThickActive: [" << kount << "] eta:" << active.ieta
490  << ":" << active.eta << " zside " << active.zside << " depth "
491  << active.depth << " type " << active.stype << " thick "
492  << active.thick << std::endl;
493 #endif
494  }
495  }
496  return actives;
497 }
498 
499 std::vector<HcalCellType>
501 
502  if (subdet == HcalBarrel || subdet == HcalEndcap) {
503  std::vector<HcalCellType> cells;
504  int isub = (subdet == HcalBarrel) ? 0 : 1;
505  std::vector<HcalDDDRecConstants::HcalEtaBin> etabins = getEtaBins(isub);
506  std::vector<int> missPhi;
507  for (const auto& etabin : etabins) {
508  std::vector<HcalCellType> temp;
509  std::vector<int> count;
510  std::vector<double> dmin, dmax;
511  for (unsigned int il=0; il<etabin.layer.size(); ++il) {
512  HcalCellType cell(subdet, etabin.ieta, etabin.zside, 0,
514  temp.emplace_back(cell);
515  count.emplace_back(0);
516  dmin.emplace_back(0);
517  dmax.emplace_back(0);
518  }
519  int ieta = etabin.ieta;
520  for (int keta=etaSimValu[ieta-1].first; keta<=etaSimValu[ieta-1].second;
521  ++keta) {
522  std::vector<HcalCellType> cellsm = hcons.HcalCellTypes(subdet,keta,-1);
523  for (unsigned int il=0; il<etabin.layer.size(); ++il) {
524  for (auto & ic : cellsm) {
525  if (ic.depthSegment() >= etabin.layer[il].first &&
526  ic.depthSegment() <= etabin.layer[il].second &&
527  ic.etaBin() == temp[il].etaBin() &&
528  ic.zside() == temp[il].zside()) {
529  if (count[il] == 0) {
530  temp[il] = ic;
531  dmin[il] = ic.depthMin();
532  dmax[il] = ic.depthMax();
533  }
534  ++count[il];
535  if (ic.depthMin() < dmin[il])
536  dmin[il] = ic.depthMin();
537  if (ic.depthMax() > dmax[il])
538  dmax[il] = ic.depthMax();
539  }
540  }
541  }
542  }
543  for (unsigned int il=0; il<etabin.layer.size(); ++il) {
544  int depth = etabin.depthStart + (int)(il);
545  temp[il].setEta(ieta,etabin.etaMin,etabin.etaMax);
546  temp[il].setDepth(depth,dmin[il],dmax[il]);
547  double foff = (etabin.ieta <= iEtaMax[0]) ? hpar->phioff[0] : hpar->phioff[1];
548  int unit = hcons.unitPhi(etabin.dphi);
549  temp[il].setPhi(etabin.phis, missPhi, foff, etabin.dphi, unit);
550  cells.emplace_back(temp[il]);
551  }
552  }
553 #ifdef EDM_ML_DEBUG
554  std::cout << "HcalDDDRecConstants: found " << cells.size()
555  << " cells for sub-detector type " << isub << std::endl;
556  for (unsigned int ic=0; ic<cells.size(); ++ic)
557  std::cout << "Cell[" << ic << "] " << cells[ic] << std::endl;
558 #endif
559  return cells;
560  } else {
561  return hcons.HcalCellTypes(subdet,-1,-1);
562  }
563 }
564 
566 
567  if (subdet == HcalBarrel || subdet == HcalEndcap) {
568  unsigned int num = 0;
569  std::vector<HcalCellType> cellTypes = HcalCellTypes(subdet);
570  for (auto & cellType : cellTypes) {
571  num += (unsigned int)(cellType.nPhiBins());
572  }
573 #ifdef EDM_ML_DEBUG
574  edm::LogInfo ("HCalGeom") << "HcalDDDRecConstants:numberOfCells "
575  << cellTypes.size() << " " << num
576  << " for subdetector " << subdet;
577 #endif
578  return num;
579  } else {
580  return hcons.numberOfCells(subdet);
581  }
582 }
583 
584 unsigned int HcalDDDRecConstants::nCells(HcalSubdetector subdet) const {
585 
586  if (subdet == HcalBarrel || subdet == HcalEndcap) {
587  int isub = (subdet == HcalBarrel) ? 0 : 1;
588  std::vector<HcalDDDRecConstants::HcalEtaBin> etabins = getEtaBins(isub);
589  unsigned int ncell(0);
590  for (auto & etabin : etabins) {
591  ncell += ((etabin.phis.size())*(etabin.layer.size()));
592  }
593  return ncell;
594  } else if (subdet == HcalOuter) {
595  return kHOSizePreLS1;
596  } else if (subdet == HcalForward) {
597  return (unsigned int)(hcons.numberOfCells(subdet));
598  } else {
599  return 0;
600  }
601 }
602 
603 unsigned int HcalDDDRecConstants::nCells() const {
605 }
606 
608 
609  std::map<HcalDetId,HcalDetId>::const_iterator itr = detIdSp_.find(id);
610  if (itr == detIdSp_.end()) return id;
611  else return itr->second;
612 }
613 
615 
616  HcalDetId hid(id);
617  std::map<HcalDetId,std::vector<HcalDetId>>::const_iterator itr = detIdSpR_.find(id);
618  if (itr != detIdSpR_.end())
619  hid = HcalDetId(id.subdet(),id.ieta(),id.iphi(),(itr->second)[0].depth());
620  return hid;
621 }
622 
624 
625  HcalDetId hid(id);
626  std::map<HcalDetId,std::vector<HcalDetId>>::const_iterator itr = detIdSpR_.find(id);
627  if (itr != detIdSpR_.end())
628  hid = HcalDetId(id.subdet(),id.ieta(),id.iphi(),(itr->second).back().depth());
629  return hid;
630 }
631 
633  std::vector<HcalDetId>& ids) const {
634 
635  ids.clear();
636  std::map<HcalDetId,std::vector<HcalDetId>>::const_iterator itr = detIdSpR_.find(id);
637  if (itr == detIdSpR_.end()) {
638  ids.emplace_back(id);
639  } else {
640  for (auto k : itr->second) {
641  HcalDetId hid(id.subdet(),id.ieta(),id.iphi(),k.depth());
642  ids.emplace_back(hid);
643  }
644  }
645 }
646 
647 void HcalDDDRecConstants::specialRBXHBHE(const std::vector<HcalDetId>& idsOld,
648  std::vector<HcalDetId>& idsNew) const {
649  for (auto k : idsOld) {
650  std::map<HcalDetId,HcalDetId>::const_iterator itr = detIdSp_.find(k);
651  if (itr == detIdSp_.end()) idsNew.emplace_back(k);
652  else idsNew.emplace_back(itr->second);
653  }
654 }
655 
657  std::vector<HcalDetId>& ids) const {
658  if (tobemerged) {
659  std::map<HcalDetId,HcalDetId>::const_iterator itr;
660  for (itr = detIdSp_.begin(); itr != detIdSp_.end(); ++itr)
661  ids.emplace_back(itr->first);
662  } else{
663  std::map<HcalDetId,std::vector<HcalDetId>>::const_iterator itr;
664  for (itr = detIdSpR_.begin(); itr != detIdSpR_.end(); ++itr)
665  ids.emplace_back(itr->first);
666  }
667  return (!ids.empty());
668 }
669 
671  std::vector<std::pair<int,double> >& phis,
672  std::map<int,int>& layers, bool planOne,
673  std::vector<HcalDDDRecConstants::HcalEtaBin>& bins) const {
674 
675  unsigned int lymax = (subdet == HcalBarrel) ? maxLayerHB_+1 : maxLayer_+1;
676  int type = (subdet == HcalBarrel) ? 0 : 1;
677  double dphi = phibin[ieta-1];
679  etabin.phis.insert(etabin.phis.end(),phis.begin(),phis.end());
680  int n = (ieta == iEtaMax[type]) ? 0 : 1;
681  HcalDDDRecConstants::HcalEtaBin etabin0= HcalDDDRecConstants::HcalEtaBin(ieta,zside,dphi,etaTable[ieta-1],etaTable[ieta+n]);
682  etabin0.depthStart = hcons.getDepthEta29(phis[0].first,zside,0)+1;
683  int dstart = -1;
684  int lmin(0), lmax(0);
685  std::map<int,int>::iterator itr=layers.begin();
686  if (!layers.empty()) {
687  int dep = itr->second;
688  if (subdet == HcalEndcap && ieta == iEtaMin[type])
689  dep = hcons.getDepthEta16(subdet,phis[0].first,zside);
690  unsigned lymx0 = (layers.size() > lymax) ? lymax : layers.size();
691 #ifdef EDM_ML_DEBUG
692  std::cout << "Eta " << ieta << ":" << hpar->noff[1] << " zside " << zside
693  << " lymax " << lymx0 << ":" << lymax << " Depth " << dep << ":"
694  << itr->second;
695  unsigned int l(0);
696  for (itr = layers.begin(); itr != layers.end(); ++itr,++l)
697  std::cout << " [" << l << "] " << itr->first << ":" << itr->second;
698  std::cout << std::endl << " with " << phis.size() << " phis";
699  for (unsigned int l=0; l<phis.size(); ++l)
700  std::cout << " " << phis[l].first << ":" << phis[l].second;
701  std::cout << std::endl;
702 #endif
703  for (itr = layers.begin(); itr != layers.end(); ++itr) {
704  if (itr->first <= (int)(lymx0)) {
705  if (itr->second == dep) {
706  if (lmin == 0) lmin = itr->first;
707  lmax = itr->first;
708  } else if (itr->second > dep) {
709  if (dstart < 0) dstart = dep;
710  int lmax0 = (lmax >= lmin) ? lmax : lmin;
711  if (subdet == HcalEndcap && ieta+1 == hpar->noff[1] &&
712  dep > hcons.getDepthEta29(phis[0].first,zside,0)) {
713  etabin0.layer.emplace_back(std::pair<int,int>(lmin,lmax0));
714  } else {
715  etabin.layer.emplace_back(std::pair<int,int>(lmin,lmax0));
716  }
717  lmin = itr->first;
718  lmax = lmin-1;
719  dep = itr->second;
720  }
721  if (subdet == HcalBarrel && ieta == iEtaMax[type] &&
722  dep > hcons.getDepthEta16M(1)) break;
723  if (subdet == HcalEndcap && ieta == hpar->noff[1] &&
724  dep > hcons.getDepthEta29M(0,planOne)) {
725  lmax = lymx0;
726  break;
727  }
728  if (itr->first == (int)(lymx0)) lmax = lymx0;
729  }
730  }
731  if (lmax >= lmin) {
732  if (ieta+1 == hpar->noff[1]) {
733  etabin0.layer.emplace_back(std::pair<int,int>(lmin,lmax));
734  etabin0.phis.insert(etabin0.phis.end(),phis.begin(),phis.end());
735  bins.emplace_back(etabin0);
736 #ifdef EDM_ML_DEBUG
737  std::cout << "etabin0: dStatrt " << etabin0.depthStart << " layers "
738  << etabin0.layer.size() << ":" << lmin << ":" << lmax
739  << " phis " << phis.size() << std::endl;
740  for (unsigned int k=0; k<etabin0.layer.size(); ++k)
741  std::cout << " [" << k << "] " << etabin0.layer[k].first << ":"
742  << etabin0.layer[k].second;
743  std::cout << std::endl;
744 #endif
745  } else if (ieta == hpar->noff[1]) {
746  } else {
747  etabin.layer.emplace_back(std::pair<int,int>(lmin,lmax));
748  if (dstart < 0) dstart = dep;
749  }
750  }
751  }
752  etabin.depthStart = dstart;
753  bins.emplace_back(etabin);
754 #ifdef EDM_ML_DEBUG
755  std::cout << "etabin: dStatrt " << etabin.depthStart << " layers "
756  << etabin.layer.size() << ":" << lmin << ":" << lmax
757  << " phis " << etabin.phis.size() << std::endl;
758  for (unsigned int k=0; k<etabin.layer.size(); ++k)
759  std::cout << " [" << k << "] " << etabin.layer[k].first << ":"
760  << etabin.layer[k].second;
761  std::cout << std::endl;
762 #endif
763 }
764 
766 
767  //Eta grouping
768  int nEta = (int)(hpar->etagroup.size());
769  if (nEta != (int)(hpar->phigroup.size())) {
770  edm::LogError("HCalGeom") << "HcalDDDRecConstants: sizes of the vectors "
771  << " etaGroup (" << nEta << ") and phiGroup ("
772  << hpar->phigroup.size() << ") do not match";
773  throw cms::Exception("DDException") << "HcalDDDRecConstants: inconsistent array sizes" << nEta << ":" << hpar->phigroup.size();
774  }
775 
776  // First eta table
777  iEtaMin = hpar->etaMin;
778  iEtaMax = hpar->etaMax;
779  etaTable.clear(); ietaMap.clear(); etaSimValu.clear();
780  int ieta(0), ietaHB(0), ietaHE(0), ietaHEM(0);
781  etaTable.emplace_back(hpar->etaTable[ieta]);
782  for (int i=0; i<nEta; ++i) {
783  int ef = ieta+1;
784  ieta += (hpar->etagroup[i]);
785  if (ieta >= (int)(hpar->etaTable.size())) {
786  edm::LogError("HCalGeom") << "Going beyond the array boundary "
787  << hpar->etaTable.size() << " at index " << i
788  << " of etaTable from SimConstant";
789  throw cms::Exception("DDException") << "Going beyond the array boundary "
790  << hpar->etaTable.size()
791  << " at index " << i
792  << " of etaTable from SimConstant";
793  } else {
794  etaTable.emplace_back(hpar->etaTable[ieta]);
795  etaSimValu.emplace_back(std::pair<int,int>(ef,ieta));
796  }
797  for (int k=0; k<(hpar->etagroup[i]); ++k) ietaMap.emplace_back(i+1);
798  if (ieta <= hpar->etaMax[0]) ietaHB = i+1;
799  if (ieta <= hpar->etaMin[1]) ietaHE = i+1;
800  if (ieta <= hpar->etaMax[1]) ietaHEM= i+1;
801  }
802  iEtaMin[1] = ietaHE;
803  iEtaMax[0] = ietaHB;
804  iEtaMax[1] = ietaHEM;
805 
806  // Then Phi bins
807  nPhiBins.clear();
808  for (unsigned int k=0; k<4; ++k) nPhiBins.emplace_back(0);
809  ieta = 0;
810  phibin.clear(); phiUnitS.clear();
811  for (int i=0; i<nEta; ++i) {
812  double dphi = (hpar->phigroup[i])*(hpar->phibin[ieta]);
813  phibin.emplace_back(dphi);
814  int nphi = (int)((CLHEP::twopi + 0.001)/dphi);
815  if (ieta <= iEtaMax[0]) {
816  if (nphi > nPhiBins[0]) nPhiBins[3] = nPhiBins[0] = nphi;
817  }
818  if (ieta >= iEtaMin[1]) {
819  if (nphi > nPhiBins[1]) nPhiBins[1] = nphi;
820  }
821  ieta += (hpar->etagroup[i]);
822  }
823  for (unsigned int i=1; i<hpar->etaTable.size(); ++i) {
824  int unit = hcons.unitPhi(hpar->phibin[i-1]);
825  phiUnitS.emplace_back(unit);
826  }
827  for (double i : hpar->phitable) {
828  int nphi = (int)((CLHEP::twopi + 0.001)/i);
829  if (nphi > nPhiBins[2]) nPhiBins[2] = nphi;
830  }
831 #ifdef EDM_ML_DEBUG
832  std::cout << "Modified eta/deltaphi table for " << nEta << " bins" << std::endl;
833  for (int i=0; i<nEta; ++i)
834  std::cout << "Eta[" << i << "] = " << etaTable[i] << ":" << etaTable[i+1]
835  << ":" << etaSimValu[i].first << ":" << etaSimValu[i].second
836  << " PhiBin[" << i << "] = " << phibin[i]/CLHEP::deg <<std::endl;
837  std::cout << "PhiUnitS";
838  for (unsigned int i=0; i<phiUnitS.size(); ++i)
839  std::cout << " [" << i << "] = " << phiUnitS[i];
840  std::cout << std::endl;
841  std::cout << "nPhiBins";
842  for (unsigned int i=0; i<nPhiBins.size(); ++i)
843  std::cout << " [" << i << "] = " << nPhiBins[i];
844  std::cout << std::endl;
845  std::cout << "EtaTableHF";
846  for (unsigned int i=0; i<hpar->etaTableHF.size(); ++i)
847  std::cout << " [" << i << "] = " << hpar->etaTableHF[i];
848  std::cout << std::endl;
849  std::cout << "PhiBinHF";
850  for (unsigned int i=0; i<hpar->phitable.size(); ++i)
851  std::cout << " [" << i << "] = " << hpar->phitable[i];
852  std::cout << std::endl;
853 #endif
854 
855  //Now the depths
857  maxDepth[0] = maxDepth[1] = 0;
858  for (int i=0; i<nEta; ++i) {
859  unsigned int imx = layerGroupSize(i);
860  int laymax = (imx > 0) ? layerGroup(i,imx-1) : 0;
861  if (i < iEtaMax[0]) {
862  int laymax0 = (imx > 16) ? layerGroup(i,16) : laymax;
863  if (i+1 == iEtaMax[0]) laymax0 = hcons.getDepthEta16M(1);
864 #ifdef EDM_ML_DEBUG
865  std::cout << "HB " << i << " " << imx << " " << laymax << " "
866  << laymax0 << std::endl;
867 #endif
868  if (maxDepth[0] < laymax0) maxDepth[0] = laymax0;
869  }
870  if (i >= iEtaMin[1]-1 && i < iEtaMax[1]) {
871 #ifdef EDM_ML_DEBUG
872  std::cout << "HE " << i << " " << imx << " " << laymax << std::endl;
873 #endif
874  if (maxDepth[1] < laymax) maxDepth[1] = laymax;
875  }
876  }
877 #ifdef EDM_ML_DEBUG
878  for (int i=0; i<4; ++i)
879  std::cout << "Detector Type[" << i << "] iEta " << iEtaMin[i] << ":"
880  << iEtaMax[i] << " MaxDepth " << maxDepth[i] << std::endl;
881 #endif
882 
883  //Now the geometry constants
884  nModule[0] = hpar->modHB[0];
885  nHalves[0] = hpar->modHB[1];
886  for (unsigned int i=0; i<hpar->rHB.size(); ++i) {
887  gconsHB.emplace_back(std::pair<double,double>(hpar->rHB[i]/CLHEP::cm,
888  hpar->drHB[i]/CLHEP::cm));
889  }
890 #ifdef EDM_ML_DEBUG
891  std::cout << "HB with " << nModule[0] << " modules and " << nHalves[0]
892  <<" halves and " << gconsHB.size() << " layers" << std::endl;
893  for (unsigned int i=0; i<gconsHB.size(); ++i)
894  std::cout << "rHB[" << i << "] = " << gconsHB[i].first << " +- "
895  << gconsHB[i].second << std::endl;
896 #endif
897  nModule[1] = hpar->modHE[0];
898  nHalves[1] = hpar->modHE[1];
899  for (unsigned int i=0; i<hpar->zHE.size(); ++i) {
900  gconsHE.emplace_back(std::pair<double,double>(hpar->zHE[i]/CLHEP::cm,
901  hpar->dzHE[i]/CLHEP::cm));
902  }
903 #ifdef EDM_ML_DEBUG
904  std::cout << "HE with " << nModule[1] << " modules and " << nHalves[1]
905  <<" halves and " << gconsHE.size() << " layers" << std::endl;
906  for (unsigned int i=0; i<gconsHE.size(); ++i)
907  std::cout << "zHE[" << i << "] = " << gconsHE[i].first << " +- "
908  << gconsHE[i].second << std::endl;
909 #endif
910 
911  //Special RBX
913  if (depthMaxSp_.first == 0) {
914  depthMaxSp_ = depthMaxDf_ = std::pair<int,int>(2,maxDepth[1]);
915  } else if (depthMaxSp_.first == 1) {
916  depthMaxDf_ = std::pair<int,int>(1,maxDepth[0]);
917  if (depthMaxSp_.second > maxDepth[0]) maxDepth[0] = depthMaxSp_.second;
918  } else {
919  depthMaxDf_ = std::pair<int,int>(2,maxDepth[1]);
920  if (depthMaxSp_.second > maxDepth[1]) maxDepth[1] = depthMaxSp_.second;
921  }
922 #ifdef EDM_ML_DEBUG
923  std::cout << "Detector type and maximum depth for all RBX "
924  << depthMaxDf_.first << ":" << depthMaxDf_.second
925  << " and for special RBX " << depthMaxSp_.first << ":"
926  << depthMaxSp_.second << std::endl;
927 #endif
928 
929  //Map of special DetId's
930  std::vector<int> phis;
932  detIdSp_.clear(); detIdSpR_.clear();
933  if ((subdet == HcalBarrel) || (subdet == HcalEndcap)) {
934  int phi = (phis[0] > 0) ? phis[0] : -phis[0];
935  int zside = (phis[0] > 0) ? 1 : -1;
936  int lymax = (subdet == HcalBarrel) ? maxLayerHB_+1 : maxLayer_+1;
937  std::pair<int,int>etas = hcons.ldMap()->validEta();
938  for (int eta=etas.first; eta<=etas.second; ++eta) {
939  std::map<int,std::pair<int,int> > oldDep;
940  int depth(0);
941  int lmin = layerGroup(eta-1,0);
942  for (int lay=0; lay<lymax; ++lay) {
943  int depc = layerGroup(eta-1,lay);
944  if (depth != depc) {
945  if (depth != 0) oldDep[depth] = std::pair<int,int>(lmin,lay-1);
946  depth = depc;
947  lmin = lay;
948  }
949  }
950  if (depth != 0) oldDep[depth] = std::pair<int,int>(lmin,lymax-1);
951 #ifdef EDM_ML_DEBUG
952  std::cout << "Eta|Phi|Zside " << eta << ":" << phi << ":" << zside
953  << " with " << oldDep.size() << " old Depths" << std::endl;
954  unsigned int kk(0);
955  for (std::map<int,std::pair<int,int> >::const_iterator itr=oldDep.begin(); itr != oldDep.end(); ++itr,++kk)
956  std::cout << "[" << kk << "] " << itr->first << " --> "
957  << itr->second.first << ":" << itr->second.second << "\n";
958 #endif
959  std::pair<int,int> depths = hcons.ldMap()->getDepths(eta);
960  for (int ndepth=depths.first; ndepth<=depths.second; ++ndepth) {
961  bool flag = ((subdet == HcalBarrel && eta == iEtaMax[0] &&
962  ndepth > hcons.getDepthEta16(subdet,phi,zside)) ||
963  (subdet == HcalEndcap && eta == iEtaMin[1] &&
964  ndepth < hcons.getDepthEta16(subdet,phi,zside)));
965  if (!flag) {
966  std::vector<int> count(oldDep.size(),0);
967  int layFront = hcons.ldMap()->getLayerFront(subdet,eta,phi,zside,ndepth);
968  int layBack = hcons.ldMap()->getLayerBack(subdet,eta,phi,zside,ndepth);
969  for (int lay=layFront; lay<=layBack; ++lay) {
970  unsigned int l(0);
971  for (std::map<int,std::pair<int,int> >::iterator itr=oldDep.begin();
972  itr != oldDep.end(); ++itr,++l) {
973  if (lay >= (itr->second).first && lay <= (itr->second).second) {
974  ++count[l]; break;
975  }
976  }
977  }
978  int odepth(0), maxlay(0);
979  unsigned int l(0);
980  for (std::map<int,std::pair<int,int> >::iterator itr=oldDep.begin();
981  itr != oldDep.end(); ++itr,++l) {
982  if (count[l] > maxlay) {
983  odepth = itr->first;
984  maxlay = count[l];
985  }
986  }
987 #ifdef EDM_ML_DEBUG
988  std::cout << "New Depth " << ndepth << " old Depth " << odepth
989  << " max " << maxlay << std::endl;
990 #endif
991  for (int k : phis) {
992  zside = (k > 0) ? 1 : -1;
993  phi = (k > 0) ? k : -k;
994  if (subdet == HcalEndcap && eta == hpar->noff[1] &&
995  ndepth > hcons.getDepthEta29M(0,true)) break;
996  HcalDetId newId(subdet,zside*eta,phi,ndepth);
997  HcalDetId oldId(subdet,zside*eta,phi,odepth);
998  detIdSp_[newId] = oldId;
999  std::vector<HcalDetId> ids;
1000  std::map<HcalDetId,std::vector<HcalDetId>>::iterator itr = detIdSpR_.find(oldId);
1001  if (itr != detIdSpR_.end()) ids = itr->second;
1002  ids.emplace_back(newId);
1003  detIdSpR_[oldId] = ids;
1004  }
1005  }
1006  }
1007  }
1008 #ifdef EDM_ML_DEBUG
1009  std::cout << "Map for merging new channels to old channel IDs with "
1010  << detIdSp_.size() << " entries" << std::endl;
1011  int l(0);
1012  for (auto itr : detIdSp_) {
1013  std::cout << "[" << l << "] Special " << itr.first << " Standard "
1014  << itr.second << std::endl;
1015  ++l;
1016  }
1017  std::cout << "Reverse Map for mapping old to new IDs with "
1018  << detIdSpR_.size() << " entries" << std::endl;
1019  l = 0;
1020  for (auto itr : detIdSpR_) {
1021  std::cout << "[" << l << "] Standard " << itr.first << " Special";
1022  for (auto itr1 : itr.second)
1023  std::cout << " " << (itr1);
1024  std::cout << std::endl;
1025  ++l;
1026  }
1027 #endif
1028  }
1029 
1030 }
1031 
1032 unsigned int HcalDDDRecConstants::layerGroupSize(int eta) const {
1033  unsigned int k = 0;
1034  for (auto const & it : hpar->layerGroupEtaRec) {
1035  if (it.layer == (unsigned int)(eta + 1)) {
1036  return it.layerGroup.size();
1037  }
1038  if (it.layer > (unsigned int)(eta + 1)) break;
1039  k = it.layerGroup.size();
1040  }
1041  return k;
1042 }
1043 
1044 unsigned int HcalDDDRecConstants::layerGroup(int eta, int i) const {
1045  unsigned int k = 0;
1046  for (auto const & it : hpar->layerGroupEtaRec) {
1047  if (it.layer == (unsigned int)(eta + 1)) {
1048  return it.layerGroup.at(i);
1049  }
1050  if (it.layer > (unsigned int)(eta + 1)) break;
1051  k = it.layerGroup.at(i);
1052  }
1053  return k;
1054 }
type
Definition: HCALResponse.h:21
std::vector< int > getDepth(const int &det, const int &phi, const int &zside, const unsigned int &eta) const
std::vector< double > etaTable
std::vector< int > iEtaMin
std::vector< int > etagroup
std::pair< int, int > depthMaxSp_
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
std::map< HcalDetId, std::vector< HcalDetId > > detIdSpR_
std::pair< double, double > getEtaPhi(const int &subdet, const int &ieta, const int &iphi) const
int findDepth(const int &det, const int &eta, const int &phi, const int &zside, const int &lay) const
void getLayerDepth(const int subdet, const int ieta, const int iphi, const int zside, std::map< int, int > &layers) const
std::vector< double > rHB
std::vector< std::pair< int, int > > etaSimValu
HcalDetId mergedDepthDetId(const HcalDetId &id) const
int getFrontLayer(const int &det, const int &eta) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int getMinDepth(const int &det, const int &eta, const int &phi, const int &zside, const bool &partialOnly) const
Geom::Theta< T > theta() const
unsigned int layerGroup(int eta, int i) const
void getOneEtaBin(HcalSubdetector subdet, int ieta, int zside, std::vector< std::pair< int, double >> &phis, std::map< int, int > &layers, bool planOne, std::vector< HcalDDDRecConstants::HcalEtaBin > &bins) const
int phiNumber(const int &phi, const int &unit) const
static const int maxLayer_
int getSubdet() const
std::vector< int > maxDepth
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< double > etaTableHF
int getLayerBack(const int subdet, const int ieta, const int iphi, const int zside, const int depth) const
std::vector< int > etaMax
std::vector< int > phiUnitS
std::vector< int > modHB
int getLayerFront(const int subdet, const int ieta, const int iphi, const int zside, const int depth) const
U second(std::pair< T, U > const &p)
const HcalParameters * hpar
std::pair< int, int > getDepths(const int eta) const
int validDet(std::vector< int > &phis) const
std::vector< std::pair< double, double > > gconsHE
std::vector< double > zHE
std::vector< HcalEtaBin > getEtaBins(const int &itype) const
std::vector< double > phibin
int getMaxDepth(const int &type) const
const std::vector< double > & getRTableHF() const
void specialRBXHBHE(const std::vector< HcalDetId > &, std::vector< HcalDetId > &) const
int getDepthEta29(const int &phi, const int &zside, const int &i) const
unsigned int numberOfCells(HcalSubdetector) const
HcalDetId idFront(const HcalDetId &id) const
int unitPhi(const int &det, const int &etaR) const
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
std::vector< double > dzHE
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
double getRZ(const int &subdet, const int &ieta, const int &depth) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const std::vector< double > & getPhiTableHF() const
std::vector< HFCellParameters > getHFCellParameters() const
const std::vector< int > & getPhis() const
std::vector< int > iEtaMax
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< HcalCellType > HcalCellTypes() const
std::map< HcalDetId, HcalDetId > detIdSp_
std::vector< int > ietaMap
std::vector< int > nPhiBins
std::vector< int > modHE
std::vector< std::pair< int, int > > layer
std::pair< int, int > validEta() const
T min(T a, T b)
Definition: MathUtil.h:58
void getLayerDepth(const int &ieta, std::map< int, int > &layers) const
int getLastLayer(const int &det, const int &eta) const
std::vector< HcalCellType > HcalCellTypes(HcalSubdetector) const
unsigned int numberOfCells(const HcalSubdetector &) const
int getLayerFront(const int &det, const int &eta, const int &phi, const int &depth) const
std::vector< std::pair< int, double > > getPhis(const int &subdet, const int &ieta) const
HcalDetId idBack(const HcalDetId &id) const
int getDepthEta16M(const int &det) const
#define M_PI
int getDepthEta29M(const int &i, const bool &planOne) const
int k[5][pyjets_maxn]
bin
set the eta bin as selection string.
std::vector< double > phioff
unsigned int layerGroupSize(int eta) const
std::vector< double > etaTable
HcalDDDRecConstants(const HcalParameters *hp, const HcalDDDSimConstants &hc)
int getMaxDepth(const int &type) const
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
std::vector< double > phitable
TString units(TString variable, Char_t axis)
std::vector< double > phibin
std::vector< LayerItem > layerGroupEtaRec
std::vector< double > drHB
const HcalDDDSimConstants & hcons
susybsm::HSCParticleCollection hc
Definition: classes.h:25
std::pair< int, int > depthMaxDf_
std::vector< int > noff
std::vector< HcalActiveLength > getThickActive(const int &type) const
std::pair< int, int > getMaxDepthDet(const int &i) const
const std::vector< HcalDetId > & getIdHF2QIE() const
std::vector< std::pair< double, double > > gconsHB
std::vector< int > maxDepth
std::vector< int > phigroup
static const int maxLayerHB_
std::pair< double, double > getPhiCons(const int &det, const int &ieta) const
std::vector< std::pair< int, double > > phis
std::vector< int > etaMin
unsigned int nCells() const
int getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
int getDepthEta16(const int &det, const int &phi, const int &zside) const
const HcalLayerDepthMap * ldMap() const