12 #include "CLHEP/Random/RandGauss.h"
20 theDefaultParameters_(3.0,
46 testHEPlan1_(
false) {}
70 if (hid.
iphi() == 39 && hid.
zside() == 1 &&
94 if ((hid.
ieta() > -5) && (hid.
ieta() < 5))
100 if (hid.
depth() % 2 == 1)
102 else if (hid.
depth() % 2 == 0)
116 value0 += sipmpar.getDarkCurrent() * 25. / (1. - sipmchar->getCrossTalk(sipmpar.getType()));
118 float value[4] = {value0, value0, value0, value0};
120 for (
int i = 0;
i < 4;
i++) {
124 value[
i] = value0 + (
float)CLHEP::RandGauss::shoot(0.0,
width.getWidth(
i) / 100.);
144 width2 += sipmpar.getDarkCurrent() * 25. /
std::pow(1 - sipmchar->getCrossTalk(sipmpar.getType()), 3) *
149 for (
int i = 0;
i < 4;
i++) {
150 for (
int j = 0;
j < 4;
j++) {
161 float value[4] = {value0, value0, value0, value0};
163 for (
int i = 0;
i < 4;
i++) {
190 for (
unsigned capid = 0; capid < 4; capid++) {
208 for (
int i = 0;
i < 64;
i++) {
209 lowEdges[
i] = -1.5 +
i;
211 result.setMinCharges(lowEdges);
224 float phase = -25.0f;
225 float Xphase = (
phase + 32.0f) * 4.0
f;
233 int pulseShapeID = hparam.
mcShape();
239 Xphase = (
phase + 32.0f) * 4.0
f;
250 Xphase = (
phase + 32.0f) * 4.0
f;
261 Xphase = (
phase + 32.0f) * 4.0
f;
267 if (cell.
ieta() == 1 && cell.
iphi() == 1)
276 Xphase = (
phase + 32.0f) * 4.0
f;
288 Xphase = (
phase + 32.0f) * 4.0
f;
296 for (
int k = 0;
k < 5;
k++) {
297 rshift[
k + 1] = rshift[
k] + r1bit[
k];
300 int packingScheme = 1;
301 unsigned int param = pulseShapeID |
syncPhase << rshift[1] | (
binOfMaximum << rshift[2]) | (Iphase << rshift[3]) |
313 int containmentCorrectionFlag = 0;
315 int containmentCorrectionPreSample = 0;
318 float Xphase = (
phase + 32.0) * 4.0;
336 int LeakCorrectionID = 0;
340 int timeCorrectionID = 0;
346 int specialCaseID = 0;
348 int noiseFlaggingID = 0;
350 int pileupCleaningID = 0;
352 int packingScheme = 1;
358 containmentCorrectionFlag = 1;
359 containmentCorrectionPreSample = 0;
361 float Xphase = (
phase + 32.0) * 4.0;
369 LeakCorrectionID = 0;
371 timeCorrectionID = 0;
376 pileupCleaningID = 0;
381 containmentCorrectionFlag = 1;
382 containmentCorrectionPreSample = 0;
384 float Xphase = (
phase + 32.0) * 4.0;
392 LeakCorrectionID = 0;
394 timeCorrectionID = 0;
399 pileupCleaningID = 0;
403 containmentCorrectionFlag = 0;
404 containmentCorrectionPreSample = 0;
406 float Xphase = (
phase + 32.0) * 4.0;
414 LeakCorrectionID = 0;
416 timeCorrectionID = 0;
421 pileupCleaningID = 0;
428 for (
int k = 0;
k < 6;
k++) {
430 p1shift[
j] = p1shift[
k] + p1bit[
k];
434 param1 = containmentCorrectionFlag | (containmentCorrectionPreSample << p1shift[1]) | (Iphase << p1shift[2]) |
439 for (
int k = 0;
k < 9;
k++) {
441 q2shift[
j] = q2shift[
k] + q2bit[
k];
447 (specialCaseID << q2shift[6]) | (noiseFlaggingID << q2shift[7]) | (pileupCleaningID << q2shift[8]) |
448 (packingScheme << q2shift[9]);
481 #define EMAP_NHBHECR 9
487 #define EMAP_NHSETS 4
488 #define EMAP_NTOPBOT 2
489 #define EMAP_NHTRSHO 4
490 #define EMAP_NHSETSHO 3
506 return std::make_unique<HcalDcsMap>(dcs_map_helper);
510 static const int kUTCAMask = 0x4000000;
511 static const int kLinearIndexMax = 0x7FFFF;
512 static const int kTriggerBitMask = 0x02000000;
514 uint32_t counterTrig = 0;
516 for (
const auto& fId :
cells) {
529 assert(counterTrig < kLinearIndexMax);
530 uint32_t raw = counterTrig;
531 raw |= kUTCAMask | kTriggerBitMask;
536 return std::make_unique<HcalElectronicsMap>(emapHelper);
540 const std::vector<HcalGenericDetId>&
cells)
const {
542 std::stringstream mystream;
544 for (
const auto& fId :
cells) {
545 if (fId.isHcalDetId()) {
548 int ieta =
id.ietaAbs();
549 int iside =
id.zside();
550 int iphi =
id.iphi();
554 char sidesign = (iside == -1) ?
'M' :
'P';
557 irm = (
iphi + 1) % 4 + 1;
559 if (
ieta >= 21 && (irm == 1 || irm == 3))
560 iwedge = (
iphi + 1 + irm + 1) / 4;
562 iwedge = (
iphi + irm + 1) / 4;
565 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
566 mystream << tempbuff;
567 rbx = mystream.str();
573 if ((iside == 1 &&
ieta == 40) || (iside == -1 &&
ieta == 41)) {
574 irm = ((
iphi + 1) / 2) % 36 + 1;
575 hfphi = ((
iphi + 1) / 6) % 12 + 1;
577 irm = (
iphi + 1) / 2;
578 hfphi = (
iphi - 1) / 6 + 1;
580 irm = (irm - 1) % 3 + 1;
581 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, hfphi,
'\0');
582 mystream << tempbuff;
583 rbx = mystream.str();
588 int ring(0), sector(0);
595 for (
int i = -2;
i <
iphi;
i += 6)
599 irm = ((
iphi + 1) / 2) % 6 + 1;
600 if (
ring != 0 && sector % 2 != 0)
603 sprintf(tempbuff,
"%s%i%2.2d", det.c_str(),
ring, sector);
605 sprintf(tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign, sector);
606 mystream << tempbuff;
607 rbx = mystream.str();
613 return std::make_unique<HcalFrontEndMap>(emapHelper);
618 auto eta_depth_pair = std::make_pair(
ieta,
depth);
623 std::vector<int> segmentation;
629 return nLayersInDepth;
637 if (hid.
zside() == 1 && (hid.
iphi() == 63 || hid.
iphi() == 64 || hid.
iphi() == 65 || hid.
iphi() == 66))
659 if (nLayersInDepth > 4) {
674 if (nLayersInDepth > 4) {
704 ps.getParameter<
int>(
"pixels"),
705 ps.getParameter<
double>(
"nonlin1"),
706 ps.getParameter<
double>(
"nonlin2"),
707 ps.getParameter<
double>(
"nonlin3"),
708 ps.getParameter<
double>(
"crosstalk"),
712 return std::make_unique<HcalSiPMCharacteristics>(sipmHelper);
719 uint32_t bitInfo = ((44 << 16) | 30);
727 tppar.
loadObject(0, 0, 0xFFFFFFFFFFFFFFFF, 0, 0, 0);