7 #include "CLHEP/Random/RandGauss.h"
15 float value [4] = {value0, value0, value0, value0};
17 for (
int i = 0;
i < 4;
i++) {
18 value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i) / 100.);
19 while (value [
i] <= 0) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i));
23 value[0], value[1], value[2], value[3]
38 float value [4] = {value0, value0, value0, value0};
40 for (
int i = 0;
i < 4;
i++) {
41 value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i) / 100.);
42 while (value [
i] <= 0) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i));
46 value[0], value[1], value[2], value[3]
60 for (
int i = 0;
i < 4;
i++) {
62 for (
int j = 0;
j < 4;
j++) {
63 result.setSigma (
i,
j,
i ==
j ? width * width : 0);
75 double eff_lumi = lumi - 200.;
77 if(eff_lumi < 0.) eff_lumi = 0.;
79 value = 5.0 + 1.7 *
sqrt(eff_lumi);
81 value = 5.0 + 0.7 *
sqrt(eff_lumi);
100 for (
int i = 0;
i < 4;
i++) {
101 double width =
value;
102 for (
int j = 0;
j < 4;
j++) {
103 result.setSigma (
i,
j,
i ==
j ? width * width : 0);
145 int pulseShapeID = 125; r1bit[0] = 9;
146 int syncPhase = 0; r1bit[1] = 1;
149 float Xphase = (phase + 32.0) * 4.0;
151 int Iphase = Xphase; r1bit[3] = 8;
152 int timeSmearing = 0; r1bit[4] = 1;
160 Xphase = (phase + 32.0) * 4.0;
174 Xphase = (phase + 32.0) * 4.0;
187 Xphase = (phase + 32.0) * 4.0;
194 if (cell.
ieta() == 1 && cell.
iphi() == 1) pulseShapeID = 125;
203 Xphase = (phase + 32.0) * 4.0;
218 Xphase = (phase + 32.0) * 4.0;
229 for(
int k=0;
k<5;
k++) {
231 rshift[
j]=rshift[
k]+r1bit[
k];
235 int packingScheme = 1;
236 unsigned int param = pulseShapeID |
237 syncPhase<<rshift[1] |
238 (binOfMaximum << rshift[2]) |
239 (Iphase << rshift[3]) |
240 (timeSmearing << rshift[4] | packingScheme << 27);
320 int containmentCorrectionFlag = 0; p1bit[0]=1;
321 int containmentCorrectionPreSample = 0; p1bit[1]=1;
323 float Xphase = (phase + 32.0) * 4.0;
325 int Iphase = Xphase; p1bit[2]=8;
329 int pulseShapeID = 105; p1bit[5]=9;
334 int LeakCorrectionID = 0; q2bit[1]=4;
336 int timeCorrectionID = 0; q2bit[3]=4;
339 int specialCaseID = 0; q2bit[6]=4;
340 int noiseFlaggingID = 0; q2bit[7]=4;
341 int pileupCleaningID = 0; q2bit[8]=4;
342 int packingScheme = 1; q2bit[9]=4;
348 containmentCorrectionFlag = 1;
349 containmentCorrectionPreSample = 0;
351 float Xphase = (phase + 32.0) * 4.0;
359 useLeakCorrection = 0;
360 LeakCorrectionID = 0;
361 correctForTimeslew = 1;
362 timeCorrectionID = 0;
367 pileupCleaningID = 0;
373 containmentCorrectionFlag = 1;
374 containmentCorrectionPreSample = 0;
376 float Xphase = (phase + 32.0) * 4.0;
383 useLeakCorrection = 0;
384 LeakCorrectionID = 0;
385 correctForTimeslew = 1;
386 timeCorrectionID = 0;
391 pileupCleaningID = 0;
396 containmentCorrectionFlag = 0;
397 containmentCorrectionPreSample = 0;
399 float Xphase = (phase + 32.0) * 4.0;
409 useLeakCorrection = 0;
410 LeakCorrectionID = 0;
411 correctForTimeslew = 0;
412 timeCorrectionID = 0;
417 pileupCleaningID = 0;
423 int p1shift[7]; p1shift[0] = 0;
424 for(
int k = 0;
k < 6;
k++) {
426 p1shift[
j] = p1shift[
k] + p1bit[
k];
430 param1 = containmentCorrectionFlag |
431 (containmentCorrectionPreSample << p1shift[1]) |
432 (Iphase << p1shift[2]) |
433 (firstSample << p1shift[3]) |
434 (samplesToAdd << p1shift[4]) |
435 (pulseShapeID << p1shift[5]) ;
437 int q2shift[10]; q2shift[0] = 0;
438 for(
int k = 0;
k < 9;
k++) {
440 q2shift[
j] = q2shift[
k] + q2bit[
k];
444 param2 = useLeakCorrection |
445 (LeakCorrectionID << q2shift[1]) |
446 (correctForTimeslew << q2shift[2]) |
447 (timeCorrectionID << q2shift[3]) |
448 (correctTiming << q2shift[4]) |
449 (firstAuxTS << q2shift[5]) |
450 (specialCaseID << q2shift[6]) |
451 (noiseFlaggingID << q2shift[7]) |
452 (pileupCleaningID << q2shift[8]) |
453 (packingScheme << q2shift[9]) ;
508 static float const hbhevalue = 1./90./10.;
511 if (hid.depth() == 1) value0 = hbhevalue;
512 else if (hid.depth() == 2) value0 = hbhevalue;
513 else if (hid.depth() == 3) value0 = hbhevalue;
514 else if (hid.depth() == 4) value0 = hbhevalue;
515 else value0 = hbhevalue;
518 if (hid.depth() == 1) value0 = hbhevalue;
519 else if (hid.depth() == 2) value0 = hbhevalue;
520 else if (hid.depth() == 3) value0 = hbhevalue;
521 else if (hid.depth() == 4) value0 = hbhevalue;
522 else value0 = hbhevalue;
526 if ((hid.ieta() > -5) && (hid.ieta() < 5))
532 if (hid.depth() == 1) value0 = 0.2146;
533 else if (hid.depth() == 2) value0 = 0.3375;
534 }
else value0 = hbhevalue;
535 float value [4] = {value0, value0, value0, value0};
536 if (fSmear)
for (
int i = 0;
i < 4;
i++) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getValue (
i));
558 for (
unsigned range = 0; range < 4; range++) {
559 for (
unsigned capid = 0; capid < 4; capid++) {
560 result.setOffset (capid, range, offset);
561 result.setSlope (capid, range, slope);
573 if(hid.depth()>=3) qieType =
QIE10;
593 for (
int i = 0;
i < 64;
i++) lowEdges[
i] = -1.5 +
i*1.0;
594 result.setMinCharges (lowEdges);
606 #define EMAP_NHBHECR 9
612 #define EMAP_NHSETS 4
613 #define EMAP_NTOPBOT 2
614 #define EMAP_NHTRSHO 4
615 #define EMAP_NHSETSHO 3
641 int fedhbhenum[
EMAP_NHBHECR][2]={{702,703},{704,705},{700,701},
642 {706,707},{716,717},{708,709},
643 {714,715},{710,711},{712,713}};
645 int fedhfnum[
EMAP_NHFCR][2]={{718,719},{720,721},{722,723}};
647 int fedhonum[
EMAP_NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
651 int ihslotho[
EMAP_NHSETSHO][
EMAP_NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}};
653 int ihbhephis[
EMAP_NHBHECR]={11,19,3,27,67,35,59,43,51};
660 {{{{11,1},{ 7,1},{ 3,1}},
661 {{ 5,1},{ 1,1},{ 9,1}},
662 {{11,1},{ 7,1},{ 3,1}},
663 {{ 5,1},{ 1,1},{ 9,1}},
664 {{10,1},{ 6,1},{ 2,1}},
665 {{ 8,1},{ 4,1},{12,1}},
666 {{10,1},{ 6,1},{ 2,1}},
667 {{ 8,1},{ 4,1},{12,1}}},
668 {{{11,1},{ 7,1},{ 3,1}},
669 {{ 5,1},{ 1,1},{ 9,1}},
670 {{11,1},{ 7,1},{ 3,1}},
671 {{ 5,1},{ 1,1},{ 9,1}},
672 {{10,1},{ 6,1},{ 2,1}},
673 {{ 8,1},{ 4,1},{12,1}},
674 {{10,1},{ 6,1},{ 2,1}},
675 {{ 8,1},{ 4,1},{12,1}}}},
676 {{{{16,2},{15,2},{14,1}},
677 {{15,1},{13,1},{16,1}},
678 {{16,2},{15,2},{14,1}},
679 {{15,1},{13,1},{16,1}},
680 {{17,1},{16,3},{26,1}},
681 {{18,1},{18,2},{26,2}},
682 {{17,1},{16,3},{25,1}},
683 {{18,1},{18,2},{25,2}}},
684 {{{16,2},{15,2},{14,1}},
685 {{15,1},{13,1},{16,1}},
686 {{16,2},{15,2},{14,1}},
687 {{15,1},{13,1},{16,1}},
688 {{17,1},{16,3},{25,1}},
689 {{18,1},{18,2},{25,2}},
690 {{17,1},{16,3},{26,1}},
691 {{18,1},{18,2},{26,2}}}},
692 {{{{28,1},{28,2},{29,1}},
693 {{28,3},{24,2},{24,1}},
694 {{27,1},{27,2},{29,2}},
695 {{27,3},{23,2},{23,1}},
696 {{19,2},{20,1},{22,2}},
697 {{19,1},{20,2},{22,1}},
698 {{19,2},{20,1},{21,2}},
699 {{19,1},{20,2},{21,1}}},
700 {{{27,1},{27,2},{29,2}},
701 {{27,3},{23,2},{23,1}},
702 {{28,1},{28,2},{29,1}},
703 {{28,3},{24,2},{24,1}},
704 {{19,2},{20,1},{21,2}},
705 {{19,1},{20,2},{21,1}},
706 {{19,2},{20,1},{22,2}},
707 {{19,1},{20,2},{22,1}}}}
711 {{{33,1},{31,1},{29,1}},
712 {{32,1},{30,1},{34,1}},
713 {{33,2},{31,2},{29,2}},
714 {{32,2},{30,2},{34,2}},
715 {{34,2},{32,2},{30,2}},
716 {{31,2},{29,2},{33,2}},
717 {{34,1},{32,1},{30,1}},
718 {{31,1},{29,1},{33,1}}},
719 {{{41,1},{37,1},{35,1}},
720 {{38,1},{36,1},{39,1}},
721 {{41,2},{37,2},{35,2}},
722 {{38,2},{36,2},{39,2}},
723 {{40,2},{38,2},{36,2}},
724 {{37,2},{35,2},{39,2}},
725 {{40,1},{38,1},{36,1}},
726 {{37,1},{35,1},{39,1}}}
730 {{{{ 1,-1,0},{ 2,-1,0},{ 3,-1,0}},
731 {{ 1,-1,1},{ 2,-1,1},{ 3,-1,1}},
732 {{ 1,-1,2},{ 2,-1,2},{ 3,-1,2}},
733 {{ 1,-1,3},{ 2,-1,3},{ 3,-1,3}},
734 {{ 1,-1,4},{ 2,-1,4},{ 3,-1,4}},
735 {{ 1,-1,5},{ 2,-1,5},{ 3,-1,5}},
736 {{14, 1,0},{14, 1,1},{14, 1,2}},
737 {{14, 1,3},{14, 1,4},{14, 1,5}}},
738 {{{ 1, 1,0},{ 2, 1,0},{ 3, 1,0}},
739 {{ 1, 1,1},{ 2, 1,1},{ 3, 1,1}},
740 {{ 1, 1,2},{ 2, 1,2},{ 3, 1,2}},
741 {{ 1, 1,3},{ 2, 1,3},{ 3, 1,3}},
742 {{ 1, 1,4},{ 2, 1,4},{ 3, 1,4}},
743 {{ 1, 1,5},{ 2, 1,5},{ 3, 1,5}},
744 {{15, 1,0},{15, 1,1},{15, 1,2}},
745 {{15, 1,3},{15, 1,4},{15, 1,5}}}},
746 {{{{ 6, 1,0},{ 6, 1,1},{ 6, 1,2}},
747 {{ 6, 1,3},{ 6, 1,4},{ 6, 1,5}},
748 {{ 7, 1,0},{ 7, 1,1},{ 7, 1,2}},
749 {{ 7, 1,3},{ 7, 1,4},{ 7, 1,5}},
750 {{ 8, 1,0},{ 8, 1,1},{ 8, 1,2}},
751 {{ 8, 1,3},{ 8, 1,4},{ 8, 1,5}},
752 {{ 9, 1,0},{ 9, 1,1},{ 9, 1,2}},
753 {{ 9, 1,3},{ 9, 1,4},{ 9, 1,5}}},
754 {{{10, 1,0},{10, 1,1},{10, 1,2}},
755 {{10, 1,3},{10, 1,4},{10, 1,5}},
756 {{11, 1,0},{11, 1,1},{11, 1,2}},
757 {{11, 1,3},{11, 1,4},{11, 1,5}},
758 {{12, 1,0},{12, 1,1},{12, 1,2}},
759 {{12, 1,3},{12, 1,4},{12, 1,5}},
760 {{13, 1,0},{13, 1,1},{13, 1,2}},
761 {{13, 1,3},{13, 1,4},{13, 1,5}}}},
762 {{{{ 4,-1,0},{ 4,-1,1},{ 0, 0,0}},
763 {{ 4,-1,2},{ 4,-1,3},{ 0, 0,0}},
764 {{ 4,-1,4},{ 4,-1,5},{ 0, 0,0}},
765 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
766 {{ 5,-1,0},{ 5,-1,1},{ 5,-1,2}},
767 {{ 5,-1,3},{ 5,-1,4},{ 5,-1,5}},
768 {{14,-1,0},{14,-1,1},{14,-1,2}},
769 {{14,-1,3},{14,-1,4},{14,-1,5}}},
770 {{{ 4, 1,0},{ 4, 1,1},{ 0, 0,0}},
771 {{ 4, 1,2},{ 4, 1,3},{ 0, 0,0}},
772 {{ 4, 1,4},{ 4, 1,5},{ 0, 0,0}},
773 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
774 {{ 5, 1,0},{ 5, 1,1},{ 5, 1,2}},
775 {{ 5, 1,3},{ 5, 1,4},{ 5, 1,5}},
776 {{15,-1,0},{15,-1,1},{15,-1,2}},
777 {{15,-1,3},{15,-1,4},{15,-1,5}}}},
778 {{{{ 6,-1,0},{ 6,-1,1},{ 6,-1,2}},
779 {{ 6,-1,3},{ 6,-1,4},{ 6,-1,5}},
780 {{ 7,-1,0},{ 7,-1,1},{ 7,-1,2}},
781 {{ 7,-1,3},{ 7,-1,4},{ 7,-1,5}},
782 {{ 8,-1,0},{ 8,-1,1},{ 8,-1,2}},
783 {{ 8,-1,3},{ 8,-1,4},{ 8,-1,5}},
784 {{ 9,-1,0},{ 9,-1,1},{ 9,-1,2}},
785 {{ 9,-1,3},{ 9,-1,4},{ 9,-1,5}}},
786 {{{10,-1,0},{10,-1,1},{10,-1,2}},
787 {{10,-1,3},{10,-1,4},{10,-1,5}},
788 {{11,-1,0},{11,-1,1},{11,-1,2}},
789 {{11,-1,3},{11,-1,4},{11,-1,5}},
790 {{12,-1,0},{12,-1,1},{12,-1,2}},
791 {{12,-1,3},{12,-1,4},{12,-1,5}},
792 {{13,-1,0},{13,-1,1},{13,-1,2}},
793 {{13,-1,3},{13,-1,4},{13,-1,5}}}}
795 int ic,is,ih,itb,ifb,ifc,ifwtb,iphi_loc;
796 int iside,ieta,iphi,idepth,icrate,ihtr,ihtr_fi,ifi_ch,ispigot,idcc,ifed;
813 icrate=hbhecrate[ic];
814 iside=is<EMAP_NHSETS/2?-1:1;
815 ifwtb=(is/2+itb+1)%2;
816 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0];
817 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1];
819 det=((ieta>16||idepth>2)?(
"HE"):(
"HB"));
820 fpga=((itb%2)==1)?(
"bot"):(
"top");
823 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;
824 ispigot=(is%2)*6+ih*2+itb;
825 idcc=is<EMAP_NHSETS/2?1:2;
827 ifed=fedhbhenum[ic][idcc-1];
830 elId.setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
849 iside=is<EMAP_NHSETS/2?-1:1;
850 ieta=ihfetadepth[itb][ifb][ifc][0];
851 idepth=ihfetadepth[itb][ifb][ifc][1];
854 fpga=((itb%2)==1)?(
"bot"):(
"top");
857 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;
858 ispigot=(is%2)*6+ih*2+itb;
859 idcc=is<EMAP_NHSETS/2?1:2;
861 ifed=fedhfnum[ic][idcc-1];
863 elId.setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
882 ieta=ihoetasidephi[ih][itb][ifb][ifc][0];
883 iside=ihoetasidephi[ih][itb][ifb][ifc][1];
884 iphi_loc=ihoetasidephi[ih][itb][ifb][ifc][2];
885 ihtr=ihslotho[is][ih];
887 fpga=((itb%2)==1)?(
"bot"):(
"top");
890 iphi=(ihophis[ic]+is*6+iphi_loc-1)%72+1;
891 ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
894 ifed=fedhonum[ic][idcc-1];
896 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]
HcalQIEType makeQIEType(HcalGenericDetId fId, bool testHFQIE10)
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)