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++) {
190 const float cuts_Phase1[] = {0.1, 0.2, 0.3, 0.3};
191 const float seeds_Phase1[] = {0.125, 0.25, 0.35, 0.35};
194 int depth_m1 = hid.
depth() - 1;
195 value0 = cuts_Phase1[depth_m1];
196 value1 = seeds_Phase1[depth_m1];
199 const double lumis[] = {300, 1000, 3000, 4500};
201 const float cuts[4][4] = {{0.4, 0.5, 0.6, 0.6}, {0.8, 1.2, 1.2, 1.2}, {1.0, 2.0, 2.0, 2.0}, {1.25, 2.5, 2.5, 2.5}};
202 const float seeds[4][4] = {
203 {0.5, 0.625, 0.75, 0.75}, {1.0, 1.5, 1.5, 1.5}, {1.25, 2.5, 2.5, 2.5}, {1.5, 3.0, 3.0, 3.0}};
204 const double eps = 1.e-6;
206 for (
int i = 0;
i < 4;
i++) {
208 value0 =
cuts[
i][depth_m1];
229 for (
unsigned capid = 0; capid < 4; capid++) {
247 for (
int i = 0;
i < 64;
i++) {
248 lowEdges[
i] = -1.5 +
i;
250 result.setMinCharges(lowEdges);
263 float phase = -25.0f;
264 float Xphase = (
phase + 32.0f) * 4.0
f;
272 int pulseShapeID = hparam.
mcShape();
278 Xphase = (
phase + 32.0f) * 4.0
f;
289 Xphase = (
phase + 32.0f) * 4.0
f;
300 Xphase = (
phase + 32.0f) * 4.0
f;
306 if (cell.
ieta() == 1 && cell.
iphi() == 1)
315 Xphase = (
phase + 32.0f) * 4.0
f;
327 Xphase = (
phase + 32.0f) * 4.0
f;
335 for (
int k = 0;
k < 5;
k++) {
336 rshift[
k + 1] = rshift[
k] + r1bit[
k];
339 int packingScheme = 1;
340 unsigned int param = pulseShapeID |
syncPhase << rshift[1] | (
binOfMaximum << rshift[2]) | (Iphase << rshift[3]) |
352 int containmentCorrectionFlag = 0;
354 int containmentCorrectionPreSample = 0;
357 float Xphase = (
phase + 32.0) * 4.0;
375 int LeakCorrectionID = 0;
379 int timeCorrectionID = 0;
385 int specialCaseID = 0;
387 int noiseFlaggingID = 0;
389 int pileupCleaningID = 0;
391 int packingScheme = 1;
397 containmentCorrectionFlag = 1;
398 containmentCorrectionPreSample = 0;
400 float Xphase = (
phase + 32.0) * 4.0;
408 LeakCorrectionID = 0;
410 timeCorrectionID = 0;
415 pileupCleaningID = 0;
420 containmentCorrectionFlag = 1;
421 containmentCorrectionPreSample = 0;
423 float Xphase = (
phase + 32.0) * 4.0;
431 LeakCorrectionID = 0;
433 timeCorrectionID = 0;
438 pileupCleaningID = 0;
442 containmentCorrectionFlag = 0;
443 containmentCorrectionPreSample = 0;
445 float Xphase = (
phase + 32.0) * 4.0;
453 LeakCorrectionID = 0;
455 timeCorrectionID = 0;
460 pileupCleaningID = 0;
467 for (
int k = 0;
k < 6;
k++) {
469 p1shift[
j] = p1shift[
k] + p1bit[
k];
473 param1 = containmentCorrectionFlag | (containmentCorrectionPreSample << p1shift[1]) | (Iphase << p1shift[2]) |
478 for (
int k = 0;
k < 9;
k++) {
480 q2shift[
j] = q2shift[
k] + q2bit[
k];
486 (specialCaseID << q2shift[6]) | (noiseFlaggingID << q2shift[7]) | (pileupCleaningID << q2shift[8]) |
487 (packingScheme << q2shift[9]);
520 #define EMAP_NHBHECR 9 526 #define EMAP_NHSETS 4 527 #define EMAP_NTOPBOT 2 528 #define EMAP_NHTRSHO 4 529 #define EMAP_NHSETSHO 3 545 return std::make_unique<HcalDcsMap>(dcs_map_helper);
549 static const int kUTCAMask = 0x4000000;
550 static const int kLinearIndexMax = 0x7FFFF;
551 static const int kTriggerBitMask = 0x02000000;
553 uint32_t counterTrig = 0;
555 for (
const auto& fId :
cells) {
568 assert(counterTrig < kLinearIndexMax);
569 uint32_t raw = counterTrig;
570 raw |= kUTCAMask | kTriggerBitMask;
575 return std::make_unique<HcalElectronicsMap>(emapHelper);
579 const std::vector<HcalGenericDetId>&
cells)
const {
581 std::stringstream mystream;
583 for (
const auto& fId :
cells) {
584 if (fId.isHcalDetId()) {
587 int ieta =
id.ietaAbs();
588 int iside =
id.zside();
589 int iphi =
id.iphi();
593 char sidesign = (iside == -1) ?
'M' :
'P';
596 irm = (
iphi + 1) % 4 + 1;
598 if (
ieta >= 21 && (irm == 1 || irm == 3))
599 iwedge = (
iphi + 1 + irm + 1) / 4;
601 iwedge = (
iphi + irm + 1) / 4;
604 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, iwedge,
'\0');
605 mystream << tempbuff;
606 rbx = mystream.str();
612 if ((iside == 1 &&
ieta == 40) || (iside == -1 &&
ieta == 41)) {
613 irm = ((
iphi + 1) / 2) % 36 + 1;
614 hfphi = ((
iphi + 1) / 6) % 12 + 1;
616 irm = (
iphi + 1) / 2;
617 hfphi = (
iphi - 1) / 6 + 1;
619 irm = (irm - 1) % 3 + 1;
620 sprintf(tempbuff,
"%s%c%2.2i%c", det.c_str(), sidesign, hfphi,
'\0');
621 mystream << tempbuff;
622 rbx = mystream.str();
634 for (
int i = -2;
i <
iphi;
i += 6)
638 irm = ((
iphi + 1) / 2) % 6 + 1;
642 sprintf(tempbuff,
"%s%i%2.2d", det.c_str(),
ring,
sector);
644 sprintf(tempbuff,
"%s%i%c%2.2d", det.c_str(),
ring, sidesign,
sector);
645 mystream << tempbuff;
646 rbx = mystream.str();
652 return std::make_unique<HcalFrontEndMap>(emapHelper);
657 auto eta_depth_pair = std::make_pair(
ieta,
depth);
662 std::vector<int> segmentation;
668 return nLayersInDepth;
676 if (hid.
zside() == 1 && (hid.
iphi() == 63 || hid.
iphi() == 64 || hid.
iphi() == 65 || hid.
iphi() == 66))
698 if (nLayersInDepth > 4) {
713 if (nLayersInDepth > 4) {
743 ps.getParameter<
int>(
"pixels"),
744 ps.getParameter<
double>(
"nonlin1"),
745 ps.getParameter<
double>(
"nonlin2"),
746 ps.getParameter<
double>(
"nonlin3"),
747 ps.getParameter<
double>(
"crosstalk"),
751 return std::make_unique<HcalSiPMCharacteristics>(sipmHelper);
758 uint32_t bitInfo = ((44 << 16) | 30);
766 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_
HcalPFCut makePFCut(HcalGenericDetId fId, double intlumi, bool noHE) const
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
Abs< T >::type abs(const T &t)
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)
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
Power< A, B >::type pow(const A &a, const B &b)
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId, bool eff, const HcalTopology *topo, double intlumi)
constexpr int depth() const
get the tower depth