12 #include "CLHEP/Random/RandGauss.h" 20 theDefaultParameters_(3.0,
48 testHEPlan1_(
false) {}
72 if (hid.
iphi() == 39 && hid.
zside() == 1 &&
96 if ((hid.
ieta() > -5) && (hid.
ieta() < 5))
102 if (hid.
depth() % 2 == 1)
104 else if (hid.
depth() % 2 == 0)
118 value0 += sipmpar.getDarkCurrent() * 25. / (1. - sipmchar->getCrossTalk(sipmpar.getType()));
120 float value[4] = {value0, value0, value0, value0};
122 for (
int i = 0;
i < 4;
i++) {
126 value[
i] = value0 + (
float)CLHEP::RandGauss::shoot(0.0,
width.getWidth(
i) / 100.);
146 width2 += sipmpar.getDarkCurrent() * 25. /
std::pow(1 - sipmchar->getCrossTalk(sipmpar.getType()), 3) *
151 for (
int i = 0;
i < 4;
i++) {
152 for (
int j = 0;
j < 4;
j++) {
163 float value[4] = {value0, value0, value0, value0};
165 for (
int i = 0;
i < 4;
i++) {
199 for (
unsigned capid = 0; capid < 4; capid++) {
217 for (
int i = 0;
i < 64;
i++) {
218 lowEdges[
i] = -1.5 +
i;
220 result.setMinCharges(lowEdges);
233 float phase = -25.0f;
234 float Xphase = (
phase + 32.0f) * 4.0
f;
242 int pulseShapeID = hparam.
mcShape();
248 Xphase = (
phase + 32.0f) * 4.0
f;
259 Xphase = (
phase + 32.0f) * 4.0
f;
270 Xphase = (
phase + 32.0f) * 4.0
f;
276 if (cell.
ieta() == 1 && cell.
iphi() == 1)
285 Xphase = (
phase + 32.0f) * 4.0
f;
297 Xphase = (
phase + 32.0f) * 4.0
f;
305 for (
int k = 0;
k < 5;
k++) {
306 rshift[
k + 1] = rshift[
k] + r1bit[
k];
309 int packingScheme = 1;
310 unsigned int param = pulseShapeID |
syncPhase << rshift[1] | (
binOfMaximum << rshift[2]) | (Iphase << rshift[3]) |
322 int containmentCorrectionFlag = 0;
324 int containmentCorrectionPreSample = 0;
327 float Xphase = (
phase + 32.0) * 4.0;
345 int LeakCorrectionID = 0;
349 int timeCorrectionID = 0;
355 int specialCaseID = 0;
357 int noiseFlaggingID = 0;
359 int pileupCleaningID = 0;
361 int packingScheme = 1;
367 containmentCorrectionFlag = 1;
368 containmentCorrectionPreSample = 0;
370 float Xphase = (
phase + 32.0) * 4.0;
378 LeakCorrectionID = 0;
380 timeCorrectionID = 0;
385 pileupCleaningID = 0;
390 containmentCorrectionFlag = 1;
391 containmentCorrectionPreSample = 0;
393 float Xphase = (
phase + 32.0) * 4.0;
401 LeakCorrectionID = 0;
403 timeCorrectionID = 0;
408 pileupCleaningID = 0;
412 containmentCorrectionFlag = 0;
413 containmentCorrectionPreSample = 0;
415 float Xphase = (
phase + 32.0) * 4.0;
423 LeakCorrectionID = 0;
425 timeCorrectionID = 0;
430 pileupCleaningID = 0;
437 for (
int k = 0;
k < 6;
k++) {
439 p1shift[
j] = p1shift[
k] + p1bit[
k];
443 param1 = containmentCorrectionFlag | (containmentCorrectionPreSample << p1shift[1]) | (Iphase << p1shift[2]) |
448 for (
int k = 0;
k < 9;
k++) {
450 q2shift[
j] = q2shift[
k] + q2bit[
k];
456 (specialCaseID << q2shift[6]) | (noiseFlaggingID << q2shift[7]) | (pileupCleaningID << q2shift[8]) |
457 (packingScheme << q2shift[9]);
490 #define EMAP_NHBHECR 9 496 #define EMAP_NHSETS 4 497 #define EMAP_NTOPBOT 2 498 #define EMAP_NHTRSHO 4 499 #define EMAP_NHSETSHO 3 515 return std::make_unique<HcalDcsMap>(dcs_map_helper);
519 static const int kUTCAMask = 0x4000000;
520 static const int kLinearIndexMax = 0x7FFFF;
521 static const int kTriggerBitMask = 0x02000000;
523 uint32_t counterTrig = 0;
525 for (
const auto& fId :
cells) {
538 assert(counterTrig < kLinearIndexMax);
539 uint32_t raw = counterTrig;
540 raw |= kUTCAMask | kTriggerBitMask;
545 return std::make_unique<HcalElectronicsMap>(emapHelper);
549 const std::vector<HcalGenericDetId>&
cells)
const {
551 std::stringstream mystream;
553 for (
const auto& fId :
cells) {
554 if (fId.isHcalDetId()) {
557 int ieta =
id.ietaAbs();
558 int iside =
id.zside();
559 int iphi =
id.iphi();
563 char sidesign = (iside == -1) ?
'M' :
'P';
566 irm = (
iphi + 1) % 4 + 1;
568 if (
ieta >= 21 && (irm == 1 || irm == 3))
569 iwedge = (
iphi + 1 + irm + 1) / 4;
571 iwedge = (
iphi + irm + 1) / 4;
574 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
575 mystream << tempbuff;
576 rbx = mystream.str();
582 if ((iside == 1 &&
ieta == 40) || (iside == -1 &&
ieta == 41)) {
583 irm = ((
iphi + 1) / 2) % 36 + 1;
584 hfphi = ((
iphi + 1) / 6) % 12 + 1;
586 irm = (
iphi + 1) / 2;
587 hfphi = (
iphi - 1) / 6 + 1;
589 irm = (irm - 1) % 3 + 1;
590 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, hfphi,
'\0');
591 mystream << tempbuff;
592 rbx = mystream.str();
604 for (
int i = -2;
i <
iphi;
i += 6)
608 irm = ((
iphi + 1) / 2) % 6 + 1;
612 sprintf(tempbuff,
"%s%i%2.2d", det.c_str(),
ring,
sector);
614 sprintf(tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign,
sector);
615 mystream << tempbuff;
616 rbx = mystream.str();
622 return std::make_unique<HcalFrontEndMap>(emapHelper);
627 auto eta_depth_pair = std::make_pair(
ieta,
depth);
632 std::vector<int> segmentation;
638 return nLayersInDepth;
646 if (hid.
zside() == 1 && (hid.
iphi() == 63 || hid.
iphi() == 64 || hid.
iphi() == 65 || hid.
iphi() == 66))
668 if (nLayersInDepth > 4) {
683 if (nLayersInDepth > 4) {
713 ps.getParameter<
int>(
"pixels"),
714 ps.getParameter<
double>(
"nonlin1"),
715 ps.getParameter<
double>(
"nonlin2"),
716 ps.getParameter<
double>(
"nonlin3"),
717 ps.getParameter<
double>(
"crosstalk"),
721 return std::make_unique<HcalSiPMCharacteristics>(sipmHelper);
728 uint32_t bitInfo = ((44 << 16) | 30);
736 tppar.
loadObject(0, 0, 0xFFFFFFFFFFFFFFFF, 0, 0, 0);
HcalHardcodeParameters theHOParameters_
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
double photoelectronsToAnalog() const
std::map< std::pair< int, int >, int > theLayersInDepths_
HcalRecoParam makeRecoParam(HcalGenericDetId fId) const
bool loadObject(DetId fId, int rm, std::string rbx)
load a new entry
const HcalHardcodeParameters & getParameters(HcalGenericDetId fId) const
constexpr int zside() const
get the z-side of the cell (1/-1)
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
const int getGainIndex(HcalGenericDetId fId) const
constexpr int ietaAbs() const
get the absolute value of the cell ieta
double darkCurrent(unsigned index, double intlumi) const
std::vector< edm::ParameterSet > theSiPMCharacteristics_
void makeHardcodeFrontEndMap(HcalFrontEndMap &emap, const std::vector< HcalGenericDetId > &cells) const
double pedestalWidth() const
HcalZSThreshold makeZSThreshold(HcalGenericDetId fId) const
HcalHardcodeParameters theDefaultParameters_
double noiseCorrelation(unsigned index) const
double seedThreshold() const
constexpr HcalSubdetector subdet() const
get the subdetector
HcalHardcodeParameters theHEUpgradeParameters_
std::unique_ptr< HcalSiPMCharacteristics > makeHardcodeSiPMCharacteristics() const
HcalGainWidth makeGainWidth(HcalGenericDetId fId) const
HcalHardcodeParameters theHBUpgradeParameters_
constexpr int ieta() const
get the cell ieta
HcalTimingParam makeTimingParam(HcalGenericDetId fId) const
HcalTPChannelParameter makeHardcodeTPChannelParameter(HcalGenericDetId fId) const
HcalQIECoder makeQIECoder(HcalGenericDetId fId) const
bool isHEPlan1(HcalGenericDetId fId) const
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
HcalHardcodeParameters theHBParameters_
std::unique_ptr< HcalDcsMap > makeHardcodeDcsMap() const
HcalQIEType makeQIEType(HcalGenericDetId fId) const
double gain(unsigned index) const
HcalGenericSubdetector genericSubdet() const
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false) const
constexpr uint32_t rawId() const
get the raw id
void makeHardcodeTPParameters(HcalTPParameters &tppar) const
std::unique_ptr< HcalElectronicsMap > makeHardcodeMap(const std::vector< HcalGenericDetId > &cells) const
bool loadObject(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1=0, float auxi2=0)
HcalQIEShape makeQIEShape() const
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId) const
void loadObject(int version, int adcCut, uint64_t tdcMask, uint32_t tbits, int auxi1, int auxi2)
HcalMCParam makeMCParam(HcalGenericDetId fId) const
double noiseThreshold() 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)
HcalPFCut makePFCut(HcalGenericDetId fId) const
HcalHardcodeParameters theHEParameters_
HcalSiPMParameter makeHardcodeSiPMParameter(HcalGenericDetId fId, const HcalTopology *topo, double intlumi)
double gainWidth(unsigned index) const
Readout chain identification for Hcal.
HcalHardcodeParameters theHFUpgradeParameters_
constexpr int iphi() const
get the cell iphi
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId, bool eff, const HcalTopology *topo, double intlumi)
constexpr int depth() const
get the tower depth