10 #include "CLHEP/Random/RandGauss.h" 17 : 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}),
18 setHB_(
false), setHE_(
false), setHF_(
false), setHO_(
false),
19 setHBUpgrade_(
false), setHEUpgrade_(
false), setHFUpgrade_(
false),
20 useHBUpgrade_(
false), useHEUpgrade_(
false), useHOUpgrade_(
true),
21 useHFUpgrade_(
false), testHFQIE10_(
false), testHEPlan1_(
false)
60 if ((hid.
ieta() > -5) && (hid.
ieta() < 5)) index = 0;
64 if (hid.
depth() % 2 == 1) index = 0;
65 else if (hid.
depth() % 2 == 0) index = 1;
73 float value [4] = {value0,value0,value0,value0};
75 for (
int i = 0;
i < 4;
i++) {
77 while (value [
i] <= 0.0
f)
79 value [
i] = value0 + (
float)CLHEP::RandGauss::shoot (0.0, width.
getWidth (
i) / 100.);
83 value[0], value[1], value[2], value[3]
93 float width2 = value*
value;
94 for (
int i = 0;
i < 4;
i++) {
95 for (
int j = 0; j < 4; j++) {
106 float value [4] = {value0, value0, value0, value0};
108 for (
int i = 0;
i < 4;
i++) {
110 while (value [
i] <= 0.0
f) value [
i] = value0 + (
float)CLHEP::RandGauss::shoot (0.0, width.
getValue (
i));
127 for (
unsigned range = 0; range < 4; range++) {
128 for (
unsigned capid = 0; capid < 4; capid++) {
129 result.setOffset (capid, range, param.qieOffset(range));
130 result.setSlope (capid, range, param.qieSlope(range));
146 for (
int i = 0;
i < 64;
i++) { lowEdges[
i] = -1.5 +
i; }
147 result.setMinCharges (lowEdges);
165 float phase = -25.0f;
166 float Xphase = (phase + 32.0f) * 4.0
f;
168 int Iphase = Xphase; r1bit[3] = 8;
172 int pulseShapeID = hparam.
mcShape();
179 Xphase = (phase + 32.0f) * 4.0
f;
191 Xphase = (phase + 32.0f) * 4.0
f;
203 Xphase = (phase + 32.0f) * 4.0
f;
209 if (cell.
ieta() == 1 && cell.
iphi() == 1) pulseShapeID = 125;
218 Xphase = (phase + 32.0f) * 4.0
f;
231 Xphase = (phase + 32.0f) * 4.0
f;
241 for(
int k=0;
k<5;
k++) {
242 rshift[
k+1]=rshift[
k]+r1bit[
k];
245 int packingScheme = 1;
246 unsigned int param = pulseShapeID |
247 syncPhase<<rshift[1] |
248 (binOfMaximum << rshift[2]) |
249 (Iphase << rshift[3]) |
250 (timeSmearing << rshift[4] | packingScheme << 27);
263 int containmentCorrectionFlag = 0; p1bit[0]=1;
264 int containmentCorrectionPreSample = 0; p1bit[1]=1;
266 float Xphase = (phase + 32.0) * 4.0;
268 int Iphase = Xphase; p1bit[2]=8;
280 int LeakCorrectionID = 0; q2bit[1]=4;
282 int timeCorrectionID = 0; q2bit[3]=4;
285 int specialCaseID = 0; q2bit[6]=4;
286 int noiseFlaggingID = 0; q2bit[7]=4;
287 int pileupCleaningID = 0; q2bit[8]=4;
288 int packingScheme = 1; q2bit[9]=4;
294 containmentCorrectionFlag = 1;
295 containmentCorrectionPreSample = 0;
297 float Xphase = (phase + 32.0) * 4.0;
304 useLeakCorrection = 0;
305 LeakCorrectionID = 0;
306 correctForTimeslew = 1;
307 timeCorrectionID = 0;
312 pileupCleaningID = 0;
318 containmentCorrectionFlag = 1;
319 containmentCorrectionPreSample = 0;
321 float Xphase = (phase + 32.0) * 4.0;
328 useLeakCorrection = 0;
329 LeakCorrectionID = 0;
330 correctForTimeslew = 1;
331 timeCorrectionID = 0;
336 pileupCleaningID = 0;
341 containmentCorrectionFlag = 0;
342 containmentCorrectionPreSample = 0;
344 float Xphase = (phase + 32.0) * 4.0;
351 useLeakCorrection = 0;
352 LeakCorrectionID = 0;
353 correctForTimeslew = 0;
354 timeCorrectionID = 0;
359 pileupCleaningID = 0;
365 int p1shift[7]; p1shift[0] = 0;
366 for(
int k = 0;
k < 6;
k++) {
368 p1shift[j] = p1shift[
k] + p1bit[
k];
372 param1 = containmentCorrectionFlag |
373 (containmentCorrectionPreSample << p1shift[1]) |
374 (Iphase << p1shift[2]) |
375 (firstSample << p1shift[3]) |
376 (samplesToAdd << p1shift[4]) |
377 (pulseShapeID << p1shift[5]) ;
379 int q2shift[10]; q2shift[0] = 0;
380 for(
int k = 0;
k < 9;
k++) {
382 q2shift[j] = q2shift[
k] + q2bit[
k];
386 param2 = useLeakCorrection |
387 (LeakCorrectionID << q2shift[1]) |
388 (correctForTimeslew << q2shift[2]) |
389 (timeCorrectionID << q2shift[3]) |
390 (correctTiming << q2shift[4]) |
391 (firstAuxTS << q2shift[5]) |
392 (specialCaseID << q2shift[6]) |
393 (noiseFlaggingID << q2shift[7]) |
394 (pileupCleaningID << q2shift[8]) |
395 (packingScheme << q2shift[9]) ;
415 #define EMAP_NHBHECR 9 421 #define EMAP_NHSETS 4 422 #define EMAP_NTOPBOT 2 423 #define EMAP_NHTRSHO 4 424 #define EMAP_NHSETSHO 3 442 static const int kUTCAMask = 0x4000000;
443 static const int kLinearIndexMax = 0x7FFFF;
444 static const int kTriggerBitMask = 0x02000000;
446 uint32_t counterTrig = 0;
447 for(
const auto& fId : cells){
455 assert(counter < kLinearIndexMax);
463 assert(counterTrig < kLinearIndexMax);
464 uint32_t raw = counterTrig;
465 raw |= kUTCAMask | kTriggerBitMask;
475 std::stringstream mystream;
477 for (
const auto& fId : cells) {
478 if (fId.isHcalDetId()) {
481 int ieta =
id.ietaAbs();
482 int iside =
id.zside();
483 int iphi =
id.iphi();
487 char sidesign = (iside == -1) ?
'M' :
'P';
489 det = detector[subdet];
490 irm = (iphi+1)%4 + 1;
492 if (ieta >= 21 && (irm == 1 || irm == 3))
493 iwedge = (iphi + 1 + irm + 1) / 4;
495 iwedge = (iphi + irm + 1) / 4;
496 if (iwedge > 18) iwedge -= 18;
497 sprintf (tempbuff,
"%s%c%2.2i%c",det.c_str(),sidesign,iwedge,
'\0');
498 mystream << tempbuff;
499 rbx = mystream.str();
503 det = detector[subdet];
505 if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)) {
506 irm = ((iphi + 1) / 2) % 36 + 1;
507 hfphi = ((iphi + 1) / 6) % 12 + 1;
509 irm = ( iphi + 1) / 2;
510 hfphi = (iphi - 1) / 6 + 1;
512 irm = (irm - 1) % 3 + 1;
513 sprintf (tempbuff,
"%s%c%2.2i%c",det.c_str(),sidesign,hfphi,
'\0');
514 mystream << tempbuff;
515 rbx = mystream.str();
519 det = detector[subdet];
520 int ring(0), sector(0);
521 if (ieta <= 4)
ring = 0;
522 else if (ieta >= 5 && ieta <= 10)
ring = 1;
524 for (
int i = -2;
i < iphi;
i+=6) sector++;
525 if (sector > 12) sector = 1;
526 irm = ((iphi+1)/2)%6 + 1;
527 if (
ring != 0 && sector % 2 != 0) sector++;
529 sprintf (tempbuff,
"%s%i%2.2d",det.c_str(),
ring,sector);
531 sprintf (tempbuff,
"%s%i%c%2.2d",det.c_str(),
ring,sidesign,sector);
532 mystream << tempbuff;
533 rbx = mystream.str();
544 auto eta_depth_pair = std::make_pair(ieta,depth);
550 std::vector<int> segmentation;
553 int nLayersInDepth =
std::distance(std::lower_bound(segmentation.begin(),segmentation.end(),
depth),
554 std::upper_bound(segmentation.begin(),segmentation.end(),
depth));
556 return nLayersInDepth;
564 if(hid.
zside()==1 && (hid.
iphi()==63 || hid.
iphi()==64 || hid.
iphi()==65 || hid.
iphi()==66))
return true;
581 if(nLayersInDepth > 4) {
595 if(nLayersInDepth > 4) {
621 ps.getParameter<
int>(
"pixels"),
622 ps.getParameter<
double>(
"nonlin1"),
623 ps.getParameter<
double>(
"nonlin2"),
624 ps.getParameter<
double>(
"nonlin3"),
625 ps.getParameter<
double>(
"crosstalk"),
635 uint32_t bitInfo = ((44 << 16) | 30);
643 tppar.
loadObject(0,0,0xFFFFFFFFFFFFFFFF,0,0,0);
const double pedestalWidth() const
HcalGainWidth makeGainWidth(HcalGenericDetId fId)
HcalHardcodeParameters theHOParameters_
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
HcalSubdetector subdet() const
get the subdetector
const int recoShape() const
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
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
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
const int mcShape() const
HcalMCParam makeMCParam(HcalGenericDetId fId)
void makeHardcodeSiPMCharacteristics(HcalSiPMCharacteristics &sipm)
float getValue(int fCapId) const
get value for capId = 0..3
HcalHardcodeParameters theDefaultParameters_
const HcalHardcodeParameters & getParameters(HcalGenericDetId fId)
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
void makeHardcodeMap(HcalElectronicsMap &emap, const std::vector< HcalGenericDetId > &cells)
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)
HcalHardcodeParameters theHBUpgradeParameters_
bool loadObject(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1=0, float auxi2=0)
HcalTimingParam makeTimingParam(HcalGenericDetId fId)
HcalQIEType makeQIEType(HcalGenericDetId fId)
int ieta() const
get the cell ieta
HcalQIEShape makeQIEShape()
void makeHardcodeDcsMap(HcalDcsMap &dcs_map)
const double pedestal() const
HcalHardcodeParameters theHBParameters_
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
int ietaAbs() const
get the absolute value of the cell ieta
int iphi() const
get the cell iphi
void makeHardcodeTPParameters(HcalTPParameters &tppar)
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
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
bool loadObject(DetId fId, int rm, std::string rbx)
load a new entry
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_