CMS 3D CMS Logo

HcalPulseShapes.cc
Go to the documentation of this file.
14 #include "CLHEP/Random/RandFlat.h"
15 
16 // #include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
17 #include <cmath>
18 #include <iostream>
19 #include <fstream>
20 #include "TMath.h"
21 
23 : theMCParams(0),
24  theTopology(0),
25  theRecoParams(0),
26  theShapes()
27 {
28 /*
29 
30 Reco MC
31 --------------------------------------------------------------------------------------
32 000 not used (reserved)
33 101 101 hpdShape_ HPD (original version)
34 102 102 =101 HPD BV 30 volts in HBP iphi54
35 103 123 hpdShape_v2, hpdShapeMC_v2 HPD (2011. oct version)
36 104 124 hpdBV30Shape_v2, hpdBV30ShapeMC_v2 HPD bv30 in HBP iph54
37 105 125 hpdShape_v2, hpdShapeMC_v2 HPD (2011.11.12 version)
38 201 201 siPMShape_ SiPMs Zecotec shape (HO)
39 202 202 =201, SiPMs Hamamatsu shape (HO)
40 203 203 siPMShape2017_ SiPMs Hamamatsu shape (HE 2017)
41 205 205 siPMShapeData2017_ SiPMs from Data (HE data 2017)
42 301 301 hfShape_ regular HF PMT shape
43 401 401 regular ZDC shape
44 --------------------------------------------------------------------------------------
45 
46 */
47 
48 
49  float ts1, ts2, ts3, thpd, tpre, wd1, wd2, wd3;
50 
51  // HPD Shape Version 1 (used before CMSSW5, until Oct 2011)
52  ts1=8. ; ts2=10. ; ts3=29.3; thpd=4.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0;
53  computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShape_);
54  theShapes[101] = &hpdShape_;
55  theShapes[102] = theShapes[101];
56 
57  // HPD Shape Version 2 for CMSSW 5. Nov 2011 (RECO and MC separately)
58  ts1=8. ; ts2=10. ; ts3=25.0; thpd=4.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0;
59  computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShape_v2);
60  theShapes[103] = &hpdShape_v2;
61 
62  ts1=8. ; ts2=10. ; ts3=29.3; thpd=4.0; tpre=7.0; wd1=2.0; wd2=0.7; wd3=1.0;
63  computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShapeMC_v2);
64  theShapes[123] = &hpdShapeMC_v2;
65 
66  // HPD Shape Version 3 for CMSSW 5. Nov 2011 (RECO and MC separately)
67  ts1=8. ; ts2=19. ; ts3=29.3; thpd=4.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=0.32;
68  computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShape_v3);
69  theShapes[105] = &hpdShape_v3;
70 
71  ts1=8. ; ts2=10. ; ts3=22.3; thpd=4.0; tpre=7.0; wd1=2.0; wd2=0.7; wd3=1.0;
72  computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdShapeMC_v3);
73  theShapes[125] = &hpdShapeMC_v3;
74 
75  // HPD with Bias Voltage 30 volts, wider pulse. (HBPlus iphi54)
76 
77  ts1=8. ; ts2=12. ; ts3=31.7; thpd=9.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0;
78  computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdBV30Shape_v2);
79  theShapes[104] = &hpdBV30Shape_v2;
80 
81  ts1=8. ; ts2=12. ; ts3=31.7; thpd=9.0; tpre=9.0; wd1=2.0; wd2=0.7; wd3=1.0;
82  computeHPDShape(ts1,ts2,ts3,thpd,tpre,wd1,wd2,wd3, hpdBV30ShapeMC_v2);
84 
85  // HF and SiPM
86 
91 
92  theShapes[201] = &siPMShape_;
93  theShapes[202] = theShapes[201];
94  theShapes[203] = &siPMShape2017_;
96  theShapes[301] = &hfShape_;
97  //theShapes[401] = new CaloCachedShapeIntegrator(&theZDCShape);
98 
99 }
100 
101 
103  if (theMCParams) delete theMCParams;
104  if (theRecoParams) delete theRecoParams;
105  if (theTopology) delete theTopology;
106 }
107 
108 
110 {
112  es.get<HcalMCParamsRcd>().get(p);
113  theMCParams = new HcalMCParams(*p.product());
114 
116  es.get<HcalRecNumberingRecord>().get(htopo);
117  theTopology=new HcalTopology(*htopo);
119 
121  es.get<HcalRecoParamsRcd>().get(q);
124 }
125 
126 
128 {
129  if (theMCParams) delete theMCParams;
130  if (theRecoParams) delete theRecoParams;
131  if (theTopology) delete theTopology;
132 
133 
134  theMCParams = 0;
135  theRecoParams = 0;
136  theTopology = 0;
137 }
138 
139 
140 //void HcalPulseShapes::computeHPDShape()
141 void HcalPulseShapes::computeHPDShape(float ts1, float ts2, float ts3, float thpd, float tpre,
142  float wd1, float wd2, float wd3, Shape &tmphpdShape_)
143 {
144 
145 // pulse shape time constants in ns
146 /*
147  const float ts1 = 8.; // scintillation time constants : 1,2,3
148  const float ts2 = 10.;
149  const float ts3 = 29.3;
150  const float thpd = 4.; // HPD current collection drift time
151  const float tpre = 9.; // preamp time constant (refit on TB04 data)
152 
153  const float wd1 = 2.; // relative weights of decay exponents
154  const float wd2 = 0.7;
155  const float wd3 = 1.;
156 */
157  // pulse shape components over a range of time 0 ns to 255 ns in 1 ns steps
158  unsigned int nbin = 256;
159  tmphpdShape_.setNBin(nbin);
160  std::vector<float> ntmp(nbin,0.0); // zeroing output pulse shape
161  std::vector<float> nth(nbin,0.0); // zeroing HPD drift shape
162  std::vector<float> ntp(nbin,0.0); // zeroing Binkley preamp shape
163  std::vector<float> ntd(nbin,0.0); // zeroing Scintillator decay shape
164 
165  unsigned int i,j,k;
166  float norm;
167 
168  // HPD starts at I and rises to 2I in thpd of time
169  norm=0.0;
170  for(j=0;j<thpd && j<nbin;j++){
171  nth[j] = 1.0 + ((float)j)/thpd;
172  norm += nth[j];
173  }
174  // normalize integrated current to 1.0
175  for(j=0;j<thpd && j<nbin;j++){
176  nth[j] /= norm;
177  }
178 
179  // Binkley shape over 6 time constants
180  norm=0.0;
181  for(j=0;j<6*tpre && j<nbin;j++){
182  ntp[j] = ((float)j)*exp(-((float)(j*j))/(tpre*tpre));
183  norm += ntp[j];
184  }
185  // normalize pulse area to 1.0
186  for(j=0;j<6*tpre && j<nbin;j++){
187  ntp[j] /= norm;
188  }
189 
190 // ignore stochastic variation of photoelectron emission
191 // <...>
192 
193 // effective tile plus wave-length shifter decay time over 4 time constants
194  unsigned int tmax = 6 * (int)ts3;
195 
196  norm=0.0;
197  for(j=0;j<tmax && j<nbin;j++){
198  ntd[j] = wd1 * exp(-((float)j)/ts1) +
199  wd2 * exp(-((float)j)/ts2) +
200  wd3 * exp(-((float)j)/ts3) ;
201  norm += ntd[j];
202  }
203  // normalize pulse area to 1.0
204  for(j=0;j<tmax && j<nbin;j++){
205  ntd[j] /= norm;
206  }
207 
208  unsigned int t1,t2,t3,t4;
209  for(i=0;i<tmax && i<nbin;i++){
210  t1 = i;
211  // t2 = t1 + top*rand;
212  // ignoring jitter from optical path length
213  t2 = t1;
214  for(j=0;j<thpd && j<nbin;j++){
215  t3 = t2 + j;
216  for(k=0;k<4*tpre && k<nbin;k++){ // here "4" is set deliberately,
217  t4 = t3 + k; // as in test fortran toy MC ...
218  if(t4<nbin){
219  unsigned int ntb=t4;
220  ntmp[ntb] += ntd[i]*nth[j]*ntp[k];
221  }
222  }
223  }
224  }
225 
226  // normalize for 1 GeV pulse height
227  norm = 0.;
228  for(i=0;i<nbin;i++){
229  norm += ntmp[i];
230  }
231 
232  for(i=0; i<nbin; i++){
233  ntmp[i] /= norm;
234  }
235 
236  for(i=0; i<nbin; i++){
237  tmphpdShape_.setShapeBin(i,ntmp[i]);
238  }
239 }
240 
242  // first create pulse shape over a range of time 0 ns to 255 ns in 1 ns steps
243  unsigned int nbin = 256;
244  hfShape_.setNBin(nbin);
245  std::vector<float> ntmp(nbin,0.0); //
246 
247  const float k0=0.7956; // shape parameters
248  const float p2=1.355;
249  const float p4=2.327;
250  const float p1=4.3; // position parameter
251 
252  float norm = 0.0;
253 
254  for(unsigned int j = 0; j < 25 && j < nbin; ++j){
255 
256  float r0 = j-p1;
257  float sigma0 = (r0<0) ? p2 : p2*p4;
258  r0 /= sigma0;
259  if(r0 < k0) ntmp[j] = exp(-0.5*r0*r0);
260  else ntmp[j] = exp(0.5*k0*k0-k0*r0);
261  norm += ntmp[j];
262  }
263  // normalize pulse area to 1.0
264  for(unsigned int j = 0; j < 25 && j < nbin; ++j){
265  ntmp[j] /= norm;
266  hfShape_.setShapeBin(j,ntmp[j]);
267  }
268 }
269 
270 
272 {
273  //From Jay Lawhorn: derived from data Edward Laird phase scan may2017
274  //https://indico.cern.ch/event/641978/contributions/2604491/attachments/1468666/2271582/17-05-31-hcal-hep17-pulse-shape.pdf
275  //Run numbers are 294736-294740 and 294929-294950
276 
277  unsigned int nbin = 250;
278 
279  std::vector<float> nt = {
280  3.97958e-29,
281  1.11634e-22,
282  9.96106e-18,
283  6.25334e-14,
284  5.08863e-11,
285  8.59141e-09,
286  4.32285e-07,
287  8.56617e-06,
288  8.28549e-05,
289  0.000461447,
290  0.00168052,
291  0.00441395,
292  0.00901637,
293  0.0151806,
294  0.0220314,
295  0.028528,
296  0.0338471,
297  0.0375578,
298  0.0395985,
299  0.0401567,
300  0.0395398,
301  0.0380776,
302  0.0360669,
303  0.0337474,
304  0.0312984,
305  0.0288457,
306  0.0264721,
307  0.0242276,
308  0.0221393,
309  0.0202181,
310  0.0184647,
311  0.0168731,
312  0.0154335,
313  0.0141346,
314  0.0129639,
315  0.0119094,
316  0.0109594,
317  0.0101031,
318  0.0093305,
319  0.00863267,
320  0.0080015,
321  0.00742977,
322  0.00691107,
323  0.00643969,
324  0.00601059,
325  0.00561931,
326  0.00526188,
327  0.00493483,
328  0.00463505,
329  0.00435981,
330  0.00410667,
331  0.00387348,
332  0.00365832,
333  0.00345949,
334  0.00327547,
335  0.0031049,
336  0.00294656,
337  0.00279938,
338  0.00266237,
339  0.00253467,
340  0.00241548,
341  0.0023041,
342  0.00219989,
343  0.00210227,
344  0.00201072,
345  0.00192476,
346  0.00184397,
347  0.00176795,
348  0.00169634,
349  0.00162884,
350  0.00156512,
351  0.00150494,
352  0.00144803,
353  0.00139418,
354  0.00134317,
355  0.00129481,
356  0.00124894,
357  0.00120537,
358  0.00116398,
359  0.00112461,
360  0.00108715,
361  0.00105147,
362  0.00101747,
363  0.000985042,
364  0.000954096,
365  0.000924545,
366  0.000896308,
367  0.000869311,
368  0.000843482,
369  0.000818758,
370  0.000795077,
371  0.000772383,
372  0.000750623,
373  0.000729747,
374  0.00070971,
375  0.000690466,
376  0.000671977,
377  0.000654204,
378  0.00063711,
379  0.000620663,
380  0.000604831,
381  0.000589584,
382  0.000574894,
383  0.000560735,
384  0.000547081,
385  0.00053391,
386  0.0005212,
387  0.000508929,
388  0.000497078,
389  0.000485628,
390  0.000474561,
391  0.000463862,
392  0.000453514,
393  0.000443501,
394  0.000433811,
395  0.000424429,
396  0.000415343,
397  0.00040654,
398  0.00039801,
399  0.000389741,
400  0.000381722,
401  0.000373944,
402  0.000366398,
403  0.000359074,
404  0.000351964,
405  0.00034506,
406  0.000338353,
407  0.000331838,
408  0.000325505,
409  0.00031935,
410  0.000313365,
411  0.000307544,
412  0.000301881,
413  0.000296371,
414  0.000291009,
415  0.000285788,
416  0.000280705,
417  0.000275755,
418  0.000270932,
419  0.000266233,
420  0.000261653,
421  0.00025719,
422  0.000252837,
423  0.000248593,
424  0.000244454,
425  0.000240416,
426  0.000236475,
427  0.00023263,
428  0.000228876,
429  0.000225212,
430  0.000221633,
431  0.000218138,
432  0.000214724,
433  0.000211389,
434  0.00020813,
435  0.000204945,
436  0.000201831,
437  0.000198787,
438  0.000195811,
439  0.0001929,
440  0.000190053,
441  0.000187268,
442  0.000184543,
443  0.000181876,
444  0.000179266,
445  0.000176711,
446  0.00017421,
447  0.000171761,
448  0.000169363,
449  0.000167014,
450  0.000164713,
451  0.000162459,
452  0.00016025,
453  0.000158086,
454  0.000155964,
455  0.000153885,
456  0.000151847,
457  0.000149848,
458  0.000147888,
459  0.000145966,
460  0.000144081,
461  0.000142232,
462  0.000140418,
463  0.000138638,
464  0.000136891,
465  0.000135177,
466  0.000133494,
467  0.000131843,
468  0.000130221,
469  0.00012863,
470  0.000127066,
471  0.000125531,
472  0.000124023,
473  0.000122543,
474  0.000121088,
475  0.000119658,
476  0.000118254,
477  0.000116874,
478  0.000115518,
479  0.000114185,
480  0.000112875,
481  0.000111587,
482  0.000110321,
483  0.000109076,
484  0.000107851,
485  0.000106648,
486  0.000105464,
487  0.000104299,
488  0.000103154,
489  0.000102027,
490  0.000100918,
491  9.98271e-05,
492  9.87537e-05,
493  9.76974e-05,
494  9.66578e-05,
495  9.56346e-05,
496  9.46274e-05,
497  9.3636e-05,
498  9.26599e-05,
499  9.16989e-05,
500  9.07526e-05,
501  8.98208e-05,
502  8.89032e-05,
503  8.79995e-05,
504  8.71093e-05,
505  8.62325e-05,
506  8.53688e-05,
507  8.45179e-05,
508  8.36796e-05,
509  8.28536e-05,
510  8.20397e-05,
511  8.12376e-05,
512  8.04471e-05,
513  7.96681e-05,
514  7.89002e-05,
515  7.81433e-05,
516  7.73972e-05,
517  7.66616e-05,
518  7.59364e-05,
519  7.52213e-05,
520  7.45163e-05,
521  7.3821e-05,
522  7.31354e-05,
523  7.24592e-05,
524  7.17923e-05,
525  7.11345e-05,
526  7.04856e-05,
527  6.98455e-05,
528  6.9214e-05,
529  6.8591e-05
530  };
531 
532 
534 
535  double norm = 0.;
536  for (unsigned int j = 0; j < nbin; ++j) {
537  norm += (nt[j]>0) ? nt[j] : 0.;
538  }
539 
540  for (unsigned int j = 0; j < nbin; ++j) {
541  nt[j] /= norm;
543  }
544 }
545 
547 {
548 
549  unsigned int nbin = 128;
550 
551 //From Jake Anderson: toy MC convolution of SiPM pulse + WLS fiber shape + SiPM nonlinear response
552  std::vector<float> nt = {
553  2.782980485851731e-6,
554  4.518134885954626e-5,
555  2.7689305197392056e-4,
556  9.18328418900969e-4,
557  .002110072599166349,
558  .003867856860331454,
559  .006120046224897771,
560  .008754774090536956,
561  0.0116469503358586,
562  .01467007449455966,
563  .01770489955229477,
564  .02064621450689512,
565  .02340678093764222,
566  .02591874610854916,
567  .02813325527435303,
568  0.0300189241965647,
569  .03155968107671164,
570  .03275234052577155,
571  .03360415306318798,
572  .03413048377960748,
573  .03435270899678218,
574  .03429637464659661,
575  .03398962975487166,
576  .03346192884394954,
577  .03274298516247742,
578  .03186195009136525,
579  .03084679116113031,
580  0.0297238406141036,
581  .02851748748929785,
582  .02724998816332392,
583  .02594137274487424,
584  .02460942736731527,
585  .02326973510736116,
586  .02193576080366117,
587  0.0206189674254987,
588  .01932895378564653,
589  0.0180736052958666,
590  .01685925112650875,
591  0.0156908225633535,
592  .01457200857138456,
593  .01350540559602467,
594  .01249265947824805,
595  .01153459805300423,
596  .01063135355597282,
597  .009782474412011936,
598  .008987026319784546,
599  0.00824368281357106,
600  .007550805679909604,
601  .006906515742762193,
602  .006308754629755056,
603  .005755338185695127,
604  .005244002229973356,
605  .004772441359900532,
606  .004338341490928299,
607  .003939406800854143,
608  0.00357338171220501,
609  0.0032380685079891,
610  .002931341133259233,
611  .002651155690306086,
612  .002395558090237333,
613  .002162689279320922,
614  .001950788415487319,
615  .001758194329648101,
616  .001583345567913682,
617  .001424779275191974,
618  .001281129147671334,
619  0.00115112265163774,
620  .001033577678808199,
621  9.273987838127585e-4,
622  8.315731274976846e-4,
623  7.451662302008696e-4,
624  6.673176219006913e-4,
625  5.972364609644049e-4,
626  5.341971801529036e-4,
627  4.775352065178378e-4,
628  4.266427928961177e-4,
629  3.8096498904225923e-4,
630  3.3999577417327287e-4,
631  3.032743659102713e-4,
632  2.703817158798329e-4,
633  2.4093719775272793e-4,
634  2.145954900503894e-4,
635  1.9104365317752797e-4,
636  1.6999839784346724e-4,
637  1.5120354022478893e-4,
638  1.3442763782650755e-4,
639  1.1946179895521507e-4,
640  1.0611765796993575e-4,
641  9.422550797617687e-5,
642  8.363258233342666e-5,
643  7.420147621931836e-5,
644  6.580869950304933e-5,
645  5.834335229919868e-5,
646  5.17059147771959e-5,
647  4.5807143072062634e-5,
648  4.0567063461299446e-5,
649  3.591405732740723e-5,
650  3.178402980354131e-5,
651  2.811965539165646e-5,
652  2.4869694240316126e-5,
653  2.1988373166730962e-5,
654  1.9434825899529382e-5,
655  1.717258740121378e-5,
656  1.5169137499243157e-5,
657  1.339548941011129e-5,
658  1.1825819079078403e-5,
659  1.0437131581057595e-5,
660  9.208961130078894e-6,
661  8.12310153137994e-6,
662  7.163364176588591e-6,
663  6.315360932244386e-6,
664  5.566309502463164e-6,
665  4.904859063429651e-6,
666  4.320934164082596e-6,
667  3.8055950719111903e-6,
668  3.350912911083174e-6,
669  2.9498580949517117e-6,
670  2.596200697612328e-6,
671  2.2844215378879293e-6,
672  2.0096328693141094e-6,
673  1.7675076766686654e-6,
674  1.5542166787225756e-6,
675  1.366372225473431e-6,
676  1.200978365778838e-6,
677  1.0553864128982371e-6,
678  9.272554464808518e-7,
679  8.145171945902259e-7,
680  7.153448381918271e-7
681  };
682 
683  siPMShape_.setNBin(nbin);
684 
685  double norm = 0.;
686  for (unsigned int j = 0; j < nbin; ++j) {
687  norm += (nt[j]>0) ? nt[j] : 0.;
688  }
689 
690  for (unsigned int j = 0; j < nbin; ++j) {
691  nt[j] /= norm;
692  siPMShape_.setShapeBin(j,nt[j]);
693  }
694 }
695 
697 {
698  //numerical convolution of SiPM pulse + WLS fiber shape
700 
702 
703  //skip first bin, always 0
704  double norm = 0.;
705  for (unsigned int j = 1; j <= nBinsSiPM_; ++j) {
706  norm += (nt[j]>0) ? nt[j] : 0.;
707  }
708 
709  for (unsigned int j = 1; j <= nBinsSiPM_; ++j) {
710  nt[j] /= norm;
711  siPMShape2017_.setShapeBin(j,nt[j]);
712  }
713 }
714 
716 HcalPulseShapes::getShape(int shapeType) const
717 {
718  ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType);
719  if(shapeMapItr == theShapes.end()) {
720  throw cms::Exception("HcalPulseShapes") << "unknown shapeType";
721  return hpdShape_; // should not return this, but...
722  } else {
723  return *(shapeMapItr->second);
724  }
725 }
726 
727 
729 HcalPulseShapes::shape(const HcalDetId & detId) const
730 {
731  if(!theMCParams) {
732  return defaultShape(detId);
733  }
734  int shapeType = theMCParams->getValues(detId)->signalShape();
735 
736  ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType);
737  if(shapeMapItr == theShapes.end()) {
738  return defaultShape(detId);
739  } else {
740  return *(shapeMapItr->second);
741  }
742 }
743 
746 {
747  if(!theRecoParams) {
748  return defaultShape(detId);
749  }
750  int shapeType = theRecoParams->getValues(detId.rawId())->pulseShapeID();
751 
752  ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType);
753  if(shapeMapItr == theShapes.end()) {
754  return defaultShape(detId);
755  } else {
756  return *(shapeMapItr->second);
757  }
758 }
759 
760 
763 {
764  edm::LogWarning("HcalPulseShapes") << "Cannot find HCAL MC Params ";
765  HcalSubdetector subdet = detId.subdet();
766  switch(subdet) {
767  case HcalBarrel:
768  return hbShape();
769  case HcalEndcap:
770  return heShape();
771  case HcalForward:
772  return hfShape();
773  case HcalOuter:
774  //FIXME doesn't look for SiPMs
775  return hoShape(false);
776  default:
777  throw cms::Exception("HcalPulseShapes") << "unknown detId";
778  break;
779  }
780 }
781 
782 //SiPM helpers
783 
784 inline double gexp(double t, double A, double c, double t0, double s) {
785  static double const root2(sqrt(2));
786  return -A*0.5*exp(c*t+0.5*c*c*s*s-c*s)*(erf(-0.5*root2/s*(t-t0+c*s*s))-1);
787 }
788 
789 inline double onePulse(double t, double A, double sigma, double theta, double m) {
790  return (t<theta) ? 0 : A*TMath::LogNormal(t,sigma,theta,m);
791 }
792 
794  // HO SiPM pulse shape fit from Jake Anderson ca. 2013
795  double A1(0.08757), c1(-0.5257), t01(2.4013), s1(0.6721);
796  double A2(0.007598), c2(-0.1501), t02(6.9412), s2(0.8710);
797  return gexp(t,A1,c1,t01,s1) + gexp(t,A2,c2,t02,s2);
798 }
799 
801  // taken from fit to laser measurement taken by Iouri M. in Spring 2016.
802  double A1(5.204/6.94419), sigma1_shape(0.5387), theta1_loc(-0.3976), m1_scale(4.428);
803  double A2(1.855/6.94419), sigma2_shape(0.8132), theta2_loc(7.025), m2_scale(12.29);
804  return
805  onePulse(t,A1,sigma1_shape,theta1_loc,m1_scale) +
806  onePulse(t,A2,sigma2_shape,theta2_loc,m2_scale);
807 }
808 
809 double HcalPulseShapes::generatePhotonTime(CLHEP::HepRandomEngine* engine) {
810  double result(0.);
811  while (true) {
812  result = CLHEP::RandFlat::shoot(engine, HcalPulseShapes::Y11RANGE_);
813  if (CLHEP::RandFlat::shoot(engine, HcalPulseShapes::Y11MAX_) < HcalPulseShapes::Y11TimePDF(result))
814  return result;
815  }
816 }
817 
819  return exp(-0.0635-0.1518*t)*pow(t, 2.528)/2485.9;
820 }
const Shape & getShape(int shapeType) const
void setNBin(int n)
const Shape & heShape() const
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
void setShapeBin(int i, float f)
const Shape & hoShape(bool sipm=false) const
void beginRun(edm::EventSetup const &es)
Geom::Theta< T > theta() const
static constexpr float Y11MAX_
const Item * getValues(DetId fId, bool throwOnFail=true) const
static const int nBinsSiPM_
const Shape & shapeForReco(const HcalDetId &detId) const
static double analyticPulseShapeSiPMHE(double t)
double onePulse(double t, double A, double sigma, double theta, double m)
const Shape & shape(const HcalDetId &detId) const
automatically figures out which shape to return
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
HcalRecoParams * theRecoParams
static std::vector< double > convolve(unsigned nbin, F1 f1, F2 f2)
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
T sqrt(T t)
Definition: SSEVec.h:18
double p4[4]
Definition: TauolaWrapper.h:92
void computeSiPMShapeData2017()
HcalSubdetector
Definition: HcalAssistant.h:31
static double generatePhotonTime(CLHEP::HepRandomEngine *engine)
double p2[4]
Definition: TauolaWrapper.h:90
int nt
Definition: AMPTWrapper.h:32
int k[5][pyjets_maxn]
static const double tmax[3]
const Shape & defaultShape(const HcalDetId &detId) const
in case of conditions problems
const Shape & hfShape() const
void computeHPDShape(float, float, float, float, float, float, float, float, Shape &)
const HcalTopology * theTopology
HcalMCParams * theMCParams
const T & get() const
Definition: EventSetup.h:56
double gexp(double t, double A, double c, double t0, double s)
unsigned int signalShape() const
Definition: HcalMCParam.h:40
const Shape & hbShape() const
double p1[4]
Definition: TauolaWrapper.h:89
static constexpr float Y11RANGE_
static double Y11TimePDF(double t)
T const * product() const
Definition: ESHandle.h:86
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void setTopo(const HcalTopology *topo)
static double analyticPulseShapeSiPMHO(double t)