CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HCALProperties.cc
Go to the documentation of this file.
2 
3 //This class header
5 #include <cmath>
6 #include <iostream>
7 
8 
10 {
11  hOPi = fastDet.getParameter<double>("HCAL_PiOverE");
12  spotFrac= fastDet.getParameter<double>("HCAL_Sampling");
13 
14  // splitting of 28-th tower is taken into account (2.65-2.853-3.0)
15  double etatow_ [42] = {
16  0.000, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870, 0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.853, 3.000, 3.139, 3.314, 3.489, 3.664, 3.839, 4.013, 4.191, 4.363, 4.538, 4.716, 4.889, 5.191
17  };
18 
19  double hcalDepthLam_ [41] = {
20  8.930, 9.001, 9.132, 8.912, 8.104, 8.571, 8.852, 9.230, 9.732, 10.29, 10.95, 11.68, 12.49, 12.57, 12.63, 6.449, 5.806, 8.973, 8.934, 8.823, 8.727, 8.641, 8.565, 8.496, 8.436, 8.383, 8.346, 8.307, 8.298, 8.281, 9.442, 9.437, 9.432, 9.429, 9.432, 9.433, 9.430, 9.437, 9.442, 9.446, 9.435 };
21 
22  for (int i = 0; i < 42; i++) { etatow[i] = etatow_[i];}
23  for (int i = 0; i < 41; i++) { hcalDepthLam[i] = hcalDepthLam_[i];}
24 
25 }
26 
27 double HCALProperties::getHcalDepth(double eta) const{
28 
29  int ieta = eta2ieta(eta);
30 
31  /*
32  std::cout << " HCALProperties::getHcalDepth for eta = " << eta
33  << " returns lam.thickness = " << hcalDepthLam[ieta] << std::endl;
34  */
35 
36  return hcalDepthLam[ieta];
37 
38 }
39 
40 
41 
42 int HCALProperties::eta2ieta(double eta) const {
43  // binary search in the array of towers eta edges
44  int size = 42;
45 
46  double x = fabs(eta);
47  int curr = size / 2;
48  int step = size / 4;
49  int iter;
50  int prevdir = 0;
51  int actudir = 0;
52 
53  for (iter = 0; iter < size ; iter++) {
54 
55  if( curr >= size || curr < 1 )
56  std::cout << " HCALProperties::eta2ieta - wrong current index = "
57  << curr << " !!!" << std::endl;
58 
59  if ((x <= etatow[curr]) && (x > etatow[curr-1])) break;
60  prevdir = actudir;
61  if(x > etatow[curr]) {actudir = 1;}
62  else {actudir = -1;}
63  if(prevdir * actudir < 0) { if(step > 1) step /= 2;}
64  curr += actudir * step;
65  if(curr > size) curr = size;
66  else { if(curr < 1) {curr = 1;}}
67 
68  /*
69  std::cout << " HCALProperties::eta2ieta end of iter." << iter
70  << " curr, etatow[curr-1], etatow[curr] = "
71  << curr << " " << etatow[curr-1] << " " << etatow[curr] << std::endl;
72  */
73 
74  }
75 
76  /*
77  std::cout << " HCALProperties::eta2ieta for input x = " << x
78  << " found index = " << curr-1
79  << std::endl;
80  */
81 
82  return curr-1;
83 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
int eta2ieta(double eta) const
list step
Definition: launcher.py:15
double hcalDepthLam[41]
T eta() const
HCALProperties(const edm::ParameterSet &fastDet)
double etatow[42]
double getHcalDepth(double) const
tuple cout
Definition: gather_cfg.py:41
Definition: DDAxes.h:10
tuple size
Write out results.