38 #include "TProfile2D.h" 48 std::cout <<
"EcalChannelStatus Source handler constructor\n" << std::endl;
116 for (
int theSm = 0; theSm < 36; theSm++) {
117 for (
int theLM = 0; theLM < 2; theLM++) {
118 isEBRef1[theSm][theLM] =
false;
119 isEBRef2[theSm][theLM] =
false;
120 isGoodLaserEBSm[theSm][theLM] =
false;
127 for (
int theSector = 0; theSector < 18; theSector++) {
128 for (
int theLM = 0; theLM < 2; theLM++) {
129 isEERef1[theSector][theLM] =
false;
130 isEERef2[theSector][theLM] =
false;
131 isGoodLaserEESm[theSector][theLM] =
false;
135 typedef std::map<EcalLogicID, MonLaserBlueDat>::const_iterator CImon;
139 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
141 int sm_num = ecid_xt.
getID1();
142 int xt_num = ecid_xt.
getID2();
143 int yt_num = ecid_xt.
getID3();
149 if (ecid_xt.
getName() ==
"EB_crystal_number") {
152 theFed = 600 + elecId.
dccId();
155 if (ecid_xt.
getName() ==
"EE_crystal_number") {
157 EEDetId eedetid(xt_num, yt_num, sm_num);
159 theFed = 600 + elecId.
dccId();
160 theIx = eedetid.
ix();
169 if (ecid_xt.
getName() ==
"EE_crystal_number") {
170 if (theFed > 600 && theFed < 610)
171 thisFed = theFed - 601;
172 if (theFed > 645 && theFed < 655)
173 thisFed = theFed - 646 + 9;
175 if (ecid_xt.
getName() ==
"EB_crystal_number") {
176 thisFed = theFed - 610;
180 int theTTieta = -100;
181 int theTTiphi = -100;
183 if (ecid_xt.
getName() ==
"EB_crystal_number") {
184 theTTieta = (theTT - 1) / 4 + 1;
185 theTTiphi = (theTT - 1) % 4 + 1;
186 if (theTTieta == 1 || theTTiphi == 3 || theTTiphi == 4)
188 if (theTTieta > 1 && (theTTiphi == 1 || theTTiphi == 2))
191 if ((ecid_xt.
getName() ==
"EE_crystal_number") && (thisFed == 7 || thisFed == 16)) {
203 if (ecid_xt.
getName() ==
"EB_crystal_number") {
205 if (!isEBRef1[thisFed][theLM] && !isEBRef2[thisFed][theLM] && myApdMean > 100)
206 isEBRef1[thisFed][theLM] =
true;
207 if (isEBRef1[thisFed][theLM] && !isEBRef2[thisFed][theLM] && myApdMean > 100)
208 isEBRef2[thisFed][theLM] =
true;
212 if (ecid_xt.
getName() ==
"EE_crystal_number") {
213 EEDetId eedetid(xt_num, yt_num, sm_num);
216 if (thisFed != 7 && thisFed != 16) {
217 if (!isEERef1[thisFed][0] && !isEERef2[thisFed][0] && myApdMean > 100) {
218 isEERef1[thisFed][0] =
true;
219 isEERef1[thisFed][1] =
true;
221 if (isEERef1[thisFed][0] && !isEERef2[thisFed][0] && myApdMean > 100) {
222 isEERef2[thisFed][0] =
true;
223 isEERef2[thisFed][1] =
true;
228 if (thisFed == 7 || thisFed == 16) {
229 if (!isEERef1[thisFed][theLM] && !isEERef2[thisFed][theLM] && myApdMean > 100)
230 isEERef1[thisFed][theLM] =
true;
231 if (isEERef1[thisFed][theLM] && !isEERef2[thisFed][theLM] && myApdMean > 100)
232 isEERef2[thisFed][theLM] =
true;
238 for (
int theSm = 0; theSm < 36; theSm++) {
239 for (
int theLM = 0; theLM < 2; theLM++) {
240 if (isEBRef1[theSm][theLM] && isEBRef2[theSm][theLM])
241 isGoodLaserEBSm[theSm][theLM] =
true;
246 for (
int theSector = 0; theSector < 18; theSector++) {
247 for (
int theLM = 0; theLM < 2; theLM++) {
248 if (isEERef1[theSector][theLM] && isEERef2[theSector][theLM])
249 isGoodLaserEESm[theSector][theLM] =
true;
264 std::map<EcalLogicID, RunCrystalErrorsDat> theMask;
265 ecalErrorMask_.fetchDataSet(&theMask);
267 if (!theMask.empty()) {
268 std::map<EcalLogicID, RunCrystalErrorsDat>::const_iterator
m;
269 for (
m = theMask.begin();
m != theMask.end();
m++) {
271 int sm_num = ecid_xt.
getID1();
272 int xt_num = ecid_xt.
getID2();
273 int yt_num = ecid_xt.
getID3();
275 if ((
m->second).getErrorBits() & bits03) {
276 if (ecid_xt.
getName() ==
"EB_crystal_number") {
278 maskedOnlinePedEB.insert(std::pair<DetId, float>(ebdetid, 9999.));
281 EEDetId eedetid(xt_num, yt_num, sm_num);
282 maskedOnlinePedEE.insert(std::pair<DetId, float>(eedetid, 9999.));
305 std::map<EcalLogicID, RunCrystalErrorsDat> theMask;
306 ecalErrorMask_.fetchDataSet(&theMask);
308 if (!theMask.empty()) {
309 std::map<EcalLogicID, RunCrystalErrorsDat>::const_iterator
m;
310 for (
m = theMask.begin();
m != theMask.end();
m++) {
312 int sm_num = ecid_xt.
getID1();
313 int xt_num = ecid_xt.
getID2();
314 int yt_num = ecid_xt.
getID3();
316 if ((
m->second).getErrorBits() & bits03) {
317 if (ecid_xt.
getName() ==
"EB_crystal_number") {
319 maskedPedEB.insert(std::pair<DetId, float>(ebdetid, 9999.));
322 EEDetId eedetid(xt_num, yt_num, sm_num);
323 maskedPedEE.insert(std::pair<DetId, float>(eedetid, 9999.));
340 std::map<EcalLogicID, RunCrystalErrorsDat> theMask;
341 ecalErrorMask_.fetchDataSet(&theMask);
343 if (!theMask.empty()) {
344 std::map<EcalLogicID, RunCrystalErrorsDat>::const_iterator
m;
345 for (
m = theMask.begin();
m != theMask.end();
m++) {
347 int sm_num = ecid_xt.
getID1();
348 int xt_num = ecid_xt.
getID2();
349 int yt_num = ecid_xt.
getID3();
351 if ((
m->second).getErrorBits() & bits03) {
352 if (ecid_xt.
getName() ==
"EB_crystal_number") {
354 maskedLaserEB.insert(std::pair<DetId, float>(ebdetid, 9999.));
357 EEDetId eedetid(xt_num, yt_num, sm_num);
358 maskedLaserEE.insert(std::pair<DetId, float>(eedetid, 9999.));
371 std::map<EcalLogicID, RunCrystalErrorsDat> theMask;
372 ecalErrorMask_.fetchDataSet(&theMask);
374 if (!theMask.empty()) {
375 std::map<EcalLogicID, RunCrystalErrorsDat>::const_iterator
m;
376 for (
m = theMask.begin();
m != theMask.end();
m++) {
378 int sm_num = ecid_xt.
getID1();
379 int xt_num = ecid_xt.
getID2();
380 int yt_num = ecid_xt.
getID3();
382 if ((
m->second).getErrorBits() & bits03) {
383 if (ecid_xt.
getName() ==
"EB_crystal_number") {
385 maskedPhysicsEB.insert(std::pair<DetId, float>(ebdetid, 9999.));
388 EEDetId eedetid(xt_num, yt_num, sm_num);
389 maskedPhysicsEE.insert(std::pair<DetId, float>(eedetid, 9999.));
401 std::map<EcalLogicID, RunFEConfigDat> feconfig;
402 econn->fetchDataSet(&feconfig, &myRun);
404 typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
409 for (feConfIter
p = feconfig.begin();
p != feconfig.end();
p++) {
417 myconfig.
setId(fe_conf_id);
418 econn->fetchConfigSet(&myconfig);
424 econn->fetchConfigSet(&mybadTT);
426 std::vector<ODBadTTDat> badTT_dat;
427 econn->fetchConfigDataSet(&badTT_dat, &mybadTT);
429 for (
size_t iTT = 0; iTT < badTT_dat.size(); iTT++) {
430 int fed_id = badTT_dat[iTT].getFedId();
431 int tt_id = badTT_dat[iTT].getTTId();
433 *daqFile << fed_id <<
" " << tt_id << std::endl;
436 if ((fed_id <= 609 || fed_id >= 646) && tt_id < 69) {
446 std::vector<EcalLogicID> badCrystals;
447 badCrystals =
econn->getEcalLogicIDSet(
"EE_readout_tower",
454 "EE_crystal_number");
456 for (
size_t mycrys = 0; mycrys < badCrystals.size(); mycrys++) {
460 int yt2 = log_id % 1000;
461 int xt2 = (log_id % 1000000) / 1000;
462 int zt2 = (log_id / 1000000) % 10;
467 *daqFile2 << xt2 <<
" " << yt2 <<
" " << zSide << std::endl;
471 if (fed_id >= 610 && fed_id <= 645 && tt_id < 69) {
475 if (fed_id >= 610 && fed_id <= 627)
476 db_fedId = fed_id - 609 + 18;
477 if (fed_id >= 628 && fed_id <= 645)
478 db_fedId = fed_id - 627;
480 std::vector<EcalLogicID> badCrystals;
481 badCrystals =
econn->getEcalLogicIDSet(
"EB_trigger_tower",
488 "EB_crystal_number");
490 for (
size_t mycrys = 0; mycrys < badCrystals.size(); mycrys++) {
492 int sm_num = ecid_xt.
getID1();
494 int xt2_num = log_id % 10000;
512 std::map<EcalLogicID, MonCrystalConsistencyDat> wrongGain_mon) {
517 std::map<DetId, float>::const_iterator theIter;
523 typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
526 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
527 uint16_t status_now = 0;
530 int sm_num = ecid_xt.
getID1();
531 int xt_num = ecid_xt.
getID2();
532 int yt_num = ecid_xt.
getID3();
543 float lowerCut = 999.;
544 if (ecid_xt.
getName() ==
"EB_crystal_number") {
547 if (ecid_xt.
getName() ==
"EE_crystal_number") {
550 if ((checkPedestalRMSGain12(&ped_item) > lowerCut) || (checkPedestalRMSGain6(&ped_item) > lowerCut) ||
551 (checkPedestalRMSGain1(&ped_item) > lowerCut))
555 if ((checkPedestalValueGain12(&ped_item) > 300 || checkPedestalValueGain12(&ped_item) < 100) ||
556 (checkPedestalValueGain6(&ped_item) > 300 || checkPedestalValueGain6(&ped_item) < 100) ||
557 (checkPedestalValueGain1(&ped_item) > 300 || checkPedestalValueGain1(&ped_item) < 100))
561 if (checkPedestalRMSGain12(&ped_item) == 0 || checkPedestalRMSGain6(&ped_item) == 0 ||
562 checkPedestalRMSGain1(&ped_item) == 0)
566 if (checkPedestalValueGain12(&ped_item) < 0 && checkPedestalValueGain6(&ped_item) < 0 &&
567 checkPedestalValueGain1(&ped_item) > 0)
571 if (checkPedestalValueGain12(&ped_item) < 0 && checkPedestalValueGain6(&ped_item) > 0 &&
572 checkPedestalValueGain1(&ped_item) < 0)
576 if (checkPedestalValueGain12(&ped_item) < 0 && checkPedestalValueGain6(&ped_item) > 0 &&
577 checkPedestalValueGain1(&ped_item) > 0)
581 if (status_now > 0) {
582 if (ecid_xt.
getName() ==
"EB_crystal_number") {
585 int thisFed = 600 + elecId.
dccId();
587 *ResFileEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" 588 << ped_item.mean_x12 <<
"\t\t" << ped_item.rms_x12 <<
"\t\t" << ped_item.mean_x6 <<
"\t\t" 589 << ped_item.rms_x6 <<
"\t\t" << ped_item.mean_x1 <<
"\t\t" << ped_item.rms_x1 << std::endl;
593 for (theIter = maskedPedEB.begin(); theIter != maskedPedEB.end(); ++theIter) {
594 if ((*theIter).first == ebdetid)
598 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" 599 << ped_item.mean_x12 <<
"\t\t" << ped_item.rms_x12 <<
"\t\t" << ped_item.mean_x6 <<
"\t\t" 600 << ped_item.rms_x6 <<
"\t\t" << ped_item.mean_x1 <<
"\t\t" << ped_item.rms_x1 << std::endl;
605 EEDetId eedetid(xt_num, yt_num, sm_num);
607 int thisFed = 600 + elecId.
dccId();
608 *ResFileEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
609 <<
"\t\t" << eedetid.
hashedIndex() <<
"\t\t" << ped_item.mean_x12 <<
"\t\t" << ped_item.rms_x12
610 <<
"\t\t" << ped_item.mean_x6 <<
"\t\t" << ped_item.rms_x6 <<
"\t\t" << ped_item.mean_x1 <<
"\t\t" 611 << ped_item.rms_x1 << std::endl;
614 for (theIter = maskedPedEE.begin(); theIter != maskedPedEE.end(); ++theIter) {
615 if ((*theIter).first == eedetid)
619 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
620 <<
"\t\t" << eedetid.
hashedIndex() <<
"\t\t" << ped_item.mean_x12 <<
"\t\t" 621 << ped_item.rms_x12 <<
"\t\t" << ped_item.mean_x6 <<
"\t\t" << ped_item.rms_x6 <<
"\t\t" 622 << ped_item.mean_x1 <<
"\t\t" << ped_item.rms_x1 << std::endl;
630 typedef std::map<EcalLogicID, MonCrystalConsistencyDat>::const_iterator WGmonIter;
633 for (WGmonIter
p = wrongGain_mon.begin();
p != wrongGain_mon.end();
p++) {
635 rd_wgain =
p->second;
636 int sm_num = ecid_xt.
getID1();
637 int xt_num = ecid_xt.
getID2();
638 int yt_num = ecid_xt.
getID3();
642 if (ecid_xt.
getName() ==
"EB_crystal_number") {
645 int thisFed = 600 + elecId.
dccId();
646 *ResFileEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" 647 <<
"at gain zero" << std::endl;
651 for (theIter = maskedPedEB.begin(); theIter != maskedPedEB.end(); ++theIter) {
652 if ((*theIter).first == ebdetid)
656 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" 657 <<
"at gain zero" << std::endl;
662 EEDetId eedetid(xt_num, yt_num, sm_num);
664 int thisFed = 600 + elecId.
dccId();
665 *ResFileEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
667 <<
"at gain zero" << std::endl;
670 for (theIter = maskedPedEE.begin(); theIter != maskedPedEE.end(); ++theIter) {
671 if ((*theIter).first == eedetid)
675 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
677 <<
"at gain zero" << std::endl;
694 std::map<DetId, float>::const_iterator theIter;
696 typedef std::map<EcalLogicID, MonLaserBlueDat>::const_iterator CImon;
700 for (CImon
p = dataset_mon.begin();
p != dataset_mon.end();
p++) {
702 int sm_num = ecid_xt.
getID1();
703 int xt_num = ecid_xt.
getID2();
704 int yt_num = ecid_xt.
getID3();
710 if (ecid_xt.
getName() ==
"EB_crystal_number") {
713 theFed = 600 + elecId.
dccId();
716 if (ecid_xt.
getName() ==
"EE_crystal_number") {
718 EEDetId eedetid(xt_num, yt_num, sm_num);
720 theFed = 600 + elecId.
dccId();
721 theIx = eedetid.
ix();
727 if (ecid_xt.
getName() ==
"EE_crystal_number") {
728 if (theFed > 600 && theFed < 610)
729 thisFed = theFed - 601;
730 if (theFed > 645 && theFed < 655)
731 thisFed = theFed - 646 + 9;
733 if (ecid_xt.
getName() ==
"EB_crystal_number") {
734 thisFed = theFed - 610;
738 int theTTieta = -100;
739 int theTTiphi = -100;
741 if (ecid_xt.
getName() ==
"EB_crystal_number") {
742 theTTieta = (theTT - 1) / 4 + 1;
743 theTTiphi = (theTT - 1) % 4 + 1;
744 if (theTTieta == 1 || theTTiphi == 3 || theTTiphi == 4)
746 if (theTTieta > 1 && (theTTiphi == 1 || theTTiphi == 2))
749 if ((ecid_xt.
getName() ==
"EE_crystal_number") && (thisFed == 7 || thisFed == 16)) {
757 uint16_t status_now = 0;
761 if (ecid_xt.
getName() ==
"EB_crystal_number") {
762 if ((myApdMean < 400) && isGoodLaserEBSm[thisFed][theLM])
766 if (ecid_xt.
getName() ==
"EE_crystal_number") {
767 if (myApdMean < 100) {
768 if (thisFed != 7 && thisFed != 16 && isGoodLaserEESm[thisFed][0])
770 if ((thisFed == 7 || thisFed == 16) && isGoodLaserEESm[thisFed][theLM])
776 if (status_now > 0) {
777 if (ecid_xt.
getName() ==
"EB_crystal_number") {
779 *ResFileEB << theFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << myApdMean
784 for (theIter = maskedLaserEB.begin(); theIter != maskedLaserEB.end(); ++theIter) {
785 if ((*theIter).first == ebdetid)
789 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << myApdMean
795 EEDetId eedetid(xt_num, yt_num, sm_num);
796 *ResFileEE << theFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
797 <<
"\t\t" << eedetid.
hashedIndex() <<
"\t\t" << myApdMean << std::endl;
801 for (theIter = maskedLaserEE.begin(); theIter != maskedLaserEE.end(); ++theIter) {
802 if ((*theIter).first == eedetid)
806 *ResFileEE << theFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
807 <<
"\t\t" << eedetid.
hashedIndex() <<
"\t\t" << myApdMean << std::endl;
820 std::map<EcalLogicID, MonCrystalConsistencyDat> wrongGain_mon,
821 std::map<EcalLogicID, MonLaserBlueDat> laser_mon,
822 std::map<EcalLogicID, MonOccupancyDat> occupancy_mon) {
828 std::map<DetId, float>::const_iterator theIter;
829 std::map<DetId, float> badPedOnEB, badPedOnEE;
830 std::map<DetId, float> badPedOnRmsEB, badPedOnRmsEE;
831 std::map<DetId, float> badGainEB, badGainEE;
832 std::map<DetId, float> badLaserEB, badLaserEE;
833 std::map<DetId, float> badOccHighEB, badOccHighEE;
835 typedef std::map<EcalLogicID, MonPedestalsOnlineDat>::const_iterator CImonPedO;
836 typedef std::map<EcalLogicID, MonCrystalConsistencyDat>::const_iterator CImonCons;
837 typedef std::map<EcalLogicID, MonOccupancyDat>::const_iterator CImonOcc;
838 typedef std::map<EcalLogicID, MonLaserBlueDat>::const_iterator CImonLaser;
848 float totEntriesAboveHighThrEB = 0.;
849 float totEntriesAboveHighThrEE = 0.;
850 for (CImonOcc
p = occupancy_mon.begin();
p != occupancy_mon.end();
p++) {
854 if (ecid_xt.
getName() ==
"EB_crystal_number" && highOcc > -1)
855 totEntriesAboveHighThrEB = totEntriesAboveHighThrEB + highOcc;
856 if (ecid_xt.
getName() ==
"EE_crystal_number" && highOcc > -1)
857 totEntriesAboveHighThrEE = totEntriesAboveHighThrEE + highOcc;
861 for (CImonPedO
p = pedestalO_mon.begin();
p != pedestalO_mon.end();
p++) {
862 bool isWrong =
false;
865 int sm_num = ecid_xt.
getID1();
866 int xt_num = ecid_xt.
getID2();
867 int yt_num = ecid_xt.
getID3();
873 float lowerCut = 999.;
874 if (ecid_xt.
getName() ==
"EB_crystal_number") {
877 if (ecid_xt.
getName() ==
"EE_crystal_number") {
880 if (checkPedestalRMSGain12(&ped_item) > lowerCut)
882 if (checkPedestalValueGain12(&ped_item) > 300)
884 if (checkPedestalValueGain12(&ped_item) < 100)
886 if (checkPedestalRMSGain12(&ped_item) == 0)
891 if (ecid_xt.
getName() ==
"EB_crystal_number") {
893 theIter = badPedOnEB.find(ebdetid);
894 if (theIter == badPedOnEB.end()) {
895 badPedOnEB.insert(std::pair<DetId, float>(ebdetid, rd_ped0.
getADCMeanG12()));
896 badPedOnRmsEB.insert(std::pair<DetId, float>(ebdetid, rd_ped0.
getADCRMSG12()));
900 EEDetId eedetid(xt_num, yt_num, sm_num);
901 theIter = badPedOnEE.find(eedetid);
902 if (theIter == badPedOnEE.end()) {
903 badPedOnEE.insert(std::pair<DetId, float>(eedetid, rd_ped0.
getADCMeanG12()));
904 badPedOnRmsEE.insert(std::pair<DetId, float>(eedetid, rd_ped0.
getADCRMSG12()));
912 for (CImonCons
p = wrongGain_mon.begin();
p != wrongGain_mon.end();
p++) {
913 bool isWrong =
false;
915 rd_wgain =
p->second;
916 int sm_num = ecid_xt.
getID1();
917 int xt_num = ecid_xt.
getID2();
918 int yt_num = ecid_xt.
getID3();
925 if (ecid_xt.
getName() ==
"EB_crystal_number") {
927 theIter = badGainEB.find(ebdetid);
928 if (theIter == badGainEB.end())
929 badGainEB.insert(std::pair<DetId, float>(ebdetid, 999.));
932 EEDetId eedetid(xt_num, yt_num, sm_num);
933 theIter = badGainEE.find(eedetid);
934 if (theIter == badGainEE.end())
935 badGainEE.insert(std::pair<DetId, float>(eedetid, 999.));
942 for (CImonOcc
p = occupancy_mon.begin();
p != occupancy_mon.end();
p++) {
945 int sm_num = ecid_xt.
getID1();
946 int xt_num = ecid_xt.
getID2();
947 int yt_num = ecid_xt.
getID3();
952 bool isWrong =
false;
953 float occAvg = -999.;
954 if (ecid_xt.
getName() ==
"EB_crystal_number") {
959 if (ecid_xt.
getName() ==
"EE_crystal_number") {
966 if (ecid_xt.
getName() ==
"EB_crystal_number") {
968 theIter = badOccHighEB.find(ebdetid);
969 if (theIter == badOccHighEB.end())
970 badOccHighEB.insert(std::pair<DetId, float>(ebdetid, occAvg));
973 EEDetId eedetid(xt_num, yt_num, sm_num);
974 theIter = badOccHighEE.find(eedetid);
975 if (theIter == badOccHighEE.end())
976 badOccHighEE.insert(std::pair<DetId, float>(eedetid, occAvg));
983 for (CImonLaser
p = laser_mon.begin();
p != laser_mon.end();
p++) {
986 int sm_num = ecid_xt.
getID1();
987 int xt_num = ecid_xt.
getID2();
988 int yt_num = ecid_xt.
getID3();
994 if (ecid_xt.
getName() ==
"EB_crystal_number") {
997 theFed = 600 + elecId.
dccId();
1000 if (ecid_xt.
getName() ==
"EE_crystal_number") {
1002 EEDetId eedetid(xt_num, yt_num, sm_num);
1004 theFed = 600 + elecId.
dccId();
1005 theIx = eedetid.
ix();
1011 if (ecid_xt.
getName() ==
"EE_crystal_number") {
1012 if (theFed > 600 && theFed < 610)
1013 thisFed = theFed - 601;
1014 if (theFed > 645 && theFed < 655)
1015 thisFed = theFed - 646 + 9;
1017 if (ecid_xt.
getName() ==
"EB_crystal_number") {
1018 thisFed = theFed - 610;
1022 int theTTieta = -100;
1023 int theTTiphi = -100;
1025 if (ecid_xt.
getName() ==
"EB_crystal_number") {
1026 theTTieta = (theTT - 1) / 4 + 1;
1027 theTTiphi = (theTT - 1) % 4 + 1;
1028 if (theTTieta == 1 || theTTiphi == 3 || theTTiphi == 4)
1030 if (theTTieta > 1 && (theTTiphi == 1 || theTTiphi == 2))
1033 if ((ecid_xt.
getName() ==
"EE_crystal_number") && (thisFed == 7 || thisFed == 16)) {
1041 rd_blue =
p->second;
1044 bool isWrong =
false;
1045 if (ecid_xt.
getName() ==
"EB_crystal_number") {
1046 if ((myApdMean < 400) && isGoodLaserEBSm[thisFed][theLM])
1049 if (ecid_xt.
getName() ==
"EE_crystal_number") {
1050 if (myApdMean < 100) {
1051 if (thisFed != 7 && thisFed != 16 && isGoodLaserEESm[thisFed][0])
1053 if ((thisFed == 7 || thisFed == 16) && isGoodLaserEESm[thisFed][theLM])
1059 if (ecid_xt.
getName() ==
"EB_crystal_number") {
1061 theIter = badLaserEB.find(ebdetid);
1062 if (theIter == badLaserEB.end())
1063 badLaserEB.insert(std::pair<DetId, float>(ebdetid, myApdMean));
1066 EEDetId eedetid(xt_num, yt_num, sm_num);
1067 theIter = badLaserEE.find(eedetid);
1068 if (theIter == badLaserEE.end())
1069 badLaserEE.insert(std::pair<DetId, float>(eedetid, myApdMean));
1076 std::map<DetId, float>::const_iterator theIterPedOn;
1077 std::map<DetId, float>::const_iterator theIterPedOnRms;
1078 std::map<DetId, float>::const_iterator theIterGain;
1079 std::map<DetId, float>::const_iterator theIterLaser;
1080 std::map<DetId, float>::const_iterator theIterOccHigh;
1083 for (theIterPedOn = badPedOnEB.begin(); theIterPedOn != badPedOnEB.end(); ++theIterPedOn) {
1084 float thePedOn = (*theIterPedOn).second;
1085 float thePedOnRms = 9999.;
1086 float theGain = 9999.;
1087 float theLaser = 9999.;
1088 float theOccHigh = 9999.;
1090 theIterPedOnRms = badPedOnRmsEB.find((*theIterPedOn).first);
1091 theIterGain = badGainEB.find((*theIterPedOn).first);
1092 theIterLaser = badLaserEB.find((*theIterPedOn).first);
1093 theIterOccHigh = badOccHighEB.find((*theIterPedOn).first);
1095 if (theIterPedOnRms != badPedOnRmsEB.end())
1096 thePedOnRms = (*theIterPedOnRms).second;
1097 if (theIterLaser != badLaserEB.end())
1098 theLaser = (*theIterLaser).second;
1099 if (theIterOccHigh != badOccHighEB.end())
1100 theOccHigh = (*theIterOccHigh).second;
1103 EBDetId ebdetid((*theIterPedOn).first);
1105 thisFed = 600 + elecId.
dccId();
1109 bool isNewPed =
true;
1110 bool isNewLaser =
true;
1111 bool isNewPhysics =
true;
1112 for (theIter = maskedOnlinePedEB.begin(); theIter != maskedOnlinePedEB.end(); ++theIter) {
1113 if ((*theIter).first == ebdetid)
1117 for (theIter = maskedLaserEB.begin(); theIter != maskedLaserEB.end(); ++theIter) {
1118 if ((*theIter).first == ebdetid)
1122 for (theIter = maskedPhysicsEB.begin(); theIter != maskedPhysicsEB.end(); ++theIter) {
1123 if ((*theIter).first == ebdetid)
1124 isNewPhysics =
false;
1127 if (isNewPed || (theLaser != 9999 && isNewLaser) || (theOccHigh != 9999 && isNewPhysics))
1130 if (theIterGain != badGainEB.end()) {
1131 *ResFileEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" 1132 << thePedOnRms <<
"\t\t" 1134 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1137 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn
1138 <<
"\t\t" << thePedOnRms <<
"\t\t" 1140 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1142 float thisEtaFill =
float(0);
1143 if (ebdetid.ieta() > 0)
1144 thisEtaFill = ebdetid.ieta() - 0.5;
1145 if (ebdetid.ieta() < 0)
1146 thisEtaFill = ebdetid.ieta();
1147 newBadEB_->Fill((ebdetid.iphi() - 0.5), thisEtaFill, 2);
1150 *ResFileEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" 1151 << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1154 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn
1155 <<
"\t\t" << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh
1158 float thisEtaFill =
float(0);
1159 if (ebdetid.ieta() > 0)
1160 thisEtaFill = ebdetid.ieta() - 0.5;
1161 if (ebdetid.ieta() < 0)
1162 thisEtaFill = ebdetid.ieta();
1163 newBadEB_->Fill((ebdetid.iphi() - 0.5), thisEtaFill, 2);
1169 for (theIterLaser = badLaserEB.begin(); theIterLaser != badLaserEB.end(); ++theIterLaser) {
1171 theIterPedOnRms = badPedOnRmsEB.find((*theIterLaser).first);
1172 if (theIterPedOnRms != badPedOnRmsEB.end())
1175 float thePedOn = 9999.;
1176 float thePedOnRms = 9999.;
1177 float theGain = 9999.;
1178 float theLaser = (*theIterLaser).second;
1179 float theOccHigh = 9999.;
1181 theIterGain = badGainEB.find((*theIterLaser).first);
1182 theIterOccHigh = badOccHighEB.find((*theIterLaser).first);
1183 if (theIterOccHigh != badOccHighEB.end())
1184 theOccHigh = (*theIterOccHigh).second;
1187 EBDetId ebdetid((*theIterLaser).first);
1189 thisFed = 600 + elecId.
dccId();
1193 bool isNewPed =
true;
1194 bool isNewLaser =
true;
1195 bool isNewPhysics =
true;
1196 for (theIter = maskedOnlinePedEB.begin(); theIter != maskedOnlinePedEB.end(); ++theIter) {
1197 if ((*theIter).first == ebdetid)
1201 for (theIter = maskedLaserEB.begin(); theIter != maskedLaserEB.end(); ++theIter) {
1202 if ((*theIter).first == ebdetid)
1206 for (theIter = maskedPhysicsEB.begin(); theIter != maskedPhysicsEB.end(); ++theIter) {
1207 if ((*theIter).first == ebdetid)
1208 isNewPhysics =
false;
1211 if ((isNewPed && theIterGain != badGainEB.end()) || (isNewLaser) || (theOccHigh != 9999 && isNewPhysics))
1214 if (theIterGain != badGainEB.end()) {
1215 *ResFileEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" 1216 << thePedOnRms <<
"\t\t" 1218 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1221 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn
1222 <<
"\t\t" << thePedOnRms <<
"\t\t" 1224 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1226 float thisEtaFill =
float(0);
1227 if (ebdetid.ieta() > 0)
1228 thisEtaFill = ebdetid.ieta() - 0.5;
1229 if (ebdetid.ieta() < 0)
1230 thisEtaFill = ebdetid.ieta();
1231 newBadEB_->Fill((ebdetid.iphi() - 0.5), thisEtaFill, 2);
1234 *ResFileEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" 1235 << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1238 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.ic() <<
"\t\t" << ebdetid.hashedIndex() <<
"\t\t" << thePedOn
1239 <<
"\t\t" << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh
1242 float thisEtaFill =
float(0);
1243 if (ebdetid.ieta() > 0)
1244 thisEtaFill = ebdetid.ieta() - 0.5;
1245 if (ebdetid.ieta() < 0)
1246 thisEtaFill = ebdetid.ieta();
1247 newBadEB_->Fill((ebdetid.iphi() - 0.5), thisEtaFill, 2);
1253 for (theIterOccHigh = badOccHighEB.begin(); theIterOccHigh != badOccHighEB.end(); ++theIterOccHigh) {
1255 theIterPedOnRms = badPedOnRmsEB.find((*theIterOccHigh).first);
1256 theIterLaser = badLaserEB.find((*theIterOccHigh).first);
1257 if (theIterPedOnRms != badPedOnRmsEB.end())
1259 if (theIterLaser != badLaserEB.end())
1262 float thePedOn = 9999.;
1263 float thePedOnRms = 9999.;
1264 float theGain = 9999.;
1265 float theLaser = 9999.;
1266 float theOccHigh = (*theIterOccHigh).second;
1267 theIterGain = badGainEB.find((*theIterOccHigh).first);
1270 EBDetId ebdetid((*theIterOccHigh).first);
1272 thisFed = 600 + elecId.
dccId();
1276 bool isNewPed =
true;
1277 bool isNewPhysics =
true;
1278 for (theIter = maskedOnlinePedEB.begin(); theIter != maskedOnlinePedEB.end(); ++theIter) {
1279 if ((*theIter).first == ebdetid)
1283 for (theIter = maskedPhysicsEB.begin(); theIter != maskedPhysicsEB.end(); ++theIter) {
1284 if ((*theIter).first == ebdetid)
1285 isNewPhysics =
false;
1288 if ((isNewPed && theIterGain != badGainEB.end()) || (isNewPhysics))
1291 if (theIterGain != badGainEB.end()) {
1292 *ResFileEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" 1293 << thePedOnRms <<
"\t\t" 1295 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1298 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << thePedOn
1299 <<
"\t\t" << thePedOnRms <<
"\t\t" 1301 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1303 float thisEtaFill =
float(0);
1304 if (ebdetid.
ieta() > 0)
1305 thisEtaFill = ebdetid.
ieta() - 0.5;
1306 if (ebdetid.
ieta() < 0)
1307 thisEtaFill = ebdetid.
ieta();
1308 newBadEB_->Fill((ebdetid.
iphi() - 0.5), thisEtaFill, 2);
1311 *ResFileEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" 1312 << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1315 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << thePedOn
1316 <<
"\t\t" << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh
1319 float thisEtaFill =
float(0);
1320 if (ebdetid.
ieta() > 0)
1321 thisEtaFill = ebdetid.
ieta() - 0.5;
1322 if (ebdetid.
ieta() < 0)
1323 thisEtaFill = ebdetid.
ieta();
1324 newBadEB_->Fill((ebdetid.
iphi() - 0.5), thisEtaFill, 2);
1330 for (theIterGain = badGainEB.begin(); theIterGain != badGainEB.end(); ++theIterGain) {
1332 theIterPedOnRms = badPedOnRmsEB.find((*theIterGain).first);
1333 theIterLaser = badLaserEB.find((*theIterGain).first);
1334 theIterOccHigh = badOccHighEB.find((*theIterGain).first);
1335 if (theIterPedOnRms != badPedOnRmsEB.end())
1337 if (theIterLaser != badLaserEB.end())
1339 if (theIterOccHigh != badOccHighEB.end())
1342 float thePedOn = 9999.;
1343 float thePedOnRms = 9999.;
1344 float theLaser = 9999.;
1345 float theOccHigh = 9999.;
1348 EBDetId ebdetid((*theIterGain).first);
1350 thisFed = 600 + elecId.
dccId();
1354 bool isNewPed =
true;
1355 for (theIter = maskedOnlinePedEB.begin(); theIter != maskedOnlinePedEB.end(); ++theIter) {
1356 if ((*theIter).first == ebdetid)
1360 if (isNewPed && theIterGain != badGainEB.end())
1363 *ResFileEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" 1364 << thePedOnRms <<
"\t\t" 1366 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1369 *ResFileNewEB << thisFed <<
"\t\t" << ebdetid.
ic() <<
"\t\t" << ebdetid.
hashedIndex() <<
"\t\t" << thePedOn
1370 <<
"\t\t" << thePedOnRms <<
"\t\t" 1372 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1374 float thisEtaFill =
float(0);
1375 if (ebdetid.
ieta() > 0)
1376 thisEtaFill = ebdetid.
ieta() - 0.5;
1377 if (ebdetid.
ieta() < 0)
1378 thisEtaFill = ebdetid.
ieta();
1379 newBadEB_->Fill((ebdetid.
iphi() - 0.5), thisEtaFill, 2);
1384 for (theIterPedOn = badPedOnEE.begin(); theIterPedOn != badPedOnEE.end(); ++theIterPedOn) {
1385 float thePedOn = (*theIterPedOn).second;
1386 float thePedOnRms = 9999.;
1387 float theGain = 9999.;
1388 float theLaser = 9999.;
1389 float theOccHigh = 9999.;
1391 theIterPedOnRms = badPedOnRmsEE.find((*theIterPedOn).first);
1392 theIterGain = badGainEE.find((*theIterPedOn).first);
1393 theIterLaser = badLaserEE.find((*theIterPedOn).first);
1394 theIterOccHigh = badOccHighEE.find((*theIterPedOn).first);
1396 if (theIterPedOnRms != badPedOnRmsEE.end())
1397 thePedOnRms = (*theIterPedOnRms).second;
1398 if (theIterLaser != badLaserEE.end())
1399 theLaser = (*theIterLaser).second;
1400 if (theIterOccHigh != badOccHighEE.end())
1401 theOccHigh = (*theIterOccHigh).second;
1404 EEDetId eedetid((*theIterPedOn).first);
1406 thisFed = 600 + elecId.
dccId();
1410 bool isNewPed =
true;
1411 bool isNewLaser =
true;
1412 bool isNewPhysics =
true;
1413 for (theIter = maskedOnlinePedEE.begin(); theIter != maskedOnlinePedEE.end(); ++theIter) {
1414 if ((*theIter).first == eedetid)
1418 for (theIter = maskedLaserEE.begin(); theIter != maskedLaserEE.end(); ++theIter) {
1419 if ((*theIter).first == eedetid)
1423 for (theIter = maskedPhysicsEE.begin(); theIter != maskedPhysicsEE.end(); ++theIter) {
1424 if ((*theIter).first == eedetid)
1425 isNewPhysics =
false;
1428 if (isNewPed || (theLaser != 9999 && isNewLaser) || (theOccHigh != 9999 && isNewPhysics))
1431 if (theIterGain != badGainEE.end()) {
1432 *ResFileEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside() <<
"\t\t" 1433 << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1435 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1438 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside()
1439 <<
"\t\t" << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1441 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1443 if (eedetid.zside() > 0)
1444 newBadEEP_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1445 if (eedetid.zside() < 0)
1446 newBadEEM_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1449 *ResFileEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside() <<
"\t\t" 1450 << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" 1451 << theLaser <<
"\t\t" << theOccHigh << std::endl;
1454 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside()
1455 <<
"\t\t" << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1456 << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1458 if (eedetid.zside() > 0)
1459 newBadEEP_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1460 if (eedetid.zside() < 0)
1461 newBadEEM_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1467 for (theIterLaser = badLaserEE.begin(); theIterLaser != badLaserEE.end(); ++theIterLaser) {
1469 theIterPedOnRms = badPedOnRmsEE.find((*theIterLaser).first);
1470 if (theIterPedOnRms != badPedOnRmsEE.end())
1473 float thePedOn = 9999.;
1474 float thePedOnRms = 9999.;
1475 float theGain = 9999.;
1476 float theLaser = (*theIterLaser).second;
1477 float theOccHigh = 9999.;
1479 theIterGain = badGainEE.find((*theIterLaser).first);
1480 theIterOccHigh = badOccHighEE.find((*theIterLaser).first);
1481 if (theIterOccHigh != badOccHighEE.end())
1482 theOccHigh = (*theIterOccHigh).second;
1485 EEDetId eedetid((*theIterLaser).first);
1487 thisFed = 600 + elecId.
dccId();
1491 bool isNewPed =
true;
1492 bool isNewLaser =
true;
1493 bool isNewPhysics =
true;
1494 for (theIter = maskedOnlinePedEE.begin(); theIter != maskedOnlinePedEE.end(); ++theIter) {
1495 if ((*theIter).first == eedetid)
1499 for (theIter = maskedLaserEE.begin(); theIter != maskedLaserEE.end(); ++theIter) {
1500 if ((*theIter).first == eedetid)
1504 for (theIter = maskedPhysicsEE.begin(); theIter != maskedPhysicsEE.end(); ++theIter) {
1505 if ((*theIter).first == eedetid)
1506 isNewPhysics =
false;
1509 if ((isNewPed && theIterGain != badGainEE.end()) || (isNewLaser) || (theOccHigh != 9999 && isNewPhysics))
1512 if (theIterGain != badGainEE.end()) {
1513 *ResFileEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside() <<
"\t\t" 1514 << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1516 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1519 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside()
1520 <<
"\t\t" << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1522 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1524 if (eedetid.zside() > 0)
1525 newBadEEP_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1526 if (eedetid.zside() < 0)
1527 newBadEEM_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1530 *ResFileEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside() <<
"\t\t" 1531 << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" 1532 << theLaser <<
"\t\t" << theOccHigh << std::endl;
1535 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.ix() <<
"\t\t" << eedetid.iy() <<
"\t\t" << eedetid.zside()
1536 <<
"\t\t" << eedetid.hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1537 << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1539 if (eedetid.zside() > 0)
1540 newBadEEP_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1541 if (eedetid.zside() < 0)
1542 newBadEEM_->Fill((eedetid.ix() - 0.5), (eedetid.iy() - 0.5), 4);
1548 for (theIterOccHigh = badOccHighEE.begin(); theIterOccHigh != badOccHighEE.end(); ++theIterOccHigh) {
1550 theIterPedOnRms = badPedOnRmsEE.find((*theIterOccHigh).first);
1551 theIterLaser = badLaserEE.find((*theIterOccHigh).first);
1552 if (theIterPedOnRms != badPedOnRmsEE.end())
1554 if (theIterLaser != badLaserEE.end())
1557 float thePedOn = 9999.;
1558 float thePedOnRms = 9999.;
1559 float theGain = 9999.;
1560 float theLaser = 9999.;
1561 float theOccHigh = (*theIterOccHigh).second;
1562 theIterGain = badGainEE.find((*theIterOccHigh).first);
1565 EEDetId eedetid((*theIterOccHigh).first);
1567 thisFed = 600 + elecId.
dccId();
1571 bool isNewPed =
true;
1572 bool isNewPhysics =
true;
1573 for (theIter = maskedOnlinePedEE.begin(); theIter != maskedOnlinePedEE.end(); ++theIter) {
1574 if ((*theIter).first == eedetid)
1578 for (theIter = maskedPhysicsEE.begin(); theIter != maskedPhysicsEE.end(); ++theIter) {
1579 if ((*theIter).first == eedetid)
1580 isNewPhysics =
false;
1583 if ((isNewPed && theIterGain != badGainEE.end()) || (isNewPhysics))
1586 if (theIterGain != badGainEE.end()) {
1587 *ResFileEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside() <<
"\t\t" 1588 << eedetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1590 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1593 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
1594 <<
"\t\t" << eedetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1596 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1598 if (eedetid.
zside() > 0)
1599 newBadEEP_->Fill((eedetid.
ix() - 0.5), (eedetid.
iy() - 0.5), 4);
1600 if (eedetid.
zside() < 0)
1601 newBadEEM_->Fill((eedetid.
ix() - 0.5), (eedetid.
iy() - 0.5), 4);
1604 *ResFileEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside() <<
"\t\t" 1605 << eedetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" << theGain <<
"\t\t" 1606 << theLaser <<
"\t\t" << theOccHigh << std::endl;
1609 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
1610 <<
"\t\t" << eedetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1611 << theGain <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1613 if (eedetid.
zside() > 0)
1614 newBadEEP_->Fill((eedetid.
ix() - 0.5), (eedetid.
iy() - 0.5), 4);
1615 if (eedetid.
zside() < 0)
1616 newBadEEM_->Fill((eedetid.
ix() - 0.5), (eedetid.
iy() - 0.5), 4);
1622 for (theIterGain = badGainEE.begin(); theIterGain != badGainEE.end(); ++theIterGain) {
1624 theIterPedOnRms = badPedOnRmsEE.find((*theIterGain).first);
1625 theIterLaser = badLaserEE.find((*theIterGain).first);
1626 theIterOccHigh = badOccHighEE.find((*theIterGain).first);
1627 if (theIterPedOnRms != badPedOnRmsEE.end())
1629 if (theIterLaser != badLaserEE.end())
1631 if (theIterOccHigh != badOccHighEE.end())
1633 float thePedOn = 9999.;
1634 float thePedOnRms = 9999.;
1635 float theLaser = 9999.;
1636 float theOccHigh = 9999.;
1639 EEDetId eedetid((*theIterGain).first);
1641 thisFed = 600 + elecId.
dccId();
1645 bool isNewPed =
true;
1646 for (theIter = maskedOnlinePedEE.begin(); theIter != maskedOnlinePedEE.end(); ++theIter) {
1647 if ((*theIter).first == eedetid)
1651 if (isNewPed && theIterGain != badGainEE.end())
1654 *ResFileEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside() <<
"\t\t" 1655 << eedetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1657 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1660 *ResFileNewEE << thisFed <<
"\t\t" << eedetid.
ix() <<
"\t\t" << eedetid.
iy() <<
"\t\t" << eedetid.
zside()
1661 <<
"\t\t" << eedetid.
hashedIndex() <<
"\t\t" << thePedOn <<
"\t\t" << thePedOnRms <<
"\t\t" 1663 <<
"\t\t" << theLaser <<
"\t\t" << theOccHigh << std::endl;
1665 if (eedetid.
zside() > 0)
1666 newBadEEP_->Fill((eedetid.
ix() - 0.5), (eedetid.
iy() - 0.5), 4);
1667 if (eedetid.
zside() < 0)
1668 newBadEEM_->Fill((eedetid.
ix() - 0.5), (eedetid.
iy() - 0.5), 4);
1675 std::ostringstream
ss;
1679 unsigned int max_since = 0;
1680 max_since =
static_cast<unsigned int>(
tagInfo().lastInterval.since);
1681 std::cout <<
"max_since : " << max_since << std::endl;
1683 std::cout <<
"Retrieving run list from ONLINE DB ... " << std::endl;
1685 std::cout <<
"Connection done" << std::endl;
1688 std::cout <<
" Problem with OMDS: connection parameters " << m_sid <<
"/" << m_user <<
"/" << m_pass << std::endl;
1693 newBadEB_ =
new TProfile2D(
"newBadEB_",
"new bad channels, EB", 360, 0., 360., 170, -85., 85.);
1694 newBadEEP_ =
new TProfile2D(
"newBad_EEP_",
"new bad channels, EE+", 100, 0., 100., 100, 0., 100.);
1695 newBadEEM_ =
new TProfile2D(
"newBad_EEM_",
"new bad channels, EE-", 100, 0., 100., 100, 0., 100.);
1709 unsigned int min_run = 0;
1710 if (m_firstRun < max_since) {
1711 min_run = max_since + 1;
1713 min_run = m_firstRun;
1715 unsigned int max_run = m_lastRun;
1724 if (m_runtype ==
"PEDESTAL")
1726 if (m_runtype ==
"LASER")
1728 if (m_runtype ==
"COSMIC" || m_runtype ==
"BEAM" || m_runtype ==
"PHYSICS" || m_runtype ==
"HALO" ||
1729 m_runtype ==
"GLOBAL_COSMICS")
1735 mon_list =
econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
1740 sprintf(
outfile,
"BadChannelsEB_run%d.txt", min_run);
1742 sprintf(
outfile,
"BadChannelsEE_run%d.txt", min_run);
1744 sprintf(
outfile,
"BadNewChannelsEB_run%d.txt", min_run);
1746 sprintf(
outfile,
"BadNewChannelsEE_run%d.txt", min_run);
1748 sprintf(
outfile,
"DaqConfig_run%d.txt", min_run);
1750 sprintf(
outfile,
"DaqConfig_channels_run%d.txt", min_run);
1755 <<
"tower" << std::endl;
1757 if (m_runtype ==
"PEDESTAL") {
1774 <<
"RmsG1" << std::endl;
1796 <<
"RmsG1" << std::endl;
1798 *ResFileNewEB <<
"Fed" 1814 <<
"RmsG1" << std::endl;
1816 *ResFileNewEE <<
"Fed" 1836 <<
"RmsG1" << std::endl;
1839 if (m_runtype ==
"LASER") {
1846 <<
"apd" << std::endl;
1857 <<
"apd" << std::endl;
1858 *ResFileNewEB <<
"Fed" 1864 <<
"apd" << std::endl;
1865 *ResFileNewEE <<
"Fed" 1875 <<
"apd" << std::endl;
1878 if (m_runtype ==
"COSMIC" || m_runtype ==
"BEAM" || m_runtype ==
"PHYSICS" || m_runtype ==
"HALO" ||
1879 m_runtype ==
"GLOBAL_COSMICS") {
1895 <<
"\t\t" << std::endl;
1915 <<
"\t\t" << std::endl;
1917 *ResFileNewEB <<
"Fed" 1932 <<
"\t\t" << std::endl;
1934 *ResFileNewEE <<
"Fed" 1952 <<
"\t\t" << std::endl;
1957 std::vector<MonRunIOV> mon_run_vec = mon_list.
getRuns();
1958 int mon_runs = mon_run_vec.size();
1959 std::cout <<
"number of Mon runs is " << mon_runs << std::endl;
1961 std::cout <<
"PROBLEM! 0 runs analyzed by DQM" << std::endl;
1963 ss <<
"PROBLEM! 0 runs analyzed by DQM" << std::endl;
1966 maskedOnlinePedEB.clear();
1967 maskedOnlinePedEE.clear();
1968 maskedPedEB.clear();
1969 maskedPedEE.clear();
1970 maskedLaserEB.clear();
1971 maskedLaserEE.clear();
1972 maskedPhysicsEB.clear();
1973 maskedPhysicsEE.clear();
1976 std::map<DetId, float>::const_iterator theIter;
1980 for (
int dqmRun = 0; dqmRun < mon_runs; dqmRun++) {
1981 unsigned long iDqmRun = (
unsigned long)mon_run_vec[dqmRun].getRunIOV().getRunNumber();
1983 std::cout <<
"retrieve the DQM data for run number: " << iDqmRun
1984 <<
", subrun number: " << mon_run_vec[dqmRun].getSubRunNumber() << std::endl;
1986 if (mon_run_vec[dqmRun].getSubRunNumber() ==
1991 myRun = mon_run_vec[dqmRun].getRunIOV();
1995 RunIOV runiov_prime = mon_run_vec[dqmRun].getRunIOV();
1998 std::cout <<
"Fetching masked channels from DB" << std::endl;
1999 ecalErrorMask_.readDB(
econn, &runiov_prime);
2005 if (m_runtype ==
"PEDESTAL") {
2007 std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
2008 econn->fetchDataSet(&dataset_mon, &mon_run_vec[dqmRun]);
2009 std::cout <<
"running pedestal analysis" << std::endl;
2010 std::cout <<
"OMDS record for pedestals, run " << iDqmRun <<
" is made of " << dataset_mon.size()
2011 <<
" entries" << std::endl;
2014 std::map<EcalLogicID, MonCrystalConsistencyDat> wrongGain_mon;
2015 econn->fetchDataSet(&wrongGain_mon, &mon_run_vec[dqmRun]);
2016 std::cout <<
"OMDS record for consistency, run " << iDqmRun <<
" is made of " << wrongGain_mon.size()
2017 <<
" entries" << std::endl;
2020 if (!dataset_mon.empty()) {
2021 pedAnalysis(dataset_mon, wrongGain_mon);
2023 std::cout <<
"Not enought data for pedestal analysis" << std::endl;
2024 ss <<
"Not enought data for pedestal analysis" << std::endl;
2029 if (m_runtype ==
"LASER") {
2031 std::map<EcalLogicID, MonLaserBlueDat> dataset_mon;
2032 econn->fetchDataSet(&dataset_mon, &mon_run_vec[dqmRun]);
2033 std::cout <<
"running the laser analysis based on DQM data" << std::endl;
2034 std::cout <<
"OMDS record for run " << iDqmRun <<
" is made of " << dataset_mon.size() <<
" records" 2038 if (!dataset_mon.empty()) {
2039 nBadLaserModules(dataset_mon);
2040 laserAnalysis(dataset_mon);
2042 std::cout <<
"Not enought data for dqm-based laser analysis" << std::endl;
2043 ss <<
"Not enought data for dqm-based laser analysis" << std::endl;
2048 if (m_runtype ==
"COSMIC" || m_runtype ==
"BEAM" || m_runtype ==
"PHYSICS" || m_runtype ==
"HALO" ||
2049 m_runtype ==
"GLOBAL_COSMICS") {
2051 std::map<EcalLogicID, MonPedestalsOnlineDat> pedonline_mon;
2052 econn->fetchDataSet(&pedonline_mon, &mon_run_vec[dqmRun]);
2053 std::cout <<
"running pedestal online analysis" << std::endl;
2054 std::cout <<
"OMDS record for pedestals, run " << iDqmRun <<
" is made of " << pedonline_mon.size()
2058 std::map<EcalLogicID, MonCrystalConsistencyDat> wrongGain_mon;
2059 econn->fetchDataSet(&wrongGain_mon, &mon_run_vec[dqmRun]);
2060 std::cout <<
"OMDS record for consistency, run " << iDqmRun <<
" is made of " << wrongGain_mon.size()
2061 <<
" entries" << std::endl;
2064 std::map<EcalLogicID, MonOccupancyDat> occupancy_mon;
2065 econn->fetchDataSet(&occupancy_mon, &mon_run_vec[dqmRun]);
2066 std::cout <<
"OMDS record for occupancy, run " << iDqmRun <<
" is made of " << occupancy_mon.size()
2070 std::map<EcalLogicID, MonLaserBlueDat> laser_mon;
2071 econn->fetchDataSet(&laser_mon, &mon_run_vec[dqmRun]);
2072 std::cout <<
"running laser analysis" << std::endl;
2073 std::cout <<
"OMDS record for laser, run " << iDqmRun <<
" is made of " << laser_mon.size() <<
" records" 2077 if (pedonline_mon.empty()) {
2078 std::cout <<
"Not enought data for pedestal online analysis" << std::endl;
2079 ss <<
"Not enought data for pedestal online analysis" << std::endl;
2081 if (occupancy_mon.empty()) {
2082 std::cout <<
"Not enought data for occupancy analysis" << std::endl;
2083 ss <<
"Not enought data for occupancy analysis" << std::endl;
2085 if (laser_mon.empty()) {
2086 std::cout <<
"Not enought data for laser analysis" << std::endl;
2087 ss <<
"Not enought data for laser analysis" << std::endl;
2089 if (!pedonline_mon.empty() || !occupancy_mon.empty() || !wrongGain_mon.empty() || !laser_mon.empty()) {
2090 nBadLaserModules(laser_mon);
2091 cosmicsAnalysis(pedonline_mon, wrongGain_mon, laser_mon, occupancy_mon);
2097 gStyle->SetPalette(1);
2098 gStyle->SetOptStat(0);
2099 TCanvas
c(
"c",
"c", 1);
2100 newBadEB_->SetMaximum(11);
2101 newBadEB_->Draw(
"colz");
2103 lEB.DrawLine(0, 0, 360, 0);
2104 while (iLineEB < 18) {
2105 lEB.DrawLine(iLineEB * 20, -85, iLineEB * 20, 85);
2108 c.SaveAs(
"newBadEB_.png");
2111 lEE.SetLineWidth(1);
2112 int ixSectorsEE[202] = {
2113 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 55, 55, 45, 45, 43, 43, 42, 42, 41, 41, 40, 40, 39,
2114 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 55, 55, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61,
2115 0, 100, 100, 97, 97, 95, 95, 92, 92, 87, 87, 85, 85, 80, 80, 75, 75, 65, 65, 60, 60, 40, 40,
2116 35, 35, 25, 25, 20, 20, 15, 15, 13, 13, 8, 8, 5, 5, 3, 3, 0, 0, 3, 3, 5, 5, 8,
2117 8, 13, 13, 15, 15, 20, 20, 25, 25, 35, 35, 40, 40, 60, 60, 65, 65, 75, 75, 80, 80, 85, 85,
2118 87, 87, 92, 92, 95, 95, 97, 97, 100, 100, 0, 61, 65, 65, 70, 70, 80, 80, 90, 90, 92, 0, 61,
2119 65, 65, 90, 90, 97, 0, 57, 60, 60, 65, 65, 70, 70, 75, 75, 80, 80, 0, 50, 50, 0, 43, 40,
2120 40, 35, 35, 30, 30, 25, 25, 20, 20, 0, 39, 35, 35, 10, 10, 3, 0, 39, 35, 35, 30, 30, 20,
2121 20, 10, 10, 8, 0, 45, 45, 40, 40, 35, 35, 0, 55, 55, 60, 60, 65, 65};
2122 int iySectorsEE[202] = {
2123 50, 55, 55, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 55, 55, 45, 45, 43,
2124 43, 42, 42, 41, 41, 40, 40, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 50, 0, 50, 60, 60, 65, 65,
2125 75, 75, 80, 80, 85, 85, 87, 87, 92, 92, 95, 95, 97, 97, 100, 100, 97, 97, 95, 95, 92, 92, 87, 87, 85, 85,
2126 80, 80, 75, 75, 65, 65, 60, 60, 40, 40, 35, 35, 25, 25, 20, 20, 15, 15, 13, 13, 8, 8, 5, 5, 3, 3,
2127 0, 0, 3, 3, 5, 5, 8, 8, 13, 13, 15, 15, 20, 20, 25, 25, 35, 35, 40, 40, 50, 0, 45, 45, 40, 40,
2128 35, 35, 30, 30, 25, 25, 0, 50, 50, 55, 55, 60, 60, 0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87, 0,
2129 61, 100, 0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87, 0, 50, 50, 55, 55, 60, 60, 0, 45, 45, 40, 40,
2130 35, 35, 30, 30, 25, 25, 0, 39, 30, 30, 15, 15, 5, 0, 39, 30, 30, 15, 15, 5};
2132 newBadEEP_->SetMaximum(11);
2133 newBadEEP_->Draw(
"colz");
2134 for (
int iLineEEP = 0; iLineEEP < 201; iLineEEP = iLineEEP + 1) {
2135 if ((ixSectorsEE[iLineEEP] != 0 || iySectorsEE[iLineEEP] != 0) &&
2136 (ixSectorsEE[iLineEEP + 1] != 0 || iySectorsEE[iLineEEP + 1] != 0)) {
2138 ixSectorsEE[iLineEEP], iySectorsEE[iLineEEP], ixSectorsEE[iLineEEP + 1], iySectorsEE[iLineEEP + 1]);
2141 c.SaveAs(
"newBadEEP_.png");
2143 newBadEEM_->SetMaximum(11);
2144 newBadEEM_->Draw(
"colz");
2145 for (
int iLineEEP = 0; iLineEEP < 201; iLineEEP = iLineEEP + 1) {
2146 if ((ixSectorsEE[iLineEEP] != 0 || iySectorsEE[iLineEEP] != 0) &&
2147 (ixSectorsEE[iLineEEP + 1] != 0 || iySectorsEE[iLineEEP + 1] != 0)) {
2149 ixSectorsEE[iLineEEP], iySectorsEE[iLineEEP], ixSectorsEE[iLineEEP + 1], iySectorsEE[iLineEEP + 1]);
2152 c.SaveAs(
"newBadEEM_.png");
2161 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
2165 ecalElectronicsMap_ = (*theEcalElectronicsMap);
void setRunTypeDef(const RunTypeDef &runTypeDef)
T getParameter(std::string const &) const
int getProblemsGainZero() const
int getEventsOverHighThreshold() const
std::string getName() const
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int iphi() const
get the crystal iphi
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
float getPedRMSG6() const
float checkPedestalValueGain12(EcalPedestals::Item *item)
void setGeneralTag(std::string tag)
float getPedRMSG1() const
~EcalChannelStatusHandler() override
void setRunTag(const RunTag &tag)
void cosmicsAnalysis(std::map< EcalLogicID, MonPedestalsOnlineDat > pedestalO_mon, std::map< EcalLogicID, MonCrystalConsistencyDat > wrongGain_mon, std::map< EcalLogicID, MonLaserBlueDat > laser_mon, std::map< EcalLogicID, MonOccupancyDat > occupancy_mon)
float checkPedestalValueGain6(EcalPedestals::Item *item)
int ieta() const
get the crystal ieta
T getUntrackedParameter(std::string const &, T const &) const
EcalChannelStatusHandler(edm::ParameterSet const &)
static uint64_t getMask(std::string shortDesc)
float getPedMeanG1() const
float checkPedestalRMSGain12(EcalPedestals::Item *item)
int towerId() const
get the tower id
float getPedMeanG6() const
int ic() const
get ECAL/crystal number inside SM
float getADCMeanG12() const
void nBadLaserModules(std::map< EcalLogicID, MonLaserBlueDat > dataset_mon)
float checkPedestalRMSGain6(EcalPedestals::Item *item)
void setMonVersionDef(const MonVersionDef &ver)
float getPedRMSG12() const
std::string m_locationsource
void setLocationDef(const LocationDef &locDef)
std::vector< MonRunIOV > getRuns()
void getNewObjects() override
unsigned long long uint64_t
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
float checkPedestalValueGain1(EcalPedestals::Item *item)
float getADCRMSG12() const
void setMonRunTag(const MonRunTag &tag)
float getPedMeanG12() const
void setMonitoringVersion(std::string ver)
void laserAnalysis(std::map< EcalLogicID, MonLaserBlueDat > dataset_mon)
float checkPedestalRMSGain1(EcalPedestals::Item *item)
int hashedIndex() const
get a compact index for arrays
void setGeneralTag(std::string tag)
static const int SMCRYSTALMODE
void setElectronicsMap(const EcalElectronicsMapping *)
void pedAnalysis(std::map< EcalLogicID, MonPedestalsDat > dataset_mon, std::map< EcalLogicID, MonCrystalConsistencyDat > wrongGain_mon)
void daqOut(const RunIOV &myRun)