CMS 3D CMS Logo

HcalHardcodeGeometryLoader.cc
Go to the documentation of this file.
7 
8 #include <vector>
9 #include <algorithm>
10 
12 //#define DebugLog
13 // ==============> Loader Itself <==========================
14 
16 
17  MAX_HCAL_PHI = 72;
18  DEGREE2RAD = M_PI / 180.;
19 #ifdef DebugLog
20  std::cout << "Instantiate HcalHardCodeGeometryLoader" << std::endl;
21 #endif
22 }
23 
25 
26  int maxEta = fTopology.lastHERing();
27  m_segmentation.resize(maxEta);
28  for (int i = 0; i < maxEta; i++) {
29  fTopology.getDepthSegmentation(i+1,m_segmentation[i]);
30 #ifdef DebugLog
31  std::cout << "Eta" << i+1;
32  for (unsigned int k=0; k<m_segmentation[i].size(); ++k) {
33  std::cout << " [" << k << "] " << m_segmentation[i][k];
34  }
35  std::cout << std::endl;
36 #endif
37  }
38  HcalGeometry* hcalGeometry = new HcalGeometry (fTopology);
39  if( nullptr == hcalGeometry->cornersMgr() ) hcalGeometry->allocateCorners ( fTopology.ncells()+fTopology.getHFSize() );
40  if( nullptr == hcalGeometry->parMgr() ) hcalGeometry->allocatePar (hcalGeometry->numberOfShapes(),
42  if (fTopology.mode() == HcalTopologyMode::H2) { // TB geometry
43  fillHBHO (hcalGeometry, makeHBCells(fTopology), true);
44  fillHBHO (hcalGeometry, makeHOCells(), false);
45  fillHE (hcalGeometry, makeHECells_H2());
46  } else { // regular geometry
47  fillHBHO (hcalGeometry, makeHBCells(fTopology), true);
48  fillHBHO (hcalGeometry, makeHOCells(), false);
49  fillHF (hcalGeometry, makeHFCells());
50  fillHE (hcalGeometry, makeHECells(fTopology));
51  }
52  //fast insertion of valid ids requires sort at end
53  hcalGeometry->sortValidIds();
54  return hcalGeometry;
55 }
56 
57 
58 // ----------> HB <-----------
59 std::vector <HcalHardcodeGeometryLoader::HBHOCellParameters> HcalHardcodeGeometryLoader::makeHBCells (const HcalTopology & topology) {
60 
61  const float HBRMIN = 181.1;
62  const float HBRMAX = 288.8;
63 
64  float normalDepths[2] = {HBRMIN, HBRMAX};
65  float ring15Depths[3] = {HBRMIN, 258.4, HBRMAX};
66  float ring16Depths[3] = {HBRMIN, 190.4, 232.6};
67  float layerDepths[18] = {HBRMIN, 188.7, 194.7, 200.7, 206.7, 212.7, 218.7,
68  224.7, 230.7, 236.7, 242.7, 249.3, 255.9, 262.5,
69  269.1, 275.7, 282.3, HBRMAX};
70  float slhcDepths[4] = {HBRMIN, 214., 239., HBRMAX};
71 #ifdef DebugLog
72  std::cout <<"FlexiGeometryLoader called for "<< topology.mode() << ":" << HcalTopologyMode::SLHC << std::endl;
73 #endif
74  std::vector <HcalHardcodeGeometryLoader::HBHOCellParameters> result;
75  for(int iring = 1; iring <= 16; ++iring) {
76  std::vector<float> depths;
77  if (topology.mode() != HcalTopologyMode::SLHC) {
78  if (iring == 15) {
79  for (float ring15Depth : ring15Depths) depths.emplace_back(ring15Depth);
80  } else if (iring == 16) {
81  for (float ring16Depth : ring16Depths) depths.emplace_back(ring16Depth);
82  } else {
83  for (float normalDepth : normalDepths) depths.emplace_back(normalDepth);
84  }
85  } else {
86  if (m_segmentation.size() >= (unsigned int)(iring)) {
87  int depth = m_segmentation[iring-1][0];
88  depths.emplace_back(layerDepths[depth]);
89  int layer = 1;
90  for (unsigned int i=1; i<m_segmentation[iring-1].size(); ++i) {
91  if (depth != m_segmentation[iring-1][i]) {
92  depth = m_segmentation[iring-1][i];
93  layer = i;
94  if (iring != 16 || depth < 3)
95  depths.emplace_back(layerDepths[depth]);
96  }
97  if (i >= 17) break;
98  }
99  if (layer <= 17) depths.emplace_back(HBRMAX);
100  } else {
101  for (int i=0; i<4; ++i) {
102  if (iring != 16 || i < 3) {
103  depths.emplace_back(slhcDepths[i]);
104  }
105  }
106  }
107  }
108  unsigned int ndepth=depths.size()-1;
109  unsigned int startingDepth=1;
110  float etaMin=(iring-1)*0.087;
111  float etaMax=iring*0.087;
112  // topology.depthBinInformation(HcalBarrel, iring, ndepth, startingDepth);
113 #ifdef DebugLog
114  std::cout << "HBRing " << iring << " eta " << etaMin << ":" << etaMax << " depths " << ndepth << ":" << startingDepth;
115  for (unsigned int i=0; i<depths.size(); ++i) std::cout << ":" << depths[i];
116  std::cout << "\n";
117 #endif
118  for (unsigned int idepth = startingDepth; idepth <= ndepth; ++idepth) {
119  float rmin = depths[idepth-1];
120  float rmax = depths[idepth];
121 #ifdef DebugLog
122  std::cout << "HB " << idepth << " R " << rmin << ":" << rmax << "\n";
123 #endif
124  result.emplace_back(HcalHardcodeGeometryLoader::HBHOCellParameters(iring, (int)idepth, 1, 1, 5, rmin, rmax, etaMin, etaMax));
125  }
126  }
127  return result;
128 }
129 
130 
131 
132 // ----------> HO <-----------
133 std::vector <HcalHardcodeGeometryLoader::HBHOCellParameters> HcalHardcodeGeometryLoader::makeHOCells () {
134  const float HORMIN0 = 390.0;
135  const float HORMIN1 = 412.6;
136  const float HORMAX = 413.6;
137 
139  // eta, depth, firstPhi, stepPhi, deltaPhi, rMin, rMax, etaMin, etaMax
140  HcalHardcodeGeometryLoader::HBHOCellParameters ( 1, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087*0, 0.087*1),
141  HcalHardcodeGeometryLoader::HBHOCellParameters ( 2, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087*1, 0.087*2),
142  HcalHardcodeGeometryLoader::HBHOCellParameters ( 3, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087*2, 0.087*3),
143  HcalHardcodeGeometryLoader::HBHOCellParameters ( 4, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087*3, 0.3075),
144  HcalHardcodeGeometryLoader::HBHOCellParameters ( 5, 4, 1, 1, 5, HORMIN1, HORMAX, 0.3395, 0.087*5),
145  HcalHardcodeGeometryLoader::HBHOCellParameters ( 6, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*5, 0.087*6),
146  HcalHardcodeGeometryLoader::HBHOCellParameters ( 7, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*6, 0.087*7),
147  HcalHardcodeGeometryLoader::HBHOCellParameters ( 8, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*7, 0.087*8),
148  HcalHardcodeGeometryLoader::HBHOCellParameters ( 9, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*8, 0.087*9),
149  HcalHardcodeGeometryLoader::HBHOCellParameters (10, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*9, 0.8494),
150  HcalHardcodeGeometryLoader::HBHOCellParameters (11, 4, 1, 1, 5, HORMIN1, HORMAX, 0.873, 0.087*11),
151  HcalHardcodeGeometryLoader::HBHOCellParameters (12, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*11, 0.087*12),
152  HcalHardcodeGeometryLoader::HBHOCellParameters (13, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*12, 0.087*13),
153  HcalHardcodeGeometryLoader::HBHOCellParameters (14, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*13, 0.087*14),
154  HcalHardcodeGeometryLoader::HBHOCellParameters (15, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087*14, 0.087*15)
155  };
156  int nCells = sizeof(cells)/sizeof(HcalHardcodeGeometryLoader::HBHOCellParameters);
157  std::vector <HcalHardcodeGeometryLoader::HBHOCellParameters> result;
158  result.reserve (nCells);
159  for (int i = 0; i < nCells; ++i) result.emplace_back (cells[i]);
160  return result;
161 }
162 
163 
164 //
165 // Convert constants to appropriate cells
166 //
167 void HcalHardcodeGeometryLoader::fillHBHO (HcalGeometry* fGeometry, const std::vector <HcalHardcodeGeometryLoader::HBHOCellParameters>& fCells, bool fHB) {
168 
169  fGeometry->increaseReserve(fCells.size());
170  for (const auto & param : fCells) {
171  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
172  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
173  HcalDetId hid (fHB ? HcalBarrel : HcalOuter, param.eta*iside, iPhi, param.depth);
174  float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD; // middle of the cell
175  float etaCenter = 0.5*(param.etaMin + param.etaMax);
176  float x = param.rMin* cos (phiCenter);
177  float y = param.rMin* sin (phiCenter);
178  float z = iside * param.rMin * sinh(etaCenter);
179  // make cell geometry
180  GlobalPoint refPoint (x,y,z); // center of the cell's face
181  std::vector<CCGFloat> cellParams;
182  cellParams.reserve (5);
183  cellParams.emplace_back (0.5 * (param.etaMax - param.etaMin)); // deta_half
184  cellParams.emplace_back (0.5 * param.dphi * DEGREE2RAD); // dphi_half
185  cellParams.emplace_back (0.5 * (param.rMax - param.rMin) * cosh (etaCenter)); // dr_half
186  cellParams.emplace_back ( fabs( refPoint.eta() ) ) ;
187  cellParams.emplace_back ( fabs( refPoint.z() ) ) ;
188 #ifdef DebugLog
189  std::cout << "HcalHardcodeGeometryLoader::fillHBHO-> " << hid << hid.ieta() << '/' << hid.iphi() << '/' << hid.depth() << refPoint << '/' << cellParams [0] << '/' << cellParams [1] << '/' << cellParams [2] << std::endl;
190 #endif
191  fGeometry->newCellFast(refPoint, refPoint, refPoint,
192  CaloCellGeometry::getParmPtr(cellParams,
193  fGeometry->parMgr(),
194  fGeometry->parVecVec()),
195  hid ) ;
196  }
197  }
198  }
199 }
200 
201 
202 // ----------> HE <-----------
203 std::vector<HcalHardcodeGeometryLoader::HECellParameters> HcalHardcodeGeometryLoader::makeHECells (const HcalTopology & topology) {
204 
205  std::vector <HcalHardcodeGeometryLoader::HECellParameters> result;
206  const float HEZMIN = 400.458;
207  const float HEZMID = 436.168;
208  const float HEZMAX = 549.268;
209  float normalDepths[3] = {HEZMIN, HEZMID, HEZMAX};
210  float tripleDepths[4] = {HEZMIN, 418.768, HEZMID, HEZMAX};
211  float slhcDepths[5] = {HEZMIN, 418.768, HEZMID, 493., HEZMAX};
212  float ring16Depths[2] = {418.768,470.968};
213  float ring16slhcDepths[3] = {418.768, 450., 470.968};
214  float ring17Depths[2] = {409.698,514.468};
215  float ring17slhcDepths[5] = {409.698, 435., 460., 495., 514.468};
216  float ring18Depths[3] = {391.883,427.468,540.568};
217  float ring18slhcDepths[5] = {391.883, 439., 467., 504. , 540.568};
218  float etaBounds[] = {0.087*15, 0.087*16, 0.087*17, 0.087*18, 0.087*19,
219  1.74, 1.83, 1.93, 2.043, 2.172, 2.322, 2.500,
220  2.650, 2.868, 3.000};
221  float layerDepths[19] = {HEZMIN, 408.718, 416.978, 425.248, 433.508, 441.768,
222  450.038,458.298, 466.558, 474.828, 483.088, 491.348,
223  499.618,507.878, 516.138, 524.398, 532.668, 540.928,
224  HEZMAX};
225 
226  // count by ring - 16
227  for(int iringm16=0; iringm16 <= 13; ++iringm16) {
228  int iring = iringm16 + 16;
229  std::vector<float> depths;
230  unsigned int startingDepth = 1;
231  if (topology.mode() != HcalTopologyMode::SLHC) {
232  if (iring == 16)
233  {for (float ring16Depth : ring16Depths) depths.emplace_back(ring16Depth); startingDepth = 3;}
234  else if (iring == 17)
235  for (float ring17Depth : ring17Depths) depths.emplace_back(ring17Depth);
236  else if (iring == 18)
237  for (float ring18Depth : ring18Depths) depths.emplace_back(ring18Depth);
238  else if (iring == topology.lastHERing())
239  for (int i=0; i<3; ++i) depths.emplace_back(tripleDepths[i]);
240  else if (iring >= topology.firstHETripleDepthRing())
241  for (float tripleDepth : tripleDepths) depths.emplace_back(tripleDepth);
242  else
243  for (float normalDepth : normalDepths) depths.emplace_back(normalDepth);
244  } else {
245  if (m_segmentation.size() >= (unsigned int)(iring)) {
246  int depth = m_segmentation[iring-1][0];
247  if (iring == 16) depths.emplace_back(ring16Depths[0]);
248  else if (iring == 17) depths.emplace_back(ring17Depths[0]);
249  else if (iring == 18) depths.emplace_back(ring18Depths[0]);
250  else depths.emplace_back(layerDepths[depth]);
251  int layer = 1;
252  float lastDepth = depths[0];
253  for (unsigned int i=1; i<m_segmentation[iring-1].size(); ++i) {
254  if (depth != m_segmentation[iring-1][i]) {
255  depth = m_segmentation[iring-1][i];
256  layer = i;
257  if (layerDepths[depth] > lastDepth && (iring != 16 || depth > 3)) {
258  depths.emplace_back(layerDepths[depth]);
259  lastDepth = layerDepths[depth];
260  }
261  }
262  }
263  if (layer <= 17) depths.emplace_back(HEZMAX);
264  if (iring == 16) startingDepth = 3;
265  } else {
266  if (iring == 16) {for (float ring16slhcDepth : ring16slhcDepths) depths.emplace_back(ring16slhcDepth); startingDepth = 3;}
267  else if (iring == 17) for (float ring17slhcDepth : ring17slhcDepths) depths.emplace_back(ring17slhcDepth);
268  else if (iring == 18) for (float ring18slhcDepth : ring18slhcDepths) depths.emplace_back(ring18slhcDepth);
269  else for (float slhcDepth : slhcDepths) depths.emplace_back(slhcDepth);
270  }
271  }
272  float etamin = etaBounds[iringm16];
273  float etamax = etaBounds[iringm16+1];
274  unsigned int ndepth = depths.size()-1;
275  // topology.depthBinInformation(HcalEndcap, iring, ndepth, startingDepth);
276 #ifdef DebugLog
277  std::cout << "HERing " << iring << " eta " << etamin << ":" << etamax << " depths " << ndepth << ":" << startingDepth;
278  for (unsigned int i=0; i<depths.size(); ++i) std::cout << ":" << depths[i];
279  std::cout << "\n";
280 #endif
281  for (unsigned int idepth = 0; idepth < ndepth; ++idepth) {
282  int depthIndex = (int)(idepth + startingDepth);
283  float zmin = depths[idepth];
284  float zmax = depths[idepth+1];
285  if (depthIndex <= 7) {
286 #ifdef DebugLog
287  std::cout << "HE Depth " << idepth << ":" << depthIndex << " Z " << zmin << ":" << zmax << "\n";
288 #endif
289  int stepPhi = (iring >= topology.firstHEDoublePhiRing() ? 2 : 1);
290  int deltaPhi = (iring >= topology.firstHEDoublePhiRing() ? 10 : 5);
291  if (topology.mode() != HcalTopologyMode::SLHC &&
292  iring == topology.lastHERing()-1 && idepth == ndepth-1) {
293 #ifdef DebugLog
294  std::cout << "HE iEta " << iring << " Depth " << depthIndex << " Eta " << etamin << ":" << etaBounds[iringm16+2] << std::endl;
295 #endif
296  result.emplace_back(HcalHardcodeGeometryLoader::HECellParameters(iring, depthIndex, 1, stepPhi, deltaPhi, zmin, zmax, etamin, etaBounds[iringm16+2]));
297  } else {
298 #ifdef DebugLog
299  std::cout << "HE iEta " << iring << " Depth " << depthIndex << " Eta " << etamin << ":" << etamax << std::endl;
300 #endif
301  result.emplace_back(HcalHardcodeGeometryLoader::HECellParameters(iring, depthIndex, 1, stepPhi, deltaPhi, zmin, zmax, etamin, etamax));
302  }
303  }
304  }
305  }
306 
307  return result;
308 }
309 
310 
311 // ----------> HE @ H2 <-----------
312 std::vector <HcalHardcodeGeometryLoader::HECellParameters> HcalHardcodeGeometryLoader::makeHECells_H2 () {
313 
314  const float HEZMIN_H2 = 400.715;
315  const float HEZMID_H2 = 436.285;
316  const float HEZMAX_H2 = 541.885;
317 
319  // eta, depth, firstPhi, stepPhi, deltaPhi, zMin, zMax, etaMin, etaMax
320  HcalHardcodeGeometryLoader::HECellParameters ( 16, 3, 1, 1, 5, 409.885, 462.685, 1.305, 1.373),
321  HcalHardcodeGeometryLoader::HECellParameters ( 17, 1, 1, 1, 5, HEZMIN_H2, 427.485, 1.373, 1.444),
322  HcalHardcodeGeometryLoader::HECellParameters ( 17, 2, 1, 1, 5, 427.485, 506.685, 1.373, 1.444),
323  HcalHardcodeGeometryLoader::HECellParameters ( 18, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.444, 1.521),
324  HcalHardcodeGeometryLoader::HECellParameters ( 18, 2, 1, 1, 5, HEZMID_H2, 524.285, 1.444, 1.521),
325  HcalHardcodeGeometryLoader::HECellParameters ( 19, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.521, 1.603),
326  HcalHardcodeGeometryLoader::HECellParameters ( 19, 2, 1, 1, 5, HEZMID_H2, HEZMAX_H2, 1.521, 1.603),
327  HcalHardcodeGeometryLoader::HECellParameters ( 20, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.603, 1.693),
328  HcalHardcodeGeometryLoader::HECellParameters ( 20, 2, 1, 1, 5, HEZMID_H2, HEZMAX_H2, 1.603, 1.693),
329  HcalHardcodeGeometryLoader::HECellParameters ( 21, 1, 1, 2, 5, HEZMIN_H2, HEZMID_H2, 1.693, 1.79),
330  HcalHardcodeGeometryLoader::HECellParameters ( 21, 2, 1, 2, 5, HEZMID_H2, HEZMAX_H2, 1.693, 1.79),
331  HcalHardcodeGeometryLoader::HECellParameters ( 22, 1, 1, 2,10, HEZMIN_H2, HEZMID_H2, 1.79, 1.88),
332  HcalHardcodeGeometryLoader::HECellParameters ( 22, 2, 1, 2,10, HEZMID_H2, HEZMAX_H2, 1.79, 1.88),
333  HcalHardcodeGeometryLoader::HECellParameters ( 23, 1, 1, 2,10, HEZMIN_H2, HEZMID_H2, 1.88, 1.98),
334  HcalHardcodeGeometryLoader::HECellParameters ( 23, 2, 1, 2,10, HEZMID_H2, HEZMAX_H2, 1.88, 1.98),
335  HcalHardcodeGeometryLoader::HECellParameters ( 24, 1, 1, 2,10, HEZMIN_H2, 418.685, 1.98, 2.09),
336  HcalHardcodeGeometryLoader::HECellParameters ( 24, 2, 1, 2,10, 418.685, HEZMID_H2, 1.98, 2.09),
337  HcalHardcodeGeometryLoader::HECellParameters ( 24, 3, 1, 2,10, HEZMID_H2, HEZMAX_H2, 1.98, 2.09),
338  HcalHardcodeGeometryLoader::HECellParameters ( 25, 1, 1, 2,10, HEZMIN_H2, 418.685, 2.09, 2.21),
339  HcalHardcodeGeometryLoader::HECellParameters ( 25, 2, 1, 2,10, 418.685, HEZMID_H2, 2.09, 2.21),
340  HcalHardcodeGeometryLoader::HECellParameters ( 25, 3, 1, 2,10, HEZMID_H2, HEZMAX_H2, 2.09, 2.21)
341  };
342  int nCells = sizeof(cells)/sizeof(HcalHardcodeGeometryLoader::HECellParameters);
343  std::vector <HcalHardcodeGeometryLoader::HECellParameters> result;
344  result.reserve (nCells);
345  for (int i = 0; i < nCells; ++i) result.emplace_back (cells[i]);
346  return result;
347 }
348 
349 // ----------> HF <-----------
350 std::vector <HcalHardcodeGeometryLoader::HFCellParameters> HcalHardcodeGeometryLoader::makeHFCells () {
351 
352  const float HFZMIN1 = 1115.;
353  const float HFZMIN2 = 1137.;
354  const float HFZMAX = 1280.1;
355 
357  // eta, depth, firstPhi, stepPhi, deltaPhi, zMin, zMax, rMin, rMax
358  HcalHardcodeGeometryLoader::HFCellParameters (29, 1, 1, 2, 10, HFZMIN1, HFZMAX,116.2,130.0),
359  HcalHardcodeGeometryLoader::HFCellParameters (29, 2, 1, 2, 10, HFZMIN2, HFZMAX,116.2,130.0),
360  HcalHardcodeGeometryLoader::HFCellParameters (30, 1, 1, 2, 10, HFZMIN1, HFZMAX, 97.5,116.2),
361  HcalHardcodeGeometryLoader::HFCellParameters (30, 2, 1, 2, 10, HFZMIN2, HFZMAX, 97.5,116.2),
362  HcalHardcodeGeometryLoader::HFCellParameters (31, 1, 1, 2, 10, HFZMIN1, HFZMAX, 81.8, 97.5),
363  HcalHardcodeGeometryLoader::HFCellParameters (31, 2, 1, 2, 10, HFZMIN2, HFZMAX, 81.8, 97.5),
364  HcalHardcodeGeometryLoader::HFCellParameters (32, 1, 1, 2, 10, HFZMIN1, HFZMAX, 68.6, 81.8),
365  HcalHardcodeGeometryLoader::HFCellParameters (32, 2, 1, 2, 10, HFZMIN2, HFZMAX, 68.6, 81.8),
366  HcalHardcodeGeometryLoader::HFCellParameters (33, 1, 1, 2, 10, HFZMIN1, HFZMAX, 57.6, 68.6),
367  HcalHardcodeGeometryLoader::HFCellParameters (33, 2, 1, 2, 10, HFZMIN2, HFZMAX, 57.6, 68.6),
368  HcalHardcodeGeometryLoader::HFCellParameters (34, 1, 1, 2, 10, HFZMIN1, HFZMAX, 48.3, 57.6),
369  HcalHardcodeGeometryLoader::HFCellParameters (34, 2, 1, 2, 10, HFZMIN2, HFZMAX, 48.3, 57.6),
370  HcalHardcodeGeometryLoader::HFCellParameters (35, 1, 1, 2, 10, HFZMIN1, HFZMAX, 40.6, 48.3),
371  HcalHardcodeGeometryLoader::HFCellParameters (35, 2, 1, 2, 10, HFZMIN2, HFZMAX, 40.6, 48.3),
372  HcalHardcodeGeometryLoader::HFCellParameters (36, 1, 1, 2, 10, HFZMIN1, HFZMAX, 34.0, 40.6),
373  HcalHardcodeGeometryLoader::HFCellParameters (36, 2, 1, 2, 10, HFZMIN2, HFZMAX, 34.0, 40.6),
374  HcalHardcodeGeometryLoader::HFCellParameters (37, 1, 1, 2, 10, HFZMIN1, HFZMAX, 28.6, 34.0),
375  HcalHardcodeGeometryLoader::HFCellParameters (37, 2, 1, 2, 10, HFZMIN2, HFZMAX, 28.6, 34.0),
376  HcalHardcodeGeometryLoader::HFCellParameters (38, 1, 1, 2, 10, HFZMIN1, HFZMAX, 24.0, 28.6),
377  HcalHardcodeGeometryLoader::HFCellParameters (38, 2, 1, 2, 10, HFZMIN2, HFZMAX, 24.0, 28.6),
378  HcalHardcodeGeometryLoader::HFCellParameters (39, 1, 1, 2, 10, HFZMIN1, HFZMAX, 20.1, 24.0),
379  HcalHardcodeGeometryLoader::HFCellParameters (39, 2, 1, 2, 10, HFZMIN2, HFZMAX, 20.1, 24.0),
380  HcalHardcodeGeometryLoader::HFCellParameters (40, 1, 3, 4, 20, HFZMIN1, HFZMAX, 16.9, 20.1),
381  HcalHardcodeGeometryLoader::HFCellParameters (40, 2, 3, 4, 20, HFZMIN2, HFZMAX, 16.9, 20.1),
382  HcalHardcodeGeometryLoader::HFCellParameters (41, 1, 3, 4, 20, HFZMIN1, HFZMAX, 12.5, 16.9),
383  HcalHardcodeGeometryLoader::HFCellParameters (41, 2, 3, 4, 20, HFZMIN2, HFZMAX, 12.5, 16.9)
384  };
385  int nCells = sizeof(cells)/sizeof(HcalHardcodeGeometryLoader::HFCellParameters);
386  std::vector <HcalHardcodeGeometryLoader::HFCellParameters> result;
387  result.reserve (nCells);
388  for (int i = 0; i < nCells; ++i) result.emplace_back (cells[i]);
389  return result;
390 }
391 
392 void HcalHardcodeGeometryLoader::fillHE (HcalGeometry* fGeometry, const std::vector <HcalHardcodeGeometryLoader::HECellParameters>& fCells) {
393 
394  fGeometry->increaseReserve(fCells.size());
395  for (const auto & param : fCells) {
396  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
397  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
398  HcalDetId hid (HcalEndcap, param.eta*iside, iPhi, param.depth);
399  float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD; // middle of the cell
400  float etaCenter = 0.5 * (param.etaMin + param.etaMax);
401 
402  float perp = param.zMin / sinh (etaCenter);
403  float x = perp * cos (phiCenter);
404  float y = perp * sin (phiCenter);
405  float z = iside * param.zMin;
406  // make cell geometry
407  GlobalPoint refPoint (x,y,z); // center of the cell's face
408  std::vector<CCGFloat> cellParams;
409  cellParams.reserve (5);
410  cellParams.emplace_back (0.5 * (param.etaMax - param.etaMin)); //deta_half
411  cellParams.emplace_back (0.5 * param.dphi * DEGREE2RAD); // dphi_half
412  cellParams.emplace_back (-0.5 * (param.zMax - param.zMin) / tanh (etaCenter)); // dz_half, "-" means edges in Z
413  cellParams.emplace_back ( fabs( refPoint.eta() ) ) ;
414  cellParams.emplace_back ( fabs( refPoint.z() ) ) ;
415 #ifdef DebugLog
416  std::cout << "HcalHardcodeGeometryLoader::fillHE-> " << hid << refPoint << '/' << cellParams [0] << '/' << cellParams [1] << '/' << cellParams [2] << std::endl;
417 #endif
418  fGeometry->newCellFast(refPoint, refPoint, refPoint,
419  CaloCellGeometry::getParmPtr(cellParams,
420  fGeometry->parMgr(),
421  fGeometry->parVecVec()),
422  hid ) ;
423  }
424  }
425  }
426 }
427 
428 void HcalHardcodeGeometryLoader::fillHF (HcalGeometry* fGeometry, const std::vector <HcalHardcodeGeometryLoader::HFCellParameters>& fCells) {
429 
430  fGeometry->increaseReserve(fCells.size());
431  for (const auto & param : fCells) {
432  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
433  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
434  HcalDetId hid (HcalForward, param.eta*iside, iPhi, param.depth);
435  float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD; // middle of the cell
436  GlobalPoint inner (param.rMin, 0, param.zMin);
437  GlobalPoint outer (param.rMax, 0, param.zMin);
438  float iEta = inner.eta();
439  float oEta = outer.eta();
440  float etaCenter = 0.5 * ( iEta + oEta );
441 
442  float perp = param.zMin / sinh (etaCenter);
443  float x = perp * cos (phiCenter);
444  float y = perp * sin (phiCenter);
445  float z = iside * param.zMin;
446  // make cell geometry
447  GlobalPoint refPoint (x,y,z); // center of the cell's face
448  std::vector<CCGFloat> cellParams;
449  cellParams.reserve (5);
450  cellParams.emplace_back (0.5 * ( iEta - oEta )); // deta_half
451  cellParams.emplace_back (0.5 * param.dphi * DEGREE2RAD); // dphi_half
452  cellParams.emplace_back (0.5 * (param.zMax - param.zMin)); // dz_half
453  cellParams.emplace_back ( fabs( refPoint.eta()));
454  cellParams.emplace_back ( fabs( refPoint.z() ) ) ;
455 #ifdef DebugLog
456  std::cout << "HcalHardcodeGeometryLoader::fillHF-> " << hid << refPoint << '/' << cellParams [0] << '/' << cellParams [1] << '/' << cellParams [2] << std::endl;
457 #endif
458  fGeometry->newCellFast(refPoint, refPoint, refPoint,
459  CaloCellGeometry::getParmPtr(cellParams,
460  fGeometry->parMgr(),
461  fGeometry->parVecVec()),
462  hid ) ;
463  }
464  }
465  }
466 }
void fillHBHO(HcalGeometry *fGeometry, const std::vector< HBHOCellParameters > &fCells, bool fHB)
unsigned int getHFSize() const
Definition: HcalTopology.h:141
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
std::vector< HFCellParameters > makeHFCells()
CaloTopology const * topology(0)
std::vector< HBHOCellParameters > makeHOCells()
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
unsigned int numberOfShapes() const override
Definition: HcalGeometry.h:45
double maxEta
void fillHF(HcalGeometry *fGeometry, const std::vector< HFCellParameters > &fCells)
void allocatePar(ParVec::size_type n, unsigned int m)
HcalTopologyMode::Mode mode() const
Definition: HcalTopology.h:31
void newCellFast(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
CaloCellGeometry::CCGFloat CCGFloat
void sortValidIds()
T z() const
Definition: PV3DBase.h:64
int firstHETripleDepthRing() const
Definition: HcalTopology.h:99
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
CaloSubdetectorGeometry * load(const HcalTopology &fTopology)
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
#define M_PI
int k[5][pyjets_maxn]
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:103
std::vector< HECellParameters > makeHECells(const HcalTopology &topology)
CaloCellGeometry::CornersMgr * cornersMgr()
std::vector< std::vector< int > > m_segmentation
void increaseReserve(unsigned int extra)
T eta() const
Definition: PV3DBase.h:76
T perp() const
Magnitude of transverse component.
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
std::vector< HBHOCellParameters > makeHBCells(const HcalTopology &topology)
void fillHE(HcalGeometry *fGeometry, const std::vector< HECellParameters > &fCells)
HcalHardcodeGeometryLoader(const edm::ParameterSet &)
int lastHERing() const
Definition: HcalTopology.h:90
std::vector< HECellParameters > makeHECells_H2()