7 #include "CLHEP/Random/RandGauss.h"
14 float value [4] = {value0, value0, value0, value0};
16 for (
int i = 0;
i < 4;
i++) {
17 value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i) / 100.);
18 while (value [
i] <= 0) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i));
22 value[0], value[1], value[2], value[3]
37 float value [4] = {value0, value0, value0, value0};
39 for (
int i = 0;
i < 4;
i++) {
40 value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i) / 100.);
41 while (value [
i] <= 0) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i));
45 value[0], value[1], value[2], value[3]
59 for (
int i = 0;
i < 4;
i++) {
61 for (
int j = 0;
j < 4;
j++) {
62 result.setSigma (
i,
j,
i ==
j ? width * width : 0);
74 double eff_lumi = lumi - 200.;
76 if(eff_lumi < 0.) eff_lumi = 0.;
78 value = 5.0 + 1.7 *
sqrt(eff_lumi);
80 value = 5.0 + 0.7 *
sqrt(eff_lumi);
99 for (
int i = 0;
i < 4;
i++) {
100 double width =
value;
101 for (
int j = 0;
j < 4;
j++) {
102 result.setSigma (
i,
j,
i ==
j ? width * width : 0);
144 int pulseShapeID = 125; r1bit[0] = 9;
145 int syncPhase = 0; r1bit[1] = 1;
148 float Xphase = (phase + 32.0) * 4.0;
150 int Iphase = Xphase; r1bit[3] = 8;
151 int timeSmearing = 0; r1bit[4] = 1;
159 Xphase = (phase + 32.0) * 4.0;
173 Xphase = (phase + 32.0) * 4.0;
186 Xphase = (phase + 32.0) * 4.0;
193 if (cell.
ieta() == 1 && cell.
iphi() == 1) pulseShapeID = 125;
202 Xphase = (phase + 32.0) * 4.0;
217 Xphase = (phase + 32.0) * 4.0;
228 for(
int k=0;
k<5;
k++) {
230 rshift[
j]=rshift[
k]+r1bit[
k];
234 int packingScheme = 1;
235 unsigned int param = pulseShapeID |
236 syncPhase<<rshift[1] |
237 (binOfMaximum << rshift[2]) |
238 (Iphase << rshift[3]) |
239 (timeSmearing << rshift[4] | packingScheme << 27);
319 int containmentCorrectionFlag = 0; p1bit[0]=1;
320 int containmentCorrectionPreSample = 0; p1bit[1]=1;
322 float Xphase = (phase + 32.0) * 4.0;
324 int Iphase = Xphase; p1bit[2]=8;
328 int pulseShapeID = 105; p1bit[5]=9;
333 int LeakCorrectionID = 0; q2bit[1]=4;
335 int timeCorrectionID = 0; q2bit[3]=4;
338 int specialCaseID = 0; q2bit[6]=4;
339 int noiseFlaggingID = 0; q2bit[7]=4;
340 int pileupCleaningID = 0; q2bit[8]=4;
341 int packingScheme = 1; q2bit[9]=4;
347 containmentCorrectionFlag = 1;
348 containmentCorrectionPreSample = 0;
350 float Xphase = (phase + 32.0) * 4.0;
358 useLeakCorrection = 0;
359 LeakCorrectionID = 0;
360 correctForTimeslew = 1;
361 timeCorrectionID = 0;
366 pileupCleaningID = 0;
372 containmentCorrectionFlag = 1;
373 containmentCorrectionPreSample = 0;
375 float Xphase = (phase + 32.0) * 4.0;
382 useLeakCorrection = 0;
383 LeakCorrectionID = 0;
384 correctForTimeslew = 1;
385 timeCorrectionID = 0;
390 pileupCleaningID = 0;
395 containmentCorrectionFlag = 0;
396 containmentCorrectionPreSample = 0;
398 float Xphase = (phase + 32.0) * 4.0;
408 useLeakCorrection = 0;
409 LeakCorrectionID = 0;
410 correctForTimeslew = 0;
411 timeCorrectionID = 0;
416 pileupCleaningID = 0;
422 int p1shift[7]; p1shift[0] = 0;
423 for(
int k = 0;
k < 6;
k++) {
425 p1shift[
j] = p1shift[
k] + p1bit[
k];
429 param1 = containmentCorrectionFlag |
430 (containmentCorrectionPreSample << p1shift[1]) |
431 (Iphase << p1shift[2]) |
432 (firstSample << p1shift[3]) |
433 (samplesToAdd << p1shift[4]) |
434 (pulseShapeID << p1shift[5]) ;
436 int q2shift[10]; q2shift[0] = 0;
437 for(
int k = 0;
k < 9;
k++) {
439 q2shift[
j] = q2shift[
k] + q2bit[
k];
443 param2 = useLeakCorrection |
444 (LeakCorrectionID << q2shift[1]) |
445 (correctForTimeslew << q2shift[2]) |
446 (timeCorrectionID << q2shift[3]) |
447 (correctTiming << q2shift[4]) |
448 (firstAuxTS << q2shift[5]) |
449 (specialCaseID << q2shift[6]) |
450 (noiseFlaggingID << q2shift[7]) |
451 (pileupCleaningID << q2shift[8]) |
452 (packingScheme << q2shift[9]) ;
507 static float const hbhevalue = 1./90./10.;
510 if (hid.depth() == 1) value0 = hbhevalue;
511 else if (hid.depth() == 2) value0 = hbhevalue;
512 else if (hid.depth() == 3) value0 = hbhevalue;
513 else if (hid.depth() == 4) value0 = hbhevalue;
514 else value0 = hbhevalue;
517 if (hid.depth() == 1) value0 = hbhevalue;
518 else if (hid.depth() == 2) value0 = hbhevalue;
519 else if (hid.depth() == 3) value0 = hbhevalue;
520 else if (hid.depth() == 4) value0 = hbhevalue;
521 else value0 = hbhevalue;
525 if ((hid.ieta() > -5) && (hid.ieta() < 5))
531 if (hid.depth() == 1) value0 = 0.2146;
532 else if (hid.depth() == 2) value0 = 0.3375;
533 }
else value0 = hbhevalue;
534 float value [4] = {value0, value0, value0, value0};
535 if (fSmear)
for (
int i = 0;
i < 4;
i++) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getValue (
i));
559 for (
unsigned range = 0; range < 4; range++) {
560 for (
unsigned capid = 0; capid < 4; capid++) {
561 result.setOffset (capid, range, offset);
562 result.setSlope (capid, range, slope);
572 for (
int i = 0;
i < 64;
i++) lowEdges[
i] = -1.5 +
i*1.0;
573 result.setMinCharges (lowEdges);
585 #define EMAP_NHBHECR 9
591 #define EMAP_NHSETS 4
592 #define EMAP_NTOPBOT 2
593 #define EMAP_NHTRSHO 4
594 #define EMAP_NHSETSHO 3
620 int fedhbhenum[
EMAP_NHBHECR][2]={{702,703},{704,705},{700,701},
621 {706,707},{716,717},{708,709},
622 {714,715},{710,711},{712,713}};
624 int fedhfnum[
EMAP_NHFCR][2]={{718,719},{720,721},{722,723}};
626 int fedhonum[
EMAP_NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
630 int ihslotho[
EMAP_NHSETSHO][
EMAP_NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}};
632 int ihbhephis[
EMAP_NHBHECR]={11,19,3,27,67,35,59,43,51};
639 {{{{11,1},{ 7,1},{ 3,1}},
640 {{ 5,1},{ 1,1},{ 9,1}},
641 {{11,1},{ 7,1},{ 3,1}},
642 {{ 5,1},{ 1,1},{ 9,1}},
643 {{10,1},{ 6,1},{ 2,1}},
644 {{ 8,1},{ 4,1},{12,1}},
645 {{10,1},{ 6,1},{ 2,1}},
646 {{ 8,1},{ 4,1},{12,1}}},
647 {{{11,1},{ 7,1},{ 3,1}},
648 {{ 5,1},{ 1,1},{ 9,1}},
649 {{11,1},{ 7,1},{ 3,1}},
650 {{ 5,1},{ 1,1},{ 9,1}},
651 {{10,1},{ 6,1},{ 2,1}},
652 {{ 8,1},{ 4,1},{12,1}},
653 {{10,1},{ 6,1},{ 2,1}},
654 {{ 8,1},{ 4,1},{12,1}}}},
655 {{{{16,2},{15,2},{14,1}},
656 {{15,1},{13,1},{16,1}},
657 {{16,2},{15,2},{14,1}},
658 {{15,1},{13,1},{16,1}},
659 {{17,1},{16,3},{26,1}},
660 {{18,1},{18,2},{26,2}},
661 {{17,1},{16,3},{25,1}},
662 {{18,1},{18,2},{25,2}}},
663 {{{16,2},{15,2},{14,1}},
664 {{15,1},{13,1},{16,1}},
665 {{16,2},{15,2},{14,1}},
666 {{15,1},{13,1},{16,1}},
667 {{17,1},{16,3},{25,1}},
668 {{18,1},{18,2},{25,2}},
669 {{17,1},{16,3},{26,1}},
670 {{18,1},{18,2},{26,2}}}},
671 {{{{28,1},{28,2},{29,1}},
672 {{28,3},{24,2},{24,1}},
673 {{27,1},{27,2},{29,2}},
674 {{27,3},{23,2},{23,1}},
675 {{19,2},{20,1},{22,2}},
676 {{19,1},{20,2},{22,1}},
677 {{19,2},{20,1},{21,2}},
678 {{19,1},{20,2},{21,1}}},
679 {{{27,1},{27,2},{29,2}},
680 {{27,3},{23,2},{23,1}},
681 {{28,1},{28,2},{29,1}},
682 {{28,3},{24,2},{24,1}},
683 {{19,2},{20,1},{21,2}},
684 {{19,1},{20,2},{21,1}},
685 {{19,2},{20,1},{22,2}},
686 {{19,1},{20,2},{22,1}}}}
690 {{{33,1},{31,1},{29,1}},
691 {{32,1},{30,1},{34,1}},
692 {{33,2},{31,2},{29,2}},
693 {{32,2},{30,2},{34,2}},
694 {{34,2},{32,2},{30,2}},
695 {{31,2},{29,2},{33,2}},
696 {{34,1},{32,1},{30,1}},
697 {{31,1},{29,1},{33,1}}},
698 {{{41,1},{37,1},{35,1}},
699 {{38,1},{36,1},{39,1}},
700 {{41,2},{37,2},{35,2}},
701 {{38,2},{36,2},{39,2}},
702 {{40,2},{38,2},{36,2}},
703 {{37,2},{35,2},{39,2}},
704 {{40,1},{38,1},{36,1}},
705 {{37,1},{35,1},{39,1}}}
709 {{{{ 1,-1,0},{ 2,-1,0},{ 3,-1,0}},
710 {{ 1,-1,1},{ 2,-1,1},{ 3,-1,1}},
711 {{ 1,-1,2},{ 2,-1,2},{ 3,-1,2}},
712 {{ 1,-1,3},{ 2,-1,3},{ 3,-1,3}},
713 {{ 1,-1,4},{ 2,-1,4},{ 3,-1,4}},
714 {{ 1,-1,5},{ 2,-1,5},{ 3,-1,5}},
715 {{14, 1,0},{14, 1,1},{14, 1,2}},
716 {{14, 1,3},{14, 1,4},{14, 1,5}}},
717 {{{ 1, 1,0},{ 2, 1,0},{ 3, 1,0}},
718 {{ 1, 1,1},{ 2, 1,1},{ 3, 1,1}},
719 {{ 1, 1,2},{ 2, 1,2},{ 3, 1,2}},
720 {{ 1, 1,3},{ 2, 1,3},{ 3, 1,3}},
721 {{ 1, 1,4},{ 2, 1,4},{ 3, 1,4}},
722 {{ 1, 1,5},{ 2, 1,5},{ 3, 1,5}},
723 {{15, 1,0},{15, 1,1},{15, 1,2}},
724 {{15, 1,3},{15, 1,4},{15, 1,5}}}},
725 {{{{ 6, 1,0},{ 6, 1,1},{ 6, 1,2}},
726 {{ 6, 1,3},{ 6, 1,4},{ 6, 1,5}},
727 {{ 7, 1,0},{ 7, 1,1},{ 7, 1,2}},
728 {{ 7, 1,3},{ 7, 1,4},{ 7, 1,5}},
729 {{ 8, 1,0},{ 8, 1,1},{ 8, 1,2}},
730 {{ 8, 1,3},{ 8, 1,4},{ 8, 1,5}},
731 {{ 9, 1,0},{ 9, 1,1},{ 9, 1,2}},
732 {{ 9, 1,3},{ 9, 1,4},{ 9, 1,5}}},
733 {{{10, 1,0},{10, 1,1},{10, 1,2}},
734 {{10, 1,3},{10, 1,4},{10, 1,5}},
735 {{11, 1,0},{11, 1,1},{11, 1,2}},
736 {{11, 1,3},{11, 1,4},{11, 1,5}},
737 {{12, 1,0},{12, 1,1},{12, 1,2}},
738 {{12, 1,3},{12, 1,4},{12, 1,5}},
739 {{13, 1,0},{13, 1,1},{13, 1,2}},
740 {{13, 1,3},{13, 1,4},{13, 1,5}}}},
741 {{{{ 4,-1,0},{ 4,-1,1},{ 0, 0,0}},
742 {{ 4,-1,2},{ 4,-1,3},{ 0, 0,0}},
743 {{ 4,-1,4},{ 4,-1,5},{ 0, 0,0}},
744 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
745 {{ 5,-1,0},{ 5,-1,1},{ 5,-1,2}},
746 {{ 5,-1,3},{ 5,-1,4},{ 5,-1,5}},
747 {{14,-1,0},{14,-1,1},{14,-1,2}},
748 {{14,-1,3},{14,-1,4},{14,-1,5}}},
749 {{{ 4, 1,0},{ 4, 1,1},{ 0, 0,0}},
750 {{ 4, 1,2},{ 4, 1,3},{ 0, 0,0}},
751 {{ 4, 1,4},{ 4, 1,5},{ 0, 0,0}},
752 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
753 {{ 5, 1,0},{ 5, 1,1},{ 5, 1,2}},
754 {{ 5, 1,3},{ 5, 1,4},{ 5, 1,5}},
755 {{15,-1,0},{15,-1,1},{15,-1,2}},
756 {{15,-1,3},{15,-1,4},{15,-1,5}}}},
757 {{{{ 6,-1,0},{ 6,-1,1},{ 6,-1,2}},
758 {{ 6,-1,3},{ 6,-1,4},{ 6,-1,5}},
759 {{ 7,-1,0},{ 7,-1,1},{ 7,-1,2}},
760 {{ 7,-1,3},{ 7,-1,4},{ 7,-1,5}},
761 {{ 8,-1,0},{ 8,-1,1},{ 8,-1,2}},
762 {{ 8,-1,3},{ 8,-1,4},{ 8,-1,5}},
763 {{ 9,-1,0},{ 9,-1,1},{ 9,-1,2}},
764 {{ 9,-1,3},{ 9,-1,4},{ 9,-1,5}}},
765 {{{10,-1,0},{10,-1,1},{10,-1,2}},
766 {{10,-1,3},{10,-1,4},{10,-1,5}},
767 {{11,-1,0},{11,-1,1},{11,-1,2}},
768 {{11,-1,3},{11,-1,4},{11,-1,5}},
769 {{12,-1,0},{12,-1,1},{12,-1,2}},
770 {{12,-1,3},{12,-1,4},{12,-1,5}},
771 {{13,-1,0},{13,-1,1},{13,-1,2}},
772 {{13,-1,3},{13,-1,4},{13,-1,5}}}}
774 int ic,is,ih,itb,ifb,ifc,ifwtb,iphi_loc;
775 int iside,ieta,iphi,idepth,icrate,ihtr,ihtr_fi,ifi_ch,ispigot,idcc,ifed;
792 icrate=hbhecrate[ic];
793 iside=is<EMAP_NHSETS/2?-1:1;
794 ifwtb=(is/2+itb+1)%2;
795 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0];
796 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1];
798 det=((ieta>16||idepth>2)?(
"HE"):(
"HB"));
799 fpga=((itb%2)==1)?(
"bot"):(
"top");
802 iphi=(ieta>20)?(ihbhephis[ic]+(is%2)*4+itb*2-1)%72+1:(ihbhephis[ic]+(is%2)*4+itb*2+(ifb/2+is/2+1)%2-1)%72+1;
803 ispigot=(is%2)*6+ih*2+itb;
804 idcc=is<EMAP_NHSETS/2?1:2;
806 ifed=fedhbhenum[ic][idcc-1];
809 elId.setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
828 iside=is<EMAP_NHSETS/2?-1:1;
829 ieta=ihfetadepth[itb][ifb][ifc][0];
830 idepth=ihfetadepth[itb][ifb][ifc][1];
833 fpga=((itb%2)==1)?(
"bot"):(
"top");
836 iphi=(ieta>39)?(ihfphis[ic]+(is%2)*12+ih*4-3)%72+1:(ihfphis[ic]+(is%2)*12+ih*4+(ifb/4)*2-1)%72+1;
837 ispigot=(is%2)*6+ih*2+itb;
838 idcc=is<EMAP_NHSETS/2?1:2;
840 ifed=fedhfnum[ic][idcc-1];
842 elId.setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
861 ieta=ihoetasidephi[ih][itb][ifb][ifc][0];
862 iside=ihoetasidephi[ih][itb][ifb][ifc][1];
863 iphi_loc=ihoetasidephi[ih][itb][ifb][ifc][2];
864 ihtr=ihslotho[is][ih];
866 fpga=((itb%2)==1)?(
"bot"):(
"top");
869 iphi=(ihophis[ic]+is*6+iphi_loc-1)%72+1;
870 ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
873 ifed=fedhonum[ic][idcc-1];
875 elId.setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
static const HcalDetId Undefined
HcalQIEShape makeQIEShape()
HcalTimingParam makeTimingParam(HcalGenericDetId fId)
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
static const double slope[3]
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId)
float getValue(int fCapId) const
get value for capId = 0..3
void makeHardcodeMap(HcalElectronicsMap &emap)
uint32_t rawId() const
get the raw id
HcalQIECoder makeQIECoder(HcalGenericDetId fId)
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId)
void makeHardcodeDcsMap(HcalDcsMap &dcs_map)
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false)
int ieta() const
get the cell ieta
HcalRecoParam makeRecoParam(HcalGenericDetId fId)
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
int iphi() const
get the cell iphi
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
HcalGainWidth makeGainWidth(HcalGenericDetId fId)
HcalGenericSubdetector genericSubdet() const
HcalMCParam makeMCParam(HcalGenericDetId fId)
Readout chain identification for Hcal.
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)