CMS 3D CMS Logo

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