11 #include "CLHEP/Random/RandGauss.h" 18 : theDefaultParameters_(3.0,0.5,{0.2,0.2},{0.0,0.0},0,{0.0,0.0,0.0,0.0},{0.9,0.9,0.9,0.9},125,105,0.0,{0.0}),
19 setHB_(
false), setHE_(
false), setHF_(
false), setHO_(
false),
20 setHBUpgrade_(
false), setHEUpgrade_(
false), setHFUpgrade_(
false),
21 useHBUpgrade_(
false), useHEUpgrade_(
false), useHOUpgrade_(
true),
22 useHFUpgrade_(
false), testHFQIE10_(
false), testHEPlan1_(
false)
61 if ((hid.
ieta() > -5) && (hid.
ieta() < 5)) index = 0;
65 if (hid.
depth() % 2 == 1) index = 0;
66 else if (hid.
depth() % 2 == 0) index = 1;
74 float value [4] = {value0,value0,value0,value0};
76 for (
int i = 0;
i < 4;
i++) {
78 while (value [
i] <= 0.0
f)
80 value [
i] = value0 + (
float)CLHEP::RandGauss::shoot (0.0, width.
getWidth (
i) / 100.);
84 value[0], value[1], value[2], value[3]
94 float width2 = value*
value;
95 for (
int i = 0;
i < 4;
i++) {
96 for (
int j = 0; j < 4; j++) {
107 float value [4] = {value0, value0, value0, value0};
109 for (
int i = 0;
i < 4;
i++) {
111 while (value [
i] <= 0.0
f) value [
i] = value0 + (
float)CLHEP::RandGauss::shoot (0.0, width.
getValue (
i));
128 for (
unsigned range = 0; range < 4; range++) {
129 for (
unsigned capid = 0; capid < 4; capid++) {
130 result.setOffset (capid, range, param.qieOffset(range));
131 result.setSlope (capid, range, param.qieSlope(range));
147 for (
int i = 0;
i < 64;
i++) { lowEdges[
i] = -1.5 +
i; }
148 result.setMinCharges (lowEdges);
166 float phase = -25.0f;
167 float Xphase = (phase + 32.0f) * 4.0
f;
169 int Iphase = Xphase; r1bit[3] = 8;
173 int pulseShapeID = hparam.
mcShape();
180 Xphase = (phase + 32.0f) * 4.0
f;
192 Xphase = (phase + 32.0f) * 4.0
f;
204 Xphase = (phase + 32.0f) * 4.0
f;
210 if (cell.
ieta() == 1 && cell.
iphi() == 1) pulseShapeID = 125;
219 Xphase = (phase + 32.0f) * 4.0
f;
232 Xphase = (phase + 32.0f) * 4.0
f;
242 for(
int k=0;
k<5;
k++) {
243 rshift[
k+1]=rshift[
k]+r1bit[
k];
246 int packingScheme = 1;
247 unsigned int param = pulseShapeID |
248 syncPhase<<rshift[1] |
249 (binOfMaximum << rshift[2]) |
250 (Iphase << rshift[3]) |
251 (timeSmearing << rshift[4] | packingScheme << 27);
264 int containmentCorrectionFlag = 0; p1bit[0]=1;
265 int containmentCorrectionPreSample = 0; p1bit[1]=1;
267 float Xphase = (phase + 32.0) * 4.0;
269 int Iphase = Xphase; p1bit[2]=8;
281 int LeakCorrectionID = 0; q2bit[1]=4;
283 int timeCorrectionID = 0; q2bit[3]=4;
286 int specialCaseID = 0; q2bit[6]=4;
287 int noiseFlaggingID = 0; q2bit[7]=4;
288 int pileupCleaningID = 0; q2bit[8]=4;
289 int packingScheme = 1; q2bit[9]=4;
295 containmentCorrectionFlag = 1;
296 containmentCorrectionPreSample = 0;
298 float Xphase = (phase + 32.0) * 4.0;
305 useLeakCorrection = 0;
306 LeakCorrectionID = 0;
307 correctForTimeslew = 1;
308 timeCorrectionID = 0;
313 pileupCleaningID = 0;
319 containmentCorrectionFlag = 1;
320 containmentCorrectionPreSample = 0;
322 float Xphase = (phase + 32.0) * 4.0;
329 useLeakCorrection = 0;
330 LeakCorrectionID = 0;
331 correctForTimeslew = 1;
332 timeCorrectionID = 0;
337 pileupCleaningID = 0;
342 containmentCorrectionFlag = 0;
343 containmentCorrectionPreSample = 0;
345 float Xphase = (phase + 32.0) * 4.0;
352 useLeakCorrection = 0;
353 LeakCorrectionID = 0;
354 correctForTimeslew = 0;
355 timeCorrectionID = 0;
360 pileupCleaningID = 0;
366 int p1shift[7]; p1shift[0] = 0;
367 for(
int k = 0;
k < 6;
k++) {
369 p1shift[j] = p1shift[
k] + p1bit[
k];
373 param1 = containmentCorrectionFlag |
374 (containmentCorrectionPreSample << p1shift[1]) |
375 (Iphase << p1shift[2]) |
376 (firstSample << p1shift[3]) |
377 (samplesToAdd << p1shift[4]) |
378 (pulseShapeID << p1shift[5]) ;
380 int q2shift[10]; q2shift[0] = 0;
381 for(
int k = 0;
k < 9;
k++) {
383 q2shift[j] = q2shift[
k] + q2bit[
k];
387 param2 = useLeakCorrection |
388 (LeakCorrectionID << q2shift[1]) |
389 (correctForTimeslew << q2shift[2]) |
390 (timeCorrectionID << q2shift[3]) |
391 (correctTiming << q2shift[4]) |
392 (firstAuxTS << q2shift[5]) |
393 (specialCaseID << q2shift[6]) |
394 (noiseFlaggingID << q2shift[7]) |
395 (pileupCleaningID << q2shift[8]) |
396 (packingScheme << q2shift[9]) ;
416 #define EMAP_NHBHECR 9 422 #define EMAP_NHSETS 4 423 #define EMAP_NTOPBOT 2 424 #define EMAP_NHTRSHO 4 425 #define EMAP_NHSETSHO 3 441 return std::make_unique<HcalDcsMap>(dcs_map_helper);
445 static const int kUTCAMask = 0x4000000;
446 static const int kLinearIndexMax = 0x7FFFF;
447 static const int kTriggerBitMask = 0x02000000;
449 uint32_t counterTrig = 0;
451 for(
const auto& fId : cells){
459 assert(counter < kLinearIndexMax);
467 assert(counterTrig < kLinearIndexMax);
468 uint32_t raw = counterTrig;
469 raw |= kUTCAMask | kTriggerBitMask;
474 return std::make_unique<HcalElectronicsMap>(emapHelper);
479 std::stringstream mystream;
481 for (
const auto& fId : cells) {
482 if (fId.isHcalDetId()) {
485 int ieta =
id.ietaAbs();
486 int iside =
id.zside();
487 int iphi =
id.iphi();
491 char sidesign = (iside == -1) ?
'M' :
'P';
493 det = detector[subdet];
494 irm = (iphi+1)%4 + 1;
496 if (ieta >= 21 && (irm == 1 || irm == 3))
497 iwedge = (iphi + 1 + irm + 1) / 4;
499 iwedge = (iphi + irm + 1) / 4;
500 if (iwedge > 18) iwedge -= 18;
501 sprintf (tempbuff,
"%s%c%2.2i%c",det.c_str(),sidesign,iwedge,
'\0');
502 mystream << tempbuff;
503 rbx = mystream.str();
507 det = detector[subdet];
509 if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)) {
510 irm = ((iphi + 1) / 2) % 36 + 1;
511 hfphi = ((iphi + 1) / 6) % 12 + 1;
513 irm = ( iphi + 1) / 2;
514 hfphi = (iphi - 1) / 6 + 1;
516 irm = (irm - 1) % 3 + 1;
517 sprintf (tempbuff,
"%s%c%2.2i%c",det.c_str(),sidesign,hfphi,
'\0');
518 mystream << tempbuff;
519 rbx = mystream.str();
523 det = detector[subdet];
524 int ring(0), sector(0);
525 if (ieta <= 4)
ring = 0;
526 else if (ieta >= 5 && ieta <= 10)
ring = 1;
528 for (
int i = -2;
i < iphi;
i+=6) sector++;
529 if (sector > 12) sector = 1;
530 irm = ((iphi+1)/2)%6 + 1;
531 if (
ring != 0 && sector % 2 != 0) sector++;
533 sprintf (tempbuff,
"%s%i%2.2d",det.c_str(),
ring,sector);
535 sprintf (tempbuff,
"%s%i%c%2.2d",det.c_str(),
ring,sidesign,sector);
536 mystream << tempbuff;
537 rbx = mystream.str();
543 return std::make_unique<HcalFrontEndMap>(emapHelper);
548 auto eta_depth_pair = std::make_pair(ieta,depth);
554 std::vector<int> segmentation;
557 int nLayersInDepth =
std::distance(std::lower_bound(segmentation.begin(),segmentation.end(),
depth),
558 std::upper_bound(segmentation.begin(),segmentation.end(),
depth));
560 return nLayersInDepth;
568 if(hid.
zside()==1 && (hid.
iphi()==63 || hid.
iphi()==64 || hid.
iphi()==65 || hid.
iphi()==66))
return true;
585 if(nLayersInDepth > 4) {
599 if(nLayersInDepth > 4) {
626 ps.getParameter<
int>(
"pixels"),
627 ps.getParameter<
double>(
"nonlin1"),
628 ps.getParameter<
double>(
"nonlin2"),
629 ps.getParameter<
double>(
"nonlin3"),
630 ps.getParameter<
double>(
"crosstalk"),
634 return std::make_unique<HcalSiPMCharacteristics>(sipmHelper);
641 uint32_t bitInfo = ((44 << 16) | 30);
649 tppar.
loadObject(0,0,0xFFFFFFFFFFFFFFFF,0,0,0);
const double pedestalWidth() const
std::unique_ptr< HcalDcsMap > makeHardcodeDcsMap()
HcalGainWidth makeGainWidth(HcalGenericDetId fId)
HcalHardcodeParameters theHOParameters_
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) 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)
HcalRecoParam makeRecoParam(HcalGenericDetId fId)
HcalQIECoder makeQIECoder(HcalGenericDetId fId)
const int qieType() const
const int mcShape() const
HcalMCParam makeMCParam(HcalGenericDetId fId)
float getValue(int fCapId) const
get value for capId = 0..3
HcalHardcodeParameters theDefaultParameters_
const HcalHardcodeParameters & getParameters(HcalGenericDetId fId)
std::unique_ptr< HcalSiPMCharacteristics > makeHardcodeSiPMCharacteristics()
const double gainWidth(unsigned index) const
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId)
const double photoelectronsToAnalog() const
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId)
uint32_t rawId() const
get the raw id
HcalHardcodeParameters theHEUpgradeParameters_
void makeHardcodeFrontEndMap(HcalFrontEndMap &emap, const std::vector< HcalGenericDetId > &cells)
HcalTPChannelParameter makeHardcodeTPChannelParameter(HcalGenericDetId fId)
int depth() const
get the tower depth
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)
HcalHardcodeParameters theHBUpgradeParameters_
HcalTimingParam makeTimingParam(HcalGenericDetId fId)
HcalQIEType makeQIEType(HcalGenericDetId fId)
int ieta() const
get the cell ieta
HcalQIEShape makeQIEShape()
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
int iphi() const
get the cell iphi
std::unique_ptr< HcalElectronicsMap > makeHardcodeMap(const std::vector< HcalGenericDetId > &cells)
void makeHardcodeTPParameters(HcalTPParameters &tppar)
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)
const double gain(unsigned index) const
static std::atomic< unsigned int > counter
int getLayersInDepth(int ieta, int depth, const HcalTopology *topo)
HcalHardcodeParameters theHFParameters_
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false)
const int getGainIndex(HcalGenericDetId fId)
bool isHEPlan1(HcalGenericDetId fId)
HcalHardcodeParameters theHEParameters_
HcalSiPMParameter makeHardcodeSiPMParameter(HcalGenericDetId fId, const HcalTopology *topo, double intlumi)
HcalGenericSubdetector genericSubdet() const
std::map< std::pair< int, int >, int > theLayersInDepths_
Readout chain identification for Hcal.
HcalHardcodeParameters theHFUpgradeParameters_