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, nEBbad = 0, nEEbad = 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") {
248 if (!checkPedestal(&
item))
252 if (!checkPedestal(&
item))
258 if (!checkPedestal(&
item)) {
261 std::cout <<
"BAD LIST: channel " << sm_num <<
"/" << xt_num <<
"/" << yt_num <<
"ped/rms "
262 <<
item.mean_x12 <<
"/" <<
item.rms_x12 << std::endl;
289 if (nbad < (dataset_mon.size() * 0.05) && (nEB > 10200 || nEE > 2460)) {
290 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
293 int sm_num = ecid_xt.
getID1();
294 int xt_num = ecid_xt.
getID2();
295 int yt_num = ecid_xt.
getID3();
305 if (ecid_xt.
getName() ==
"EB_crystal_number") {
310 if (
item.mean_x1 == -1 ||
item.rms_x1 == -1 ||
item.mean_x6 == -1 ||
item.rms_x6 == -1 ||
311 item.mean_x12 == -1 ||
item.rms_x12 == -1 ||
item.mean_x1 == 0 ||
item.rms_x1 == 0 ||
312 item.mean_x6 == 0 ||
item.rms_x6 == 0 ||
item.mean_x12 == 0 ||
item.rms_x12 == 0) {
317 if (
item.mean_x1 == -1 ||
item.mean_x1 == 0)
318 item.mean_x1 = previous_ped.mean_x1;
319 if (
item.rms_x1 == -1 ||
item.rms_x1 == 0)
320 item.rms_x1 = previous_ped.rms_x1;
321 if (
item.mean_x6 == -1 ||
item.mean_x6 == 0)
322 item.mean_x6 = previous_ped.mean_x6;
323 if (
item.rms_x6 == -1 ||
item.rms_x6 == 0)
324 item.rms_x6 = previous_ped.rms_x6;
325 if (
item.mean_x12 == -1 ||
item.mean_x12 == 0)
326 item.mean_x12 = previous_ped.mean_x12;
327 if (
item.rms_x12 == -1 ||
item.rms_x12 == 0)
328 item.rms_x12 = previous_ped.rms_x12;
339 EEDetId eedetid(xt_num, yt_num, sm_num);
342 if (
item.mean_x1 == -1 ||
item.rms_x1 == -1 ||
item.mean_x6 == -1 ||
item.rms_x6 == -1 ||
343 item.mean_x12 == -1 ||
item.rms_x12 == -1 ||
item.mean_x1 == 0 ||
item.rms_x1 == 0 ||
344 item.mean_x6 == 0 ||
item.rms_x6 == 0 ||
item.mean_x12 == 0 ||
item.rms_x12 == 0) {
349 if (
item.mean_x1 == -1 ||
item.mean_x1 == 0)
350 item.mean_x1 = previous_ped.mean_x1;
351 if (
item.rms_x1 == -1 ||
item.rms_x1 == 0)
352 item.rms_x1 = previous_ped.rms_x1;
353 if (
item.mean_x6 == -1 ||
item.mean_x6 == 0)
354 item.mean_x6 = previous_ped.mean_x6;
355 if (
item.rms_x6 == -1 ||
item.rms_x6 == 0)
356 item.rms_x6 = previous_ped.rms_x6;
357 if (
item.mean_x12 == -1 ||
item.mean_x12 == 0)
358 item.mean_x12 = previous_ped.mean_x12;
359 if (
item.rms_x12 == -1 ||
item.rms_x12 == 0)
360 item.rms_x12 = previous_ped.rms_x12;
369 edm::LogInfo(
"Generating popcon record for run ") << irun <<
"..." << std::flush;
388 item.mean_x1 = aped.mean_x1;
389 item.rms_x1 = aped.rms_x1;
390 item.mean_x6 = aped.mean_x6;
391 item.rms_x6 = aped.rms_x6;
392 item.mean_x12 = aped.mean_x12;
393 item.rms_x12 = aped.rms_x12;
396 if ((
iEta == -1 ||
iEta == 1) && iPhi == 20) {
397 float x = aped.mean_x12;
398 edm::LogInfo(
"channel:") <<
iEta <<
"/" << iPhi <<
"/" << hiee <<
" ped mean 12=" <<
x;
413 item.mean_x1 = aped.mean_x1;
414 item.rms_x1 = aped.rms_x1;
415 item.mean_x6 = aped.mean_x6;
416 item.rms_x6 = aped.rms_x6;
417 item.mean_x12 = aped.mean_x12;
418 item.rms_x12 = aped.rms_x12;
428 item.mean_x1 = aped.mean_x1;
429 item.rms_x1 = aped.rms_x1;
430 item.mean_x6 = aped.mean_x6;
431 item.rms_x6 = aped.rms_x6;
432 item.mean_x12 = aped.mean_x12;
433 item.rms_x12 = aped.rms_x12;
441 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)pedtemp, snc));
443 ss <<
"Run=" << irun <<
"_WAS_GOOD_" << std::endl;
444 m_userTextLog =
ss.str() +
";";
447 edm::LogInfo(
"Run ") << irun <<
" was BAD !!!! not sent to the DB";
448 if (nbad >= (dataset_mon.size() * 0.05))
454 ss <<
"Run=" << irun <<
"_WAS_BAD_" << std::endl;
455 m_userTextLog =
ss.str() +
";";
463 edm::LogInfo(
"Ecal - > end of getNewObjects -----------\n");
469 unsigned int max_since = 0;
470 max_since = static_cast<unsigned int>(
tagInfo().lastInterval.since);
472 Ref ped_db = lastPayload();
490 for (
int iX = ixmin; iX <= ixmax; ++iX) {
491 for (
int iY = iymin; iY <= iymax; ++iY) {
499 item.mean_x1 = aped.mean_x1;
500 item.rms_x1 = aped.rms_x1;
501 item.mean_x6 = aped.mean_x6;
502 item.rms_x6 = aped.rms_x6;
503 item.mean_x12 = aped.mean_x12;
504 item.rms_x12 = aped.rms_x12;
506 if (iX == ixmin && iY == iymin)
512 edm::LogInfo(
"We just retrieved the last valid record from DB ");
516 edm::LogInfo(
"Retrieving run list from ONLINE DB ... ");
551 unsigned int min_run = max_since + 1;
553 unsigned int max_run = m_lastRun;
554 mon_list =
econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
556 std::vector<MonRunIOV> mon_run_vec = mon_list.
getRuns();
557 size_t mon_runs = mon_run_vec.size();
561 for (
size_t kr = 0; kr < mon_runs; kr++) {
562 unsigned int irun = static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().
getRunNumber());
564 edm::LogInfo(
"here is first sub run : ") << mon_run_vec[kr].getSubRunNumber();
565 edm::LogInfo(
"here is the run number: ") << mon_run_vec[kr].getRunIOV().getRunNumber();
569 if (mon_run_vec[kr].getSubRunNumber() <= 1) {
571 RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
574 std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
575 econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
576 std::cout <<
"OMDS record for run " << irun <<
" is made of " << dataset_mon.size() << std::endl;
577 typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
586 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
590 int xt_num = ecid_xt.
getID2();
595 ix = 95 - (xt_num - 1) / 20;
596 iy = 46 + (xt_num - 1) % 20;
613 if (ix == ixmin && iy == iymin)
617 edm::LogInfo(
"Generating popcon record for run ") << irun <<
"..." << std::flush;
626 for (
int iX = ixmin; iX <= ixmax; ++iX) {
627 for (
int iY = iymin; iY <= iymax; ++iY) {
634 item.mean_x1 = aped.mean_x1;
635 item.rms_x1 = aped.rms_x1;
636 item.mean_x6 = aped.mean_x6;
637 item.rms_x6 = aped.rms_x6;
638 item.mean_x12 = aped.mean_x12;
639 item.rms_x12 = aped.rms_x12;
642 if (iX == ixmin && iY == iymin)
650 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)pedtemp, snc));
652 edm::LogInfo(
"Ecal - > end of getNewObjectsH2 -----------\n");
663 std::ifstream fInput;
664 fInput.open(m_filename);
665 if (!fInput.is_open()) {
666 edm::LogInfo(
"ERROR : cannot open file ") << m_filename;
675 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
676 fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel] >>
677 EBmean1[iChannel] >> EBrms1[iChannel];
678 if (hashedId != iChannel + 1) {
679 edm::LogInfo(
"File") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
687 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
688 fInput >> hashedId >> EEmean12[iChannel] >> EErms12[iChannel] >> EEmean6[iChannel] >> EErms6[iChannel] >>
689 EEmean1[iChannel] >> EErms1[iChannel];
691 edm::LogInfo(
"File") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
707 item.mean_x1 = EBmean1[hieb];
708 item.rms_x1 = EBrms1[hieb];
709 item.mean_x6 = EBmean6[hieb];
710 item.rms_x6 = EBrms6[hieb];
711 item.mean_x12 = EBmean12[hieb];
712 item.rms_x12 = EBrms12[hieb];
720 for (
int iz = -1; iz < 2; iz = iz + 2) {
728 item.mean_x1 = EEmean1[hiee];
729 item.rms_x1 = EErms1[hiee];
730 item.mean_x6 = EEmean6[hiee];
731 item.rms_x6 = EErms6[hiee];
732 item.mean_x12 = EEmean12[hiee];
733 item.rms_x12 = EErms12[hiee];
741 unsigned int irun = m_firstRun;
743 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)ped, snc));
745 edm::LogInfo(
"Ecal - > end of readPedestalFile -----------\n");
752 fxml.open(m_filename);
753 if (!fxml.is_open()) {
754 edm::LogInfo(
"ERROR : cannot open file ") << m_filename;
758 fout.open(
"Pedestal.check");
763 double RingMean[28][2][3], RingRMS[28][2][3];
766 for (
int side = 0; side < 2; side++) {
767 for (
int igain = 0; igain <
kGains; igain++) {
768 RingMean[
ring][side][igain] = 0.;
769 RingRMS[
ring][side][igain] = 0.;
770 NbVal[
ring][side][igain] = 0;
775 for (
int i = 0;
i < 9;
i++)
776 std::getline(fxml, dummyLine);
778 for (
int iEBChannel = 0; iEBChannel <
kEBChannels; iEBChannel++) {
782 if (ring < 0 || ring > 16)
789 std::istringstream m12(stt);
790 m12 >> EBmean12[iEBChannel];
792 stt = bid.substr(9, 15);
793 std::istringstream r12(stt);
794 r12 >> EBrms12[iEBChannel];
795 if (EBrms12[iEBChannel] != 0. && EBrms12[iEBChannel] < 5.) {
796 RingMean[
ring][izz][0] += EBrms12[iEBChannel];
797 RingRMS[
ring][izz][0] += EBrms12[iEBChannel] * EBrms12[iEBChannel];
798 NbVal[
ring][izz][0]++;
801 stt = bid.substr(9, 15);
802 std::istringstream m6(stt);
803 m6 >> EBmean6[iEBChannel];
805 stt = bid.substr(8, 15);
806 std::istringstream r6(stt);
807 r6 >> EBrms6[iEBChannel];
808 if (EBrms6[iEBChannel] != 0. && EBrms6[iEBChannel] < 5.) {
809 RingMean[
ring][izz][1] += EBrms6[iEBChannel];
810 RingRMS[
ring][izz][1] += EBrms6[iEBChannel] * EBrms6[iEBChannel];
811 NbVal[
ring][izz][1]++;
814 stt = bid.substr(9, 15);
815 std::istringstream m1(stt);
816 m1 >> EBmean1[iEBChannel];
818 stt = bid.substr(8, 15);
819 std::istringstream
r1(stt);
820 r1 >> EBrms1[iEBChannel];
821 if (EBrms1[iEBChannel] != 0. && EBrms1[iEBChannel] < 5.) {
822 RingMean[
ring][izz][2] += EBrms1[iEBChannel];
823 RingRMS[
ring][izz][2] += EBrms1[iEBChannel] * EBrms1[iEBChannel];
824 NbVal[
ring][izz][2]++;
826 if (iEBChannel % 10000 == 0)
827 fout <<
" EB channel " << iEBChannel <<
" " << EBmean12[iEBChannel] <<
" " << EBrms12[iEBChannel] <<
" "
828 << EBmean6[iEBChannel] <<
" " << EBrms6[iEBChannel] <<
" " << EBmean1[iEBChannel] <<
" "
829 << EBrms1[iEBChannel] << std::endl;
830 for (
int i = 0;
i < 3;
i++)
831 std::getline(fxml, dummyLine);
835 std::ifstream fCrystal;
836 fCrystal.open(
"Crystal");
837 if (!fCrystal.is_open()) {
842 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
843 fCrystal >> ringEE[iChannel];
844 int ring =
abs(ringEE[iChannel]) - 1;
845 if (ring < 17 || ring > 27) {
846 edm::LogInfo(
" EE channel ") << iChannel <<
" ring " << ringEE[iChannel];
854 for (
int i = 0;
i < 6;
i++)
855 std::getline(fxml, dummyLine);
856 for (
int iEEChannel = 0; iEEChannel <
kEEChannels; iEEChannel++) {
860 std::istringstream m12(stt);
861 m12 >> EEmean12[iEEChannel];
862 int ring =
abs(ringEE[iEEChannel]) - 1;
863 if (ring < 17 || ring > 27)
866 if (iEEChannel < 7324)
869 stt = bid.substr(9, 15);
870 std::istringstream r12(stt);
871 r12 >> EErms12[iEEChannel];
872 if (EErms12[iEEChannel] != 0. && EErms12[iEEChannel] < 5.) {
873 RingMean[
ring][izz][0] += EErms12[iEEChannel];
874 RingRMS[
ring][izz][0] += EErms12[iEEChannel] * EErms12[iEEChannel];
875 NbVal[
ring][izz][0]++;
878 stt = bid.substr(9, 15);
879 std::istringstream m6(stt);
880 m6 >> EEmean6[iEEChannel];
882 stt = bid.substr(8, 15);
883 std::istringstream r6(stt);
884 r6 >> EErms6[iEEChannel];
885 if (EErms6[iEEChannel] != 0. && EErms6[iEEChannel] < 5.) {
886 RingMean[
ring][izz][1] += EErms6[iEEChannel];
887 RingRMS[
ring][izz][1] += EErms6[iEEChannel] * EErms6[iEEChannel];
888 NbVal[
ring][izz][1]++;
891 stt = bid.substr(9, 15);
892 std::istringstream m1(stt);
893 m1 >> EEmean1[iEEChannel];
895 stt = bid.substr(8, 15);
896 std::istringstream
r1(stt);
897 r1 >> EErms1[iEEChannel];
898 if (EErms1[iEEChannel] != 0. && EErms1[iEEChannel] < 5.) {
899 RingMean[
ring][izz][2] += EErms1[iEEChannel];
900 RingRMS[
ring][izz][2] += EErms1[iEEChannel] * EErms1[iEEChannel];
901 NbVal[
ring][izz][2]++;
903 if (iEEChannel % 1000 == 0)
904 fout <<
" EE channel " << iEEChannel <<
" " << EEmean12[iEEChannel] <<
" " << EErms12[iEEChannel] <<
" "
905 << EEmean6[iEEChannel] <<
" " << EErms6[iEEChannel] <<
" " << EEmean1[iEEChannel] <<
" "
906 << EErms1[iEEChannel] << std::endl;
907 for (
int i = 0;
i < 3;
i++)
908 std::getline(fxml, dummyLine);
917 for (
int side = 0; side < 2; side++) {
927 fout <<
" ring " <<
ring + 1 <<
" mean " <<
x <<
" rms " <<
rms <<
" ";
931 fout <<
"***** End caps ***** EE- EE+" << std::endl;
949 item.mean_x12 = 200.;
952 if (ring < 0 || ring > 16)
957 if (EBrms1[hieb] == 0 || EBrms1[hieb] > RingMean[
ring][side][2] + 3 * RingRMS[
ring][side][2]) {
958 fout <<
" EB channel " << hieb <<
" eta " <<
iEta <<
" phi " << iPhi <<
" ring " <<
ring + 1
959 <<
" gain 1 rms " << EBrms1[hieb] <<
" replaced by " << RingMean[
ring][side][2] << std::endl;
960 item.rms_x1 = RingMean[
ring][side][2];
962 item.rms_x1 = EBrms1[hieb];
963 if (EBrms6[hieb] == 0 || EBrms6[hieb] > RingMean[
ring][side][1] + 3 * RingRMS[
ring][side][1]) {
964 fout <<
" EB channel " << hieb <<
" eta " <<
iEta <<
" phi " << iPhi <<
" ring " <<
ring + 1
965 <<
" gain 6 rms " << EBrms6[hieb] <<
" replaced by " << RingMean[
ring][side][1] << std::endl;
966 item.rms_x6 = RingMean[
ring][side][1];
968 item.rms_x6 = EBrms6[hieb];
969 if (EBrms12[hieb] == 0 || EBrms12[hieb] > RingMean[
ring][side][0] + 3 * RingRMS[
ring][side][0]) {
970 fout <<
" EB channel " << hieb <<
" eta " <<
iEta <<
" phi " << iPhi <<
" ring " <<
ring + 1
971 <<
" gain 12 rms " << EBrms12[hieb] <<
" replaced by " << RingMean[
ring][side][0] << std::endl;
972 item.rms_x12 = RingMean[
ring][side][0];
974 item.rms_x12 = EBrms12[hieb];
975 if (hieb > 4534 && hieb < 4540)
976 edm::LogInfo(
" Channel ") << hieb <<
" ring " <<
ring <<
" 12 " << EBrms12[hieb] <<
" mean "
977 << RingMean[
ring][side][0] <<
" rms " << RingRMS[
ring][side][0] <<
" 6 "
978 << EBrms6[hieb] <<
" mean " << RingMean[
ring][side][1] <<
" rms "
979 << RingRMS[
ring][side][1] <<
" 1 " << EBrms1[hieb] <<
" mean "
980 << RingMean[
ring][side][2] <<
" rms " << RingRMS[
ring][side][2];
983 item.rms_x1 = EBrms1[hieb];
984 item.rms_x6 = EBrms6[hieb];
985 item.rms_x12 = EBrms12[hieb];
987 if (
item.rms_x1 > 4. ||
item.rms_x6 > 4. ||
item.rms_x12 > 4.)
995 for (
int iz = -1; iz < 2; iz = iz + 2) {
1003 item.mean_x1 = 200.;
1004 item.mean_x6 = 200.;
1005 item.mean_x12 = 200.;
1007 int ring =
abs(ringEE[hiee]) - 1;
1008 if (ring < 17 || ring > 27)
1010 if (EErms1[hiee] == 0 || EErms1[hiee] > RingMean[
ring][iz][2] + 3 * RingRMS[
ring][iz][2]) {
1011 fout <<
" EE channel " << hiee <<
" x " << iX <<
" y " << iY <<
" z " << iz <<
" ring " <<
ring + 1
1012 <<
" gain 1 rms " << EErms1[hiee] <<
" replaced by " << RingMean[
ring][iz][2] << std::endl;
1013 item.rms_x1 = RingMean[
ring][iz][2];
1015 item.rms_x1 = EErms1[hiee];
1016 if (EErms6[hiee] == 0 || EErms6[hiee] > RingMean[
ring][iz][1] + 3 * RingRMS[
ring][iz][1]) {
1017 fout <<
" EE channel " << hiee <<
" x " << iX <<
" y " << iY <<
" z " << iz <<
" ring " <<
ring + 1
1018 <<
" gain 6 rms " << EErms6[hiee] <<
" replaced by " << RingMean[
ring][iz][1] << std::endl;
1019 item.rms_x6 = RingMean[
ring][iz][1];
1021 item.rms_x6 = EErms6[hiee];
1022 if (EErms12[hiee] == 0 || EErms12[hiee] > RingMean[
ring][iz][0] + 3 * RingRMS[
ring][iz][0]) {
1023 fout <<
" EE channel " << hiee <<
" x " << iX <<
" y " << iY <<
" z " << iz <<
" ring " <<
ring + 1
1024 <<
" gain 12 rms " << EErms12[hiee] <<
" replaced by " << RingMean[
ring][iz][0] << std::endl;
1025 item.rms_x12 = RingMean[
ring][iz][0];
1027 item.rms_x12 = EErms12[hiee];
1030 item.rms_x1 = EErms1[hiee];
1031 item.rms_x6 = EErms6[hiee];
1032 item.rms_x12 = EErms12[hiee];
1041 unsigned int irun = m_firstRun;
1043 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)ped, snc));
1045 edm::LogInfo(
"Ecal - > end of readPedestalMC -----------\n");
1052 edm::LogInfo(
" reading local Pedestal run (2017 way)! ") << m_filename;
1055 Ref ped_db = lastPayload();
1070 item.mean_x1 = aped.mean_x1;
1071 item.rms_x1 = aped.rms_x1;
1072 item.mean_x6 = aped.mean_x6;
1073 item.rms_x6 = aped.rms_x6;
1074 item.mean_x12 = aped.mean_x12;
1075 item.rms_x12 = aped.rms_x12;
1084 EEDetId eedetidpos(iX, iY, 1);
1089 item.mean_x1 = aped.mean_x1;
1090 item.rms_x1 = aped.rms_x1;
1091 item.mean_x6 = aped.mean_x6;
1092 item.rms_x6 = aped.rms_x6;
1093 item.mean_x12 = aped.mean_x12;
1094 item.rms_x12 = aped.rms_x12;
1098 EEDetId eedetidneg(iX, iY, -1);
1103 item.mean_x1 = aped.mean_x1;
1104 item.rms_x1 = aped.rms_x1;
1105 item.mean_x6 = aped.mean_x6;
1106 item.rms_x6 = aped.rms_x6;
1107 item.mean_x12 = aped.mean_x12;
1108 item.rms_x12 = aped.rms_x12;
1114 edm::LogInfo(
" reading the input file ") << m_filename;
1115 std::ifstream fInput;
1116 fInput.open(m_filename);
1117 if (!fInput.is_open()) {
1118 edm::LogInfo(
"ERROR : cannot open file ") << m_filename;
1127 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
1128 fInput >> hashedId >> EBmean12[iChannel] >> EBrms12[iChannel] >> EBmean6[iChannel] >> EBrms6[iChannel] >>
1129 EBmean1[iChannel] >> EBrms1[iChannel];
1130 if (hashedId != iChannel + 1) {
1131 edm::LogInfo(
"File ") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
1139 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
1140 fInput >> hashedId >> EEmean12[iChannel] >> EErms12[iChannel] >> EEmean6[iChannel] >> EErms6[iChannel] >>
1141 EEmean1[iChannel] >> EErms1[iChannel];
1143 edm::LogInfo(
"File ") << m_filename <<
" strange hash " << hashedId <<
" while iChannel " << iChannel;
1160 if (
debug & (EBmean12[hieb] == -999. || EBrms12[hieb] == -999. || EBmean6[hieb] == -999. ||
1161 EBrms6[hieb] == -999. || EBmean1[hieb] == -999. || EBrms1[hieb] == -999.))
1163 <<
iEta <<
" phi " << iPhi <<
" " << EBmean12[hieb] <<
" " << EBrms12[hieb] <<
" " << EBmean6[hieb] <<
" "
1164 << EBrms6[hieb] <<
" " << EBmean1[hieb] <<
" " << EBrms1[hieb];
1165 if (EBmean1[hieb] != -999.)
1166 item.mean_x1 = EBmean1[hieb];
1168 item.mean_x1 = previous_ped.mean_x1;
1169 if (EBrms1[hieb] != -999.)
1170 item.rms_x1 = EBrms1[hieb];
1172 item.rms_x1 = previous_ped.rms_x1;
1173 if (EBmean6[hieb] != -999.)
1174 item.mean_x6 = EBmean6[hieb];
1176 item.mean_x6 = previous_ped.mean_x6;
1177 if (EBrms6[hieb] != -999.)
1178 item.rms_x6 = EBrms6[hieb];
1180 item.rms_x6 = previous_ped.rms_x6;
1181 if (EBmean12[hieb] != -999.)
1182 item.mean_x12 = EBmean12[hieb];
1184 item.mean_x12 = previous_ped.mean_x12;
1185 if (EBrms12[hieb] != -999.)
1186 item.rms_x12 = EBrms12[hieb];
1188 item.rms_x12 = previous_ped.rms_x12;
1196 for (
int iz = -1; iz < 2; iz = iz + 2) {
1205 if (
debug & (EEmean12[hiee] == -999. || EErms12[hiee] == -999. || EEmean6[hiee] == -999. ||
1206 EErms6[hiee] == -999. || EEmean1[hiee] == -999. || EErms1[hiee] == -999.))
1208 << iX <<
" y " << iY <<
" z" << iz <<
" " << EEmean12[hiee] <<
" " << EErms12[hiee] <<
" "
1209 << EEmean6[hiee] <<
" " << EErms6[hiee] <<
" " << EEmean1[hiee] <<
" " << EErms1[hiee];
1210 if (EEmean1[hiee] != -999.)
1211 item.mean_x1 = EEmean1[hiee];
1213 item.mean_x1 = previous_ped.mean_x1;
1214 if (EErms1[hiee] != -999.)
1215 item.rms_x1 = EErms1[hiee];
1217 item.rms_x1 = previous_ped.rms_x1;
1218 if (EEmean6[hiee] != -999.)
1219 item.mean_x6 = EEmean6[hiee];
1221 item.mean_x6 = previous_ped.mean_x6;
1222 if (EErms6[hiee] != -999.)
1223 item.rms_x6 = EErms6[hiee];
1225 item.rms_x6 = previous_ped.rms_x6;
1226 if (EEmean12[hiee] != -999.)
1227 item.mean_x12 = EEmean12[hiee];
1229 item.mean_x12 = previous_ped.mean_x12;
1230 if (EErms12[hiee] != -999.)
1231 item.rms_x12 = EErms12[hiee];
1233 item.rms_x12 = previous_ped.rms_x12;
1241 unsigned int irun = m_firstRun;
1243 m_to_transfer.push_back(std::make_pair((
EcalPedestals*)ped, snc));
1245 edm::LogInfo(
"Ecal - > end of readPedestal2017 -----------\n");
1251 TFile* hfile =
new TFile(m_filename.c_str());
1253 TTree* treeChan = (TTree*)hfile->Get(
"PedChan");
1254 int iChannel = 0, ix = 0, iy = 0, iz = 0;
1255 treeChan->SetBranchAddress(
"Channels", &iChannel);
1256 treeChan->SetBranchAddress(
"x", &ix);
1257 treeChan->SetBranchAddress(
"y", &iy);
1258 treeChan->SetBranchAddress(
"z", &iz);
1259 int neventsChan = (
int)treeChan->GetEntries();
1263 treeChan->GetEntry(
entry);
1265 ringEB[iChannel] = (
abs(ix) - 1) / 5;
1266 sideEB[iChannel] = 1;
1268 sideEB[iChannel] = 0;
1269 if (
entry % 10000 == 0)
1270 edm::LogInfo(
" EB channel ") << iChannel <<
" eta " << ix <<
" phi " << iy <<
" side " << sideEB[iChannel]
1271 <<
" ring " << ringEB[iChannel];
1273 ixEE[iChannel] = ix;
1274 iyEE[iChannel] = iy;
1275 izEE[iChannel] = iz;
1276 if (
entry % 1000 == 0)
1277 edm::LogInfo(
" EE channel ") << iChannel <<
" x " << ixEE[iChannel] <<
" y " << iyEE[iChannel] <<
" z "
1366 Int_t run16Index = 0;
1368 Int_t fed[
kChannels],
chan[
kChannels],
id,
run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time,
1369 run_time_stablebeam, nxt,
time[54];
1371 TTree*
tree = (TTree*)hfile->Get(
"T");
1373 tree->SetBranchAddress(
"id", &
id);
1374 tree->SetBranchAddress(
"run", &
run);
1375 tree->SetBranchAddress(
"run_type", &run_type);
1376 tree->SetBranchAddress(
"seq_id", &seq_id);
1377 tree->SetBranchAddress(
"las_id", &las_id);
1378 tree->SetBranchAddress(
"fill_num", &fill_num);
1379 tree->SetBranchAddress(
"run_num_infill", &run_num_infill);
1380 tree->SetBranchAddress(
"run_time", &run_time);
1381 tree->SetBranchAddress(
"run_time_stablebeam", &run_time_stablebeam);
1382 tree->SetBranchAddress(
"lumi", &
lumi);
1383 tree->SetBranchAddress(
"bfield", &bfield);
1384 tree->SetBranchAddress(
"nxt", &nxt);
1385 tree->SetBranchAddress(
"time",
time);
1386 tree->SetBranchAddress(
"fed", fed);
1387 tree->SetBranchAddress(
"chan",
chan);
1388 tree->SetBranchAddress(
"ped", ped);
1389 tree->SetBranchAddress(
"pedrms", pedrms);
1393 fout.open(
"copyTreePedestals.txt");
1394 if (!
fout.is_open()) {
1395 edm::LogInfo(
"ERROR : cannot open file copyTreePedestals.txt");
1401 for (
int ich = 0; ich <
kChannels; ich++) {
1407 fout <<
" first run " <<
run <<
" fill " << fill_num <<
" B field " << bfield <<
" run type " << run_type
1408 <<
" seq_id " << seq_id <<
" las_id " << las_id <<
" run_num_infill " << run_num_infill <<
" lumi " <<
lumi
1409 <<
" nb of Crystals " << nxt << std::endl;
1410 for (
int ich = 0; ich <
kChannels; ich++) {
1411 if (ped[ich] != 0.) {
1413 fout <<
" channel " << ich <<
" FED " << fed[ich] <<
" chan " <<
chan[ich] <<
" pedestal " << ped[ich]
1414 <<
" RMS " << pedrms[ich] << std::endl;
1416 fout <<
" channel " << ich <<
" EE channel " << ich -
kEBChannels <<
" FED " << fed[ich] <<
" chan "
1417 <<
chan[ich] <<
" pedestal " << ped[ich] <<
" RMS " << pedrms[ich] << std::endl;
1421 int run_type_kept = m_runtype;
1422 int first_run_kept = (
int)m_firstRun;
1423 int last_run_kept = (
int)m_lastRun;
1425 int firsttimeFED = -1;
1429 if (
run < first_run_kept) {
1430 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1431 <<
" before first wanted " << m_firstRun << std::endl;
1435 if (
run > last_run_kept) {
1436 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1437 <<
" after last wanted " << m_lastRun << std::endl;
1441 if (run_type != run_type_kept) {
1442 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time <<
" run type "
1443 << run_type << std::endl;
1447 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1448 <<
" *********** Number of channels " << nxt << std::endl;
1451 if (bfield < 3.79) {
1452 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1453 <<
" *********** bfield = " << bfield << std::endl;
1456 if (run_type_kept == 1) {
1458 for (
int ifed = 0; ifed < 54; ifed++) {
1459 if (
time[ifed] < run_time_stablebeam) {
1461 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" run_time " << run_time
1462 <<
" *********** sequence before stable beam at " << run_time_stablebeam <<
" FED " << ifed <<
" : "
1465 fout <<
" FED " << ifed <<
" : " <<
time[ifed];
1469 if (time_seq != 0) {
1470 fout <<
" total nb " << time_seq << std::endl;
1478 if (
run == runold) {
1480 for (
int ich = 0; ich <
kChannels; ich++) {
1481 if (ped[ich] < 300 && ped[ich] > 100) {
1482 EAmean12[ich] += ped[ich];
1483 EArms12[ich] += pedrms[ich];
1491 if (RunEntry == 0 || (run_type_kept == 2 && RunEntry < 6))
1492 fout <<
" skiped run " << runold <<
" not enough entries : " << RunEntry << std::endl;
1494 fout <<
" entry " <<
entry - 1 <<
" run " << runold <<
" nb of events " << RunEntry;
1495 firsttimeFED =
time[0];
1496 for (
int ifed = 0; ifed < 54; ifed++) {
1498 if (firsttimeFED <
time[ifed])
1499 firsttimeFED =
time[ifed];
1504 bool foundNew =
false;
1506 if (runold > pedxml[
i]) {
1507 fout <<
" found a new gain 1, 6 file " << pedxml[
i] <<
" at index " <<
i << std::endl;
1510 if (runold < pedxml[
i + 1])
1515 int Indexxml = run16Index - 1;
1516 fout <<
" opening Pedestals_" << pedxml[Indexxml] <<
".xml at index " << Indexxml << std::endl;
1518 fxml.open(Form(
"Pedestals_%i.xml", pedxml[Indexxml]));
1519 if (!fxml.is_open()) {
1520 edm::LogInfo(
"ERROR : cannot open file Pedestals_") << pedxml[Indexxml] <<
".xml";
1524 for (
int i = 0;
i < 9;
i++)
1525 std::getline(fxml, dummyLine);
1527 for (
int iEBChannel = 0; iEBChannel <
kEBChannels; iEBChannel++) {
1528 fxml >> mean12 >> rms12 >> bid;
1538 std::istringstream m6(stt);
1539 m6 >> EAmean6[iEBChannel];
1541 stt = bid.substr(8, 15);
1542 std::istringstream r6(stt);
1543 r6 >> EArms6[iEBChannel];
1545 stt = bid.substr(9, 15);
1546 std::istringstream m1(stt);
1547 m1 >> EAmean1[iEBChannel];
1549 stt = bid.substr(8, 15);
1550 std::istringstream
r1(stt);
1551 r1 >> EArms1[iEBChannel];
1552 if (iEBChannel % 10000 == 0)
1553 fout <<
" EB channel " << iEBChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[iEBChannel] <<
" "
1554 << EArms6[iEBChannel] <<
" " << EAmean1[iEBChannel] <<
" " << EArms1[iEBChannel] << std::endl;
1555 for (
int i = 0;
i < 3;
i++)
1556 std::getline(fxml, dummyLine);
1558 for (
int i = 0;
i < 6;
i++)
1559 std::getline(fxml, dummyLine);
1560 for (
int iEEChannel = 0; iEEChannel <
kEEChannels; iEEChannel++) {
1562 fxml >> mean12 >> rms12 >> bid;
1564 std::istringstream m6(stt);
1567 stt = bid.substr(8, 15);
1568 std::istringstream r6(stt);
1571 stt = bid.substr(9, 15);
1572 std::istringstream m1(stt);
1575 stt = bid.substr(8, 15);
1576 std::istringstream
r1(stt);
1578 if (iEEChannel % 1000 == 0)
1579 fout <<
" EE channel " << iEEChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[ich] <<
" "
1580 << EArms6[ich] <<
" " << EAmean1[ich] <<
" " << EArms1[ich] << std::endl;
1581 for (
int i = 0;
i < 3;
i++)
1582 std::getline(fxml, dummyLine);
1591 for (
int ich = 0; ich <
kChannels; ich++) {
1592 if (EAentry[ich] != 0) {
1593 EAmean12[ich] /= EAentry[ich];
1594 EArms12[ich] /= EAentry[ich];
1596 EAmean12[ich] = 200.;
1599 if (ich % 10000 == 0)
1600 fout <<
" channel " << ich <<
" ped " << EAmean12[ich] <<
" RMS " << EArms12[ich] << std::endl;
1602 item.mean_x1 = EAmean1[ich];
1603 item.rms_x1 = EArms1[ich];
1604 item.mean_x6 = EAmean6[ich];
1605 item.rms_x6 = EArms6[ich];
1606 item.mean_x12 = EAmean12[ich];
1607 item.rms_x12 = EArms12[ich];
1625 for (
int ich = 0; ich <
kChannels; ich++) {
1626 if (ped[ich] < 300 && ped[ich] > 100) {
1627 EAmean12[ich] = ped[ich];
1628 EArms12[ich] = pedrms[ich];
1639 fout <<
" last entry fill " << fill_num <<
" run " << runold <<
" nb of events " << RunEntry <<
" time " << run_time
1640 <<
" " << run_time_stablebeam <<
" " <<
time[0] <<
" run type " << run_type << std::endl;
1641 for (
int ifed = 0; ifed < 54; ifed++)
1646 for (
int ich = 0; ich <
kChannels; ich++) {
1647 if (EAentry[ich] != 0) {
1648 EAmean12[ich] /= EAentry[ich];
1649 EArms12[ich] /= EAentry[ich];
1651 EAmean12[ich] = 200.;
1654 if (ich % 10000 == 0)
1655 fout <<
" channel " << ich <<
" ped " << EAmean12[ich] <<
" RMS " << EArms12[ich] << std::endl;
1659 item.mean_x1 = EAmean1[ich];
1660 item.rms_x1 = EArms1[ich];
1661 item.mean_x6 = EAmean6[ich];
1662 item.rms_x6 = EArms6[ich];
1663 item.mean_x12 = EAmean12[ich];
1664 item.rms_x12 = EArms12[ich];
1678 edm::LogInfo(
"Ecal - > end of readPedestalTree -----------\n");
1685 TFile* hfile =
new TFile(m_filename.c_str());
1687 TTree* treeChan = (TTree*)hfile->Get(
"PedChan");
1688 int iChannel = 0, ix = 0, iy = 0, iz = 0;
1689 treeChan->SetBranchAddress(
"Channels", &iChannel);
1690 treeChan->SetBranchAddress(
"x", &ix);
1691 treeChan->SetBranchAddress(
"y", &iy);
1692 treeChan->SetBranchAddress(
"z", &iz);
1693 int neventsChan = (
int)treeChan->GetEntries();
1697 treeChan->GetEntry(
entry);
1699 ringEB[iChannel] = (
abs(ix) - 1) / 5;
1700 sideEB[iChannel] = 1;
1702 sideEB[iChannel] = 0;
1704 edm::LogInfo(
" EB channel ") << iChannel <<
" eta " << ix <<
" phi " << iy <<
" side " << sideEB[iChannel]
1705 <<
" ring " << ringEB[iChannel];
1707 ixEE[iChannel] = ix;
1708 iyEE[iChannel] = iy;
1709 izEE[iChannel] = iz;
1711 edm::LogInfo(
" EE channel ") << iChannel <<
" x " << ixEE[iChannel] <<
" y " << iyEE[iChannel] <<
" z "
1800 Int_t run16Index = 0;
1802 Int_t fed[
kChannels],
chan[
kChannels],
id,
run, run_type, seq_id, las_id, fill_num, run_num_infill, run_time,
1803 run_time_stablebeam, nxt,
time[54];
1805 TTree*
tree = (TTree*)hfile->Get(
"T");
1807 tree->SetBranchAddress(
"id", &
id);
1808 tree->SetBranchAddress(
"run", &
run);
1809 tree->SetBranchAddress(
"run_type", &run_type);
1810 tree->SetBranchAddress(
"seq_id", &seq_id);
1811 tree->SetBranchAddress(
"las_id", &las_id);
1812 tree->SetBranchAddress(
"fill_num", &fill_num);
1813 tree->SetBranchAddress(
"run_num_infill", &run_num_infill);
1814 tree->SetBranchAddress(
"run_time", &run_time);
1815 tree->SetBranchAddress(
"run_time_stablebeam", &run_time_stablebeam);
1816 tree->SetBranchAddress(
"lumi", &
lumi);
1817 tree->SetBranchAddress(
"bfield", &bfield);
1818 tree->SetBranchAddress(
"nxt", &nxt);
1819 tree->SetBranchAddress(
"time",
time);
1820 tree->SetBranchAddress(
"fed", fed);
1821 tree->SetBranchAddress(
"chan",
chan);
1822 tree->SetBranchAddress(
"ped", ped);
1823 tree->SetBranchAddress(
"pedrms", pedrms);
1827 fout.open(
"copyTimestampPedestals.txt");
1828 if (!
fout.is_open()) {
1829 edm::LogInfo(
"ERROR : cannot open file copyTimestampPedestals.txt");
1834 for (
int ich = 0; ich <
kChannels; ich++) {
1835 EAmean12[ich] = 200.;
1839 fout <<
" first run " <<
run <<
" fill " << fill_num <<
" B field " << bfield <<
" run type " << run_type
1840 <<
" seq_id " << seq_id <<
" las_id " << las_id <<
" run_num_infill " << run_num_infill <<
" lumi " <<
lumi
1841 <<
" nb of Crystals " << nxt << std::endl;
1843 for (
int ich = 0; ich <
kChannels; ich++) {
1844 if (ped[ich] != 0.) {
1846 fout <<
" channel " << ich <<
" FED " << fed[ich] <<
" chan " <<
chan[ich] <<
" pedestal " << ped[ich]
1847 <<
" RMS " << pedrms[ich] << std::endl;
1849 fout <<
" channel " << ich <<
" EE channel " << ich -
kEBChannels <<
" FED " << fed[ich] <<
" chan "
1850 <<
chan[ich] <<
" pedestal " << ped[ich] <<
" RMS " << pedrms[ich] << std::endl;
1855 int runold = -1, fillold = -1, firsttimeFEDold = -1;
1856 int firsttimeFED = -1, firstFillSequence = 0;
1857 bool firstSeqBeforeStable =
false;
1859 int first_run_kept = (
int)m_firstRun;
1860 int last_run_kept = (
int)m_lastRun;
1865 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id
1866 <<
" *********** Number of channels " << nxt;
1868 fout <<
" rejected" << std::endl;
1873 if (run_type != 1) {
1874 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id
1875 <<
" *********** run_type ( 1 coll, 2 cosm, 3 circ, 4 test ) = " << run_type << std::endl;
1878 if (las_id != 447) {
1879 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id
1880 <<
" *********** laser wave length = " << las_id << std::endl;
1888 if (bfield < 3.79) {
1889 fout <<
" entry " <<
entry <<
" run " <<
run <<
" sequence " << seq_id <<
" *********** bfield = " << bfield
1895 fout <<
" fill " << fill_num;
1896 fout <<
" sequence " << seq_id;
1897 if (run_type == 1) {
1898 fout <<
" stable " << run_time_stablebeam;
1899 if (run_time_stablebeam < first_run_kept) {
1900 fout <<
" before first wanted " << m_firstRun << std::endl;
1904 firsttimeFED =
time[0];
1905 for (
int ifed = 0; ifed < 54; ifed++) {
1906 if (
time[ifed] > firsttimeFEDold &&
time[ifed] < firsttimeFED)
1907 firsttimeFED =
time[ifed];
1909 if (firsttimeFED < first_run_kept) {
1910 fout <<
" time " << firsttimeFED <<
" before first wanted " << m_firstRun << std::endl;
1913 if (firsttimeFED > last_run_kept) {
1914 fout <<
" entry " <<
entry <<
" time " << firsttimeFED <<
" after last wanted " << m_lastRun << std::endl;
1917 fout <<
" time " << firsttimeFED << std::endl;
1918 if (firsttimeFED <= firsttimeFEDold) {
1919 edm::LogInfo(
" Problem finding the IOV : old one ") << firsttimeFEDold <<
" new one " << firsttimeFED;
1920 for (
int ifed = 0; ifed < 54; ifed++)
1924 firsttimeFEDold = firsttimeFED;
1927 if (fill_num != fillold) {
1928 firstSeqBeforeStable =
false;
1929 firstFillSequence = 0;
1931 firstFillSequence++;
1932 if (run_type == 1) {
1933 if (run_time_stablebeam > 0) {
1934 if (firsttimeFED < run_time_stablebeam) {
1935 fout <<
" data taken before stable beam, skip it" << std::endl;
1936 firstSeqBeforeStable =
true;
1942 fout <<
" *** entry " <<
entry <<
" run_time_stablebeam " << run_time_stablebeam << std::endl;
1943 if (firstSeqBeforeStable) {
1944 firstSeqBeforeStable =
false;
1945 firsttimeFED = run_time_stablebeam;
1946 fout <<
" first full sequence after stable; change the IOV " << firsttimeFED << std::endl;
1948 if (firstFillSequence == 0) {
1949 if (firsttimeFED > run_time_stablebeam) {
1950 fout <<
" first full sequence " << firsttimeFED <<
" after stable " << run_time_stablebeam
1951 <<
"; change the IOV " << std::endl;
1952 firsttimeFED = run_time_stablebeam;
1957 for (
int ich = 0; ich <
kChannels; ich++) {
1958 if (ped[ich] < 300 && ped[ich] > 100) {
1959 EAmean12[ich] = ped[ich];
1960 EArms12[ich] = pedrms[ich];
1964 bool foundNew =
false;
1965 if (
run != runold) {
1967 if (
run > pedxml[
i]) {
1968 fout <<
" found a new gain 1, 6 file " << pedxml[
i] <<
" at index " <<
i << std::endl;
1972 if (
run < pedxml[
i + 1])
1977 int Indexxml = run16Index - 1;
1978 fout <<
" opening Pedestals_" << pedxml[Indexxml] <<
".xml at index " << Indexxml << std::endl;
1980 fxml.open(Form(
"Pedestals_%i.xml", pedxml[Indexxml]));
1981 if (!fxml.is_open()) {
1982 edm::LogInfo(
"ERROR : cannot open file Pedestals_") << pedxml[Indexxml] <<
".xml";
1986 for (
int i = 0;
i < 9;
i++)
1987 std::getline(fxml, dummyLine);
1989 for (
int iEBChannel = 0; iEBChannel <
kEBChannels; iEBChannel++) {
1990 fxml >> mean12 >> rms12 >> bid;
1992 std::istringstream m6(stt);
1993 m6 >> EAmean6[iEBChannel];
1995 stt = bid.substr(8, 15);
1996 std::istringstream r6(stt);
1997 r6 >> EArms6[iEBChannel];
1999 stt = bid.substr(9, 15);
2000 std::istringstream m1(stt);
2001 m1 >> EAmean1[iEBChannel];
2003 stt = bid.substr(8, 15);
2004 std::istringstream
r1(stt);
2005 r1 >> EArms1[iEBChannel];
2006 if (
debug && iEBChannel % 10000 == 0)
2007 fout <<
" EB channel " << iEBChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[iEBChannel] <<
" "
2008 << EArms6[iEBChannel] <<
" " << EAmean1[iEBChannel] <<
" " << EArms1[iEBChannel] << std::endl;
2009 for (
int i = 0;
i < 3;
i++)
2010 std::getline(fxml, dummyLine);
2012 for (
int i = 0;
i < 6;
i++)
2013 std::getline(fxml, dummyLine);
2014 for (
int iEEChannel = 0; iEEChannel <
kEEChannels; iEEChannel++) {
2016 fxml >> mean12 >> rms12 >> bid;
2018 std::istringstream m6(stt);
2021 stt = bid.substr(8, 15);
2022 std::istringstream r6(stt);
2025 stt = bid.substr(9, 15);
2026 std::istringstream m1(stt);
2029 stt = bid.substr(8, 15);
2030 std::istringstream
r1(stt);
2032 if (
debug && iEEChannel % 1000 == 0)
2033 fout <<
" EE channel " << iEEChannel <<
" " << mean12 <<
" " << rms12 <<
" " << EAmean6[ich] <<
" "
2034 << EArms6[ich] <<
" " << EAmean1[ich] <<
" " << EArms1[ich] << std::endl;
2035 for (
int i = 0;
i < 3;
i++)
2036 std::getline(fxml, dummyLine);
2044 for (
int ich = 0; ich <
kChannels; ich++) {
2045 if (
debug && ich % 10000 == 0)
2046 fout <<
" channel " << ich <<
" ped " << EAmean12[ich] <<
" RMS " << EArms12[ich] << std::endl;
2048 item.mean_x1 = EAmean1[ich];
2049 item.rms_x1 = EArms1[ich];
2050 item.mean_x6 = EAmean6[ich];
2051 item.rms_x6 = EArms6[ich];
2052 item.mean_x12 = EAmean12[ich];
2053 item.rms_x12 = EArms12[ich];
2068 fout <<
" entry " <<
entry <<
" transfer " << transfer <<
" iov " << iov << std::endl;
2070 fout <<
" m_to_transfer " << firsttimeFED << std::endl;
2075 edm::LogInfo(
"Ecal - > end of readPedestalTimestamp -----------\n");