18 std::istringstream
iss;
37 explicit operator bool()
const {
return ((
eof ==
true) ?
false : !
iss.fail()); }
42 while ((
bool)gis && !(gis.
iss >>
var)) {
53 : dbFilename_(iConfig.getUntrackedParameter<
std::
string>(
"DatabaseFile",
"")),
54 flagPrint_(iConfig.getParameter<
bool>(
"WriteInFile")) {
85 auto prod = std::make_unique<EcalTPGPedestals>();
87 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
90 item.mean_x12 = (it->second)[0];
91 item.mean_x6 = (it->second)[3];
92 item.mean_x1 = (it->second)[6];
100 auto prod = std::make_unique<EcalTPGLinearizationConst>();
102 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
105 item.mult_x12 = (it->second)[1];
106 item.mult_x6 = (it->second)[4];
107 item.mult_x1 = (it->second)[7];
108 item.shift_x12 = (it->second)[2];
109 item.shift_x6 = (it->second)[5];
110 item.shift_x1 = (it->second)[8];
118 auto prod = std::make_unique<EcalTPGSlidingWindow>();
120 for (
int subdet = 0; subdet < 2; subdet++) {
121 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
123 prod->setValue(it->first, (it->second)[0]);
131 auto prod = std::make_unique<EcalTPGFineGrainEBIdMap>();
134 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
136 fg.
setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]);
137 prod->setValue(it->first, fg);
144 auto prod = std::make_unique<EcalTPGFineGrainStripEE>();
147 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
150 item.threshold = (it->second)[2];
151 item.lut = (it->second)[3];
157 item.threshold = (it->second)[2];
158 item.lut = (it->second)[3];
166 auto prod = std::make_unique<EcalTPGFineGrainTowerEE>();
168 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
170 prod->setValue(it->first, (it->second)[1]);
176 auto prod = std::make_unique<EcalTPGLutIdMap>();
179 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
181 unsigned int lutArray[1024];
182 for (
int i = 0;
i < 1024;
i++)
183 lutArray[
i] = (it->second)[
i];
185 prod->setValue(it->first, lut);
191 auto prod = std::make_unique<EcalTPGWeightIdMap>();
194 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
196 weights.setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]);
203 auto prod = std::make_unique<EcalTPGWeightGroup>();
205 for (
int subdet = 0; subdet < 2; subdet++) {
206 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
208 prod->setValue(it->first, (it->second)[1]);
215 auto prod = std::make_unique<EcalTPGLutGroup>();
217 for (
int subdet = 0; subdet < 2; subdet++) {
218 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
220 prod->setValue(it->first, (it->second)[0]);
228 auto prod = std::make_unique<EcalTPGFineGrainEBGroup>();
230 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
232 prod->setValue(it->first, (it->second)[1]);
238 auto prod = std::make_unique<EcalTPGPhysicsConst>();
240 std::map<uint32_t, std::vector<float>>::const_iterator it;
243 item.EtSat = (it->second)[0];
244 item.ttf_threshold_Low = (it->second)[1];
245 item.ttf_threshold_High = (it->second)[2];
246 item.FG_lowThreshold = (it->second)[3];
247 item.FG_highThreshold = (it->second)[4];
248 item.FG_lowRatio = (it->second)[5];
249 item.FG_highRatio = (it->second)[6];
256 auto prod = std::make_unique<EcalTPGCrystalStatus>();
258 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
262 prod->setValue(it->first, badXValue);
268 auto prod = std::make_unique<EcalTPGStripStatus>();
274 auto prod = std::make_unique<EcalTPGTowerStatus>();
276 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
280 prod->setValue(it->first, 0);
285 prod->setValue(it->first, 0);
292 auto prod = std::make_unique<EcalTPGSpike>();
295 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
297 prod->setValue(it->first, (it->second)[2]);
310 std::vector<unsigned int> param;
311 std::vector<float> paramF;
312 int NBstripparams[2] = {4, 4};
324 finalFileName = fileInPath.
fullPath();
327 edm::LogWarning(
"EcalTPG") <<
"Couldnt find database file via fileinpath, "
328 "trying with pathname directly!!";
334 while (gis >> dataCard) {
335 if (dataCard ==
"PHYSICS_EB" || dataCard ==
"PHYSICS_EE") {
347 for (
int i = 0;
i < 7;
i++) {
349 paramF.push_back(dataF);
355 std::ostringstream oss;
365 std::ostringstream oss;
387 if (dataCard ==
"CRYSTAL") {
397 std::cout <<
"COMMENT ====== barrel crystals ====== " << std::endl;
400 std::cout <<
"COMMENT ====== endcap crystals ====== " << std::endl;
408 for (
int i = 0;
i < 9;
i++) {
409 gis >> std::hex >>
data;
411 param.push_back(
data);
415 std::ostringstream oss;
416 oss << std::hex <<
data;
424 }
else if (
i > 2 &&
i < 6) {
425 std::ostringstream oss;
426 oss << std::hex <<
data;
433 }
else if (
i > 5 &&
i < 9) {
434 std::ostringstream oss;
435 oss << std::hex <<
data;
457 if (dataCard ==
"STRIP_EB") {
466 for (
int i = 0;
i < NBstripparams[0];
i++) {
467 gis >> std::hex >>
data;
469 param.push_back(
data);
477 std::ostringstream oss;
479 oss <<
"0x" << std::hex <<
data;
483 std::ostringstream oss;
484 oss <<
" 0x" << std::hex <<
data;
498 if (dataCard ==
"STRIP_EE") {
508 for (
int i = 0;
i < NBstripparams[1];
i++) {
509 gis >> std::hex >>
data;
510 param.push_back(
data);
518 std::ostringstream oss;
520 oss <<
"0x" << std::hex <<
data;
524 std::ostringstream oss;
525 oss <<
" 0x" << std::hex <<
data;
539 if (dataCard ==
"TOWER_EE") {
546 for (
int i = 0;
i < 2;
i++) {
547 gis >> std::hex >>
data;
548 param.push_back(
data);
563 if (dataCard ==
"TOWER_EB") {
570 for (
int i = 0;
i < 3;
i++) {
577 param.push_back(
data);
584 if (dataCard ==
"WEIGHT") {
588 gis >> std::hex >>
id;
596 for (
int i = 0;
i < 5;
i++) {
597 gis >> std::hex >>
data;
598 param.push_back(
data);
601 std::ostringstream oss;
602 oss << std::hex <<
data;
620 if (dataCard ==
"FG") {
624 gis >> std::hex >>
id;
630 for (
int i = 0;
i < 5;
i++) {
631 gis >> std::hex >>
data;
632 param.push_back(
data);
635 std::ostringstream oss;
636 oss << std::hex <<
data;
655 if (dataCard ==
"LUT") {
656 gis >> std::hex >>
id;
662 for (
int i = 0;
i < 1024;
i++) {
663 gis >> std::hex >>
data;
664 param.push_back(
data);
682 int subdet,
int tccNb,
int towerNbInTcc,
int stripNbInTower,
int xtalNbInStrip) {
683 std::vector<int>
range;
698 range.push_back(109);
713 range[1] = tccNb + 1;
715 if (towerNbInTcc > 0) {
716 range[2] = towerNbInTcc;
717 range[3] = towerNbInTcc + 1;
719 if (stripNbInTower > 0) {
720 range[4] = stripNbInTower;
721 range[5] = stripNbInTower + 1;
723 if (xtalNbInStrip > 0) {
724 range[6] = xtalNbInStrip;
725 range[7] = xtalNbInStrip + 1;