CMS 3D CMS Logo

EnergyUncertaintyPhotonSpecific.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
6 
8 
10 
12  double et = energy / cosh(eta);
13 
14  constexpr int nBinsEta = 6;
15  const double EtaBins[nBinsEta + 1] = {0.0, 0.7, 1.15, 1.44, 1.56, 2.0, 2.5};
16 
17  constexpr int nBinsBrem = 6;
18  const double BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0};
19 
20  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par0 = {
21  {{{0.0232291, 0.00703187, 0.00692465, 0.00855993, 0.00795058, 0.0107494}},
22  {{0.0614866, 0.00894211, 0.0102959, 0.0128934, 0.0130199, 0.0180839}},
23  {{0.0291343, 0.00876269, 0.0120863, 0.0112655, 0.0168267, 0.0168059}},
24  {{0.158403, 0.0717431, 0.0385666, 0.0142631, 0.0421638, 0.046331}},
25  {{0.0483944, 0.0168516, 0.0243039, 0.031795, 0.0414953, 0.058031}},
26  {{0.107158, 0.021685, 0.0196619, 0.0324734, 0.0414953, 0.058031}}}};
27 
28  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par1 = {
29  {{{0., 0.646644, 0.292698, 0.280843, 0.370007, 0.276159}},
30  {{0., 0.466937, 0.313568, 0.302943, 0.505135, 0.382134}},
31  {{0., 0.375159, 0.397635, 0.856565, 0.636468, 1.09268}},
32  {{0., 1.66981, 3.6319, 8.85991, 3.1289, 1.29951}},
33  {{0., 1.19617, 0.994626, 0.875925, 0.654605, 0.292915}},
34  {{0., 0.574207, 0.940217, 0.574766, 0.654605, 0.292915}}}};
35 
36  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par2 = {
37  {{{0., -7.4698, 4.16907, 4.25527, 3.03429, 4.44532}},
38  {{0., 3.33434, 6.34301, 6.35598, 2.52964, 5.3388}},
39  {{0., 7.11411, 5.97451, -5.76122, -1.54548, -0.547554}},
40  {{0., 6.86275, -3.76633, -32.6073, -6.58653, 1.76117}},
41  {{0., -6.78666, -4.26073, 1.43183, 4.45367, 8.48307}},
42  {{0., -0.566981, -6.05845, -5.23571, 4.45367, 8.48307}}}};
43 
44  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par3 = {
45  {{{0., 5.53373e-08, 5.61149e-06, 9.6404e-07, 4.43986e-07, 2.58822e-06}},
46  {{0., 0.000114835, 2.86726e-07, 0.00190694, 0.120204, 3.59921e-07}},
47  {{0., 0.0438575, 0.0469782, 4.99993, 4.99992, 0.0952985}},
48  {{0., 0.00543544, 6.56718e-05, 0.00119538, 1.10125e-05, 0.00204206}},
49  {{0., 4.98192, 4.99984, 0.0920944, 0.030385, 0.0134321}},
50  {{0., 0.0120609, 0.000193818, 4.9419, 0.030385, 0.0134321}}}};
51 
52  int iEtaSl = -1;
53  for (int iEta = 0; iEta < nBinsEta; ++iEta) {
54  if (EtaBins[iEta] <= std::abs(eta) && std::abs(eta) < EtaBins[iEta + 1]) {
55  iEtaSl = iEta;
56  }
57  }
58 
59  int iBremSl = -1;
60  for (int iBrem = 0; iBrem < nBinsBrem; ++iBrem) {
61  if (BremBins[iBrem] <= brem && brem < BremBins[iBrem + 1]) {
62  iBremSl = iBrem;
63  }
64  }
65 
66  if (std::abs(eta) > 2.5)
67  iEtaSl = nBinsEta - 1;
68  if (brem < BremBins[0])
69  iBremSl = 0;
70  if (brem > BremBins[nBinsBrem - 1])
71  iBremSl = nBinsBrem - 1;
72 
73  float uncertainty = 0;
74  if (iBremSl >= 0 && iBremSl < nBinsBrem && iEtaSl >= 0 && iEtaSl < nBinsEta) {
75  if (et < 5)
76  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) +
77  par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl]));
78  if (et > 200)
79  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) +
80  par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl]));
81 
82  if (et > 5 && et < 200)
83  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) +
84  par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl]));
85  }
86 
87  return (uncertainty * energy);
88 }
89 
91  double et = energy / cosh(eta);
92 
93  constexpr int nBinsEta = 6;
94  const double EtaBins[nBinsEta + 1] = {0.0, 0.7, 1.15, 1.44, 1.56, 2.0, 2.5};
95 
96  constexpr int nBinsBrem = 2;
97  const double BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0};
98 
99  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par0 = {{{{0.00806753, 0.00899298}},
100  {{0.00880649, 0.00972275}},
101  {{0.0101474, 0.0109109}},
102  {{0.00343003, 0.0372159}},
103  {{0.0192411, 0.0195124}},
104  {{0.0203644, 0.0198718}}}};
105 
106  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par1 = {{{{0.143754, 0.10159}},
107  {{0.0716169, 0.0752675}},
108  {{-0.332171, 0.0425903}},
109  {{11.5791, 1.44028}},
110  {{0.0511006, 0.104321}},
111  {{-0.050789, 0.106859}}}};
112 
113  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par2 = {{{{-0.00368104, 4.70884}},
114  {{5.23856, 3.35623}},
115  {{-31.8456, 6.52561}},
116  {{-112.084, -40.}},
117  {{7.56304, 5.71476}},
118  {{-7.96854, 3.54235}}}};
119 
120  constexpr std::array<std::array<float, nBinsBrem>, nBinsEta> par3 = {{{{0.219829, 9.07419e-08}},
121  {{0.00632907, 2.49397e-07}},
122  {{22.543, 2.18593e-08}},
123  {{-863.968, 0.00102639}},
124  {{0.00331583, 6.12472e-06}},
125  {{4.71223, 6.89631e-06}}}};
126 
127  int iEtaSl = -1;
128  for (int iEta = 0; iEta < nBinsEta; ++iEta) {
129  if (EtaBins[iEta] <= std::abs(eta) && std::abs(eta) < EtaBins[iEta + 1]) {
130  iEtaSl = iEta;
131  }
132  }
133 
134  int iBremSl = -1;
135  for (int iBrem = 0; iBrem < nBinsBrem; ++iBrem) {
136  if (BremBins[iBrem] <= brem && brem < BremBins[iBrem + 1]) {
137  iBremSl = iBrem;
138  }
139  }
140 
141  if (std::abs(eta) > 2.5)
142  iEtaSl = nBinsEta - 1;
143  if (brem < BremBins[0])
144  iBremSl = 0;
145  if (brem > BremBins[nBinsBrem - 1])
146  iBremSl = nBinsBrem - 1;
147 
148  float uncertainty = 0;
149  if (iBremSl >= 0 && iBremSl < nBinsBrem && iEtaSl >= 0 && iEtaSl < nBinsEta) {
150  if (et < 5)
151  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) +
152  par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl]));
153  else if (et > 200)
154  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) +
155  par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl]));
156  else if (et >= 5 && et <= 200)
157  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) +
158  par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl]));
159  }
160 
161  return (uncertainty * energy);
162 }
double computePhotonEnergyUncertainty_highR9(double eta, double brem, double energy)
Definition: config.py:1
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double computePhotonEnergyUncertainty_lowR9(double eta, double brem, double energy)
EnergyUncertaintyPhotonSpecific(const edm::ParameterSet &config)
void init(const edm::EventSetup &theEventSetup)