12 #include "CLHEP/Random/RandGauss.h"
20 theDefaultParameters_(3.0,
46 testHEPlan1_(
false) {}
70 if (hid.iphi() == 39 && hid.zside() == 1 &&
71 (hid.depth() >= 3 || (hid.depth() == 2 && (hid.ieta() == 30 || hid.ieta() == 34))) &&
setHFUpgrade_)
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++) {
122 while (value[
i] <= 0.0
f)
124 value[
i] = value0 + (float)CLHEP::RandGauss::shoot(0.0, width.
getWidth(
i) / 100.);
136 float width2 = value *
value;
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++) {
165 while (value[
i] <= 0.0
f)
166 value[
i] = value0 + (float)CLHEP::RandGauss::shoot(0.0, width.
getValue(
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;
229 int timeSmearing = 0;
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]) |
302 (timeSmearing << rshift[4] | packingScheme << 27);
313 int containmentCorrectionFlag = 0;
315 int containmentCorrectionPreSample = 0;
318 float Xphase = (phase + 32.0) * 4.0;
330 int pulseShapeID = hparam.recoShape();
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;
368 useLeakCorrection = 0;
369 LeakCorrectionID = 0;
370 correctForTimeslew = 1;
371 timeCorrectionID = 0;
376 pileupCleaningID = 0;
381 containmentCorrectionFlag = 1;
382 containmentCorrectionPreSample = 0;
384 float Xphase = (phase + 32.0) * 4.0;
391 useLeakCorrection = 0;
392 LeakCorrectionID = 0;
393 correctForTimeslew = 1;
394 timeCorrectionID = 0;
399 pileupCleaningID = 0;
403 containmentCorrectionFlag = 0;
404 containmentCorrectionPreSample = 0;
406 float Xphase = (phase + 32.0) * 4.0;
413 useLeakCorrection = 0;
414 LeakCorrectionID = 0;
415 correctForTimeslew = 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]) |
435 (firstSample << p1shift[3]) | (samplesToAdd << p1shift[4]) | (pulseShapeID << p1shift[5]);
439 for (
int k = 0;
k < 9;
k++) {
441 q2shift[
j] = q2shift[
k] + q2bit[
k];
445 param2 = useLeakCorrection | (LeakCorrectionID << q2shift[1]) | (correctForTimeslew << q2shift[2]) |
446 (timeCorrectionID << q2shift[3]) | (correctTiming << q2shift[4]) | (firstAuxTS << q2shift[5]) |
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) {
522 assert(counter < kLinearIndexMax);
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;
543 std::string detector[5] = {
"XX",
"HB",
"HE",
"HO",
"HF"};
544 for (
const auto& fId : cells) {
548 int ieta =
id.ietaAbs();
549 int iside =
id.zside();
550 int iphi =
id.iphi();
554 char sidesign = (iside == -1) ?
'M' :
'P';
556 det = detector[subdet];
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();
571 det = detector[subdet];
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();
587 det = detector[subdet];
588 int ring(0), sector(0);
591 else if (ieta >= 5 && ieta <= 10)
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);
621 return nLayers->second;
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);
const double pedestalWidth() const
HcalMCParam makeMCParam(HcalGenericDetId fId) const
HcalHardcodeParameters theHOParameters_
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
std::map< std::pair< int, int >, int > theLayersInDepths_
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId) const
bool loadObject(DetId fId, int rm, std::string rbx)
load a new entry
std::vector< edm::ParameterSet > theSiPMCharacteristics_
const double noiseCorrelation(unsigned index) const
constexpr uint32_t rawId() const
get the raw id
__host__ __device__ constexpr RandomIt upper_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
const int qieType() const
bool isHEPlan1(HcalGenericDetId fId) const
float getValue(int fCapId) const
get value for capId = 0..3
HcalHardcodeParameters theDefaultParameters_
const double gainWidth(unsigned index) const
const uint16_t range(const Frame &aFrame)
const double photoelectronsToAnalog() const
HcalTimingParam makeTimingParam(HcalGenericDetId fId) const
constexpr HcalSubdetector subdet() const
get the subdetector
HcalRecoParam makeRecoParam(HcalGenericDetId fId) const
HcalHardcodeParameters theHEUpgradeParameters_
void makeHardcodeFrontEndMap(HcalFrontEndMap &emap, const std::vector< HcalGenericDetId > &cells) const
HcalHardcodeParameters theHBUpgradeParameters_
HcalQIECoder makeQIECoder(HcalGenericDetId fId) const
std::unique_ptr< HcalDcsMap > makeHardcodeDcsMap() const
constexpr int iphi() const
get the cell iphi
HcalQIEShape makeQIEShape() const
void makeHardcodeTPParameters(HcalTPParameters &tppar) const
constexpr int ieta() const
get the cell ieta
const int getGainIndex(HcalGenericDetId fId) const
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
const double pedestal() const
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
HcalHardcodeParameters theHBParameters_
std::unique_ptr< HcalSiPMCharacteristics > makeHardcodeSiPMCharacteristics() const
HcalTPChannelParameter makeHardcodeTPChannelParameter(HcalGenericDetId fId) const
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
HcalGainWidth makeGainWidth(HcalGenericDetId fId) const
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false) const
std::unique_ptr< HcalElectronicsMap > makeHardcodeMap(const std::vector< HcalGenericDetId > &cells) const
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
bool loadObject(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1=0, float auxi2=0)
const double darkCurrent(unsigned index, double intlumi) const
void loadObject(int version, int adcCut, uint64_t tdcMask, uint32_t tbits, int auxi1, int auxi2)
HcalQIEType makeQIEType(HcalGenericDetId fId) const
const double gain(unsigned index) const
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
const HcalHardcodeParameters & getParameters(HcalGenericDetId fId) const
static std::atomic< unsigned int > counter
int getLayersInDepth(int ieta, int depth, const HcalTopology *topo)
HcalHardcodeParameters theHFParameters_
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear, bool eff, const HcalTopology *topo, double intlumi)
HcalHardcodeParameters theHEParameters_
const int zsThreshold() const
HcalSiPMParameter makeHardcodeSiPMParameter(HcalGenericDetId fId, const HcalTopology *topo, double intlumi)
HcalGenericSubdetector genericSubdet() const
Readout chain identification for Hcal.
HcalHardcodeParameters theHFUpgradeParameters_
Power< A, B >::type pow(const A &a, const B &b)
HcalZSThreshold makeZSThreshold(HcalGenericDetId fId) const
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId, bool eff, const HcalTopology *topo, double intlumi)