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( 0 == hcalGeometry->cornersMgr() ) hcalGeometry->allocateCorners ( fTopology.ncells()+fTopology.getHFSize() );
40  if( 0 == 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 (int i=0; i<3; ++i) depths.push_back(ring15Depths[i]);
80  } else if (iring == 16) {
81  for (int i=0; i<3; ++i) depths.push_back(ring16Depths[i]);
82  } else {
83  for (int i=0; i<2; ++i) depths.push_back(normalDepths[i]);
84  }
85  } else {
86  if (m_segmentation.size() >= (unsigned int)(iring)) {
87  int depth = m_segmentation[iring-1][0];
88  depths.push_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.push_back(layerDepths[depth]);
96  }
97  if (i >= 17) break;
98  }
99  if (layer <= 17) depths.push_back(HBRMAX);
100  } else {
101  for (int i=0; i<4; ++i) {
102  if (iring != 16 || i < 3) {
103  depths.push_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.push_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.push_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 (size_t iCell = 0; iCell < fCells.size(); ++iCell) {
171  const HcalHardcodeGeometryLoader::HBHOCellParameters& param = fCells[iCell];
172  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
173  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
174  HcalDetId hid (fHB ? HcalBarrel : HcalOuter, param.eta*iside, iPhi, param.depth);
175  float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD; // middle of the cell
176  float etaCenter = 0.5*(param.etaMin + param.etaMax);
177  float x = param.rMin* cos (phiCenter);
178  float y = param.rMin* sin (phiCenter);
179  float z = iside * param.rMin * sinh(etaCenter);
180  // make cell geometry
181  GlobalPoint refPoint (x,y,z); // center of the cell's face
182  std::vector<CCGFloat> cellParams;
183  cellParams.reserve (5);
184  cellParams.push_back (0.5 * (param.etaMax - param.etaMin)); // deta_half
185  cellParams.push_back (0.5 * param.dphi * DEGREE2RAD); // dphi_half
186  cellParams.push_back (0.5 * (param.rMax - param.rMin) * cosh (etaCenter)); // dr_half
187  cellParams.push_back ( fabs( refPoint.eta() ) ) ;
188  cellParams.push_back ( fabs( refPoint.z() ) ) ;
189 #ifdef DebugLog
190  std::cout << "HcalHardcodeGeometryLoader::fillHBHO-> " << hid << hid.ieta() << '/' << hid.iphi() << '/' << hid.depth() << refPoint << '/' << cellParams [0] << '/' << cellParams [1] << '/' << cellParams [2] << std::endl;
191 #endif
192  fGeometry->newCellFast(refPoint, refPoint, refPoint,
193  CaloCellGeometry::getParmPtr(cellParams,
194  fGeometry->parMgr(),
195  fGeometry->parVecVec()),
196  hid ) ;
197  }
198  }
199  }
200 }
201 
202 
203 // ----------> HE <-----------
204 std::vector<HcalHardcodeGeometryLoader::HECellParameters> HcalHardcodeGeometryLoader::makeHECells (const HcalTopology & topology) {
205 
206  std::vector <HcalHardcodeGeometryLoader::HECellParameters> result;
207  const float HEZMIN = 400.458;
208  const float HEZMID = 436.168;
209  const float HEZMAX = 549.268;
210  float normalDepths[3] = {HEZMIN, HEZMID, HEZMAX};
211  float tripleDepths[4] = {HEZMIN, 418.768, HEZMID, HEZMAX};
212  float slhcDepths[5] = {HEZMIN, 418.768, HEZMID, 493., HEZMAX};
213  float ring16Depths[2] = {418.768,470.968};
214  float ring16slhcDepths[3] = {418.768, 450., 470.968};
215  float ring17Depths[2] = {409.698,514.468};
216  float ring17slhcDepths[5] = {409.698, 435., 460., 495., 514.468};
217  float ring18Depths[3] = {391.883,427.468,540.568};
218  float ring18slhcDepths[5] = {391.883, 439., 467., 504. , 540.568};
219  float etaBounds[] = {0.087*15, 0.087*16, 0.087*17, 0.087*18, 0.087*19,
220  1.74, 1.83, 1.93, 2.043, 2.172, 2.322, 2.500,
221  2.650, 2.868, 3.000};
222  float layerDepths[19] = {HEZMIN, 408.718, 416.978, 425.248, 433.508, 441.768,
223  450.038,458.298, 466.558, 474.828, 483.088, 491.348,
224  499.618,507.878, 516.138, 524.398, 532.668, 540.928,
225  HEZMAX};
226 
227  // count by ring - 16
228  for(int iringm16=0; iringm16 <= 13; ++iringm16) {
229  int iring = iringm16 + 16;
230  std::vector<float> depths;
231  unsigned int startingDepth = 1;
232  if (topology.mode() != HcalTopologyMode::SLHC) {
233  if (iring == 16)
234  {for (int i=0; i<2; ++i) depths.push_back(ring16Depths[i]); startingDepth = 3;}
235  else if (iring == 17)
236  for (int i=0; i<2; ++i) depths.push_back(ring17Depths[i]);
237  else if (iring == 18)
238  for (int i=0; i<3; ++i) depths.push_back(ring18Depths[i]);
239  else if (iring == topology.lastHERing())
240  for (int i=0; i<3; ++i) depths.push_back(tripleDepths[i]);
241  else if (iring >= topology.firstHETripleDepthRing())
242  for (int i=0; i<4; ++i) depths.push_back(tripleDepths[i]);
243  else
244  for (int i=0; i<3; ++i) depths.push_back(normalDepths[i]);
245  } else {
246  if (m_segmentation.size() >= (unsigned int)(iring)) {
247  int depth = m_segmentation[iring-1][0];
248  if (iring == 16) depths.push_back(ring16Depths[0]);
249  else if (iring == 17) depths.push_back(ring17Depths[0]);
250  else if (iring == 18) depths.push_back(ring18Depths[0]);
251  else depths.push_back(layerDepths[depth]);
252  int layer = 1;
253  float lastDepth = depths[0];
254  for (unsigned int i=1; i<m_segmentation[iring-1].size(); ++i) {
255  if (depth != m_segmentation[iring-1][i]) {
256  depth = m_segmentation[iring-1][i];
257  layer = i;
258  if (layerDepths[depth] > lastDepth && (iring != 16 || depth > 3)) {
259  depths.push_back(layerDepths[depth]);
260  lastDepth = layerDepths[depth];
261  }
262  }
263  }
264  if (layer <= 17) depths.push_back(HEZMAX);
265  if (iring == 16) startingDepth = 3;
266  } else {
267  if (iring == 16) {for (int i=0; i<3; ++i) depths.push_back(ring16slhcDepths[i]); startingDepth = 3;}
268  else if (iring == 17) for (int i=0; i<5; ++i) depths.push_back(ring17slhcDepths[i]);
269  else if (iring == 18) for (int i=0; i<5; ++i) depths.push_back(ring18slhcDepths[i]);
270  else for (int i=0; i<5; ++i) depths.push_back(slhcDepths[i]);
271  }
272  }
273  float etamin = etaBounds[iringm16];
274  float etamax = etaBounds[iringm16+1];
275  unsigned int ndepth = depths.size()-1;
276  // topology.depthBinInformation(HcalEndcap, iring, ndepth, startingDepth);
277 #ifdef DebugLog
278  std::cout << "HERing " << iring << " eta " << etamin << ":" << etamax << " depths " << ndepth << ":" << startingDepth;
279  for (unsigned int i=0; i<depths.size(); ++i) std::cout << ":" << depths[i];
280  std::cout << "\n";
281 #endif
282  for (unsigned int idepth = 0; idepth < ndepth; ++idepth) {
283  int depthIndex = (int)(idepth + startingDepth);
284  float zmin = depths[idepth];
285  float zmax = depths[idepth+1];
286  if (depthIndex <= 7) {
287 #ifdef DebugLog
288  std::cout << "HE Depth " << idepth << ":" << depthIndex << " Z " << zmin << ":" << zmax << "\n";
289 #endif
290  int stepPhi = (iring >= topology.firstHEDoublePhiRing() ? 2 : 1);
291  int deltaPhi = (iring >= topology.firstHEDoublePhiRing() ? 10 : 5);
292  if (topology.mode() != HcalTopologyMode::SLHC &&
293  iring == topology.lastHERing()-1 && idepth == ndepth-1) {
294 #ifdef DebugLog
295  std::cout << "HE iEta " << iring << " Depth " << depthIndex << " Eta " << etamin << ":" << etaBounds[iringm16+2] << std::endl;
296 #endif
297  result.push_back(HcalHardcodeGeometryLoader::HECellParameters(iring, depthIndex, 1, stepPhi, deltaPhi, zmin, zmax, etamin, etaBounds[iringm16+2]));
298  } else {
299 #ifdef DebugLog
300  std::cout << "HE iEta " << iring << " Depth " << depthIndex << " Eta " << etamin << ":" << etamax << std::endl;
301 #endif
302  result.push_back(HcalHardcodeGeometryLoader::HECellParameters(iring, depthIndex, 1, stepPhi, deltaPhi, zmin, zmax, etamin, etamax));
303  }
304  }
305  }
306  }
307 
308  return result;
309 }
310 
311 
312 // ----------> HE @ H2 <-----------
313 std::vector <HcalHardcodeGeometryLoader::HECellParameters> HcalHardcodeGeometryLoader::makeHECells_H2 () {
314 
315  const float HEZMIN_H2 = 400.715;
316  const float HEZMID_H2 = 436.285;
317  const float HEZMAX_H2 = 541.885;
318 
320  // eta, depth, firstPhi, stepPhi, deltaPhi, zMin, zMax, etaMin, etaMax
321  HcalHardcodeGeometryLoader::HECellParameters ( 16, 3, 1, 1, 5, 409.885, 462.685, 1.305, 1.373),
322  HcalHardcodeGeometryLoader::HECellParameters ( 17, 1, 1, 1, 5, HEZMIN_H2, 427.485, 1.373, 1.444),
323  HcalHardcodeGeometryLoader::HECellParameters ( 17, 2, 1, 1, 5, 427.485, 506.685, 1.373, 1.444),
324  HcalHardcodeGeometryLoader::HECellParameters ( 18, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.444, 1.521),
325  HcalHardcodeGeometryLoader::HECellParameters ( 18, 2, 1, 1, 5, HEZMID_H2, 524.285, 1.444, 1.521),
326  HcalHardcodeGeometryLoader::HECellParameters ( 19, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.521, 1.603),
327  HcalHardcodeGeometryLoader::HECellParameters ( 19, 2, 1, 1, 5, HEZMID_H2, HEZMAX_H2, 1.521, 1.603),
328  HcalHardcodeGeometryLoader::HECellParameters ( 20, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.603, 1.693),
329  HcalHardcodeGeometryLoader::HECellParameters ( 20, 2, 1, 1, 5, HEZMID_H2, HEZMAX_H2, 1.603, 1.693),
330  HcalHardcodeGeometryLoader::HECellParameters ( 21, 1, 1, 2, 5, HEZMIN_H2, HEZMID_H2, 1.693, 1.79),
331  HcalHardcodeGeometryLoader::HECellParameters ( 21, 2, 1, 2, 5, HEZMID_H2, HEZMAX_H2, 1.693, 1.79),
332  HcalHardcodeGeometryLoader::HECellParameters ( 22, 1, 1, 2,10, HEZMIN_H2, HEZMID_H2, 1.79, 1.88),
333  HcalHardcodeGeometryLoader::HECellParameters ( 22, 2, 1, 2,10, HEZMID_H2, HEZMAX_H2, 1.79, 1.88),
334  HcalHardcodeGeometryLoader::HECellParameters ( 23, 1, 1, 2,10, HEZMIN_H2, HEZMID_H2, 1.88, 1.98),
335  HcalHardcodeGeometryLoader::HECellParameters ( 23, 2, 1, 2,10, HEZMID_H2, HEZMAX_H2, 1.88, 1.98),
336  HcalHardcodeGeometryLoader::HECellParameters ( 24, 1, 1, 2,10, HEZMIN_H2, 418.685, 1.98, 2.09),
337  HcalHardcodeGeometryLoader::HECellParameters ( 24, 2, 1, 2,10, 418.685, HEZMID_H2, 1.98, 2.09),
338  HcalHardcodeGeometryLoader::HECellParameters ( 24, 3, 1, 2,10, HEZMID_H2, HEZMAX_H2, 1.98, 2.09),
339  HcalHardcodeGeometryLoader::HECellParameters ( 25, 1, 1, 2,10, HEZMIN_H2, 418.685, 2.09, 2.21),
340  HcalHardcodeGeometryLoader::HECellParameters ( 25, 2, 1, 2,10, 418.685, HEZMID_H2, 2.09, 2.21),
341  HcalHardcodeGeometryLoader::HECellParameters ( 25, 3, 1, 2,10, HEZMID_H2, HEZMAX_H2, 2.09, 2.21)
342  };
343  int nCells = sizeof(cells)/sizeof(HcalHardcodeGeometryLoader::HECellParameters);
344  std::vector <HcalHardcodeGeometryLoader::HECellParameters> result;
345  result.reserve (nCells);
346  for (int i = 0; i < nCells; ++i) result.push_back (cells[i]);
347  return result;
348 }
349 
350 // ----------> HF <-----------
351 std::vector <HcalHardcodeGeometryLoader::HFCellParameters> HcalHardcodeGeometryLoader::makeHFCells () {
352 
353  const float HFZMIN1 = 1115.;
354  const float HFZMIN2 = 1137.;
355  const float HFZMAX = 1280.1;
356 
358  // eta, depth, firstPhi, stepPhi, deltaPhi, zMin, zMax, rMin, rMax
359  HcalHardcodeGeometryLoader::HFCellParameters (29, 1, 1, 2, 10, HFZMIN1, HFZMAX,116.2,130.0),
360  HcalHardcodeGeometryLoader::HFCellParameters (29, 2, 1, 2, 10, HFZMIN2, HFZMAX,116.2,130.0),
361  HcalHardcodeGeometryLoader::HFCellParameters (30, 1, 1, 2, 10, HFZMIN1, HFZMAX, 97.5,116.2),
362  HcalHardcodeGeometryLoader::HFCellParameters (30, 2, 1, 2, 10, HFZMIN2, HFZMAX, 97.5,116.2),
363  HcalHardcodeGeometryLoader::HFCellParameters (31, 1, 1, 2, 10, HFZMIN1, HFZMAX, 81.8, 97.5),
364  HcalHardcodeGeometryLoader::HFCellParameters (31, 2, 1, 2, 10, HFZMIN2, HFZMAX, 81.8, 97.5),
365  HcalHardcodeGeometryLoader::HFCellParameters (32, 1, 1, 2, 10, HFZMIN1, HFZMAX, 68.6, 81.8),
366  HcalHardcodeGeometryLoader::HFCellParameters (32, 2, 1, 2, 10, HFZMIN2, HFZMAX, 68.6, 81.8),
367  HcalHardcodeGeometryLoader::HFCellParameters (33, 1, 1, 2, 10, HFZMIN1, HFZMAX, 57.6, 68.6),
368  HcalHardcodeGeometryLoader::HFCellParameters (33, 2, 1, 2, 10, HFZMIN2, HFZMAX, 57.6, 68.6),
369  HcalHardcodeGeometryLoader::HFCellParameters (34, 1, 1, 2, 10, HFZMIN1, HFZMAX, 48.3, 57.6),
370  HcalHardcodeGeometryLoader::HFCellParameters (34, 2, 1, 2, 10, HFZMIN2, HFZMAX, 48.3, 57.6),
371  HcalHardcodeGeometryLoader::HFCellParameters (35, 1, 1, 2, 10, HFZMIN1, HFZMAX, 40.6, 48.3),
372  HcalHardcodeGeometryLoader::HFCellParameters (35, 2, 1, 2, 10, HFZMIN2, HFZMAX, 40.6, 48.3),
373  HcalHardcodeGeometryLoader::HFCellParameters (36, 1, 1, 2, 10, HFZMIN1, HFZMAX, 34.0, 40.6),
374  HcalHardcodeGeometryLoader::HFCellParameters (36, 2, 1, 2, 10, HFZMIN2, HFZMAX, 34.0, 40.6),
375  HcalHardcodeGeometryLoader::HFCellParameters (37, 1, 1, 2, 10, HFZMIN1, HFZMAX, 28.6, 34.0),
376  HcalHardcodeGeometryLoader::HFCellParameters (37, 2, 1, 2, 10, HFZMIN2, HFZMAX, 28.6, 34.0),
377  HcalHardcodeGeometryLoader::HFCellParameters (38, 1, 1, 2, 10, HFZMIN1, HFZMAX, 24.0, 28.6),
378  HcalHardcodeGeometryLoader::HFCellParameters (38, 2, 1, 2, 10, HFZMIN2, HFZMAX, 24.0, 28.6),
379  HcalHardcodeGeometryLoader::HFCellParameters (39, 1, 1, 2, 10, HFZMIN1, HFZMAX, 20.1, 24.0),
380  HcalHardcodeGeometryLoader::HFCellParameters (39, 2, 1, 2, 10, HFZMIN2, HFZMAX, 20.1, 24.0),
381  HcalHardcodeGeometryLoader::HFCellParameters (40, 1, 3, 4, 20, HFZMIN1, HFZMAX, 16.9, 20.1),
382  HcalHardcodeGeometryLoader::HFCellParameters (40, 2, 3, 4, 20, HFZMIN2, HFZMAX, 16.9, 20.1),
383  HcalHardcodeGeometryLoader::HFCellParameters (41, 1, 3, 4, 20, HFZMIN1, HFZMAX, 12.5, 16.9),
384  HcalHardcodeGeometryLoader::HFCellParameters (41, 2, 3, 4, 20, HFZMIN2, HFZMAX, 12.5, 16.9)
385  };
386  int nCells = sizeof(cells)/sizeof(HcalHardcodeGeometryLoader::HFCellParameters);
387  std::vector <HcalHardcodeGeometryLoader::HFCellParameters> result;
388  result.reserve (nCells);
389  for (int i = 0; i < nCells; ++i) result.push_back (cells[i]);
390  return result;
391 }
392 
393 void HcalHardcodeGeometryLoader::fillHE (HcalGeometry* fGeometry, const std::vector <HcalHardcodeGeometryLoader::HECellParameters>& fCells) {
394 
395  fGeometry->increaseReserve(fCells.size());
396  for (size_t iCell = 0; iCell < fCells.size(); ++iCell) {
397  const HcalHardcodeGeometryLoader::HECellParameters& param = fCells[iCell];
398  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
399  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
400  HcalDetId hid (HcalEndcap, param.eta*iside, iPhi, param.depth);
401  float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD; // middle of the cell
402  float etaCenter = 0.5 * (param.etaMin + param.etaMax);
403 
404  float perp = param.zMin / sinh (etaCenter);
405  float x = perp * cos (phiCenter);
406  float y = perp * sin (phiCenter);
407  float z = iside * param.zMin;
408  // make cell geometry
409  GlobalPoint refPoint (x,y,z); // center of the cell's face
410  std::vector<CCGFloat> cellParams;
411  cellParams.reserve (5);
412  cellParams.push_back (0.5 * (param.etaMax - param.etaMin)); //deta_half
413  cellParams.push_back (0.5 * param.dphi * DEGREE2RAD); // dphi_half
414  cellParams.push_back (-0.5 * (param.zMax - param.zMin) / tanh (etaCenter)); // dz_half, "-" means edges in Z
415  cellParams.push_back ( fabs( refPoint.eta() ) ) ;
416  cellParams.push_back ( fabs( refPoint.z() ) ) ;
417 #ifdef DebugLog
418  std::cout << "HcalHardcodeGeometryLoader::fillHE-> " << hid << refPoint << '/' << cellParams [0] << '/' << cellParams [1] << '/' << cellParams [2] << std::endl;
419 #endif
420  fGeometry->newCellFast(refPoint, refPoint, refPoint,
421  CaloCellGeometry::getParmPtr(cellParams,
422  fGeometry->parMgr(),
423  fGeometry->parVecVec()),
424  hid ) ;
425  }
426  }
427  }
428 }
429 
430 void HcalHardcodeGeometryLoader::fillHF (HcalGeometry* fGeometry, const std::vector <HcalHardcodeGeometryLoader::HFCellParameters>& fCells) {
431 
432  fGeometry->increaseReserve(fCells.size());
433  for (size_t iCell = 0; iCell < fCells.size(); ++iCell) {
434  const HcalHardcodeGeometryLoader::HFCellParameters& param = fCells[iCell];
435  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
436  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
437  HcalDetId hid (HcalForward, param.eta*iside, iPhi, param.depth);
438  float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD; // middle of the cell
439  GlobalPoint inner (param.rMin, 0, param.zMin);
440  GlobalPoint outer (param.rMax, 0, param.zMin);
441  float iEta = inner.eta();
442  float oEta = outer.eta();
443  float etaCenter = 0.5 * ( iEta + oEta );
444 
445  float perp = param.zMin / sinh (etaCenter);
446  float x = perp * cos (phiCenter);
447  float y = perp * sin (phiCenter);
448  float z = iside * param.zMin;
449  // make cell geometry
450  GlobalPoint refPoint (x,y,z); // center of the cell's face
451  std::vector<CCGFloat> cellParams;
452  cellParams.reserve (5);
453  cellParams.push_back (0.5 * ( iEta - oEta )); // deta_half
454  cellParams.push_back (0.5 * param.dphi * DEGREE2RAD); // dphi_half
455  cellParams.push_back (0.5 * (param.zMax - param.zMin)); // dz_half
456  cellParams.push_back ( fabs( refPoint.eta()));
457  cellParams.push_back ( fabs( refPoint.z() ) ) ;
458 #ifdef DebugLog
459  std::cout << "HcalHardcodeGeometryLoader::fillHF-> " << hid << refPoint << '/' << cellParams [0] << '/' << cellParams [1] << '/' << cellParams [2] << std::endl;
460 #endif
461  fGeometry->newCellFast(refPoint, refPoint, refPoint,
462  CaloCellGeometry::getParmPtr(cellParams,
463  fGeometry->parMgr(),
464  fGeometry->parVecVec()),
465  hid ) ;
466  }
467  }
468  }
469 }
void fillHBHO(HcalGeometry *fGeometry, const std::vector< HBHOCellParameters > &fCells, bool fHB)
unsigned int getHFSize() const
Definition: HcalTopology.h:135
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
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
virtual unsigned int numberOfShapes() const
Definition: HcalGeometry.h:43
T perp() const
Magnitude of transverse component.
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
std::vector< HBHOCellParameters > makeHBCells(const HcalTopology &topology)
void fillHE(HcalGeometry *fGeometry, const std::vector< HECellParameters > &fCells)
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
HcalHardcodeGeometryLoader(const edm::ParameterSet &)
int lastHERing() const
Definition: HcalTopology.h:90
std::vector< HECellParameters > makeHECells_H2()