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;
327 int samplesToAdd = 2; p1bit[4]=4;
328 int pulseShapeID = 105; p1bit[5]=9;
332 int useLeakCorrection = 0; q2bit[0]=1;
333 int LeakCorrectionID = 0; q2bit[1]=4;
334 int correctForTimeslew = 0; q2bit[2]=1;
335 int timeCorrectionID = 0; q2bit[3]=4;
336 int correctTiming = 0; q2bit[4]=1;
337 int firstAuxTS = 0; q2bit[5]=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]) ;
511 else value0 = 0.003333;
517 else value0 = 0.003333;
521 if ((hid.ieta() > -5) && (hid.ieta() < 5))
528 }
else value0 = 0.003333;
529 float value [4] = {value0, value0, value0, value0};
530 if (fSmear)
for (
int i = 0;
i < 4;
i++) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getValue (
i));
554 for (
unsigned range = 0; range < 4; range++) {
555 for (
unsigned capid = 0; capid < 4; capid++) {
556 result.setOffset (capid, range, offset);
557 result.setSlope (capid, range, slope);
567 for (
int i = 0;
i < 64;
i++) lowEdges[
i] = -1.5 +
i*1.0;
568 result.setMinCharges (lowEdges);
580 #define EMAP_NHBHECR 9
586 #define EMAP_NHSETS 4
587 #define EMAP_NTOPBOT 2
588 #define EMAP_NHTRSHO 4
589 #define EMAP_NHSETSHO 3
615 int fedhbhenum[
EMAP_NHBHECR][2]={{702,703},{704,705},{700,701},
616 {706,707},{716,717},{708,709},
617 {714,715},{710,711},{712,713}};
619 int fedhfnum[
EMAP_NHFCR][2]={{718,719},{720,721},{722,723}};
621 int fedhonum[
EMAP_NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
625 int ihslotho[
EMAP_NHSETSHO][
EMAP_NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}};
627 int ihbhephis[
EMAP_NHBHECR]={11,19,3,27,67,35,59,43,51};
634 {{{{11,1},{ 7,1},{ 3,1}},
635 {{ 5,1},{ 1,1},{ 9,1}},
636 {{11,1},{ 7,1},{ 3,1}},
637 {{ 5,1},{ 1,1},{ 9,1}},
638 {{10,1},{ 6,1},{ 2,1}},
639 {{ 8,1},{ 4,1},{12,1}},
640 {{10,1},{ 6,1},{ 2,1}},
641 {{ 8,1},{ 4,1},{12,1}}},
642 {{{11,1},{ 7,1},{ 3,1}},
643 {{ 5,1},{ 1,1},{ 9,1}},
644 {{11,1},{ 7,1},{ 3,1}},
645 {{ 5,1},{ 1,1},{ 9,1}},
646 {{10,1},{ 6,1},{ 2,1}},
647 {{ 8,1},{ 4,1},{12,1}},
648 {{10,1},{ 6,1},{ 2,1}},
649 {{ 8,1},{ 4,1},{12,1}}}},
650 {{{{16,2},{15,2},{14,1}},
651 {{15,1},{13,1},{16,1}},
652 {{16,2},{15,2},{14,1}},
653 {{15,1},{13,1},{16,1}},
654 {{17,1},{16,3},{26,1}},
655 {{18,1},{18,2},{26,2}},
656 {{17,1},{16,3},{25,1}},
657 {{18,1},{18,2},{25,2}}},
658 {{{16,2},{15,2},{14,1}},
659 {{15,1},{13,1},{16,1}},
660 {{16,2},{15,2},{14,1}},
661 {{15,1},{13,1},{16,1}},
662 {{17,1},{16,3},{25,1}},
663 {{18,1},{18,2},{25,2}},
664 {{17,1},{16,3},{26,1}},
665 {{18,1},{18,2},{26,2}}}},
666 {{{{28,1},{28,2},{29,1}},
667 {{28,3},{24,2},{24,1}},
668 {{27,1},{27,2},{29,2}},
669 {{27,3},{23,2},{23,1}},
670 {{19,2},{20,1},{22,2}},
671 {{19,1},{20,2},{22,1}},
672 {{19,2},{20,1},{21,2}},
673 {{19,1},{20,2},{21,1}}},
674 {{{27,1},{27,2},{29,2}},
675 {{27,3},{23,2},{23,1}},
676 {{28,1},{28,2},{29,1}},
677 {{28,3},{24,2},{24,1}},
678 {{19,2},{20,1},{21,2}},
679 {{19,1},{20,2},{21,1}},
680 {{19,2},{20,1},{22,2}},
681 {{19,1},{20,2},{22,1}}}}
685 {{{33,1},{31,1},{29,1}},
686 {{32,1},{30,1},{34,1}},
687 {{33,2},{31,2},{29,2}},
688 {{32,2},{30,2},{34,2}},
689 {{34,2},{32,2},{30,2}},
690 {{31,2},{29,2},{33,2}},
691 {{34,1},{32,1},{30,1}},
692 {{31,1},{29,1},{33,1}}},
693 {{{41,1},{37,1},{35,1}},
694 {{38,1},{36,1},{39,1}},
695 {{41,2},{37,2},{35,2}},
696 {{38,2},{36,2},{39,2}},
697 {{40,2},{38,2},{36,2}},
698 {{37,2},{35,2},{39,2}},
699 {{40,1},{38,1},{36,1}},
700 {{37,1},{35,1},{39,1}}}
704 {{{{ 1,-1,0},{ 2,-1,0},{ 3,-1,0}},
705 {{ 1,-1,1},{ 2,-1,1},{ 3,-1,1}},
706 {{ 1,-1,2},{ 2,-1,2},{ 3,-1,2}},
707 {{ 1,-1,3},{ 2,-1,3},{ 3,-1,3}},
708 {{ 1,-1,4},{ 2,-1,4},{ 3,-1,4}},
709 {{ 1,-1,5},{ 2,-1,5},{ 3,-1,5}},
710 {{14, 1,0},{14, 1,1},{14, 1,2}},
711 {{14, 1,3},{14, 1,4},{14, 1,5}}},
712 {{{ 1, 1,0},{ 2, 1,0},{ 3, 1,0}},
713 {{ 1, 1,1},{ 2, 1,1},{ 3, 1,1}},
714 {{ 1, 1,2},{ 2, 1,2},{ 3, 1,2}},
715 {{ 1, 1,3},{ 2, 1,3},{ 3, 1,3}},
716 {{ 1, 1,4},{ 2, 1,4},{ 3, 1,4}},
717 {{ 1, 1,5},{ 2, 1,5},{ 3, 1,5}},
718 {{15, 1,0},{15, 1,1},{15, 1,2}},
719 {{15, 1,3},{15, 1,4},{15, 1,5}}}},
720 {{{{ 6, 1,0},{ 6, 1,1},{ 6, 1,2}},
721 {{ 6, 1,3},{ 6, 1,4},{ 6, 1,5}},
722 {{ 7, 1,0},{ 7, 1,1},{ 7, 1,2}},
723 {{ 7, 1,3},{ 7, 1,4},{ 7, 1,5}},
724 {{ 8, 1,0},{ 8, 1,1},{ 8, 1,2}},
725 {{ 8, 1,3},{ 8, 1,4},{ 8, 1,5}},
726 {{ 9, 1,0},{ 9, 1,1},{ 9, 1,2}},
727 {{ 9, 1,3},{ 9, 1,4},{ 9, 1,5}}},
728 {{{10, 1,0},{10, 1,1},{10, 1,2}},
729 {{10, 1,3},{10, 1,4},{10, 1,5}},
730 {{11, 1,0},{11, 1,1},{11, 1,2}},
731 {{11, 1,3},{11, 1,4},{11, 1,5}},
732 {{12, 1,0},{12, 1,1},{12, 1,2}},
733 {{12, 1,3},{12, 1,4},{12, 1,5}},
734 {{13, 1,0},{13, 1,1},{13, 1,2}},
735 {{13, 1,3},{13, 1,4},{13, 1,5}}}},
736 {{{{ 4,-1,0},{ 4,-1,1},{ 0, 0,0}},
737 {{ 4,-1,2},{ 4,-1,3},{ 0, 0,0}},
738 {{ 4,-1,4},{ 4,-1,5},{ 0, 0,0}},
739 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
740 {{ 5,-1,0},{ 5,-1,1},{ 5,-1,2}},
741 {{ 5,-1,3},{ 5,-1,4},{ 5,-1,5}},
742 {{14,-1,0},{14,-1,1},{14,-1,2}},
743 {{14,-1,3},{14,-1,4},{14,-1,5}}},
744 {{{ 4, 1,0},{ 4, 1,1},{ 0, 0,0}},
745 {{ 4, 1,2},{ 4, 1,3},{ 0, 0,0}},
746 {{ 4, 1,4},{ 4, 1,5},{ 0, 0,0}},
747 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
748 {{ 5, 1,0},{ 5, 1,1},{ 5, 1,2}},
749 {{ 5, 1,3},{ 5, 1,4},{ 5, 1,5}},
750 {{15,-1,0},{15,-1,1},{15,-1,2}},
751 {{15,-1,3},{15,-1,4},{15,-1,5}}}},
752 {{{{ 6,-1,0},{ 6,-1,1},{ 6,-1,2}},
753 {{ 6,-1,3},{ 6,-1,4},{ 6,-1,5}},
754 {{ 7,-1,0},{ 7,-1,1},{ 7,-1,2}},
755 {{ 7,-1,3},{ 7,-1,4},{ 7,-1,5}},
756 {{ 8,-1,0},{ 8,-1,1},{ 8,-1,2}},
757 {{ 8,-1,3},{ 8,-1,4},{ 8,-1,5}},
758 {{ 9,-1,0},{ 9,-1,1},{ 9,-1,2}},
759 {{ 9,-1,3},{ 9,-1,4},{ 9,-1,5}}},
760 {{{10,-1,0},{10,-1,1},{10,-1,2}},
761 {{10,-1,3},{10,-1,4},{10,-1,5}},
762 {{11,-1,0},{11,-1,1},{11,-1,2}},
763 {{11,-1,3},{11,-1,4},{11,-1,5}},
764 {{12,-1,0},{12,-1,1},{12,-1,2}},
765 {{12,-1,3},{12,-1,4},{12,-1,5}},
766 {{13,-1,0},{13,-1,1},{13,-1,2}},
767 {{13,-1,3},{13,-1,4},{13,-1,5}}}}
769 int ic,is,ih,itb,ifb,ifc,ifwtb,iphi_loc;
770 int iside,ieta,iphi,idepth,icrate,ihtr,ihtr_fi,ifi_ch,ispigot,idcc,ifed;
787 icrate=hbhecrate[ic];
788 iside=is<EMAP_NHSETS/2?-1:1;
789 ifwtb=(is/2+itb+1)%2;
790 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0];
791 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1];
793 det=((ieta>16||idepth>2)?(
"HE"):(
"HB"));
794 fpga=((itb%2)==1)?(
"bot"):(
"top");
797 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;
798 ispigot=(is%2)*6+ih*2+itb;
799 idcc=is<EMAP_NHSETS/2?1:2;
801 ifed=fedhbhenum[ic][idcc-1];
804 elId.setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
823 iside=is<EMAP_NHSETS/2?-1:1;
824 ieta=ihfetadepth[itb][ifb][ifc][0];
825 idepth=ihfetadepth[itb][ifb][ifc][1];
828 fpga=((itb%2)==1)?(
"bot"):(
"top");
831 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;
832 ispigot=(is%2)*6+ih*2+itb;
833 idcc=is<EMAP_NHSETS/2?1:2;
835 ifed=fedhfnum[ic][idcc-1];
837 elId.setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
856 ieta=ihoetasidephi[ih][itb][ifb][ifc][0];
857 iside=ihoetasidephi[ih][itb][ifb][ifc][1];
858 iphi_loc=ihoetasidephi[ih][itb][ifb][ifc][2];
859 ihtr=ihslotho[is][ih];
861 fpga=((itb%2)==1)?(
"bot"):(
"top");
864 iphi=(ihophis[ic]+is*6+iphi_loc-1)%72+1;
865 ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
868 ifed=fedhonum[ic][idcc-1];
870 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)
int depth() const
get the tower depth
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false)
int ieta() const
get the cell ieta
unsigned int offset(bool)
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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)