18 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalPedestalsHandler")) {
19 edm::LogInfo(
"EcalPedestals Source handler constructor\n");
41 if (m_locationsource ==
"P5") {
43 }
else if (m_locationsource ==
"H2") {
45 }
else if (m_locationsource ==
"File") {
47 }
else if (m_locationsource ==
"MC") {
49 }
else if (m_locationsource ==
"2017") {
51 }
else if (m_locationsource ==
"Tree") {
53 }
else if (m_locationsource ==
"Timestamp") {
54 readPedestalTimestamp();
56 edm::LogInfo(
" unknown location ") << m_locationsource <<
" give up ";
64 if (
item->rms_x12 > 3 ||
item->rms_x12 <= 0)
66 if (
item->rms_x6 > 2 ||
item->rms_x6 <= 0)
68 if (
item->rms_x1 > 1 ||
item->rms_x1 <= 0)
70 if (
item->mean_x12 > 300 ||
item->mean_x12 <= 100)
72 if (
item->mean_x1 > 300 ||
item->mean_x1 <= 100)
74 if (
item->mean_x6 > 300 ||
item->mean_x6 <= 100)
82 std::ostringstream
ss;
85 unsigned int max_since = 0;
86 max_since =
static_cast<unsigned int>(
tagInfo().lastInterval.since);
88 Ref ped_db = lastPayload();
106 item.mean_x1 = aped.mean_x1;
107 item.rms_x1 = aped.rms_x1;
108 item.mean_x6 = aped.mean_x6;
109 item.rms_x6 = aped.rms_x6;
110 item.mean_x12 = aped.mean_x12;
111 item.rms_x12 = aped.rms_x12;
132 item.mean_x1 = aped.mean_x1;
133 item.rms_x1 = aped.rms_x1;
134 item.mean_x6 = aped.mean_x6;
135 item.rms_x6 = aped.rms_x6;
136 item.mean_x12 = aped.mean_x12;
137 item.rms_x12 = aped.rms_x12;
141 EEDetId eedetidneg(iX, iY, -1);
150 item.mean_x1 = aped.mean_x1;
151 item.rms_x1 = aped.rms_x1;
152 item.mean_x6 = aped.mean_x6;
153 item.rms_x6 = aped.rms_x6;
154 item.mean_x12 = aped.mean_x12;
155 item.rms_x12 = aped.rms_x12;
163 edm::LogInfo(
"Retrieving run list from ONLINE DB ... ");
193 unsigned int min_run = 0;
194 if (m_firstRun < max_since) {
195 min_run = max_since + 1;
197 min_run = m_firstRun;
200 unsigned int max_run = m_lastRun;
201 mon_list =
econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
203 std::vector<MonRunIOV> mon_run_vec = mon_list.
getRuns();
204 int mon_runs = mon_run_vec.size();
209 for (
int kr = 0; kr < krmax; kr++) {
212 unsigned int irun =
static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
213 edm::LogInfo(
"retrieve the data for run number: ") << mon_run_vec[kr].getRunIOV().getRunNumber();
214 if (mon_run_vec[kr].getSubRunNumber() <= 1) {
216 RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
218 std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
219 econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
220 edm::LogInfo(
"OMDS record for run ") << irun <<
" is made of " << dataset_mon.size();
221 int nEB = 0, nEE = 0;
222 typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
228 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
231 int sm_num = ecid_xt.
getID1();
232 int xt_num = ecid_xt.
getID2();
233 int yt_num = ecid_xt.
getID3();
246 if (ecid_xt.
getName() ==
"EB_crystal_number") {
254 if (!checkPedestal(&
item)) {
257 std::cout <<
"BAD LIST: channel " << sm_num <<
"/" << xt_num <<
"/" << yt_num <<
"ped/rms " 258 <<
item.mean_x12 <<
"/" <<
item.rms_x12 << std::endl;
285 if (nbad < (dataset_mon.size() * 0.05) && (nEB > 10200 || nEE > 2460)) {
286 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
289 int sm_num = ecid_xt.
getID1();
290 int xt_num = ecid_xt.
getID2();
291 int yt_num = ecid_xt.
getID3();
301 if (ecid_xt.
getName() ==
"EB_crystal_number") {
306 if (
item.mean_x1 == -1 ||
item.rms_x1 == -1 ||
item.mean_x6 == -1 ||
item.rms_x6 == -1 ||
307 item.mean_x12 == -1 ||
item.rms_x12 == -1 ||
item.mean_x1 == 0 ||
item.rms_x1 == 0 ||
308 item.mean_x6 == 0 ||
item.rms_x6 == 0 ||
item.mean_x12 == 0 ||
item.rms_x12 == 0) {
313 if (
item.mean_x1 == -1 ||
item.mean_x1 == 0)
314 item.mean_x1 = previous_ped.mean_x1;
315 if (
item.rms_x1 == -1 ||
item.rms_x1 == 0)
316 item.rms_x1 = previous_ped.rms_x1;
317 if (
item.mean_x6 == -1 ||
item.mean_x6 == 0)
318 item.mean_x6 = previous_ped.mean_x6;
319 if (
item.rms_x6 == -1 ||
item.rms_x6 == 0)
320 item.rms_x6 = previous_ped.rms_x6;
321 if (
item.mean_x12 == -1 ||
item.mean_x12 == 0)
322 item.mean_x12 = previous_ped.mean_x12;
323 if (
item.rms_x12 == -1 ||
item.rms_x12 == 0)
324 item.rms_x12 = previous_ped.rms_x12;
335 EEDetId eedetid(xt_num, yt_num, sm_num);
338 if (
item.mean_x1 == -1 ||
item.rms_x1 == -1 ||
item.mean_x6 == -1 ||
item.rms_x6 == -1 ||
339 item.mean_x12 == -1 ||
item.rms_x12 == -1 ||
item.mean_x1 == 0 ||
item.rms_x1 == 0 ||
340 item.mean_x6 == 0 ||
item.rms_x6 == 0 ||
item.mean_x12 == 0 ||
item.rms_x12 == 0) {
345 if (
item.mean_x1 == -1 ||
item.mean_x1 == 0)
346 item.mean_x1 = previous_ped.mean_x1;
347 if (
item.rms_x1 == -1 ||
item.rms_x1 == 0)
348 item.rms_x1 = previous_ped.rms_x1;
349 if (
item.mean_x6 == -1 ||
item.mean_x6 == 0)
350 item.mean_x6 = previous_ped.mean_x6;
351 if (
item.rms_x6 == -1 ||
item.rms_x6 == 0)
352 item.rms_x6 = previous_ped.rms_x6;
353 if (
item.mean_x12 == -1 ||
item.mean_x12 == 0)
354 item.mean_x12 = previous_ped.mean_x12;
355 if (
item.rms_x12 == -1 ||
item.rms_x12 == 0)
356 item.rms_x12 = previous_ped.rms_x12;
365 edm::LogInfo(
"Generating popcon record for run ") << irun <<
"..." << std::flush;
384 item.mean_x1 = aped.mean_x1;
385 item.rms_x1 = aped.rms_x1;
386 item.mean_x6 = aped.mean_x6;
387 item.rms_x6 = aped.rms_x6;
388 item.mean_x12 = aped.mean_x12;
389 item.rms_x12 = aped.rms_x12;
392 if ((
iEta == -1 ||
iEta == 1) && iPhi == 20) {
393 float x = aped.mean_x12;
394 edm::LogInfo(
"channel:") <<
iEta <<
"/" << iPhi <<
"/" << hiee <<
" ped mean 12=" <<
x;
409 item.mean_x1 = aped.mean_x1;
410 item.rms_x1 = aped.rms_x1;
411 item.mean_x6 = aped.mean_x6;
412 item.rms_x6 = aped.rms_x6;
413 item.mean_x12 = aped.mean_x12;
414 item.rms_x12 = aped.rms_x12;
424 item.mean_x1 = aped.mean_x1;
425 item.rms_x1 = aped.rms_x1;
426 item.mean_x6 = aped.mean_x6;
427 item.rms_x6 = aped.rms_x6;
428 item.mean_x12 = aped.mean_x12;
429 item.rms_x12 = aped.rms_x12;
437 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)pedtemp, snc));
439 ss <<
"Run=" << irun <<
"_WAS_GOOD_" << std::endl;
440 m_userTextLog =
ss.str() +
";";
443 edm::LogInfo(
"Run ") << irun <<
" was BAD !!!! not sent to the DB";
444 if (nbad >= (dataset_mon.size() * 0.05))
450 ss <<
"Run=" << irun <<
"_WAS_BAD_" << std::endl;
451 m_userTextLog =
ss.str() +
";";
459 edm::LogInfo(
"Ecal - > end of getNewObjects -----------\n");
465 unsigned int max_since = 0;
466 max_since =
static_cast<unsigned int>(
tagInfo().lastInterval.since);
468 Ref ped_db = lastPayload();
486 for (
int iX = ixmin; iX <= ixmax; ++iX) {
487 for (
int iY = iymin; iY <= iymax; ++iY) {
495 item.mean_x1 = aped.mean_x1;
496 item.rms_x1 = aped.rms_x1;
497 item.mean_x6 = aped.mean_x6;
498 item.rms_x6 = aped.rms_x6;
499 item.mean_x12 = aped.mean_x12;
500 item.rms_x12 = aped.rms_x12;
502 if (iX == ixmin && iY == iymin)
508 edm::LogInfo(
"We just retrieved the last valid record from DB ");
512 edm::LogInfo(
"Retrieving run list from ONLINE DB ... ");
547 unsigned int min_run = max_since + 1;
549 unsigned int max_run = m_lastRun;
550 mon_list =
econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
552 std::vector<MonRunIOV> mon_run_vec = mon_list.
getRuns();
553 size_t mon_runs = mon_run_vec.size();
557 for (
size_t kr = 0; kr < mon_runs; kr++) {
558 unsigned int irun =
static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
560 edm::LogInfo(
"here is first sub run : ") << mon_run_vec[kr].getSubRunNumber();
561 edm::LogInfo(
"here is the run number: ") << mon_run_vec[kr].getRunIOV().getRunNumber();
565 if (mon_run_vec[kr].getSubRunNumber() <= 1) {
567 RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
570 std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
571 econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
572 std::cout <<
"OMDS record for run " << irun <<
" is made of " << dataset_mon.size() << std::endl;
573 typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
582 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
586 int xt_num = ecid_xt.
getID2();
591 ix = 95 - (xt_num - 1) / 20;
592 iy = 46 + (xt_num - 1) % 20;
609 if (ix == ixmin && iy == iymin)
613 edm::LogInfo(
"Generating popcon record for run ") << irun <<
"..." << std::flush;
622 for (
int iX = ixmin; iX <= ixmax; ++iX) {
623 for (
int iY = iymin; iY <= iymax; ++iY) {
630 item.mean_x1 = aped.mean_x1;
631 item.rms_x1 = aped.rms_x1;
632 item.mean_x6 = aped.mean_x6;
633 item.rms_x6 = aped.rms_x6;
634 item.mean_x12 = aped.mean_x12;
635 item.rms_x12 = aped.rms_x12;
638 if (iX == ixmin && iY == iymin)
646 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)pedtemp, snc));
648 edm::LogInfo(
"Ecal - > end of getNewObjectsH2 -----------\n");
659 std::ifstream fInput;
660 fInput.open(m_filename);
661 if (!fInput.is_open()) {
662 edm::LogInfo(
"ERROR : cannot open file ") << m_filename;
671 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
672 fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel] >>
673 EBmean1[iChannel] >> EBrms1[iChannel];
674 if (hashedId != iChannel + 1) {
675 edm::LogInfo(
"File") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
683 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
684 fInput >> hashedId >> EEmean12[iChannel] >> EErms12[iChannel] >> EEmean6[iChannel] >> EErms6[iChannel] >>
685 EEmean1[iChannel] >> EErms1[iChannel];
687 edm::LogInfo(
"File") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
703 item.mean_x1 = EBmean1[hieb];
704 item.rms_x1 = EBrms1[hieb];
705 item.mean_x6 = EBmean6[hieb];
706 item.rms_x6 = EBrms6[hieb];
707 item.mean_x12 = EBmean12[hieb];
708 item.rms_x12 = EBrms12[hieb];
716 for (
int iz = -1; iz < 2; iz = iz + 2) {
724 item.mean_x1 = EEmean1[hiee];
725 item.rms_x1 = EErms1[hiee];
726 item.mean_x6 = EEmean6[hiee];
727 item.rms_x6 = EErms6[hiee];
728 item.mean_x12 = EEmean12[hiee];
729 item.rms_x12 = EErms12[hiee];
737 unsigned int irun = m_firstRun;
739 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)ped, snc));
741 edm::LogInfo(
"Ecal - > end of readPedestalFile -----------\n");
748 fxml.open(m_filename);
749 if (!fxml.is_open()) {
750 edm::LogInfo(
"ERROR : cannot open file ") << m_filename;
754 fout.open(
"Pedestal.check");
759 double RingMean[28][2][3], RingRMS[28][2][3];
762 for (
int side = 0; side < 2; side++) {
763 for (
int igain = 0; igain <
kGains; igain++) {
764 RingMean[
ring][side][igain] = 0.;
765 RingRMS[
ring][side][igain] = 0.;
766 NbVal[
ring][side][igain] = 0;
771 for (
int i = 0;
i < 9;
i++)
772 std::getline(fxml, dummyLine);
774 for (
int iEBChannel = 0; iEBChannel <
kEBChannels; iEBChannel++) {
778 if (ring < 0 || ring > 16)
785 std::istringstream m12(stt);
786 m12 >> EBmean12[iEBChannel];
788 stt = bid.substr(9, 15);
789 std::istringstream r12(stt);
790 r12 >> EBrms12[iEBChannel];
791 if (EBrms12[iEBChannel] != 0. && EBrms12[iEBChannel] < 5.) {
792 RingMean[
ring][izz][0] += EBrms12[iEBChannel];
793 RingRMS[
ring][izz][0] += EBrms12[iEBChannel] * EBrms12[iEBChannel];
794 NbVal[
ring][izz][0]++;
797 stt = bid.substr(9, 15);
798 std::istringstream m6(stt);
799 m6 >> EBmean6[iEBChannel];
801 stt = bid.substr(8, 15);
802 std::istringstream r6(stt);
803 r6 >> EBrms6[iEBChannel];
804 if (EBrms6[iEBChannel] != 0. && EBrms6[iEBChannel] < 5.) {
805 RingMean[
ring][izz][1] += EBrms6[iEBChannel];
806 RingRMS[
ring][izz][1] += EBrms6[iEBChannel] * EBrms6[iEBChannel];
807 NbVal[
ring][izz][1]++;
810 stt = bid.substr(9, 15);
811 std::istringstream m1(stt);
812 m1 >> EBmean1[iEBChannel];
814 stt = bid.substr(8, 15);
815 std::istringstream
r1(stt);
816 r1 >> EBrms1[iEBChannel];
817 if (EBrms1[iEBChannel] != 0. && EBrms1[iEBChannel] < 5.) {
818 RingMean[
ring][izz][2] += EBrms1[iEBChannel];
819 RingRMS[
ring][izz][2] += EBrms1[iEBChannel] * EBrms1[iEBChannel];
820 NbVal[
ring][izz][2]++;
822 if (iEBChannel % 10000 == 0)
823 fout <<
" EB channel " << iEBChannel <<
" " << EBmean12[iEBChannel] <<
" " << EBrms12[iEBChannel] <<
" " 824 << EBmean6[iEBChannel] <<
" " << EBrms6[iEBChannel] <<
" " << EBmean1[iEBChannel] <<
" " 825 << EBrms1[iEBChannel] << std::endl;
826 for (
int i = 0;
i < 3;
i++)
827 std::getline(fxml, dummyLine);
831 std::ifstream fCrystal;
832 fCrystal.open(
"Crystal");
833 if (!fCrystal.is_open()) {
838 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
839 fCrystal >> ringEE[iChannel];
840 int ring =
abs(ringEE[iChannel]) - 1;
841 if (ring < 17 || ring > 27) {
842 edm::LogInfo(
" EE channel ") << iChannel <<
" ring " << ringEE[iChannel];
850 for (
int i = 0;
i < 6;
i++)
851 std::getline(fxml, dummyLine);
852 for (
int iEEChannel = 0; iEEChannel <
kEEChannels; iEEChannel++) {
856 std::istringstream m12(stt);
857 m12 >> EEmean12[iEEChannel];
858 int ring =
abs(ringEE[iEEChannel]) - 1;
859 if (ring < 17 || ring > 27)
862 if (iEEChannel < 7324)
865 stt = bid.substr(9, 15);
866 std::istringstream r12(stt);
867 r12 >> EErms12[iEEChannel];
868 if (EErms12[iEEChannel] != 0. && EErms12[iEEChannel] < 5.) {
869 RingMean[
ring][izz][0] += EErms12[iEEChannel];
870 RingRMS[
ring][izz][0] += EErms12[iEEChannel] * EErms12[iEEChannel];
871 NbVal[
ring][izz][0]++;
874 stt = bid.substr(9, 15);
875 std::istringstream m6(stt);
876 m6 >> EEmean6[iEEChannel];
878 stt = bid.substr(8, 15);
879 std::istringstream r6(stt);
880 r6 >> EErms6[iEEChannel];
881 if (EErms6[iEEChannel] != 0. && EErms6[iEEChannel] < 5.) {
882 RingMean[
ring][izz][1] += EErms6[iEEChannel];
883 RingRMS[
ring][izz][1] += EErms6[iEEChannel] * EErms6[iEEChannel];
884 NbVal[
ring][izz][1]++;
887 stt = bid.substr(9, 15);
888 std::istringstream m1(stt);
889 m1 >> EEmean1[iEEChannel];
891 stt = bid.substr(8, 15);
892 std::istringstream
r1(stt);
893 r1 >> EErms1[iEEChannel];
894 if (EErms1[iEEChannel] != 0. && EErms1[iEEChannel] < 5.) {
895 RingMean[
ring][izz][2] += EErms1[iEEChannel];
896 RingRMS[
ring][izz][2] += EErms1[iEEChannel] * EErms1[iEEChannel];
897 NbVal[
ring][izz][2]++;
899 if (iEEChannel % 1000 == 0)
900 fout <<
" EE channel " << iEEChannel <<
" " << EEmean12[iEEChannel] <<
" " << EErms12[iEEChannel] <<
" " 901 << EEmean6[iEEChannel] <<
" " << EErms6[iEEChannel] <<
" " << EEmean1[iEEChannel] <<
" " 902 << EErms1[iEEChannel] << std::endl;
903 for (
int i = 0;
i < 3;
i++)
904 std::getline(fxml, dummyLine);
913 for (
int side = 0; side < 2; side++) {
923 fout <<
" ring " <<
ring + 1 <<
" mean " <<
x <<
" rms " <<
rms <<
" ";
927 fout <<
"***** End caps ***** EE- EE+" << std::endl;
945 item.mean_x12 = 200.;
948 if (ring < 0 || ring > 16)
953 if (EBrms1[hieb] == 0 || EBrms1[hieb] > RingMean[
ring][side][2] + 3 * RingRMS[
ring][side][2]) {
954 fout <<
" EB channel " << hieb <<
" eta " <<
iEta <<
" phi " << iPhi <<
" ring " <<
ring + 1
955 <<
" gain 1 rms " << EBrms1[hieb] <<
" replaced by " << RingMean[
ring][side][2] << std::endl;
956 item.rms_x1 = RingMean[
ring][side][2];
958 item.rms_x1 = EBrms1[hieb];
959 if (EBrms6[hieb] == 0 || EBrms6[hieb] > RingMean[
ring][side][1] + 3 * RingRMS[
ring][side][1]) {
960 fout <<
" EB channel " << hieb <<
" eta " <<
iEta <<
" phi " << iPhi <<
" ring " <<
ring + 1
961 <<
" gain 6 rms " << EBrms6[hieb] <<
" replaced by " << RingMean[
ring][side][1] << std::endl;
962 item.rms_x6 = RingMean[
ring][side][1];
964 item.rms_x6 = EBrms6[hieb];
965 if (EBrms12[hieb] == 0 || EBrms12[hieb] > RingMean[
ring][side][0] + 3 * RingRMS[
ring][side][0]) {
966 fout <<
" EB channel " << hieb <<
" eta " <<
iEta <<
" phi " << iPhi <<
" ring " <<
ring + 1
967 <<
" gain 12 rms " << EBrms12[hieb] <<
" replaced by " << RingMean[
ring][side][0] << std::endl;
968 item.rms_x12 = RingMean[
ring][side][0];
970 item.rms_x12 = EBrms12[hieb];
971 if (hieb > 4534 && hieb < 4540)
972 edm::LogInfo(
" Channel ") << hieb <<
" ring " <<
ring <<
" 12 " << EBrms12[hieb] <<
" mean " 973 << RingMean[
ring][side][0] <<
" rms " << RingRMS[
ring][side][0] <<
" 6 " 974 << EBrms6[hieb] <<
" mean " << RingMean[
ring][side][1] <<
" rms " 975 << RingRMS[
ring][side][1] <<
" 1 " << EBrms1[hieb] <<
" mean " 976 << RingMean[
ring][side][2] <<
" rms " << RingRMS[
ring][side][2];
979 item.rms_x1 = EBrms1[hieb];
980 item.rms_x6 = EBrms6[hieb];
981 item.rms_x12 = EBrms12[hieb];
983 if (
item.rms_x1 > 4. ||
item.rms_x6 > 4. ||
item.rms_x12 > 4.)
991 for (
int iz = -1; iz < 2; iz = iz + 2) {
1000 item.mean_x6 = 200.;
1001 item.mean_x12 = 200.;
1003 int ring =
abs(ringEE[hiee]) - 1;
1004 if (ring < 17 || ring > 27)
1006 if (EErms1[hiee] == 0 || EErms1[hiee] > RingMean[
ring][iz][2] + 3 * RingRMS[
ring][iz][2]) {
1007 fout <<
" EE channel " << hiee <<
" x " << iX <<
" y " << iY <<
" z " << iz <<
" ring " <<
ring + 1
1008 <<
" gain 1 rms " << EErms1[hiee] <<
" replaced by " << RingMean[
ring][iz][2] << std::endl;
1009 item.rms_x1 = RingMean[
ring][iz][2];
1011 item.rms_x1 = EErms1[hiee];
1012 if (EErms6[hiee] == 0 || EErms6[hiee] > RingMean[
ring][iz][1] + 3 * RingRMS[
ring][iz][1]) {
1013 fout <<
" EE channel " << hiee <<
" x " << iX <<
" y " << iY <<
" z " << iz <<
" ring " <<
ring + 1
1014 <<
" gain 6 rms " << EErms6[hiee] <<
" replaced by " << RingMean[
ring][iz][1] << std::endl;
1015 item.rms_x6 = RingMean[
ring][iz][1];
1017 item.rms_x6 = EErms6[hiee];
1018 if (EErms12[hiee] == 0 || EErms12[hiee] > RingMean[
ring][iz][0] + 3 * RingRMS[
ring][iz][0]) {
1019 fout <<
" EE channel " << hiee <<
" x " << iX <<
" y " << iY <<
" z " << iz <<
" ring " <<
ring + 1
1020 <<
" gain 12 rms " << EErms12[hiee] <<
" replaced by " << RingMean[
ring][iz][0] << std::endl;
1021 item.rms_x12 = RingMean[
ring][iz][0];
1023 item.rms_x12 = EErms12[hiee];
1026 item.rms_x1 = EErms1[hiee];
1027 item.rms_x6 = EErms6[hiee];
1028 item.rms_x12 = EErms12[hiee];
1037 unsigned int irun = m_firstRun;
1039 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)ped, snc));
1041 edm::LogInfo(
"Ecal - > end of readPedestalMC -----------\n");
1048 edm::LogInfo(
" reading local Pedestal run (2017 way)! ") << m_filename;
1051 Ref ped_db = lastPayload();
1066 item.mean_x1 = aped.mean_x1;
1067 item.rms_x1 = aped.rms_x1;
1068 item.mean_x6 = aped.mean_x6;
1069 item.rms_x6 = aped.rms_x6;
1070 item.mean_x12 = aped.mean_x12;
1071 item.rms_x12 = aped.rms_x12;
1080 EEDetId eedetidpos(iX, iY, 1);
1085 item.mean_x1 = aped.mean_x1;
1086 item.rms_x1 = aped.rms_x1;
1087 item.mean_x6 = aped.mean_x6;
1088 item.rms_x6 = aped.rms_x6;
1089 item.mean_x12 = aped.mean_x12;
1090 item.rms_x12 = aped.rms_x12;
1094 EEDetId eedetidneg(iX, iY, -1);
1099 item.mean_x1 = aped.mean_x1;
1100 item.rms_x1 = aped.rms_x1;
1101 item.mean_x6 = aped.mean_x6;
1102 item.rms_x6 = aped.rms_x6;
1103 item.mean_x12 = aped.mean_x12;
1104 item.rms_x12 = aped.rms_x12;
1110 edm::LogInfo(
" reading the input file ") << m_filename;
1111 std::ifstream fInput;
1112 fInput.open(m_filename);
1113 if (!fInput.is_open()) {
1114 edm::LogInfo(
"ERROR : cannot open file ") << m_filename;
1123 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
1124 fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel] >>
1125 EBmean1[iChannel] >> EBrms1[iChannel];
1126 if (hashedId != iChannel + 1) {
1127 edm::LogInfo(
"File ") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
1135 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
1136 fInput >> hashedId >> EEmean12[iChannel] >> EErms12[iChannel] >> EEmean6[iChannel] >> EErms6[iChannel] >>
1137 EEmean1[iChannel] >> EErms1[iChannel];
1139 edm::LogInfo(
"File ") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
1156 if (
debug & (EBmean12[hieb] == -999. || EBrms12[hieb] == -999. || EBmean6[hieb] == -999. ||
1157 EBrms6[hieb] == -999. || EBmean1[hieb] == -999. || EBrms1[hieb] == -999.))
1159 <<
iEta <<
" phi " << iPhi <<
" " << EBmean12[hieb] <<
" " << EBrms12[hieb] <<
" " << EBmean6[hieb] <<
" " 1160 << EBrms6[hieb] <<
" " << EBmean1[hieb] <<
" " << EBrms1[hieb];
1161 if (EBmean1[hieb] != -999.)
1162 item.mean_x1 = EBmean1[hieb];
1164 item.mean_x1 = previous_ped.mean_x1;
1165 if (EBrms1[hieb] != -999.)
1166 item.rms_x1 = EBrms1[hieb];
1168 item.rms_x1 = previous_ped.rms_x1;
1169 if (EBmean6[hieb] != -999.)
1170 item.mean_x6 = EBmean6[hieb];
1172 item.mean_x6 = previous_ped.mean_x6;
1173 if (EBrms6[hieb] != -999.)
1174 item.rms_x6 = EBrms6[hieb];
1176 item.rms_x6 = previous_ped.rms_x6;
1177 if (EBmean12[hieb] != -999.)
1178 item.mean_x12 = EBmean12[hieb];
1180 item.mean_x12 = previous_ped.mean_x12;
1181 if (EBrms12[hieb] != -999.)
1182 item.rms_x12 = EBrms12[hieb];
1184 item.rms_x12 = previous_ped.rms_x12;
1192 for (
int iz = -1; iz < 2; iz = iz + 2) {
1201 if (
debug & (EEmean12[hiee] == -999. || EErms12[hiee] == -999. || EEmean6[hiee] == -999. ||
1202 EErms6[hiee] == -999. || EEmean1[hiee] == -999. || EErms1[hiee] == -999.))
1204 << iX <<
" y " << iY <<
" z" << iz <<
" " << EEmean12[hiee] <<
" " << EErms12[hiee] <<
" " 1205 << EEmean6[hiee] <<
" " << EErms6[hiee] <<
" " << EEmean1[hiee] <<
" " << EErms1[hiee];
1206 if (EEmean1[hiee] != -999.)
1207 item.mean_x1 = EEmean1[hiee];
1209 item.mean_x1 = previous_ped.mean_x1;
1210 if (EErms1[hiee] != -999.)
1211 item.rms_x1 = EErms1[hiee];
1213 item.rms_x1 = previous_ped.rms_x1;
1214 if (EEmean6[hiee] != -999.)
1215 item.mean_x6 = EEmean6[hiee];
1217 item.mean_x6 = previous_ped.mean_x6;
1218 if (EErms6[hiee] != -999.)
1219 item.rms_x6 = EErms6[hiee];
1221 item.rms_x6 = previous_ped.rms_x6;
1222 if (EEmean12[hiee] != -999.)
1223 item.mean_x12 = EEmean12[hiee];
1225 item.mean_x12 = previous_ped.mean_x12;
1226 if (EErms12[hiee] != -999.)
1227 item.rms_x12 = EErms12[hiee];
1229 item.rms_x12 = previous_ped.rms_x12;
1237 unsigned int irun = m_firstRun;
1239 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)ped, snc));
1241 edm::LogInfo(
"Ecal - > end of readPedestal2017 -----------\n");
1247 TFile* hfile =
new TFile(m_filename.c_str());
1249 TTree* treeChan = (TTree*)hfile->Get(
"PedChan");
1250 int iChannel = 0, ix = 0, iy = 0, iz = 0;
1251 treeChan->SetBranchAddress(
"Channels", &iChannel);
1252 treeChan->SetBranchAddress(
"x", &ix);
1253 treeChan->SetBranchAddress(
"y", &iy);
1254 treeChan->SetBranchAddress(
"z", &iz);
1255 int neventsChan = (
int)treeChan->GetEntries();
1259 treeChan->GetEntry(
entry);
1261 ringEB[iChannel] = (
abs(ix) - 1) / 5;
1262 sideEB[iChannel] = 1;
1264 sideEB[iChannel] = 0;
1265 if (
entry % 10000 == 0)
1266 edm::LogInfo(
" EB channel ") << iChannel <<
" eta " << ix <<
" phi " << iy <<
" side " << sideEB[iChannel]
1267 <<
" ring " << ringEB[iChannel];
1269 ixEE[iChannel] = ix;
1270 iyEE[iChannel] = iy;
1271 izEE[iChannel] = iz;
1272 if (
entry % 1000 == 0)
1273 edm::LogInfo(
" EE channel ") << iChannel <<
" x " << ixEE[iChannel] <<
" y " << iyEE[iChannel] <<
" z " 1362 Int_t run16Index = 0;
1364 Int_t fed[
kChannels],
chan[
kChannels],
id,
run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time,
1365 run_time_stablebeam, nxt,
time[54];
1367 TTree*
tree = (TTree*)hfile->Get(
"T");
1369 tree->SetBranchAddress(
"id", &
id);
1370 tree->SetBranchAddress(
"run", &
run);
1371 tree->SetBranchAddress(
"run_type", &run_type);
1372 tree->SetBranchAddress(
"seq_id", &seq_id);
1373 tree->SetBranchAddress(
"las_id", &las_id);
1374 tree->SetBranchAddress(
"fill_num", &fill_num);
1375 tree->SetBranchAddress(
"run_num_infill", &run_num_infill);
1376 tree->SetBranchAddress(
"run_time", &run_time);
1377 tree->SetBranchAddress(
"run_time_stablebeam", &run_time_stablebeam);
1378 tree->SetBranchAddress(
"lumi", &
lumi);
1379 tree->SetBranchAddress(
"bfield", &bfield);
1380 tree->SetBranchAddress(
"nxt", &nxt);
1381 tree->SetBranchAddress(
"time",
time);
1382 tree->SetBranchAddress(
"fed", fed);
1383 tree->SetBranchAddress(
"chan",
chan);
1384 tree->SetBranchAddress(
"ped", ped);
1385 tree->SetBranchAddress(
"pedrms", pedrms);
1389 fout.open(
"copyTreePedestals.txt");
1390 if (!
fout.is_open()) {
1391 edm::LogInfo(
"ERROR : cannot open file copyTreePedestals.txt");
1397 for (
int ich = 0; ich <
kChannels; ich++) {
1403 fout <<
" first run " <<
run <<
" fill " << fill_num <<
" B field " << bfield <<
" run type " << run_type
1404 <<
" seq_id " << seq_id <<
" las_id " << las_id <<
" run_num_infill " << run_num_infill <<
" lumi " <<
lumi 1405 <<
" nb of Crystals " << nxt << std::endl;
1406 for (
int ich = 0; ich <
kChannels; ich++) {
1407 if (ped[ich] != 0.) {
1409 fout <<
" channel " << ich <<
" FED " << fed[ich] <<
" chan " <<
chan[ich] <<
" pedestal " << ped[ich]
1410 <<
" RMS " << pedrms[ich] << std::endl;
1412 fout <<
" channel " << ich <<
" EE channel " << ich -
kEBChannels <<
" FED " << fed[ich] <<
" chan " 1413 <<
chan[ich] <<
" pedestal " << ped[ich] <<
" RMS " << pedrms[ich] << std::endl;
1417 int run_type_kept = m_runtype;
1418 int first_run_kept = (
int)m_firstRun;
1419 int last_run_kept = (
int)m_lastRun;
1421 int firsttimeFED = -1;
1425 if (
run < first_run_kept) {
1426 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1427 <<
" before first wanted " << m_firstRun << std::endl;
1431 if (
run > last_run_kept) {
1432 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1433 <<
" after last wanted " << m_lastRun << std::endl;
1437 if (run_type != run_type_kept) {
1438 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time <<
" run type " 1439 << run_type << std::endl;
1443 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1444 <<
" *********** Number of channels " << nxt << std::endl;
1447 if (bfield < 3.79) {
1448 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1449 <<
" *********** bfield = " << bfield << std::endl;
1452 if (run_type_kept == 1) {
1454 for (
int ifed = 0; ifed < 54; ifed++) {
1455 if (
time[ifed] < run_time_stablebeam) {
1457 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1458 <<
" *********** sequence before stable beam at " << run_time_stablebeam <<
" FED " << ifed <<
" : " 1461 fout <<
" FED " << ifed <<
" : " <<
time[ifed];
1465 if (time_seq != 0) {
1466 fout <<
" total nb " << time_seq << std::endl;
1474 if (
run == runold) {
1476 for (
int ich = 0; ich <
kChannels; ich++) {
1477 if (ped[ich] < 300 && ped[ich] > 100) {
1478 EAmean12[ich] += ped[ich];
1479 EArms12[ich] += pedrms[ich];
1487 if (RunEntry == 0 || (run_type_kept == 2 && RunEntry < 6))
1488 fout <<
" skiped run " << runold <<
" not enough entries : " << RunEntry << std::endl;
1490 fout <<
" entry " <<
entry - 1 <<
" run " << runold <<
" nb of events " << RunEntry;
1491 firsttimeFED =
time[0];
1492 for (
int ifed = 0; ifed < 54; ifed++) {
1494 if (firsttimeFED <
time[ifed])
1495 firsttimeFED =
time[ifed];
1500 bool foundNew =
false;
1502 if (runold > pedxml[
i]) {
1503 fout <<
" found a new gain 1, 6 file " << pedxml[
i] <<
" at index " <<
i << std::endl;
1506 if (runold < pedxml[
i + 1])
1511 int Indexxml = run16Index - 1;
1512 fout <<
" opening Pedestals_" << pedxml[Indexxml] <<
".xml at index " << Indexxml << std::endl;
1514 fxml.open(Form(
"Pedestals_%i.xml", pedxml[Indexxml]));
1515 if (!fxml.is_open()) {
1516 edm::LogInfo(
"ERROR : cannot open file Pedestals_") << pedxml[Indexxml] <<
".xml";
1520 for (
int i = 0;
i < 9;
i++)
1521 std::getline(fxml, dummyLine);
1523 for (
int iEBChannel = 0; iEBChannel <
kEBChannels; iEBChannel++) {
1524 fxml >> mean12 >> rms12 >> bid;
1534 std::istringstream m6(stt);
1535 m6 >> EAmean6[iEBChannel];
1537 stt = bid.substr(8, 15);
1538 std::istringstream r6(stt);
1539 r6 >> EArms6[iEBChannel];
1541 stt = bid.substr(9, 15);
1542 std::istringstream m1(stt);
1543 m1 >> EAmean1[iEBChannel];
1545 stt = bid.substr(8, 15);
1546 std::istringstream
r1(stt);
1547 r1 >> EArms1[iEBChannel];
1548 if (iEBChannel % 10000 == 0)
1549 fout <<
" EB channel " << iEBChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[iEBChannel] <<
" " 1550 << EArms6[iEBChannel] <<
" " << EAmean1[iEBChannel] <<
" " << EArms1[iEBChannel] << std::endl;
1551 for (
int i = 0;
i < 3;
i++)
1552 std::getline(fxml, dummyLine);
1554 for (
int i = 0;
i < 6;
i++)
1555 std::getline(fxml, dummyLine);
1556 for (
int iEEChannel = 0; iEEChannel <
kEEChannels; iEEChannel++) {
1558 fxml >> mean12 >> rms12 >> bid;
1560 std::istringstream m6(stt);
1563 stt = bid.substr(8, 15);
1564 std::istringstream r6(stt);
1567 stt = bid.substr(9, 15);
1568 std::istringstream m1(stt);
1571 stt = bid.substr(8, 15);
1572 std::istringstream
r1(stt);
1574 if (iEEChannel % 1000 == 0)
1575 fout <<
" EE channel " << iEEChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[ich] <<
" " 1576 << EArms6[ich] <<
" " << EAmean1[ich] <<
" " << EArms1[ich] << std::endl;
1577 for (
int i = 0;
i < 3;
i++)
1578 std::getline(fxml, dummyLine);
1587 for (
int ich = 0; ich <
kChannels; ich++) {
1588 if (EAentry[ich] != 0) {
1589 EAmean12[ich] /= EAentry[ich];
1590 EArms12[ich] /= EAentry[ich];
1592 EAmean12[ich] = 200.;
1595 if (ich % 10000 == 0)
1596 fout <<
" channel " << ich <<
" ped " << EAmean12[ich] <<
" RMS " << EArms12[ich] << std::endl;
1598 item.mean_x1 = EAmean1[ich];
1599 item.rms_x1 = EArms1[ich];
1600 item.mean_x6 = EAmean6[ich];
1601 item.rms_x6 = EArms6[ich];
1602 item.mean_x12 = EAmean12[ich];
1603 item.rms_x12 = EArms12[ich];
1621 for (
int ich = 0; ich <
kChannels; ich++) {
1622 if (ped[ich] < 300 && ped[ich] > 100) {
1623 EAmean12[ich] = ped[ich];
1624 EArms12[ich] = pedrms[ich];
1635 fout <<
" last entry fill " << fill_num <<
" run " << runold <<
" nb of events " << RunEntry <<
" time " << run_time
1636 <<
" " << run_time_stablebeam <<
" " <<
time[0] <<
" run type " << run_type << std::endl;
1637 for (
int ifed = 0; ifed < 54; ifed++)
1642 for (
int ich = 0; ich <
kChannels; ich++) {
1643 if (EAentry[ich] != 0) {
1644 EAmean12[ich] /= EAentry[ich];
1645 EArms12[ich] /= EAentry[ich];
1647 EAmean12[ich] = 200.;
1650 if (ich % 10000 == 0)
1651 fout <<
" channel " << ich <<
" ped " << EAmean12[ich] <<
" RMS " << EArms12[ich] << std::endl;
1655 item.mean_x1 = EAmean1[ich];
1656 item.rms_x1 = EArms1[ich];
1657 item.mean_x6 = EAmean6[ich];
1658 item.rms_x6 = EArms6[ich];
1659 item.mean_x12 = EAmean12[ich];
1660 item.rms_x12 = EArms12[ich];
1674 edm::LogInfo(
"Ecal - > end of readPedestalTree -----------\n");
1681 TFile* hfile =
new TFile(m_filename.c_str());
1683 TTree* treeChan = (TTree*)hfile->Get(
"PedChan");
1684 int iChannel = 0, ix = 0, iy = 0, iz = 0;
1685 treeChan->SetBranchAddress(
"Channels", &iChannel);
1686 treeChan->SetBranchAddress(
"x", &ix);
1687 treeChan->SetBranchAddress(
"y", &iy);
1688 treeChan->SetBranchAddress(
"z", &iz);
1689 int neventsChan = (
int)treeChan->GetEntries();
1693 treeChan->GetEntry(
entry);
1695 ringEB[iChannel] = (
abs(ix) - 1) / 5;
1696 sideEB[iChannel] = 1;
1698 sideEB[iChannel] = 0;
1700 edm::LogInfo(
" EB channel ") << iChannel <<
" eta " << ix <<
" phi " << iy <<
" side " << sideEB[iChannel]
1701 <<
" ring " << ringEB[iChannel];
1703 ixEE[iChannel] = ix;
1704 iyEE[iChannel] = iy;
1705 izEE[iChannel] = iz;
1707 edm::LogInfo(
" EE channel ") << iChannel <<
" x " << ixEE[iChannel] <<
" y " << iyEE[iChannel] <<
" z " 1796 Int_t run16Index = 0;
1798 Int_t fed[
kChannels],
chan[
kChannels],
id,
run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time,
1799 run_time_stablebeam, nxt,
time[54];
1801 TTree*
tree = (TTree*)hfile->Get(
"T");
1803 tree->SetBranchAddress(
"id", &
id);
1804 tree->SetBranchAddress(
"run", &
run);
1805 tree->SetBranchAddress(
"run_type", &run_type);
1806 tree->SetBranchAddress(
"seq_id", &seq_id);
1807 tree->SetBranchAddress(
"las_id", &las_id);
1808 tree->SetBranchAddress(
"fill_num", &fill_num);
1809 tree->SetBranchAddress(
"run_num_infill", &run_num_infill);
1810 tree->SetBranchAddress(
"run_time", &run_time);
1811 tree->SetBranchAddress(
"run_time_stablebeam", &run_time_stablebeam);
1812 tree->SetBranchAddress(
"lumi", &
lumi);
1813 tree->SetBranchAddress(
"bfield", &bfield);
1814 tree->SetBranchAddress(
"nxt", &nxt);
1815 tree->SetBranchAddress(
"time",
time);
1816 tree->SetBranchAddress(
"fed", fed);
1817 tree->SetBranchAddress(
"chan",
chan);
1818 tree->SetBranchAddress(
"ped", ped);
1819 tree->SetBranchAddress(
"pedrms", pedrms);
1823 fout.open(
"copyTimestampPedestals.txt");
1824 if (!
fout.is_open()) {
1825 edm::LogInfo(
"ERROR : cannot open file copyTimestampPedestals.txt");
1830 for (
int ich = 0; ich <
kChannels; ich++) {
1831 EAmean12[ich] = 200.;
1835 fout <<
" first run " <<
run <<
" fill " << fill_num <<
" B field " << bfield <<
" run type " << run_type
1836 <<
" seq_id " << seq_id <<
" las_id " << las_id <<
" run_num_infill " << run_num_infill <<
" lumi " <<
lumi 1837 <<
" nb of Crystals " << nxt << std::endl;
1839 for (
int ich = 0; ich <
kChannels; ich++) {
1840 if (ped[ich] != 0.) {
1842 fout <<
" channel " << ich <<
" FED " << fed[ich] <<
" chan " <<
chan[ich] <<
" pedestal " << ped[ich]
1843 <<
" RMS " << pedrms[ich] << std::endl;
1845 fout <<
" channel " << ich <<
" EE channel " << ich -
kEBChannels <<
" FED " << fed[ich] <<
" chan " 1846 <<
chan[ich] <<
" pedestal " << ped[ich] <<
" RMS " << pedrms[ich] << std::endl;
1851 int runold = -1, fillold = -1, firsttimeFEDold = -1;
1852 int firsttimeFED = -1, firstFillSequence = 0;
1853 bool firstSeqBeforeStable =
false;
1855 int first_run_kept = (
int)m_firstRun;
1856 int last_run_kept = (
int)m_lastRun;
1861 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id
1862 <<
" *********** Number of channels " << nxt;
1864 fout <<
" rejected" << std::endl;
1869 if (run_type != 1) {
1870 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id
1871 <<
" *********** run_type ( 1 coll, 2 cosm, 3 circ, 4 test ) = " << run_type << std::endl;
1874 if (las_id != 447) {
1875 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id
1876 <<
" *********** laser wave length = " << las_id << std::endl;
1884 if (bfield < 3.79) {
1885 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" *********** bfield = " << bfield
1891 fout <<
" fill " << fill_num;
1892 fout <<
" sequence " << seq_id;
1893 if (run_type == 1) {
1894 fout <<
" stable " << run_time_stablebeam;
1895 if (run_time_stablebeam < first_run_kept) {
1896 fout <<
" before first wanted " << m_firstRun << std::endl;
1900 firsttimeFED =
time[0];
1901 for (
int ifed = 0; ifed < 54; ifed++) {
1902 if (
time[ifed] > firsttimeFEDold &&
time[ifed] < firsttimeFED)
1903 firsttimeFED =
time[ifed];
1905 if (firsttimeFED < first_run_kept) {
1906 fout <<
" time " << firsttimeFED <<
" before first wanted " << m_firstRun << std::endl;
1909 if (firsttimeFED > last_run_kept) {
1910 fout <<
" entry " <<
entry <<
" time " << firsttimeFED <<
" after last wanted " << m_lastRun << std::endl;
1913 fout <<
" time " << firsttimeFED << std::endl;
1914 if (firsttimeFED <= firsttimeFEDold) {
1915 edm::LogInfo(
" Problem finding the IOV : old one ") << firsttimeFEDold <<
" new one " << firsttimeFED;
1916 for (
int ifed = 0; ifed < 54; ifed++)
1920 firsttimeFEDold = firsttimeFED;
1923 if (fill_num != fillold) {
1924 firstSeqBeforeStable =
false;
1925 firstFillSequence = 0;
1927 firstFillSequence++;
1928 if (run_type == 1) {
1929 if (run_time_stablebeam > 0) {
1930 if (firsttimeFED < run_time_stablebeam) {
1931 fout <<
" data taken before stable beam, skip it" << std::endl;
1932 firstSeqBeforeStable =
true;
1938 fout <<
" *** entry " <<
entry <<
" run_time_stablebeam " << run_time_stablebeam << std::endl;
1939 if (firstSeqBeforeStable) {
1940 firstSeqBeforeStable =
false;
1941 firsttimeFED = run_time_stablebeam;
1942 fout <<
" first full sequence after stable; change the IOV " << firsttimeFED << std::endl;
1944 if (firstFillSequence == 0) {
1945 if (firsttimeFED > run_time_stablebeam) {
1946 fout <<
" first full sequence " << firsttimeFED <<
" after stable " << run_time_stablebeam
1947 <<
"; change the IOV " << std::endl;
1948 firsttimeFED = run_time_stablebeam;
1953 for (
int ich = 0; ich <
kChannels; ich++) {
1954 if (ped[ich] < 300 && ped[ich] > 100) {
1955 EAmean12[ich] = ped[ich];
1956 EArms12[ich] = pedrms[ich];
1960 bool foundNew =
false;
1961 if (
run != runold) {
1963 if (
run > pedxml[
i]) {
1964 fout <<
" found a new gain 1, 6 file " << pedxml[
i] <<
" at index " <<
i << std::endl;
1968 if (
run < pedxml[
i + 1])
1973 int Indexxml = run16Index - 1;
1974 fout <<
" opening Pedestals_" << pedxml[Indexxml] <<
".xml at index " << Indexxml << std::endl;
1976 fxml.open(Form(
"Pedestals_%i.xml", pedxml[Indexxml]));
1977 if (!fxml.is_open()) {
1978 edm::LogInfo(
"ERROR : cannot open file Pedestals_") << pedxml[Indexxml] <<
".xml";
1982 for (
int i = 0;
i < 9;
i++)
1983 std::getline(fxml, dummyLine);
1985 for (
int iEBChannel = 0; iEBChannel <
kEBChannels; iEBChannel++) {
1986 fxml >> mean12 >> rms12 >> bid;
1988 std::istringstream m6(stt);
1989 m6 >> EAmean6[iEBChannel];
1991 stt = bid.substr(8, 15);
1992 std::istringstream r6(stt);
1993 r6 >> EArms6[iEBChannel];
1995 stt = bid.substr(9, 15);
1996 std::istringstream m1(stt);
1997 m1 >> EAmean1[iEBChannel];
1999 stt = bid.substr(8, 15);
2000 std::istringstream
r1(stt);
2001 r1 >> EArms1[iEBChannel];
2002 if (
debug && iEBChannel % 10000 == 0)
2003 fout <<
" EB channel " << iEBChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[iEBChannel] <<
" " 2004 << EArms6[iEBChannel] <<
" " << EAmean1[iEBChannel] <<
" " << EArms1[iEBChannel] << std::endl;
2005 for (
int i = 0;
i < 3;
i++)
2006 std::getline(fxml, dummyLine);
2008 for (
int i = 0;
i < 6;
i++)
2009 std::getline(fxml, dummyLine);
2010 for (
int iEEChannel = 0; iEEChannel <
kEEChannels; iEEChannel++) {
2012 fxml >> mean12 >> rms12 >> bid;
2014 std::istringstream m6(stt);
2017 stt = bid.substr(8, 15);
2018 std::istringstream r6(stt);
2021 stt = bid.substr(9, 15);
2022 std::istringstream m1(stt);
2025 stt = bid.substr(8, 15);
2026 std::istringstream
r1(stt);
2028 if (
debug && iEEChannel % 1000 == 0)
2029 fout <<
" EE channel " << iEEChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[ich] <<
" " 2030 << EArms6[ich] <<
" " << EAmean1[ich] <<
" " << EArms1[ich] << std::endl;
2031 for (
int i = 0;
i < 3;
i++)
2032 std::getline(fxml, dummyLine);
2040 for (
int ich = 0; ich <
kChannels; ich++) {
2041 if (
debug && ich % 10000 == 0)
2042 fout <<
" channel " << ich <<
" ped " << EAmean12[ich] <<
" RMS " << EArms12[ich] << std::endl;
2044 item.mean_x1 = EAmean1[ich];
2045 item.rms_x1 = EArms1[ich];
2046 item.mean_x6 = EAmean6[ich];
2047 item.rms_x6 = EArms6[ich];
2048 item.mean_x12 = EAmean12[ich];
2049 item.rms_x12 = EArms12[ich];
2064 fout <<
" entry " <<
entry <<
" transfer " << transfer <<
" iov " << iov << std::endl;
2066 fout <<
" m_to_transfer " << firsttimeFED << std::endl;
2071 edm::LogInfo(
"Ecal - > end of readPedestalTimestamp -----------\n");
bool checkPedestal(EcalPedestals::Item *item)
void setRunTypeDef(const RunTypeDef &runTypeDef)
T getParameter(std::string const &) const
static const int MIN_IPHI
std::string getName() const
float getPedRMSG6() const
EcalPedestalsHandler(edm::ParameterSet const &)
static EEDetId unhashIndex(int hi)
void setGeneralTag(std::string tag)
const Item & barrel(size_t hashedIndex) const
float getPedRMSG1() const
const Int_t gainValues[kGains]
static bool validDetId(int i, int j)
check if a valid index combination
void setRunTag(const RunTag &tag)
int ieta() const
get the crystal ieta
T getUntrackedParameter(std::string const &, T const &) const
const Item & endcap(size_t hashedIndex) const
float getPedMeanG1() const
void getNewObjects() override
float getPedMeanG6() const
void readPedestalTimestamp()
Abs< T >::type abs(const T &t)
void setMonVersionDef(const MonVersionDef &ver)
float getPedRMSG12() const
static const int ETAPHIMODE
std::string m_locationsource
void setLocationDef(const LocationDef &locDef)
void insert(std::pair< uint32_t, Item > const &a)
Log< level::Info, false > LogInfo
std::vector< MonRunIOV > getRuns()
EcalPedestalsMap EcalPedestals
static const int MAX_IPHI
unsigned long long uint64_t
~EcalPedestalsHandler() override
constexpr uint32_t rawId() const
get the raw id
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
std::vector< Item >::const_iterator const_iterator
static const int MAX_IETA
void setMonRunTag(const MonRunTag &tag)
float getPedMeanG12() const
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
void setMonitoringVersion(std::string ver)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::unique_ptr< EcalPedestals > Ref
int hashedIndex() const
get a compact index for arrays
void setGeneralTag(std::string tag)
static const int SMCRYSTALMODE