11 #include "CLHEP/Random/RandGauss.h" 19 theDefaultParameters_(3.0,
44 testHEPlan1_(
false) {}
68 if (hid.
iphi() == 39 && hid.
zside() == 1 &&
92 if ((hid.
ieta() > -5) && (hid.
ieta() < 5))
98 if (hid.
depth() % 2 == 1)
100 else if (hid.
depth() % 2 == 0)
114 value0 += sipmpar.getDarkCurrent() * 25. / (1. - sipmchar->getCrossTalk(sipmpar.getType()));
116 float value[4] = {value0, value0, value0, value0};
118 for (
int i = 0;
i < 4;
i++) {
120 while (value[
i] <= 0.0
f)
122 value[
i] = value0 + (
float)CLHEP::RandGauss::shoot(0.0, width.
getWidth(
i) / 100.);
134 float width2 = value *
value;
142 width2 += sipmpar.getDarkCurrent() * 25. /
std::pow(1 - sipmchar->getCrossTalk(sipmpar.getType()), 3) *
147 for (
int i = 0;
i < 4;
i++) {
148 for (
int j = 0;
j < 4;
j++) {
159 float value[4] = {value0, value0, value0, value0};
161 for (
int i = 0;
i < 4;
i++) {
163 while (value[
i] <= 0.0
f)
164 value[
i] = value0 + (
float)CLHEP::RandGauss::shoot(0.0, width.
getValue(
i));
188 for (
unsigned capid = 0; capid < 4; capid++) {
206 for (
int i = 0;
i < 64;
i++) {
207 lowEdges[
i] = -1.5 +
i;
209 result.setMinCharges(lowEdges);
222 float phase = -25.0f;
223 float Xphase = (phase + 32.0f) * 4.0
f;
231 int pulseShapeID = hparam.
mcShape();
237 Xphase = (phase + 32.0f) * 4.0
f;
248 Xphase = (phase + 32.0f) * 4.0
f;
259 Xphase = (phase + 32.0f) * 4.0
f;
265 if (cell.
ieta() == 1 && cell.
iphi() == 1)
274 Xphase = (phase + 32.0f) * 4.0
f;
286 Xphase = (phase + 32.0f) * 4.0
f;
294 for (
int k = 0;
k < 5;
k++) {
295 rshift[
k + 1] = rshift[
k] + r1bit[
k];
298 int packingScheme = 1;
299 unsigned int param = pulseShapeID | syncPhase << rshift[1] | (binOfMaximum << rshift[2]) | (Iphase << rshift[3]) |
300 (timeSmearing << rshift[4] | packingScheme << 27);
311 int containmentCorrectionFlag = 0;
313 int containmentCorrectionPreSample = 0;
316 float Xphase = (phase + 32.0) * 4.0;
334 int LeakCorrectionID = 0;
338 int timeCorrectionID = 0;
344 int specialCaseID = 0;
346 int noiseFlaggingID = 0;
348 int pileupCleaningID = 0;
350 int packingScheme = 1;
356 containmentCorrectionFlag = 1;
357 containmentCorrectionPreSample = 0;
359 float Xphase = (phase + 32.0) * 4.0;
366 useLeakCorrection = 0;
367 LeakCorrectionID = 0;
368 correctForTimeslew = 1;
369 timeCorrectionID = 0;
374 pileupCleaningID = 0;
379 containmentCorrectionFlag = 1;
380 containmentCorrectionPreSample = 0;
382 float Xphase = (phase + 32.0) * 4.0;
389 useLeakCorrection = 0;
390 LeakCorrectionID = 0;
391 correctForTimeslew = 1;
392 timeCorrectionID = 0;
397 pileupCleaningID = 0;
401 containmentCorrectionFlag = 0;
402 containmentCorrectionPreSample = 0;
404 float Xphase = (phase + 32.0) * 4.0;
411 useLeakCorrection = 0;
412 LeakCorrectionID = 0;
413 correctForTimeslew = 0;
414 timeCorrectionID = 0;
419 pileupCleaningID = 0;
426 for (
int k = 0;
k < 6;
k++) {
428 p1shift[
j] = p1shift[
k] + p1bit[
k];
432 param1 = containmentCorrectionFlag | (containmentCorrectionPreSample << p1shift[1]) | (Iphase << p1shift[2]) |
433 (firstSample << p1shift[3]) | (samplesToAdd << p1shift[4]) | (pulseShapeID << p1shift[5]);
437 for (
int k = 0;
k < 9;
k++) {
439 q2shift[
j] = q2shift[
k] + q2bit[
k];
443 param2 = useLeakCorrection | (LeakCorrectionID << q2shift[1]) | (correctForTimeslew << q2shift[2]) |
444 (timeCorrectionID << q2shift[3]) | (correctTiming << q2shift[4]) | (firstAuxTS << q2shift[5]) |
445 (specialCaseID << q2shift[6]) | (noiseFlaggingID << q2shift[7]) | (pileupCleaningID << q2shift[8]) |
446 (packingScheme << q2shift[9]);
479 #define EMAP_NHBHECR 9 485 #define EMAP_NHSETS 4 486 #define EMAP_NTOPBOT 2 487 #define EMAP_NHTRSHO 4 488 #define EMAP_NHSETSHO 3 504 return std::make_unique<HcalDcsMap>(dcs_map_helper);
508 static const int kUTCAMask = 0x4000000;
509 static const int kLinearIndexMax = 0x7FFFF;
510 static const int kTriggerBitMask = 0x02000000;
512 uint32_t counterTrig = 0;
514 for (
const auto& fId : cells) {
520 assert(counter < kLinearIndexMax);
527 assert(counterTrig < kLinearIndexMax);
528 uint32_t raw = counterTrig;
529 raw |= kUTCAMask | kTriggerBitMask;
534 return std::make_unique<HcalElectronicsMap>(emapHelper);
538 const std::vector<HcalGenericDetId>&
cells)
const {
540 std::stringstream mystream;
542 for (
const auto& fId : cells) {
543 if (fId.isHcalDetId()) {
546 int ieta =
id.ietaAbs();
547 int iside =
id.zside();
548 int iphi =
id.iphi();
552 char sidesign = (iside == -1) ?
'M' :
'P';
554 det = detector[subdet];
555 irm = (iphi + 1) % 4 + 1;
557 if (ieta >= 21 && (irm == 1 || irm == 3))
558 iwedge = (iphi + 1 + irm + 1) / 4;
560 iwedge = (iphi + irm + 1) / 4;
563 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
564 mystream << tempbuff;
565 rbx = mystream.str();
569 det = detector[subdet];
571 if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)) {
572 irm = ((iphi + 1) / 2) % 36 + 1;
573 hfphi = ((iphi + 1) / 6) % 12 + 1;
575 irm = (iphi + 1) / 2;
576 hfphi = (iphi - 1) / 6 + 1;
578 irm = (irm - 1) % 3 + 1;
579 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, hfphi,
'\0');
580 mystream << tempbuff;
581 rbx = mystream.str();
585 det = detector[subdet];
586 int ring(0), sector(0);
589 else if (ieta >= 5 && ieta <= 10)
593 for (
int i = -2;
i <
iphi;
i += 6)
597 irm = ((iphi + 1) / 2) % 6 + 1;
598 if (
ring != 0 && sector % 2 != 0)
601 sprintf(tempbuff,
"%s%i%2.2d", det.c_str(),
ring, sector);
603 sprintf(tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign, sector);
604 mystream << tempbuff;
605 rbx = mystream.str();
611 return std::make_unique<HcalFrontEndMap>(emapHelper);
616 auto eta_depth_pair = std::make_pair(ieta, depth);
621 std::vector<int> segmentation;
624 int nLayersInDepth =
std::distance(std::lower_bound(segmentation.begin(), segmentation.end(),
depth),
625 std::upper_bound(segmentation.begin(), segmentation.end(),
depth));
627 return nLayersInDepth;
635 if (hid.
zside() == 1 && (hid.
iphi() == 63 || hid.
iphi() == 64 || hid.
iphi() == 65 || hid.
iphi() == 66))
655 if (nLayersInDepth > 4) {
668 if (nLayersInDepth > 4) {
696 ps.getParameter<
int>(
"pixels"),
697 ps.getParameter<
double>(
"nonlin1"),
698 ps.getParameter<
double>(
"nonlin2"),
699 ps.getParameter<
double>(
"nonlin3"),
700 ps.getParameter<
double>(
"crosstalk"),
704 return std::make_unique<HcalSiPMCharacteristics>(sipmHelper);
711 uint32_t bitInfo = ((44 << 16) | 30);
719 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
const HcalHardcodeParameters & getParameters(HcalGenericDetId fId) const
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId) const
HcalSubdetector subdet() const
get the subdetector
bool loadObject(DetId fId, int rm, std::string rbx)
load a new entry
const int recoShape() const
std::vector< edm::ParameterSet > theSiPMCharacteristics_
int zside() const
get the z-side of the cell (1/-1)
std::unique_ptr< HcalElectronicsMap > makeHardcodeMap(const std::vector< HcalGenericDetId > &cells) const
constexpr uint32_t rawId() const
get the raw id
const int qieType() const
bool isHEPlan1(HcalGenericDetId fId) const
const int mcShape() const
float getValue(int fCapId) const
get value for capId = 0..3
HcalHardcodeParameters theDefaultParameters_
const double gainWidth(unsigned index) const
const double photoelectronsToAnalog() const
HcalTimingParam makeTimingParam(HcalGenericDetId fId) const
HcalRecoParam makeRecoParam(HcalGenericDetId fId) const
HcalHardcodeParameters theHEUpgradeParameters_
int depth() const
get the tower depth
void makeHardcodeFrontEndMap(HcalFrontEndMap &emap, const std::vector< HcalGenericDetId > &cells) const
HcalHardcodeParameters theHBUpgradeParameters_
HcalQIECoder makeQIECoder(HcalGenericDetId fId) const
std::unique_ptr< HcalDcsMap > makeHardcodeDcsMap() const
int ieta() const
get the cell ieta
HcalQIEShape makeQIEShape() const
void makeHardcodeTPParameters(HcalTPParameters &tppar) const
const int getGainIndex(HcalGenericDetId fId) const
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
const double pedestal() const
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
HcalHardcodeParameters theHBParameters_
int ietaAbs() const
get the absolute value of the cell ieta
HcalTPChannelParameter makeHardcodeTPChannelParameter(HcalGenericDetId fId) const
int iphi() const
get the cell iphi
HcalGainWidth makeGainWidth(HcalGenericDetId fId) const
std::unique_ptr< HcalSiPMCharacteristics > makeHardcodeSiPMCharacteristics() const
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false) 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
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)