18 std::istringstream
iss;
36 if (
found != std::string::npos) {
42 explicit operator bool()
const {
return ((
eof ==
true) ?
false : !
iss.fail()); }
47 while ((
bool)gis && !(gis.
iss >>
var)) {
58 : dbFilename_(iConfig.getUntrackedParameter<
std::
string>(
"DatabaseFile",
"")),
59 flagPrint_(iConfig.getParameter<
bool>(
"WriteInFile")) {
83 tpMode_ = std::vector<uint32_t>(18, 0);
95 auto prod = std::make_unique<EcalTPGPedestals>();
97 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
100 item.mean_x12 = (it->second)[0];
101 item.mean_x6 = (it->second)[3];
102 item.mean_x1 = (it->second)[6];
110 auto prod = std::make_unique<EcalTPGLinearizationConst>();
112 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
115 item.mult_x12 = (it->second)[1];
116 item.mult_x6 = (it->second)[4];
117 item.mult_x1 = (it->second)[7];
118 item.shift_x12 = (it->second)[2];
119 item.shift_x6 = (it->second)[5];
120 item.shift_x1 = (it->second)[8];
128 auto prod = std::make_unique<EcalTPGSlidingWindow>();
130 for (
int subdet = 0; subdet < 2; subdet++) {
131 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
133 prod->setValue(it->first, (it->second)[0]);
141 auto prod = std::make_unique<EcalTPGFineGrainEBIdMap>();
144 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
146 fg.
setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]);
147 prod->setValue(it->first, fg);
154 auto prod = std::make_unique<EcalTPGFineGrainStripEE>();
157 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
160 item.threshold = (it->second)[3];
161 item.lut = (it->second)[4];
167 item.threshold = (it->second)[3];
168 item.lut = (it->second)[4];
176 auto prod = std::make_unique<EcalTPGFineGrainTowerEE>();
178 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
180 prod->setValue(it->first, (it->second)[1]);
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);
201 auto prod = std::make_unique<EcalTPGWeightIdMap>();
204 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
206 weights.setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]);
213 auto prod = std::make_unique<EcalTPGWeightGroup>();
215 for (
int subdet = 0; subdet < 2; subdet++) {
216 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
218 prod->setValue(it->first, (it->second)[1]);
226 auto prod = std::make_unique<EcalTPGOddWeightIdMap>();
229 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
231 weights.setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]);
239 auto prod = std::make_unique<EcalTPGOddWeightGroup>();
241 for (
int subdet = 0; subdet < 2; subdet++) {
242 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
244 prod->setValue(it->first, (it->second)[2]);
251 auto prod = std::make_unique<EcalTPGTPMode>();
278 auto prod = std::make_unique<EcalTPGLutGroup>();
280 for (
int subdet = 0; subdet < 2; subdet++) {
281 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
283 prod->setValue(it->first, (it->second)[0]);
291 auto prod = std::make_unique<EcalTPGFineGrainEBGroup>();
293 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
295 prod->setValue(it->first, (it->second)[1]);
301 auto prod = std::make_unique<EcalTPGPhysicsConst>();
303 std::map<uint32_t, std::vector<float>>::const_iterator it;
306 item.EtSat = (it->second)[0];
307 item.ttf_threshold_Low = (it->second)[1];
308 item.ttf_threshold_High = (it->second)[2];
309 item.FG_lowThreshold = (it->second)[3];
310 item.FG_highThreshold = (it->second)[4];
311 item.FG_lowRatio = (it->second)[5];
312 item.FG_highRatio = (it->second)[6];
319 auto prod = std::make_unique<EcalTPGCrystalStatus>();
321 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
325 prod->setValue(it->first, badXValue);
331 auto prod = std::make_unique<EcalTPGStripStatus>();
337 auto prod = std::make_unique<EcalTPGTowerStatus>();
339 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
343 prod->setValue(it->first, 0);
348 prod->setValue(it->first, 0);
355 auto prod = std::make_unique<EcalTPGSpike>();
358 std::map<uint32_t, std::vector<uint32_t>>::const_iterator it;
360 prod->setValue(it->first, (it->second)[2]);
373 std::vector<unsigned int> param;
374 std::vector<float> paramF;
375 int NBstripparams[2] = {5, 5};
387 finalFileName = fileInPath.
fullPath();
390 edm::LogWarning(
"EcalTPG") <<
"Couldnt find database file via fileinpath, " 391 "trying with pathname directly!!";
397 while (gis >> dataCard) {
398 if (dataCard ==
"PHYSICS_EB" || dataCard ==
"PHYSICS_EE") {
410 for (
int i = 0;
i < 7;
i++) {
412 paramF.push_back(dataF);
418 std::ostringstream oss;
428 std::ostringstream oss;
450 if (dataCard ==
"CRYSTAL") {
460 edm::LogVerbatim(
"EcalTrigPrimESProducer") <<
"COMMENT ====== barrel crystals ====== ";
463 edm::LogVerbatim(
"EcalTrigPrimESProducer") <<
"COMMENT ====== endcap crystals ====== ";
471 for (
int i = 0;
i < 9;
i++) {
472 gis >> std::hex >>
data;
474 param.push_back(
data);
478 std::ostringstream oss;
479 oss << std::hex <<
data;
487 }
else if (
i > 2 &&
i < 6) {
488 std::ostringstream oss;
489 oss << std::hex <<
data;
496 }
else if (
i > 5 &&
i < 9) {
497 std::ostringstream oss;
498 oss << std::hex <<
data;
520 if (dataCard ==
"STRIP_EB") {
529 for (
int i = 0;
i < NBstripparams[0];
i++) {
530 gis >> std::hex >>
data;
532 param.push_back(
data);
537 }
else if (
i >= 1 &&
i < 3) {
540 std::ostringstream oss;
542 oss <<
"0x" << std::hex <<
data;
546 std::ostringstream oss;
547 oss <<
" 0x" << std::hex <<
data;
560 if (dataCard ==
"STRIP_EE") {
570 for (
int i = 0;
i < NBstripparams[1];
i++) {
571 gis >> std::hex >>
data;
572 param.push_back(
data);
577 }
else if (
i >= 1 &&
i < 3) {
580 std::ostringstream oss;
582 oss <<
"0x" << std::hex <<
data;
586 std::ostringstream oss;
587 oss <<
" 0x" << std::hex <<
data;
601 if (dataCard ==
"TOWER_EE") {
608 for (
int i = 0;
i < 2;
i++) {
609 gis >> std::hex >>
data;
610 param.push_back(
data);
625 if (dataCard ==
"TOWER_EB") {
632 for (
int i = 0;
i < 3;
i++) {
639 param.push_back(
data);
646 if (dataCard ==
"WEIGHT") {
647 gis >> std::hex >>
id;
655 for (
int i = 0;
i < 5;
i++) {
656 gis >> std::hex >>
data;
657 param.push_back(
data);
660 std::ostringstream oss;
661 oss << std::hex <<
data;
678 if (dataCard ==
"WEIGHT_ODD") {
679 gis >> std::hex >>
id;
687 for (
int i = 0;
i < 5;
i++) {
688 gis >> std::hex >>
data;
689 param.push_back(
data);
692 std::ostringstream oss;
693 oss << std::hex <<
data;
710 if (dataCard ==
"FG") {
711 gis >> std::hex >>
id;
717 for (
int i = 0;
i < 5;
i++) {
718 gis >> std::hex >>
data;
719 param.push_back(
data);
722 std::ostringstream oss;
723 oss << std::hex <<
data;
741 if (dataCard ==
"LUT") {
742 gis >> std::hex >>
id;
748 for (
int i = 0;
i < 1024;
i++) {
749 gis >> std::hex >>
data;
750 param.push_back(
data);
760 if (dataCard ==
"TP_MODE") {
764 for (
int i = 0;
i < 18;
i++) {
766 param.push_back(
data);
769 std::ostringstream oss;
789 int subdet,
int tccNb,
int towerNbInTcc,
int stripNbInTower,
int xtalNbInStrip) {
790 std::vector<int>
range;
805 range.push_back(109);
820 range[1] = tccNb + 1;
822 if (towerNbInTcc > 0) {
823 range[2] = towerNbInTcc;
824 range[3] = towerNbInTcc + 1;
826 if (stripNbInTower > 0) {
827 range[4] = stripNbInTower;
828 range[5] = stripNbInTower + 1;
830 if (xtalNbInStrip > 0) {
831 range[6] = xtalNbInStrip;
832 range[7] = xtalNbInStrip + 1;
Log< level::Info, true > LogVerbatim
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::string fullPath() const
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::vector< uint32_t > tpMode_
std::map< uint32_t, std::vector< uint32_t > > mapWeight_odd_
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::unique_ptr< EcalTPGOddWeightGroup > produceOddWeightGroup(const EcalTPGOddWeightGroupRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapXtal_
std::unique_ptr< EcalTPGTPMode > produceTPMode(const EcalTPGTPModeRcd &)
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 &)
std::unique_ptr< EcalTPGOddWeightIdMap > produceOddWeight(const EcalTPGOddWeightIdMapRcd &)
~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_
std::map< uint32_t, std::vector< float > > mapPhys_
char data[epos_bytes_allocation]
std::unique_ptr< EcalTPGFineGrainStripEE > produceFineGrainEEstrip(const EcalTPGFineGrainStripEERcd &)
Log< level::Warning, false > LogWarning
std::unique_ptr< EcalTPGWeightIdMap > produceWeight(const EcalTPGWeightIdMapRcd &)
std::unique_ptr< EcalTPGStripStatus > produceBadStrip(const EcalTPGStripStatusRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapLut_
std::map< uint32_t, std::vector< uint32_t > > mapStrip_[2]