CMS 3D CMS Logo

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