CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 DebugLog
10 
11 enum { kHOSizePreLS1 = 2160, kHFSizePreLS1 = 1728 } ;
12 
14  const HcalDDDSimConstants& hc) :
15  hpar(hp), hcons(hc) {
16 
17 #ifdef DebugLog
18  std::cout << "HcalDDDRecConstants::HcalDDDRecConstants (const HcalParameters* hp) constructor" << std::endl;
19 #endif
20  initialize();
21 }
22 
24 #ifdef DebugLog
25  std::cout << "HcalDDDRecConstants::destructed!!!" << std::endl;
26 #endif
27 }
28 
29 std::vector<HcalDDDRecConstants::HcalEtaBin>
30 HcalDDDRecConstants::getEtaBins(const int itype) const {
31 
32  std::vector<HcalDDDRecConstants::HcalEtaBin> bins;
33  unsigned int type = (itype == 0) ? 0 : 1;
34  unsigned int lymax = (type == 0) ? 17 : 19;
35  for (int ieta = iEtaMin[type]; ieta <= iEtaMax[type]; ++ieta) {
36  int nfi = (int)((20.001*nModule[itype]*CLHEP::deg)/phibin[ieta-1]);
37  HcalDDDRecConstants::HcalEtaBin etabin = HcalDDDRecConstants::HcalEtaBin(ieta, etaTable[ieta-1], etaTable[ieta], nfi, hpar->phioff[type], phibin[ieta-1]);
38  int n = (ieta == iEtaMax[type]) ? 0 : 1;
39  HcalDDDRecConstants::HcalEtaBin etabin0= HcalDDDRecConstants::HcalEtaBin(ieta, etaTable[ieta-1], etaTable[ieta+n], nfi, hpar->phioff[type], phibin[ieta-1]);
40  etabin0.depthStart = hcons.getDepthEta29(0)+1;
41  int dstart = -1;
42  if (layerGroupSize(ieta-1) > 0) {
43  int lmin(0), lmax(0);
44  int dep = layerGroup(ieta-1, 0);
45  if (type == 1 && ieta == iEtaMin[1]) dep = hcons.getDepthEta16(1);
46  unsigned lymx0 = (layerGroupSize(ieta-1) > lymax) ? lymax : layerGroupSize(ieta-1);
47  for (unsigned int l=0; l<lymx0; ++l) {
48  if ((int)layerGroup( ieta-1, l) == dep) {
49  if (lmin == 0) lmin = l + 1;
50  lmax = l + 1;
51  } else if ((int)layerGroup( ieta-1, l ) > dep) {
52  if (dstart < 0) dstart = dep;
53  if (type == 1 && ieta+1 == hpar->noff[1] && dep > hcons.getDepthEta29(0)) {
54  etabin0.layer.push_back(std::pair<int,int>(lmin,lmax));
55  } else {
56  etabin.layer.push_back(std::pair<int,int>(lmin,lmax));
57  }
58  lmin = (l + 1);
59  lmax = l;
60  dep = layerGroup(ieta-1, l);
61  }
62  if (type == 0 && ieta == iEtaMax[type] && dep > hcons.getDepthEta16(0)) break;
63  if (type == 1 && ieta == hpar->noff[1] && dep > hcons.getDepthEta29(0)){
64  lmax = lymx0;
65  break;
66  }
67  }
68  if (lmax >= lmin) {
69  if (ieta+1 == hpar->noff[1]) {
70  etabin0.layer.push_back(std::pair<int,int>(lmin,lmax));
71  bins.push_back(etabin0);
72  } else if (ieta == hpar->noff[1]) {
73  } else {
74  etabin.layer.push_back(std::pair<int,int>(lmin,lmax));
75  if (dstart < 0) dstart = dep;
76  }
77  }
78  }
79  etabin.depthStart = dstart;
80  bins.push_back(etabin);
81  }
82 #ifdef DebugLog
83  std::cout << "Prepares " << bins.size() << " eta bins for type " << type
84  << std::endl;
85  for (unsigned int i=0; i<bins.size(); ++i) {
86  std::cout << "Bin[" << i << "]: Eta = (" << bins[i].ieta << ":"
87  << bins[i].etaMin << ":" << bins[i].etaMax << ") Phi = ("
88  << bins[i].nPhi << ":" << bins[i].phi0 << ":" << bins[i].dphi
89  << ") and " << bins[i].layer.size() << " depths (start) "
90  << bins[i].depthStart << " :";
91  for (unsigned int k=0; k<bins[i].layer.size(); ++k)
92  std::cout << " [" << k << "] " << bins[i].layer[k].first << ":"
93  << bins[i].layer[k].second;
94  std::cout << std::endl;
95  }
96 #endif
97  return bins;
98 }
99 
100 std::pair<double,double>
101 HcalDDDRecConstants::getEtaPhi(int subdet, int ieta, int iphi) const {
102  int ietaAbs = (ieta > 0) ? ieta : -ieta;
103  const double fiveDegInRad = 2*M_PI/72;
104  double eta(0), phi(0);
105  if ((subdet == static_cast<int>(HcalBarrel)) ||
106  (subdet == static_cast<int>(HcalEndcap)) ||
107  (subdet == static_cast<int>(HcalOuter))) { // Use Eta Table
108  int unit = (int)(phibin[ietaAbs-1]/fiveDegInRad+0.5);
109  int kphi = (unit == 2) ? ((iphi-1)/2 + 1) : iphi;
110  double foff = (ietaAbs <= iEtaMax[0]) ? hpar->phioff[0] : hpar->phioff[1];
111  eta = 0.5*(etaTable[ietaAbs-1]+etaTable[ietaAbs]);
112  phi = foff + (kphi-0.5)*phibin[ietaAbs-1];
113  } else {
114  ietaAbs -= iEtaMin[2];
115  int unit = (int)(hpar->phitable[ietaAbs-1]/fiveDegInRad+0.5);
116  int kphi = (unit == 4) ? ((iphi-3)/4 + 1) : ((iphi-1)/2 + 1);
117  double foff = (unit > 2) ? hpar->phioff[4] : hpar->phioff[2];
118  eta = 0.5*(hpar->etaTableHF[ietaAbs-1]+hpar->etaTableHF[ietaAbs]);
119  phi = foff + (kphi-0.5)*hpar->phitable[ietaAbs-1];
120  }
121  if (ieta < 0) eta = -eta;
122  if (phi > M_PI) phi -= (2*M_PI);
123 #ifdef DebugLog
124  std::cout << "getEtaPhi: subdet|ieta|iphi " << subdet << "|" << ieta << "|"
125  << iphi << " eta|phi " << eta << "|" << phi << std::endl;
126 #endif
127  return std::pair<double,double>(eta,phi);
128 }
129 
131 HcalDDDRecConstants::getHCID(int subdet, int ieta, int iphi, int lay,
132  int idepth) const {
133 
134  int eta(ieta), phi(iphi), depth(idepth);
135  if ((subdet == static_cast<int>(HcalOuter)) ||
136  ((subdet == static_cast<int>(HcalBarrel)) && (lay > 17))) {
137  subdet= static_cast<int>(HcalOuter);
138  depth = 4;
139  } else if (subdet == static_cast<int>(HcalBarrel) ||
140  subdet == static_cast<int>(HcalEndcap)) {
141  eta = ietaMap[ieta-1];
142  int unit = phiUnitS[ieta-1];
143  int phi0 = (iphi-1)/(hpar->phigroup[eta-1]);
144  if (unit == 2) {
145  phi0 = (iphi+1)/2;
146  phi0 = (phi0-1)/(hpar->phigroup[eta-1]);
147  } else if (unit == 4) {
148  phi0 = (iphi+5)/4;
149  phi0 = (phi0-1)/(hpar->phigroup[eta-1]);
150  }
151  ++phi0;
152  unit = hcons.unitPhi(phibin[eta-1]);
153  phi = hcons.phiNumber(phi0,unit);
154  depth = layerGroup( eta-1, lay-1 );
155  if (eta == iEtaMin[1]) {
156  if (subdet == static_cast<int>(HcalBarrel)) {
157  if (depth > hcons.getDepthEta16(0)) depth = hcons.getDepthEta16(0);
158  } else {
159  if (depth < hcons.getDepthEta16(1)) depth = hcons.getDepthEta16(1);
160  }
161  } else if (eta == hpar->noff[0] && lay > 1) {
162  int kphi = phi + int((hpar->phioff[3]+0.1)/phibin[eta-1]);
163  kphi = (kphi-1)%4 + 1;
164  if (kphi == 2 || kphi == 3) depth = layerGroup( eta-1, lay-2 );
165  } else if (eta == hpar->noff[1] && depth > 2) {
166  eta = hpar->noff[1]-1;
167  }
168  }
169 #ifdef DebugLog
170  std::cout << "getHCID: input " << subdet << ":" << ieta << ":" << iphi
171  << ":" << idepth << ":" << lay << " output " << eta << ":" << phi
172  << ":" << depth << std::endl;
173 #endif
174  return HcalDDDRecConstants::HcalID(subdet,eta,phi,depth);
175 }
176 
177 std::vector<HcalDDDRecConstants::HFCellParameters>
179 
180  std::vector<HcalDDDRecConstants::HFCellParameters> cells;
181  unsigned int nEta = hcons.getPhiTableHF().size();
182  if (maxDepth[2] > 0) {
183  for (unsigned int k=0; k<nEta; ++k) {
184  int ieta = iEtaMin[2] + k;
185  int dphi = (int)(0.001 + hcons.getPhiTableHF()[k]/(5.0*CLHEP::deg));
186  int iphi = (dphi == 4) ? 3 : 1;
187  int nphi = 72/dphi;
188  double rMin = hcons.getRTableHF()[nEta-k-1]/CLHEP::cm;
189  double rMax = hcons.getRTableHF()[nEta-k]/CLHEP::cm;
190  HcalDDDRecConstants::HFCellParameters cell1( ieta,1,iphi,dphi,nphi,rMin,rMax);
191  cells.push_back(cell1);
192  HcalDDDRecConstants::HFCellParameters cell2(-ieta,1,iphi,dphi,nphi,rMin,rMax);
193  cells.push_back(cell2);
194  }
195  }
196  if (maxDepth[2] > 2) {
197  if (hcons.getIdHF2QIE().size() > 0) {
198  for (unsigned int k=0; k<hcons.getIdHF2QIE().size(); ++k) {
199  int ieta = hcons.getIdHF2QIE()[k].ieta();
200  int ind = std::abs(ieta) - iEtaMin[2];
201  int dphi = (int)(0.001 + hcons.getPhiTableHF()[ind]/(5.0*CLHEP::deg));
202  int iphi = hcons.getIdHF2QIE()[k].iphi();
203  double rMin = hcons.getRTableHF()[nEta-ind-1]/CLHEP::cm;
204  double rMax = hcons.getRTableHF()[nEta-ind]/CLHEP::cm;
205  HcalDDDRecConstants::HFCellParameters cell1( ieta,3,iphi,dphi,1,rMin,rMax);
206  cells.push_back(cell1);
207  }
208  } else {
209  for (unsigned int k=0; k<nEta; ++k) {
210  int ieta = iEtaMin[2] + k;
211  int dphi = (int)(0.001 + hcons.getPhiTableHF()[k]/(5.0*CLHEP::deg));
212  int iphi = (dphi == 4) ? 3 : 1;
213  int nphi = 72/dphi;
214  double rMin = hcons.getRTableHF()[nEta-k-1]/CLHEP::cm;
215  double rMax = hcons.getRTableHF()[nEta-k]/CLHEP::cm;
216  HcalDDDRecConstants::HFCellParameters cell1( ieta,3,iphi,dphi,nphi,rMin,rMax);
217  cells.push_back(cell1);
218  HcalDDDRecConstants::HFCellParameters cell2(-ieta,3,iphi,dphi,nphi,rMin,rMax);
219  cells.push_back(cell2);
220  }
221  }
222  }
223 #ifdef DebugLog
224  std::cout << "HcalDDDRecConstants returns " << cells.size()
225  << " HF cell parameters" << std::endl;
226  for (unsigned int k=0; k<cells.size(); ++k)
227  std::cout << "Cell[" << k <<"] : (" << cells[k].ieta <<", "<< cells[k].depth
228  << ", " << cells[k].firstPhi << ", " << cells[k].stepPhi << ", "
229  << cells[k].nPhi << ", " << cells[k].rMin << ", "
230  << cells[k].rMax << ")" << std::endl;
231 #endif
232  return cells;
233 }
234 
235 int HcalDDDRecConstants::getMaxDepth (const int itype, const int ieta) const {
236 
237  int lmax(0);
238  unsigned int type = (itype == 0) ? 0 : 1;
239  unsigned int lymax = (type == 0) ? 17 : 19;
240  if (layerGroupSize(ieta-1) > 0) {
241  if (layerGroupSize(ieta-1) < lymax) lymax = layerGroupSize(ieta-1);
242  lmax = (int)(layerGroup(ieta-1, lymax-1));
243  if (type == 0 && ieta == iEtaMax[type]) lmax = hcons.getDepthEta16(0);
244  if (type == 1 && ieta >= hpar->noff[1]) lmax = hcons.getDepthEta29(0);
245  }
246  return lmax;
247 }
248 
249 double HcalDDDRecConstants::getRZ(int subdet, int ieta, int depth) const {
250 
251  int ietaAbs = (ieta > 0) ? ieta : -ieta;
252  double rz(0);
253 #ifdef DebugLog
254  int lay(0);
255 #endif
256  if (ietaAbs < hpar->etaMax[1]) {
257  for (unsigned int k=0; k< layerGroupSize( ietaAbs-1 ); ++k) {
258  if (depth == (int)layerGroup( ietaAbs-1, k )) {
259  rz = ((subdet == static_cast<int>(HcalBarrel)) ? (gconsHB[k].first) :
260  (gconsHE[k].first));
261  if (rz > 10.) {
262 #ifdef DebugLog
263  lay = k;
264 #endif
265  break;
266  }
267  }
268  }
269  }
270 #ifdef DebugLog
271  std::cout << "getRZ: subdet|ieta|depth " << subdet << "|" << ieta << "|"
272  << depth << " lay|rz " << lay << "|" << rz << std::endl;
273 #endif
274  return rz;
275 }
276 
277 std::vector<HcalDDDRecConstants::HcalActiveLength>
279 
280  std::vector<HcalDDDRecConstants::HcalActiveLength> actives;
281  std::vector<HcalDDDRecConstants::HcalEtaBin> bins = getEtaBins(type);
282 #ifdef DebugLog
283  unsigned int kount(0);
284 #endif
285  for (unsigned int k=0; k<bins.size(); ++k) {
286  int ieta = bins[k].ieta;
287  double eta = 0.5*(bins[k].etaMin+bins[k].etaMax);
288  double theta = 2*atan(exp(-eta));
289  double scale = 1.0/((type == 0) ? sin(theta) : cos(theta));
290  int depth = bins[k].depthStart;
291  for (unsigned int i = 0; i < bins[k].layer.size(); ++i) {
292  double thick(0);
293  for (int j = bins[k].layer[i].first; j <= bins[k].layer[i].second; ++j) {
294  if (type == 0 || j > 1)
295  thick += ((type == 0) ? gconsHB[j-1].second : gconsHE[j-1].second);
296  }
297  thick *= (2.*scale);
298  HcalDDDRecConstants::HcalActiveLength active(ieta,depth,eta,thick);
299  actives.push_back(active);
300  ++depth;
301 #ifdef DebugLog
302  kount++;
303  std::cout << "getThickActive: [" << kount << "] eta:" << active.ieta
304  << ":" << active.eta << " depth " << active.depth << " thick "
305  << active.thick << std::endl;
306 #endif
307  }
308  }
309  return actives;
310 }
311 
312 std::vector<HcalCellType>
314 
315  if (subdet == HcalBarrel || subdet == HcalEndcap) {
316  std::vector<HcalCellType> cells;
317  int isub = (subdet == HcalBarrel) ? 0 : 1;
318  std::vector<HcalDDDRecConstants::HcalEtaBin> etabins = getEtaBins(isub);
319  for (unsigned int bin=0; bin<etabins.size(); ++bin) {
320  std::vector<HcalCellType> temp;
321  std::vector<int> count;
322  std::vector<double> dmin, dmax;
323  for (unsigned int il=0; il<etabins[bin].layer.size(); ++il) {
324  HcalCellType cell(subdet, 0, 0, 0, HcalCellType::HcalCell());
325  temp.push_back(cell);
326  count.push_back(0);
327  dmin.push_back(0);
328  dmax.push_back(0);
329  }
330  int ieta = etabins[bin].ieta;
331  for (int keta=etaSimValu[ieta-1].first; keta<=etaSimValu[ieta-1].second;
332  ++keta) {
333  std::vector<HcalCellType> cells = hcons.HcalCellTypes(subdet,keta,-1);
334  for (unsigned int ic=0; ic<cells.size(); ++ic) {
335  for (unsigned int il=0; il<etabins[bin].layer.size(); ++il) {
336  if (cells[ic].depthSegment() >= etabins[bin].layer[il].first &&
337  cells[ic].depthSegment() <= etabins[bin].layer[il].second) {
338  if (count[il] == 0) {
339  temp[il] = cells[ic];
340  dmin[il] = cells[ic].depthMin();
341  dmax[il] = cells[ic].depthMax();
342  }
343  ++count[il];
344  if (cells[ic].depthMin() < dmin[il]) dmin[il] = cells[ic].depthMin();
345  if (cells[ic].depthMax() > dmax[il]) dmax[il] = cells[ic].depthMax();
346  break;
347  }
348  }
349  }
350  }
351  int unit = hcons.unitPhi(etabins[bin].dphi);
352  for (unsigned int il=0; il<etabins[bin].layer.size(); ++il) {
353  int depth = etabins[bin].depthStart + (int)(il);
354  temp[il].setEta(ieta,etabins[bin].etaMin,etabins[bin].etaMax);
355  temp[il].setPhi(etabins[bin].nPhi,unit,etabins[bin].dphi/CLHEP::deg,
356  hpar->phioff[isub]/CLHEP::deg);
357  temp[il].setDepth(depth,dmin[il],dmax[il]);
358  cells.push_back(temp[il]);
359  }
360  }
361 #ifdef DebugLog
362  std::cout << "HcalDDDRecConstants: found " << cells.size() << " cells for sub-detector type " << isub << std::endl;
363  for (unsigned int ic=0; ic<cells.size(); ++ic)
364  std::cout << "Cell[" << ic << "] " << cells[ic] << std::endl;
365 #endif
366  return cells;
367  } else {
368  return hcons.HcalCellTypes(subdet,-1,-1);
369  }
370 }
371 
373 
374  if (subdet == HcalBarrel || subdet == HcalEndcap) {
375  unsigned int num = 0;
376  std::vector<HcalCellType> cellTypes = HcalCellTypes(subdet);
377  for (unsigned int i=0; i<cellTypes.size(); i++) {
378  num += (unsigned int)(cellTypes[i].nPhiBins());
379  if (cellTypes[i].nHalves() > 1)
380  num += (unsigned int)(cellTypes[i].nPhiBins());
381  num -= (unsigned int)(cellTypes[i].nPhiMissingBins());
382  }
383 #ifdef DebugLog
384  edm::LogInfo ("HCalGeom") << "HcalDDDRecConstants:numberOfCells "
385  << cellTypes.size() << " " << num
386  << " for subdetector " << subdet;
387 #endif
388  return num;
389  } else {
390  return hcons.numberOfCells(subdet);
391  }
392 }
393 
394 unsigned int HcalDDDRecConstants::nCells(HcalSubdetector subdet) const {
395 
396  if (subdet == HcalBarrel || subdet == HcalEndcap) {
397  int isub = (subdet == HcalBarrel) ? 0 : 1;
398  std::vector<HcalDDDRecConstants::HcalEtaBin> etabins = getEtaBins(isub);
399  unsigned int ncell(0);
400  for (unsigned int i=0; i<etabins.size(); ++i) {
401  ncell += (((unsigned int)(etabins[i].nPhi))*(etabins[i].layer.size()));
402  }
403  return ncell;
404  } else if (subdet == HcalOuter) {
405  return kHOSizePreLS1;
406  } else if (subdet == HcalForward) {
407  return (unsigned int)(hcons.numberOfCells(subdet));
408  } else {
409  return 0;
410  }
411 }
412 
413 unsigned int HcalDDDRecConstants::nCells() const {
415 }
416 
418 
419  //Eta grouping
420  int nEta = (int)(hpar->etagroup.size());
421  if (nEta != (int)(hpar->phigroup.size())) {
422  edm::LogError("HCalGeom") << "HcalDDDRecConstants: sizes of the vectors "
423  << " etaGroup (" << nEta << ") and phiGroup ("
424  << hpar->phigroup.size() << ") do not match";
425  throw cms::Exception("DDException") << "HcalDDDRecConstants: inconsistent array sizes" << nEta << ":" << hpar->phigroup.size();
426  }
427 
428  // First eta table
429  iEtaMin = hpar->etaMin;
430  iEtaMax = hpar->etaMax;
431  etaTable.clear(); ietaMap.clear(); etaSimValu.clear();
432  int ieta(0), ietaHB(0), ietaHE(0);
433  etaTable.push_back(hpar->etaTable[ieta]);
434  for (int i=0; i<nEta; ++i) {
435  int ef = ieta+1;
436  ieta += (hpar->etagroup[i]);
437  if (ieta >= (int)(hpar->etaTable.size())) {
438  edm::LogError("HCalGeom") << "Going beyond the array boundary "
439  << hpar->etaTable.size() << " at index " << i
440  << " of etaTable from SimConstant";
441  throw cms::Exception("DDException") << "Going beyond the array boundary "
442  << hpar->etaTable.size()
443  << " at index " << i
444  << " of etaTable from SimConstant";
445  } else {
446  etaTable.push_back(hpar->etaTable[ieta]);
447  etaSimValu.push_back(std::pair<int,int>(ef,ieta));
448  }
449  for (int k=0; k<(hpar->etagroup[i]); ++k) ietaMap.push_back(i+1);
450  if (ieta <= hpar->etaMax[0]) ietaHB = i+1;
451  if (ieta <= hpar->etaMin[1]) ietaHE = i+1;
452  }
453  iEtaMin[1] = ietaHE;
454  iEtaMax[0] = ietaHB;
455 
456  // Then Phi bins
457  ieta = 0;
458  phibin.clear(); phiUnitS.clear();
459  for (int i=0; i<nEta; ++i) {
460  double dphi = (hpar->phigroup[i])*(hpar->phibin[ieta]);
461  phibin.push_back(dphi);
462  ieta += (hpar->etagroup[i]);
463  }
464  for (unsigned int i=1; i<hpar->etaTable.size(); ++i) {
465  int unit = hcons.unitPhi(hpar->phibin[i-1]);
466  phiUnitS.push_back(unit);
467  }
468 
469 #ifdef DebugLog
470  std::cout << "Modified eta/deltaphi table for " << nEta << " bins" << std::endl;
471  for (int i=0; i<nEta; ++i)
472  std::cout << "Eta[" << i << "] = " << etaTable[i] << ":" << etaTable[i+1]
473  << ":" << etaSimValu[i].first << ":" << etaSimValu[i].second
474  << " PhiBin[" << i << "] = " << phibin[i]/CLHEP::deg <<std::endl;
475  std::cout << "PhiUnitS";
476  for (unsigned int i=0; i<phiUnitS.size(); ++i)
477  std::cout << " [" << i << "] = " << phiUnitS[i];
478  std::cout << std::endl;
479  std::cout << "EtaTableHF";
480  for (unsigned int i=0; i<hpar->etaTableHF.size(); ++i)
481  std::cout << " [" << i << "] = " << hpar->etaTableHF[i];
482  std::cout << std::endl;
483  std::cout << "PhiBinHF";
484  for (unsigned int i=0; i<hpar->phitable.size(); ++i)
485  std::cout << " [" << i << "] = " << hpar->phitable[i];
486  std::cout << std::endl;
487 #endif
488 
489  //Now the depths
491  maxDepth[0] = maxDepth[1] = 0;
492  for (int i=0; i<nEta; ++i) {
493  unsigned int imx = layerGroupSize(i);
494  int laymax = (imx > 0) ? layerGroup(i,imx-1) : 0;
495  if (i < iEtaMax[0]) {
496  int laymax0 = (imx > 16) ? layerGroup(i,16) : laymax;
497  if (i+1 == iEtaMax[0]) laymax0 = hcons.getDepthEta16(0);
498 #ifdef DebugLog
499  std::cout << "HB " << i << " " << imx << " " << laymax << " " << laymax0 << std::endl;
500 #endif
501  if (maxDepth[0] < laymax0) maxDepth[0] = laymax0;
502  }
503  if (i >= iEtaMin[1]-1 && i < iEtaMax[1]) {
504 #ifdef DebugLog
505  std::cout << "HE " << i << " " << imx << " " << laymax << std::endl;
506 #endif
507  if (maxDepth[1] < laymax) maxDepth[1] = laymax;
508  }
509  }
510 #ifdef DebugLog
511  for (int i=0; i<4; ++i)
512  std::cout << "Detector Type[" << i << "] iEta " << iEtaMin[i] << ":"
513  << iEtaMax[i] << " MaxDepth " << maxDepth[i] << std::endl;
514 #endif
515 
516  //Now the geometry constants
517  nModule[0] = hpar->modHB[0];
518  nHalves[0] = hpar->modHB[1];
519  for (unsigned int i=0; i<hpar->rHB.size(); ++i) {
520  gconsHB.push_back(std::pair<double,double>(hpar->rHB[i]/CLHEP::cm,
521  hpar->drHB[i]/CLHEP::cm));
522  }
523 #ifdef DebugLog
524  std::cout << "HB with " << nModule[0] << " modules and " << nHalves[0]
525  <<" halves and " << gconsHB.size() << " layers" << std::endl;
526  for (unsigned int i=0; i<gconsHB.size(); ++i)
527  std::cout << "rHB[" << i << "] = " << gconsHB[i].first << " +- "
528  << gconsHB[i].second << std::endl;
529 #endif
530  nModule[1] = hpar->modHE[0];
531  nHalves[1] = hpar->modHE[1];
532  for (unsigned int i=0; i<hpar->zHE.size(); ++i) {
533  gconsHE.push_back(std::pair<double,double>(hpar->zHE[i]/CLHEP::cm,
534  hpar->dzHE[i]/CLHEP::cm));
535  }
536 #ifdef DebugLog
537  std::cout << "HE with " << nModule[1] << " modules and " << nHalves[1]
538  <<" halves and " << gconsHE.size() << " layers" << std::endl;
539  for (unsigned int i=0; i<gconsHE.size(); ++i)
540  std::cout << "zHE[" << i << "] = " << gconsHE[i].first << " +- "
541  << gconsHE[i].second << std::endl;
542 #endif
543 }
544 
545 unsigned int HcalDDDRecConstants::layerGroupSize( unsigned int eta ) const {
546  unsigned int k = 0;
547  for( auto const & it : hpar->layerGroupEtaRec ) {
548  if( it.layer == eta + 1 ) {
549  return it.layerGroup.size();
550  }
551  if( it.layer > eta + 1 ) break;
552  k = it.layerGroup.size();
553  }
554  return k;
555 }
556 
557 unsigned int HcalDDDRecConstants::layerGroup(unsigned int eta,
558  unsigned int i) const {
559  unsigned int k = 0;
560  for( auto const & it : hpar->layerGroupEtaRec ) {
561  if( it.layer == eta + 1 ) {
562  return it.layerGroup.at( i );
563  }
564  if( it.layer > eta + 1 ) break;
565  k = it.layerGroup.at( i );
566  }
567  return k;
568 }
569 
570 const std::vector<int> & HcalDDDRecConstants::getDepth(const unsigned int i) const {
571  std::vector<HcalParameters::LayerItem>::const_iterator last = hpar->layerGroupEtaRec.begin();
572  for( std::vector<HcalParameters::LayerItem>::const_iterator it = hpar->layerGroupEtaRec.begin(); it != hpar->layerGroupEtaRec.end(); ++it ) {
573  if( it->layer == i + 1 )
574  return it->layerGroup;
575  if( it->layer > i + 1 )
576  return last->layerGroup;
577  last = it;
578  }
579  return last->layerGroup;
580 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
std::vector< double > etaTable
std::vector< int > iEtaMin
std::vector< int > etagroup
int unitPhi(int det, int etaR) const
double getRZ(int subdet, int ieta, int depth) const
std::vector< double > rHB
std::vector< std::pair< int, int > > etaSimValu
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
std::vector< int > maxDepth
std::vector< double > etaTableHF
unsigned int numberOfCells(HcalSubdetector) const
std::vector< int > etaMax
int getDepthEta16(int i) const
std::vector< int > phiUnitS
std::vector< int > modHB
U second(std::pair< T, U > const &p)
const HcalParameters * hpar
int getMaxDepth(const int type) const
std::vector< std::pair< double, double > > gconsHE
std::vector< double > zHE
std::vector< double > phibin
const std::vector< double > & getRTableHF() const
unsigned int numberOfCells(HcalSubdetector) const
unsigned int layerGroup(unsigned int eta, unsigned int i) const
string unit
Definition: csvLumiCalc.py:46
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
std::vector< double > dzHE
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const std::vector< double > & getPhiTableHF() const
std::vector< HFCellParameters > getHFCellParameters() const
std::vector< int > iEtaMax
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< HcalCellType > HcalCellTypes() const
std::vector< int > ietaMap
std::vector< int > modHE
std::vector< std::pair< int, int > > layer
unsigned int layerGroupSize(unsigned int eta) const
std::vector< HcalCellType > HcalCellTypes(HcalSubdetector) const
std::vector< HcalActiveLength > getThickActive(const int type) const
#define M_PI
std::vector< double > phioff
int getDepthEta29(int i) const
std::vector< double > etaTable
HcalDDDRecConstants(const HcalParameters *hp, const HcalDDDSimConstants &hc)
const std::vector< int > & getDepth(const unsigned int i) const
std::vector< double > phitable
std::vector< double > phibin
std::vector< LayerItem > layerGroupEtaRec
int phiNumber(int phi, int unit) const
std::vector< double > drHB
const HcalDDDSimConstants & hcons
susybsm::HSCParticleCollection hc
Definition: classes.h:25
std::vector< int > noff
tuple cout
Definition: gather_cfg.py:145
const std::vector< HcalDetId > & getIdHF2QIE() const
std::vector< std::pair< double, double > > gconsHB
std::vector< int > maxDepth
std::vector< int > phigroup
for(const auto &isodef:isoDefs)
std::pair< double, double > getEtaPhi(int subdet, int ieta, int iphi) const
std::vector< int > etaMin
unsigned int nCells() const
std::vector< HcalEtaBin > getEtaBins(const int itype) const