18 std::istringstream
iss;
21 gzf = gzopen(file,
"rb");
24 edm::LogWarning(
"EcalTPG") <<
"Database file " << file <<
" not found!!!";
29 char *
res = gzgets(gzf, buffer, 256);
30 eof = (res == Z_NULL);
37 explicit operator bool()
const {
38 return ((eof ==
true) ?
false : !iss.fail());
43 while ((
bool)gis && !(gis.
iss >> var)) {
55 iConfig.getUntrackedParameter<
std::
string>(
"DatabaseFile",
"")),
56 flagPrint_(iConfig.getParameter<
bool>(
"WriteInFile")) {
86 std::unique_ptr<EcalTPGPedestals>
88 auto prod = std::make_unique<EcalTPGPedestals>();
90 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
96 prod->setValue(it->first, item);
101 std::unique_ptr<EcalTPGLinearizationConst>
104 auto prod = std::make_unique<EcalTPGLinearizationConst>();
106 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
110 item.
mult_x6 = (it->second)[4];
111 item.
mult_x1 = (it->second)[7];
115 prod->setValue(it->first, item);
120 std::unique_ptr<EcalTPGSlidingWindow>
123 auto prod = std::make_unique<EcalTPGSlidingWindow>();
125 for (
int subdet = 0; subdet < 2; subdet++) {
126 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
128 prod->setValue(it->first, (it->second)[0]);
134 std::unique_ptr<EcalTPGFineGrainEBIdMap>
137 auto prod = std::make_unique<EcalTPGFineGrainEBIdMap>();
140 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
142 fg.
setValues((it->second)[0], (it->second)[1], (it->second)[2],
143 (it->second)[3], (it->second)[4]);
144 prod->setValue(it->first, fg);
149 std::unique_ptr<EcalTPGFineGrainStripEE>
152 auto prod = std::make_unique<EcalTPGFineGrainStripEE>();
155 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
159 item.
lut = (it->second)[3];
160 prod->setValue(it->first, item);
166 item.
lut = (it->second)[3];
167 prod->setValue(it->first, item);
172 std::unique_ptr<EcalTPGFineGrainTowerEE>
175 auto prod = std::make_unique<EcalTPGFineGrainTowerEE>();
177 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
179 prod->setValue(it->first, (it->second)[1]);
184 std::unique_ptr<EcalTPGLutIdMap>
186 auto prod = std::make_unique<EcalTPGLutIdMap>();
189 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
191 unsigned int lutArray[1024];
192 for (
int i = 0;
i < 1024;
i++)
193 lutArray[
i] = (it->second)[
i];
195 prod->setValue(it->first, lut);
200 std::unique_ptr<EcalTPGWeightIdMap>
202 auto prod = std::make_unique<EcalTPGWeightIdMap>();
205 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
207 weights.
setValues((it->second)[0], (it->second)[1], (it->second)[2],
208 (it->second)[3], (it->second)[4]);
209 prod->setValue(it->first, weights);
216 auto prod = std::make_unique<EcalTPGWeightGroup>();
218 for (
int subdet = 0; subdet < 2; subdet++) {
219 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
221 prod->setValue(it->first, (it->second)[1]);
227 std::unique_ptr<EcalTPGLutGroup>
229 auto prod = std::make_unique<EcalTPGLutGroup>();
231 for (
int subdet = 0; subdet < 2; subdet++) {
232 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
234 prod->setValue(it->first, (it->second)[0]);
240 std::unique_ptr<EcalTPGFineGrainEBGroup>
243 auto prod = std::make_unique<EcalTPGFineGrainEBGroup>();
245 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
247 prod->setValue(it->first, (it->second)[1]);
252 std::unique_ptr<EcalTPGPhysicsConst>
255 auto prod = std::make_unique<EcalTPGPhysicsConst>();
257 std::map<uint32_t, std::vector<float>>::const_iterator it;
260 item.
EtSat = (it->second)[0];
267 prod->setValue(it->first, item);
272 std::unique_ptr<EcalTPGCrystalStatus>
274 auto prod = std::make_unique<EcalTPGCrystalStatus>();
276 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
281 prod->setValue(it->first, badXValue);
286 std::unique_ptr<EcalTPGStripStatus>
288 auto prod = std::make_unique<EcalTPGStripStatus>();
293 std::unique_ptr<EcalTPGTowerStatus>
295 auto prod = std::make_unique<EcalTPGTowerStatus>();
297 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
301 prod->setValue(it->first, 0);
306 prod->setValue(it->first, 0);
312 std::unique_ptr<EcalTPGSpike>
314 auto prod = std::make_unique<EcalTPGSpike>();
317 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
319 prod->setValue(it->first, (it->second)[2]);
331 std::ifstream infile;
332 std::vector<unsigned int> param;
333 std::vector<float> paramF;
334 int NBstripparams[2] = {4, 4};
342 "SimCalorimetry/EcalTrigPrimProducers/data/" +
dbFilename_;
347 finalFileName = fileInPath.
fullPath();
350 edm::LogWarning(
"EcalTPG") <<
"Couldnt find database file via fileinpath, " 351 "trying with pathname directly!!";
357 while (gis >> dataCard) {
359 if (dataCard ==
"PHYSICS_EB" || dataCard ==
"PHYSICS_EE") {
371 for (
int i = 0;
i < 7;
i++) {
373 paramF.push_back(dataF);
379 std::ostringstream oss;
389 std::ostringstream oss;
411 if (dataCard ==
"CRYSTAL") {
422 std::cout <<
"COMMENT ====== barrel crystals ====== " << std::endl;
425 std::cout <<
"COMMENT ====== endcap crystals ====== " << std::endl;
433 for (
int i = 0;
i < 9;
i++) {
434 gis >> std::hex >>
data;
436 param.push_back(data);
440 std::ostringstream oss;
441 oss << std::hex <<
data;
449 }
else if (
i > 2 &&
i < 6) {
450 std::ostringstream oss;
451 oss << std::hex <<
data;
458 }
else if (
i > 5 &&
i < 9) {
459 std::ostringstream oss;
460 oss << std::hex <<
data;
482 if (dataCard ==
"STRIP_EB") {
491 for (
int i = 0;
i < NBstripparams[0];
i++) {
492 gis >> std::hex >>
data;
494 param.push_back(data);
498 std::cout <<
"0x" << std::hex << data << std::endl;
500 std::cout <<
"" << std::hex << data << std::endl;
502 std::ostringstream oss;
504 oss <<
"0x" << std::hex <<
data;
508 std::ostringstream oss;
509 oss <<
" 0x" << std::hex <<
data;
523 if (dataCard ==
"STRIP_EE") {
533 for (
int i = 0;
i < NBstripparams[1];
i++) {
534 gis >> std::hex >>
data;
535 param.push_back(data);
539 std::cout <<
"0x" << std::hex << data << std::endl;
541 std::cout <<
" " << std::hex << data << std::endl;
543 std::ostringstream oss;
545 oss <<
"0x" << std::hex <<
data;
549 std::ostringstream oss;
550 oss <<
" 0x" << std::hex <<
data;
564 if (dataCard ==
"TOWER_EE") {
571 for (
int i = 0;
i < 2;
i++) {
572 gis >> std::hex >>
data;
573 param.push_back(data);
588 if (dataCard ==
"TOWER_EB") {
595 for (
int i = 0;
i < 3;
i++) {
602 param.push_back(data);
609 if (dataCard ==
"WEIGHT") {
614 gis >> std::hex >>
id;
622 for (
int i = 0;
i < 5;
i++) {
623 gis >> std::hex >>
data;
624 param.push_back(data);
627 std::ostringstream oss;
628 oss << std::hex <<
data;
646 if (dataCard ==
"FG") {
651 gis >> std::hex >>
id;
657 for (
int i = 0;
i < 5;
i++) {
658 gis >> std::hex >>
data;
659 param.push_back(data);
662 std::ostringstream oss;
663 oss << std::hex <<
data;
682 if (dataCard ==
"LUT") {
683 gis >> std::hex >>
id;
689 for (
int i = 0;
i < 1024;
i++) {
690 gis >> std::hex >>
data;
691 param.push_back(data);
694 std::cout <<
"0x" << std::hex << data << std::endl;
712 std::vector<int> range;
727 range.push_back(109);
742 range[1] = tccNb + 1;
744 if (towerNbInTcc > 0) {
745 range[2] = towerNbInTcc;
746 range[3] = towerNbInTcc + 1;
748 if (stripNbInTower > 0) {
749 range[4] = stripNbInTower;
750 range[5] = stripNbInTower + 1;
752 if (xtalNbInStrip > 0) {
753 range[6] = xtalNbInStrip;
754 range[7] = xtalNbInStrip + 1;
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
std::vector< int > getRange(int subdet, int smNb, int towerNbInSm, int stripNbInTower=0, int xtalNbInStrip=0)
std::unique_ptr< EcalTPGWeightGroup > produceWeightGroup(const EcalTPGWeightGroupRcd &)
std::unique_ptr< EcalTPGCrystalStatus > produceBadX(const EcalTPGCrystalStatusRcd &)
GzInputStream & operator>>(GzInputStream &gis, T &var)
void setValues(const uint32_t &ThresholdETLow, const uint32_t &ThresholdETHigh, const uint32_t &RatioLow, const uint32_t &RatioHigh, const uint32_t &LUT)
std::unique_ptr< EcalTPGLinearizationConst > produceLinearizationConst(const EcalTPGLinearizationConstRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapTower_[2]
std::unique_ptr< EcalTPGFineGrainEBIdMap > produceFineGrainEB(const EcalTPGFineGrainEBIdMapRcd &)
std::unique_ptr< EcalTPGLutIdMap > produceLUT(const EcalTPGLutIdMapRcd &)
void setLut(const unsigned int *lut)
std::unique_ptr< EcalTPGTowerStatus > produceBadTT(const EcalTPGTowerStatusRcd &)
std::unique_ptr< EcalTPGPedestals > producePedestals(const EcalTPGPedestalsRcd &)
std::unique_ptr< EcalTPGPhysicsConst > producePhysicsConst(const EcalTPGPhysicsConstRcd &)
void setStatusCode(const uint16_t &val)
std::map< uint32_t, std::vector< uint32_t > > mapXtal_
std::unique_ptr< EcalTPGFineGrainTowerEE > produceFineGrainEEtower(const EcalTPGFineGrainTowerEERcd &)
std::unique_ptr< EcalTPGSpike > produceSpike(const EcalTPGSpikeRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapWeight_
std::unique_ptr< EcalTPGSlidingWindow > produceSlidingWindow(const EcalTPGSlidingWindowRcd &)
~EcalTrigPrimESProducer() override
std::unique_ptr< EcalTPGFineGrainEBGroup > produceFineGrainEBGroup(const EcalTPGFineGrainEBGroupRcd &)
EcalTrigPrimESProducer(const edm::ParameterSet &)
std::unique_ptr< EcalTPGLutGroup > produceLutGroup(const EcalTPGLutGroupRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapFg_
double ttf_threshold_High
std::map< uint32_t, std::vector< float > > mapPhys_
char data[epos_bytes_allocation]
std::string fullPath() const
std::unique_ptr< EcalTPGFineGrainStripEE > produceFineGrainEEstrip(const EcalTPGFineGrainStripEERcd &)
std::unique_ptr< EcalTPGWeightIdMap > produceWeight(const EcalTPGWeightIdMapRcd &)
std::unique_ptr< EcalTPGStripStatus > produceBadStrip(const EcalTPGStripStatusRcd &)
void setValues(const uint32_t &w0, const uint32_t &w1, const uint32_t &w2, const uint32_t &w3, const uint32_t &w4)
std::map< uint32_t, std::vector< uint32_t > > mapLut_
std::map< uint32_t, std::vector< uint32_t > > mapStrip_[2]