test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HCALResponse.cc
Go to the documentation of this file.
1 //updated by Reza Goldouzian
2 //FastSimulation headers
6 
7 // CMSSW Headers
10 
11 #include <iostream>
12 #include <vector>
13 #include <string>
14 #include <math.h>
15 
16 using namespace edm;
17 
19  //switches
20  debug = pset.getParameter<bool>("debug");
21  usemip = pset.getParameter<bool>("usemip");
22 
23  //values for "old" response parameterizations
24  //--------------------------------------------------------------------
25  RespPar[HCAL][0][0] = pset.getParameter<double>("HadronBarrelResolution_Stochastic");
26  RespPar[HCAL][0][1] = pset.getParameter<double>("HadronBarrelResolution_Constant");
27  RespPar[HCAL][0][2] = pset.getParameter<double>("HadronBarrelResolution_Noise");
28 
29  RespPar[HCAL][1][0] = pset.getParameter<double>("HadronEndcapResolution_Stochastic");
30  RespPar[HCAL][1][1] = pset.getParameter<double>("HadronEndcapResolution_Constant");
31  RespPar[HCAL][1][2] = pset.getParameter<double>("HadronEndcapResolution_Noise");
32 
33  RespPar[VFCAL][0][0] = pset.getParameter<double>("HadronForwardResolution_Stochastic");
34  RespPar[VFCAL][0][1] = pset.getParameter<double>("HadronForwardResolution_Constant");
35  RespPar[VFCAL][0][2] = pset.getParameter<double>("HadronForwardResolution_Noise");
36 
37  RespPar[VFCAL][1][0] = pset.getParameter<double>("ElectronForwardResolution_Stochastic");
38  RespPar[VFCAL][1][1] = pset.getParameter<double>("ElectronForwardResolution_Constant");
39  RespPar[VFCAL][1][2] = pset.getParameter<double>("ElectronForwardResolution_Noise");
40 
41  eResponseScale[0] = pset.getParameter<double>("eResponseScaleHB");
42  eResponseScale[1] = pset.getParameter<double>("eResponseScaleHE");
43  eResponseScale[2] = pset.getParameter<double>("eResponseScaleHF");
44 
45  eResponsePlateau[0] = pset.getParameter<double>("eResponsePlateauHB");
46  eResponsePlateau[1] = pset.getParameter<double>("eResponsePlateauHE");
47  eResponsePlateau[2] = pset.getParameter<double>("eResponsePlateauHF");
48 
49  eResponseExponent = pset.getParameter<double>("eResponseExponent");
50  eResponseCoefficient = pset.getParameter<double>("eResponseCoefficient");
51 
52  //pion parameters
53  //--------------------------------------------------------------------
54  //energy values
55  maxHDe[0] = pset.getParameter<int>("maxHBe");
56  maxHDe[1] = pset.getParameter<int>("maxHEe");
57  maxHDe[2] = pset.getParameter<int>("maxHFe");
58  maxHDe[3] = pset.getParameter<int>("maxHFlowe");
59 
60  eGridHD[0] = pset.getParameter<vec1>("eGridHB");
61  eGridHD[1] = pset.getParameter<vec1>("eGridHE");
62  eGridHD[2] = pset.getParameter<vec1>("eGridHF");
63  eGridHD[3] = pset.getParameter<vec1>("loweGridHF");
64 
65  //region eta indices calculated from eta values
66  etaStep = pset.getParameter<double>("etaStep");
67  //eta boundaries
68  HDeta[0] = abs((int)(pset.getParameter<double>("HBeta") / etaStep));
69  HDeta[1] = abs((int)(pset.getParameter<double>("HEeta") / etaStep));
70  HDeta[2] = abs((int)(pset.getParameter<double>("HFeta") / etaStep));
71  HDeta[3] = abs((int)(pset.getParameter<double>("maxHDeta") / etaStep)); //add 1 because this is the max index
72  //eta ranges
73  maxHDetas[0] = HDeta[1] - HDeta[0];
74  maxHDetas[1] = HDeta[2] - HDeta[1];
75  maxHDetas[2] = HDeta[3] - HDeta[2];
76 
77  //parameter info
78  nPar = pset.getParameter<int>("nPar");
79  parNames = pset.getParameter<std::vector<std::string> >("parNames");
80  std::string detNames[] = {"_HB","_HE","_HF"};
81  std::string mipNames[] = {"_mip","_nomip",""};
82  std::string fraction="f";
83  //setup parameters (5D vector)
84  parameters = vec5(nPar,vec4(3,vec3(3)));
85  for(int p = 0; p < nPar; p++){ //loop over parameters
86  for(int m = 0; m < 3; m++){ //loop over mip, nomip, total
87  for(int d = 0; d < 3; d++){ //loop over dets: HB, HE, HF
88  //get from python
89  std::string pname = parNames[p] + detNames[d] + mipNames[m];
90  vec1 tmp = pset.getParameter<vec1>(pname);
91 
92  //resize vector for energy range of det d
93  parameters[p][m][d].resize(maxHDe[d]);
94 
95  for(int i = 0; i < maxHDe[d]; i++){ //loop over energy for det d
96  //resize vector for eta range of det d
97  parameters[p][m][d][i].resize(maxHDetas[d]);
98 
99  for(int j = 0; j < maxHDetas[d]; j++){ //loop over eta for det d
100  //fill in parameters vector from python
101  parameters[p][m][d][i][j] = tmp[i*maxHDetas[d] + j];
102  }
103  }
104  }
105  }
106  }
107  //set up Poisson parameters for low energy Hadrons in HF
108  //----------------------------------------------------------------------
109  PoissonParameters= vec3(4);
110  std::string PoissonParName[] = {"mean_overall","shift_overall","mean_between","shift_between"};
111  for(int d = 0; d < 4; d++){ //loop over Poisson parameteres
112  vec1 tmp1 = pset.getParameter<vec1>(PoissonParName[d]);
113  for(int i = 0; i < maxHDe[3]; i++){ //loop over energy for low HF energy points
114  PoissonParameters[d].resize(maxHDe[3]);
115  for(int j = 0; j < maxHDetas[2]; j++){ //loop over HF eta points
116  PoissonParameters[d][i].resize(maxHDetas[2]);
117  PoissonParameters[d][i][j]= tmp1[i*maxHDetas[2] + j];
118  }
119  }
120  }
121 
122 
123  //MIP fraction fill in 3d vector
125  mipfraction = vec3(3);
126  for(int d = 0; d < 3; d++){ //loop over dets: HB, HE, HF
127  //get from python
128  std::string mipname = fraction + mipNames[0] + detNames[d] ;
129  vec1 tmp1 = pset.getParameter<vec1>(mipname);
130  mipfraction[d].resize(maxHDe[d]);
131  for(int i = 0; i < maxHDe[d]; i++){ //loop over energy for det d
132  //resize vector for eta range of det d
133  mipfraction[d][i].resize(maxHDetas[d]);
134  for(int j = 0; j < maxHDetas[d]; j++){ //loop over eta for det d
135  //fill in parameters vector from python
136  mipfraction[d][i][j]= tmp1[i*maxHDetas[d] + j];
137  }
138  }
139  }
140 
141  // MUON probability histos for bin size = 0.25 GeV (0-10 GeV, 40 bins)
142  //--------------------------------------------------------------------
143  muStep = pset.getParameter<double>("muStep");
144  maxMUe = pset.getParameter<int>("maxMUe");
145  maxMUeta = pset.getParameter<int>("maxMUeta");
146  maxMUbin = pset.getParameter<int>("maxMUbin");
147  eGridMU = pset.getParameter<vec1>("eGridMU");
148  etaGridMU = pset.getParameter<vec1>("etaGridMU");
149  vec1 _responseMU[2] = {pset.getParameter<vec1>("responseMUBarrel"),pset.getParameter<vec1>("responseMUEndcap")};
150 
151  //get muon region eta indices from the eta grid
152  double _barrelMUeta = pset.getParameter<double>("barrelMUeta");
153  double _endcapMUeta = pset.getParameter<double>("endcapMUeta");
154  barrelMUeta = endcapMUeta = maxMUeta;
155  for(int i = 0; i < maxMUeta; i++) {
156  if(fabs(_barrelMUeta) <= etaGridMU[i]) { barrelMUeta = i; break; }
157  }
158  for(int i = 0; i < maxMUeta; i++) {
159  if(fabs(_endcapMUeta) <= etaGridMU[i]) { endcapMUeta = i; break; }
160  }
161  int maxMUetas[] = {endcapMUeta - barrelMUeta, maxMUeta - endcapMUeta};
162 
163  //initialize 3D vector
164  responseMU = vec3(maxMUe,vec2(maxMUeta,vec1(maxMUbin,0)));
165 
166  //fill in 3D vector
167  //(complementary cumulative distribution functions, from normalized response distributions)
168  int loc, eta_loc;
169  loc = eta_loc = -1;
170  for(int i = 0; i < maxMUe; i++){
171  for(int j = 0; j < maxMUeta; j++){
172  //check location - barrel, endcap, or forward
173  if(j==barrelMUeta) {loc = 0; eta_loc = barrelMUeta;}
174  else if(j==endcapMUeta) {loc = 1; eta_loc = endcapMUeta;}
175 
176  for(int k = 0; k < maxMUbin; k++){
177  responseMU[i][j][k] = _responseMU[loc][i*maxMUetas[loc]*maxMUbin + (j-eta_loc)*maxMUbin + k];
178 
179  if(debug) {
180  //cout.width(6);
181  LogInfo("FastCalorimetry") << " responseMU " << i << " " << j << " " << k << " = "
182  << responseMU[i][j][k] << std::endl;
183  }
184  }
185  }
186  }
187 
188  // values for EM response in HF
189  //--------------------------------------------------------------------
190  maxEMe = pset.getParameter<int>("maxEMe");
191  maxEMeta = maxHDetas[2];
192  respFactorEM = pset.getParameter<double>("respFactorEM");
193  eGridEM = pset.getParameter<vec1>("eGridEM");
194 
195  // e-gamma mean response and sigma in HF
196  vec1 _meanEM = pset.getParameter<vec1>("meanEM");
197  vec1 _sigmaEM = pset.getParameter<vec1>("sigmaEM");
198 
199  //fill in 2D vectors (w/ correction factor applied)
200  meanEM = vec2(maxEMe,vec1(maxEMeta,0));
201  sigmaEM = vec2(maxEMe,vec1(maxEMeta,0));
202  for(int i = 0; i < maxEMe; i++){
203  for(int j = 0; j < maxEMeta; j++){
204  meanEM[i][j] = respFactorEM * _meanEM[i*maxEMeta + j];
205  sigmaEM[i][j] = respFactorEM * _sigmaEM[i*maxEMeta + j];
206  }
207  }
208 
209  // HF correction for SL
210  //---------------------
211  maxEta = pset.getParameter<int>("maxEta");
212  maxEne = pset.getParameter<int>("maxEne");
213  energyHF = pset.getParameter<vec1>("energyHF");
214  corrHFg = pset.getParameter<vec1>("corrHFg");
215  corrHFh = pset.getParameter<vec1>("corrHFh");
216  corrHF = vec1(maxEta,0);
217 }
218 
219 double HCALResponse::getMIPfraction(double energy, double eta){
220  int ieta = abs((int)(eta / etaStep)) ;
221  int ie = -1;
222  //check eta and det
223  int det = getDet(ieta);
224  int deta = ieta - HDeta[det];
225  if(deta >= maxHDetas[det]) deta = maxHDetas[det] - 1;
226  else if(deta < 0 ) deta = 0;
227  //find energy range
228  for (int i = 0; i < maxHDe[det]; i++) {
229  if(energy < eGridHD[det][i]) {
230  if(i == 0) return mipfraction [det][0][deta]; // less than minimal - the first value is used instead of extrapolating
231  else ie = i-1;
232  break;
233  }
234  }
235  if(ie == -1) return mipfraction [det][maxHDe[det]-1][deta]; // more than maximal - the last value is used instead of extrapolating
236  double y1, y2;
237  double x1 = eGridHD[det][ie];
238  double x2 = eGridHD[det][ie+1];
239  y1=mipfraction[det][ie][deta];
240  y2=mipfraction[det][ie+1][deta];
241  double mean = 0;
242  mean=(y1*(x2-energy) + y2*(energy-x1))/(x2-x1);
243  return mean;
244 }
245 
246 double HCALResponse::responseHCAL(int _mip, double energy, double eta, int partype, RandomEngineAndDistribution const* random) {
247 
248 
249  int ieta = abs((int)(eta / etaStep)) ;
250  int ie = -1;
251 
252  int mip;
253  if(usemip) mip = _mip;
254  else mip = 2; //ignore mip, use only overall (mip + nomip) parameters
255 
256  double mean = 0;
257 
258  // e/gamma in HF
259  if(partype == 0) {
260  //check eta
261  ieta -= HDeta[2]; // HF starts at ieta=30 till ieta=51
262  // but resp.vector from index=0 through 20
263  if(ieta >= maxEMeta ) ieta = maxEMeta-1;
264  else if(ieta < 0) ieta = 0;
265 
266  //find energy range
267  for (int i = 0; i < maxEMe; i++) {
268  if(energy < eGridEM[i]) {
269  if(i == 0) ie = 0; // less than minimal - back extrapolation with the 1st interval
270  else ie = i-1;
271  break;
272  }
273  }
274  if(ie == -1) ie = maxEMe - 2; // more than maximum - extrapolation with last interval
275 
276  //do smearing
277  mean = interEM(energy, ie, ieta, random);
278  }
279 
280  // hadrons
281  else if(partype == 1) {
282  //check eta and det
283  int det = getDet(ieta);
284  int deta = ieta - HDeta[det];
285  if(deta >= maxHDetas[det]) deta = maxHDetas[det] - 1;
286  else if(deta < 0 ) deta = 0;
287 
288  //find energy range
289  for (int i = 0; i < maxHDe[det]; i++) {
290  if(energy < eGridHD[det][i]) {
291  if(i == 0) ie = 0; // less than minimal - back extrapolation with the 1st interval
292  else ie = i-1;
293  break;
294  }
295  }
296  if(ie == -1) ie = maxHDe[det] - 2; // more than maximum - extrapolation with last interval
297 
298  //different energy smearing for low energy hadrons in HF
299  if(det==2 && energy <20 && deta>5){
300  for (int i = 0; i < maxHDe[3]; i++) {
301  if(energy < eGridHD[3][i]) {
302  if(i == 0) ie = 0; // less than minimal - back extrapolation with the 1st interval
303  else ie = i-1;
304  break;
305  }
306  }
307  }
308  //do smearing
309  mean = interHD(mip, energy, ie, deta, det, random);
310  }
311 
312 
313  // muons
314  else if(partype == 2) {
315  //check eta
316  ieta = maxMUeta;
317  for(int i = 0; i < maxMUeta; i++) {
318  if(fabs(eta) < etaGridMU[i]) {
319  ieta = i;
320  break;
321  }
322  }
323  if(ieta < 0) ieta = 0;
324 
325  if(ieta < maxMUeta) { // HB-HE
326  //find energy range
327  for (int i = 0; i < maxMUe; i++) {
328  if(energy < eGridMU[i]) {
329  if(i == 0) ie = 0; // less than minimal - back extrapolation with the 1st interval
330  else ie = i-1;
331  break;
332  }
333  }
334  if(ie == -1) ie = maxMUe - 2; // more than maximum - extrapolation with last interval
335 
336  //do smearing
337  mean = interMU(energy, ie, ieta, random);
338  if(mean > energy) mean = energy;
339  }
340  }
341 
342  // debugging
343  if(debug) {
344  // cout.width(6);
345  LogInfo("FastCalorimetry") << std::endl
346  << " HCALResponse::responseHCAL, partype = " << partype
347  << " E, eta = " << energy << " " << eta
348  << " mean = " << mean << std::endl;
349  }
350 
351  return mean;
352 }
353 
354 double HCALResponse::interMU(double e, int ie, int ieta, RandomEngineAndDistribution const* random) {
355  double x = random->flatShoot();
356 
357  int bin1 = maxMUbin;
358  for(int i = 0; i < maxMUbin; i++) {
359  if(x > responseMU[ie][ieta][i]) {
360  bin1 = i-1;
361  break;
362  }
363  }
364  int bin2 = maxMUbin;
365  for(int i = 0; i < maxMUbin; i++) {
366  if(x > responseMU[ie+1][ieta][i]) {
367  bin2 = i-1;
368  break;
369  }
370  }
371 
372  double x1 = eGridMU[ie];
373  double x2 = eGridMU[ie+1];
374  double y1 = (bin1 + random->flatShoot()) * muStep;
375  double y2 = (bin2 + random->flatShoot()) * muStep;
376 
377  if(debug) {
378  // cout.width(6);
379  LogInfo("FastCalorimetry") << std::endl
380  << " HCALResponse::interMU " << std::endl
381  << " x, x1-x2, y1-y2 = "
382  << e << ", " << x1 <<"-" << x2 << " " << y1 <<"-" << y2 << std::endl;
383 
384  }
385 
386  //linear interpolation
387  double mean = (y1*(x2-e) + y2*(e-x1))/(x2-x1);
388 
389  if(debug) {
390  //cout.width(6);
391  LogInfo("FastCalorimetry") << std::endl
392  << " HCALResponse::interMU " << std::endl
393  << " e, ie, ieta = " << e << " " << ie << " " << ieta << std::endl
394  << " response = " << mean << std::endl;
395  }
396 
397  return mean;
398 }
399 
400 double HCALResponse::interHD(int mip, double e, int ie, int ieta, int det, RandomEngineAndDistribution const* random) {
401  double x1, x2;
402  double y1, y2;
403  if(det==2) mip=2; //ignore mip status for HF
404  double mean = 0;
405  vec1 pars(nPar,0);
406 
407  // for ieta < 5 there is overlap between HE and HF, and measurement comes from HE
408  if (det==2 && ieta>5 && e<20){
409 
410  for(int p = 0; p < 4; p++){
411  y1=PoissonParameters[p][ie][ieta];
412  y2=PoissonParameters[p][ie+1][ieta];
413  if(e>5){
414  x1 = eGridHD[det+1][ie];
415  x2 = eGridHD[det+1][ie+1];
416  pars[p] = (y1*(x2-e) + y2*(e-x1))/(x2-x1);
417  }
418  else pars[p] = y1;
419  }
420  mean =random->poissonShoot((int (PoissonShootNoNegative(pars[0],pars[1],random))+(int (PoissonShootNoNegative(pars[2],pars[3],random)))/4+random->flatShoot()/4) *6)/(0.3755*6);
421  }
422 
423  else{
424 
425  x1 = eGridHD[det][ie];
426  x2 = eGridHD[det][ie+1];
427 
428  //calculate all parameters
429  for(int p = 0; p < nPar; p++){
430  y1 = parameters[p][mip][det][ie][ieta];
431  y2 = parameters[p][mip][det][ie+1][ieta];
432 
433  //par-specific checks
434  double custom = 0;
435  bool use_custom = false;
436 
437  //do not let mu or sigma get extrapolated below zero for low energies
438  //especially important for HF since extrapolation is used for E < 15 GeV
439  if((p==0 || p==1) && e < x1){
440  double tmp = (y1*x2-y2*x1)/(x2-x1); //extrapolate down to e=0
441  if(tmp<0) { //require mu,sigma > 0 for E > 0
442  custom = y1*e/x1;
443  use_custom = true;
444  }
445  }
446  //tail parameters have lower bounds - never extrapolate down
447  else if((p==2 || p==3 || p==4 || p==5)){
448  if(e < x1 && y1 < y2){
449  custom = y1;
450  use_custom = true;
451  }
452  else if(e > x2 && y2 < y1){
453  custom = y2;
454  use_custom = true;
455  }
456  }
457 
458  //linear interpolation
459  if(use_custom) pars[p] = custom;
460  else pars[p] = (y1*(x2-e) + y2*(e-x1))/(x2-x1);
461  }
462 
463  //random smearing
464  if(nPar==6) mean = cballShootNoNegative(pars[0],pars[1],pars[2],pars[3],pars[4],pars[5], random);
465  else if(nPar==2) mean = gaussShootNoNegative(pars[0],pars[1], random); //gaussian fallback
466  }
467  return mean;
468 }
469 
470 
471 double HCALResponse::interEM(double e, int ie, int ieta, RandomEngineAndDistribution const* random) {
472  double y1 = meanEM[ie][ieta];
473  double y2 = meanEM[ie+1][ieta];
474  double x1 = eGridEM[ie];
475  double x2 = eGridEM[ie+1];
476 
477  if(debug) {
478  // cout.width(6);
479  LogInfo("FastCalorimetry") << std::endl
480  << " HCALResponse::interEM mean " << std::endl
481  << " x, x1-x2, y1-y2 = "
482  << e << ", " << x1 <<"-" << x2 << " " << y1 <<"-" << y2 << std::endl;
483  }
484 
485  //linear interpolation
486  double mean = (y1*(x2-e) + y2*(e-x1))/(x2-x1);
487 
488  y1 = sigmaEM[ie][ieta];
489  y2 = sigmaEM[ie+1][ieta];
490 
491  if(debug) {
492  // cout.width(6);
493  LogInfo("FastCalorimetry") << std::endl
494  << " HCALResponse::interEM sigma" << std::endl
495  << " x, x1-x2, y1-y2 = "
496  << e << ", " << x1 <<"-" << x2 << " " << y1 <<"-" << y2 << std::endl;
497  }
498 
499  //linear interpolation
500  double sigma = (y1*(x2-e) + y2*(e-x1))/(x2-x1);
501 
502  //random smearing
503  double rndm = gaussShootNoNegative(mean, sigma, random);
504 
505  return rndm;
506 }
507 
508 // Old parameterization of the calo response to hadrons
510  //response
511  double s = eResponseScale[hit];
512  double n = eResponseExponent;
513  double p = eResponsePlateau[hit];
514  double c = eResponseCoefficient;
515 
516  double response = e * p / (1+c*exp(n * log(s/e)));
517 
518  if(response<0.) response = 0.;
519 
520  //resolution
521  double resolution;
522  if(hit==hcforward)
523  resolution = e *sqrt( RespPar[VFCAL][1][0]*RespPar[VFCAL][1][0] / e + RespPar[VFCAL][1][1]*RespPar[VFCAL][1][1] );
524  else
525  resolution = e * sqrt( RespPar[HCAL][hit][0]*RespPar[HCAL][hit][0]/(e) + RespPar[HCAL][hit][1]*RespPar[HCAL][hit][1] );
526 
527  //random smearing
528  double rndm = gaussShootNoNegative(response, resolution, random);
529 
530  return rndm;
531 }
532 
533 //find subdet and eta offset
534 int HCALResponse::getDet(int ieta){
535  int d;
536  for(d = 0; d < 2; d++){
537  if(ieta < HDeta[d+1]){
538  break;
539  }
540  }
541  return d;
542 }
543 
544 // Remove (most) hits with negative energies
546  double out = random->gaussShoot(e,sigma);
547  if (e >= 0.) {
548  while (out < 0.) out = random->gaussShoot(e,sigma);
549  }
550  //else give up on re-trying, otherwise too much time can be lost before emeas comes out positive
551 
552  return out;
553 }
554 
555 // Remove (most) hits with negative energies
556 double HCALResponse::cballShootNoNegative(double mu, double sigma, double aL, double nL, double aR, double nR,
558  double out = cball.shoot(mu,sigma,aL,nL,aR,nR, random);
559  if (mu >= 0.) {
560  while (out < 0.) out = cball.shoot(mu,sigma,aL,nL,aR,nR, random);
561  }
562  //else give up on re-trying, otherwise too much time can be lost before emeas comes out positive
563 
564  return out;
565 }
567  double out = -1;
568  while (out < 0.) {
569  out = random->poissonShoot(e);
570  out = out + sigma;
571  }
572  return out;
573 
574 }
575 
576 void HCALResponse::correctHF(double ee, int type) {
577 
578  int jmin = 0;
579  for (int i = 0; i < maxEne; i++) {
580  if(ee >= energyHF[i]) jmin = i;
581  }
582 
583  double x1, x2, y1, y2;
584  for(int i=0; i<maxEta; ++i) {
585  if(ee < energyHF[0]) {
586  if(abs(type)==11 || abs(type)==22) corrHF[i] = corrHFg[i];
587  else corrHF[i] = corrHFh[i];
588  } else if(jmin >= maxEne-1) {
589  if(abs(type)==11 || abs(type)==22) corrHF[i] = corrHFg[maxEta*jmin+i];
590  else corrHF[i] = corrHFh[maxEta*jmin+i];
591  } else {
592  x1 = energyHF[jmin];
593  x2 = energyHF[jmin+1];
594  if(abs(type)==11 || abs(type)==22) {
595  y1 = corrHFg[maxEta*jmin+i];
596  y2 = corrHFg[maxEta*(jmin+1)+i];
597  } else {
598  y1 = corrHFh[maxEta*jmin+i];
599  y2 = corrHFh[maxEta*(jmin+1)+i];
600  }
601  corrHF[i] = y1 + (ee-x1)*((y2-y1)/(x2-x1));
602  }
603  }
604 
605 }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
double responseHCAL(int _mip, double energy, double eta, int partype, RandomEngineAndDistribution const *)
double flatShoot(double xmin=0.0, double xmax=1.0) const
int getDet(int ieta)
double getHCALEnergyResponse(double e, int hit, RandomEngineAndDistribution const *)
double interEM(double e, int ie, int ieta, RandomEngineAndDistribution const *)
void correctHF(double e, int type)
double maxEta
TRandom random
Definition: MVATrainer.cc:138
tuple d
Definition: ztail.py:151
T x() const
Cartesian x coordinate.
double PoissonShootNoNegative(double e, double sigma, RandomEngineAndDistribution const *)
std::vector< vec4 > vec5
Definition: HCALResponse.h:19
std::vector< vec2 > vec3
Definition: HCALResponse.h:17
std::vector< double > vec1
Definition: HCALResponse.h:15
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double getMIPfraction(double energy, double eta)
double interHD(int mip, double e, int ie, int ieta, int det, RandomEngineAndDistribution const *)
int j
Definition: DBlmapReader.cc:9
std::vector< vec3 > vec4
Definition: HCALResponse.h:18
const int mu
Definition: Constants.h:22
#define debug
Definition: HDRShower.cc:19
double interMU(double e, int ie, int ieta, RandomEngineAndDistribution const *)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double gaussShoot(double mean=0.0, double sigma=1.0) const
unsigned int poissonShoot(double mean) const
HCALResponse(const edm::ParameterSet &pset)
Definition: HCALResponse.cc:18
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
double gaussShootNoNegative(double e, double sigma, RandomEngineAndDistribution const *)
double cballShootNoNegative(double mu, double sigma, double aL, double nL, double aR, double nR, RandomEngineAndDistribution const *)