1 #include "../interface/DBWriterWorkers.h"
2 #include "../interface/LogicIDTranslation.h"
78 std::vector<std::string> runTypes(params.getUntrackedParameter<std::vector<std::string> >(
"runTypes"));
79 for(
unsigned iT(0); iT < runTypes.size(); ++iT)
85 std::vector<std::string>
const& meNames(sourceParams.getParameterNames());
86 for(
unsigned iP(0); iP < meNames.size(); ++iP){
97 for(MESetCollection::iterator sItr(this->
source_.begin()); sItr != this->
source_.end(); ++sItr){
98 if(!sItr->second->retrieve(_igetter, &failedPath)){
99 edm::LogError(
"EcalDQM") <<
name_ <<
": MESet " << sItr->first <<
"@" << failedPath <<
" not found";
130 std::map<EcalLogicID, MonCrystalConsistencyDat> crystalConsistencies;
131 std::map<EcalLogicID, MonTTConsistencyDat> towerConsistencies;
132 std::map<EcalLogicID, MonMemChConsistencyDat> memChannelConsistencies;
133 std::map<EcalLogicID, MonMemTTConsistencyDat> memTowerConsistencies;
152 MESet const& memblocksizeME(
source_.at(
"MEMBlockSize"));
159 DetId id(dItr->getId());
161 int nDigis(dItr->getBinContent());
162 int gain(gainME.getBinContent(
id));
163 int chid(chidME.getBinContent(
id));
164 int gainswitch(gainswitchME.getBinContent(
id));
167 if(gain > 0 || chid > 0 || gainswitch > 0){
175 int channelStatus(qItr->getBinContent());
176 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
186 for(
unsigned iTower(1); iTower <= 68; ++iTower){
187 if(!
ccuExists(iDCC + 1, iTower))
continue;
190 std::vector<DetId> channels(
getElectronicsMap()->dccTowerConstituents(iDCC + 1, iTower));
192 bool towerBad(
false);
193 for(
unsigned iD(0); iD < channels.size(); ++iD){
194 int n(digiME.getBinContent(channels[iD]));
195 if(
n > nDigis) nDigis =
n;
196 int channelStatus(qualityME.getBinContent(channels[iD]));
197 if(channelStatus ==
kBad || channelStatus ==
kMBad) towerBad =
true;
200 int towerid(toweridME.getBinContent(eid));
201 int blocksize(blocksizeME.getBinContent(eid));
202 int l1a(l1aME.getBinContent(iDCC + 1, iTower));
203 int bx(bxME.getBinContent(iDCC + 1, iTower));
205 if(towerid > 0 || blocksize > 0 || l1a > 0 || bx > 0){
222 for(
unsigned iMD(0); iMD <
memDCC.size(); ++iMD){
223 unsigned iDCC(
memDCC[iMD]);
227 for(
unsigned iPN(1); iPN <= 10; ++iPN){
230 int nDigis(memdigiME.getBinContent(pnid));
231 int memchid(memchidME.getBinContent(pnid));
232 int memgain(memgainME.getBinContent(pnid));
234 if(memchid > 0 || memgain > 0){
242 int channelStatus(pnqualityME.getBinContent(pnid));
243 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
250 for(
unsigned iTower(69); iTower <= 70; ++iTower){
254 bool towerBad(
false);
255 for(
unsigned iPN(1); iPN <= 10; ++iPN){
257 int n(memdigiME.getBinContent(pnid));
258 if(
n > nDigis) nDigis =
n;
259 int channelStatus(pnqualityME.getBinContent(pnid));
260 if(channelStatus ==
kBad || channelStatus ==
kMBad) towerBad =
true;
263 int towerid(memtoweridME.getBinContent(eid));
264 int blocksize(memblocksizeME.getBinContent(eid));
266 if(towerid > 0 || blocksize > 0){
283 if(crystalConsistencies.size() > 0){
287 if(towerConsistencies.size() > 0){
291 if(memChannelConsistencies.size() > 0){
295 if(memTowerConsistencies.size() > 0){
300 catch(std::runtime_error&
e){
301 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
322 MESetMulti const& amplitude(static_cast<MESetMulti const&>(
source_.at(
"Amplitude")));
323 unsigned nWL(laserWavelengths.size());
324 for(
unsigned iWL(0); iWL != nWL; ++iWL){
325 int wl(laserWavelengths[iWL]);
326 if(wl <= 0 || wl >= 5)
throw cms::Exception(
"InvalidConfiguration") <<
"Laser Wavelength";
327 repl[
"wl"] = std::to_string(wl);
348 std::map<EcalLogicID, MonLaserBlueDat> l1Amp;
349 std::map<EcalLogicID, MonTimingLaserBlueCrystalDat> l1Time;
350 std::map<EcalLogicID, MonPNBlueDat> l1PN;
351 std::map<EcalLogicID, MonLaserGreenDat> l2Amp;
352 std::map<EcalLogicID, MonTimingLaserGreenCrystalDat> l2Time;
353 std::map<EcalLogicID, MonPNGreenDat> l2PN;
354 std::map<EcalLogicID, MonLaserIRedDat> l3Amp;
355 std::map<EcalLogicID, MonTimingLaserIRedCrystalDat> l3Time;
356 std::map<EcalLogicID, MonPNIRedDat> l3PN;
357 std::map<EcalLogicID, MonLaserRedDat> l4Amp;
358 std::map<EcalLogicID, MonTimingLaserRedCrystalDat> l4Time;
359 std::map<EcalLogicID, MonPNRedDat> l4PN;
370 for(std::map<int, unsigned>::iterator wlItr(
wlToME_.begin()); wlItr !=
wlToME_.end(); ++wlItr){
371 int wl(wlItr->first);
372 unsigned iM(wlItr->second);
386 float aEntries(aItr->getBinEntries());
387 if(aEntries < 1.)
continue;
393 DetId id(aItr->getId());
395 float ampMean(aItr->getBinContent());
396 float ampRms(aItr->getBinError() *
std::sqrt(aEntries));
406 int channelStatus(qItr->getBinContent());
407 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
476 for(
unsigned iMD(0); iMD <
memDCC.size(); ++iMD){
477 unsigned iDCC(
memDCC[iMD]);
481 for(
unsigned iPN(1); iPN <= 10; ++iPN){
484 float entries(pnME.getBinEntries(pnid));
485 if(entries < 1.)
continue;
487 float mean(pnME.getBinContent(pnid));
490 float pedestalEntries(pnPedestalME.getBinEntries(pnid));
491 float pedestalMean(pnPedestalME.getBinContent(pnid));
492 float pedestalRms(pnPedestalME.getBinError(pnid) *
std::sqrt(pedestalEntries));
494 int channelStatus(pnQualityME.getBinContent(pnid));
495 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
565 if(l1Time.size() > 0)
571 if(l2Time.size() > 0)
577 if(l3Time.size() > 0)
583 if(l4Time.size() > 0)
588 catch(std::runtime_error&
e){
589 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
609 unsigned nG(MGPAGains.size());
610 for(
unsigned iG(0); iG != nG; ++iG){
611 int gain(MGPAGains[iG]);
612 if(gain != 1 && gain != 6 && gain != 12)
throw cms::Exception(
"InvalidConfiguration") <<
"MGPA gain";
613 repl[
"gain"] = std::to_string(gain);
619 MESetMulti const& pnPedestal(static_cast<MESetMulti const&>(
source_.at(
"PNPedestal")));
620 unsigned nGPN(MGPAGainsPN.size());
621 for(
unsigned iG(0); iG != nGPN; ++iG){
622 int gain(MGPAGainsPN[iG]);
623 if(gain != 1 && gain != 16)
throw cms::Exception(
"InvalidConfiguration") <<
"PN MGPA gain";
624 repl[
"pngain"] = std::to_string(gain);
642 std::map<EcalLogicID, MonPedestalsDat> pedestals;
643 std::map<EcalLogicID, MonPNPedDat> pnPedestals;
651 for(std::map<int, unsigned>::iterator gainItr(
gainToME_.begin()); gainItr !=
gainToME_.end(); ++gainItr){
652 int gain(gainItr->first);
653 int iM(gainItr->second);
661 float entries(pItr->getBinEntries());
662 if(entries < 1.)
continue;
666 float mean(pItr->getBinContent());
670 if(pedestals.find(logicID) == pedestals.end()){
697 int channelStatus(qItr->getBinContent());
698 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
706 for(std::map<int, unsigned>::iterator gainItr(
pnGainToME_.begin()); gainItr !=
pnGainToME_.end(); ++gainItr){
707 int gain(gainItr->first);
708 int iM(gainItr->second);
713 for(
unsigned iMD(0); iMD <
memDCC.size(); ++iMD){
714 unsigned iDCC(
memDCC[iMD]);
718 for(
unsigned iPN(1); iPN <= 10; ++iPN){
721 float entries(pnPedestalME.getBinEntries(pnid));
722 if(entries < 1.)
continue;
724 float mean(pnPedestalME.getBinContent(pnid));
725 float rms(pnPedestalME.getBinError(pnid) *
std::sqrt(entries));
728 if(pnPedestals.find(logicID) == pnPedestals.end()){
749 int channelStatus(pnQualityME.getBinContent(pnid));
750 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
760 if(pedestals.size() > 0)
762 if(pnPedestals.size() > 0)
765 catch(std::runtime_error&
e){
766 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
786 std::map<EcalLogicID, MonPedestalsOnlineDat> pedestals;
794 float entries(pItr->getBinEntries());
795 if(entries < 1.)
continue;
799 float mean(pItr->getBinContent());
803 data.setADCMeanG12(
mean);
804 data.setADCRMSG12(
rms);
806 int channelStatus(qItr->getBinContent());
807 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
808 data.setTaskStatus(channelBad);
814 if(pedestals.size() > 0)
817 catch(std::runtime_error&
e){
818 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
837 MESetMulti const& amplitude(static_cast<MESetMulti const&>(
source_.at(
"Amplitude")));
838 unsigned nG(MGPAGains.size());
839 for(
unsigned iG(0); iG != nG; ++iG){
840 int gain(MGPAGains[iG]);
841 if(gain != 1 && gain != 6 && gain != 12)
throw cms::Exception(
"InvalidConfiguration") <<
"MGPA gain";
842 repl[
"gain"] = std::to_string(gain);
848 MESetMulti const& pnAmplitude(static_cast<MESetMulti const&>(
source_.at(
"PNAmplitude")));
849 unsigned nGPN(MGPAGainsPN.size());
850 for(
unsigned iG(0); iG != nGPN; ++iG){
851 int gain(MGPAGainsPN[iG]);
852 if(gain != 1 && gain != 16)
throw cms::Exception(
"InvalidConfiguration") <<
"PN MGPA gain";
853 repl[
"pngain"] = std::to_string(gain);
873 std::map<EcalLogicID, MonTestPulseDat> amplitude;
874 std::map<EcalLogicID, MonPulseShapeDat> shape;
875 std::map<EcalLogicID, MonPNMGPADat> pnAmplitude;
885 for(std::map<int, unsigned>::iterator gainItr(
gainToME_.begin()); gainItr !=
gainToME_.end(); ++gainItr){
886 int gain(gainItr->first);
887 int iM(gainItr->second);
896 float entries(aItr->getBinEntries());
897 if(entries < 1.)
continue;
901 float mean(aItr->getBinContent());
905 if(amplitude.find(logicID) == amplitude.end()){
932 int channelStatus(qItr->getBinContent());
933 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
940 for(
unsigned iSM(0); iSM < 54; ++iSM){
941 std::vector<float> samples(10, 0.);
943 unsigned nId(ids.size());
946 for(
unsigned iD(0); iD < nId; ++iD){
951 if(shapeME.getBinEntries(
id, 1) < 1.)
continue;
955 for(
int i(0);
i < 10; ++
i)
956 samples[
i] += shapeME.getBinContent(
id,
i + 1);
959 if(nChannels == 0)
continue;
961 for(
int i(0);
i < 10; ++
i)
962 samples[
i] /= nChannels;
964 if(shape.find(logicID) == shape.end()){
966 std::vector<float> defval(10, -1.);
977 for(std::map<int, unsigned>::iterator gainItr(
pnGainToME_.begin()); gainItr !=
pnGainToME_.end(); ++gainItr){
978 int gain(gainItr->first);
979 int iM(gainItr->second);
984 for(
unsigned iMD(0); iMD <
memDCC.size(); ++iMD){
985 unsigned iDCC(
memDCC[iMD]);
989 for(
unsigned iPN(1); iPN <= 10; ++iPN){
992 float entries(pnAmplitudeME.getBinEntries(pnid));
993 if(entries < 1.)
continue;
995 float mean(pnAmplitudeME.getBinContent(pnid));
996 float rms(pnAmplitudeME.getBinError(pnid) *
std::sqrt(entries));
997 float pedestalEntries(pnPedestalME.getBinEntries(pnid));
998 float pedestalMean(pnPedestalME.getBinContent(pnid));
999 float pedestalRms(pnPedestalME.getBinError(pnid) *
std::sqrt(pedestalEntries));
1002 if(pnAmplitude.find(logicID) == pnAmplitude.end()){
1032 int channelStatus(pnQualityME.getBinContent(pnid));
1033 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
1043 if(amplitude.size() > 0)
1045 if(shape.size() > 0)
1047 if(pnAmplitude.size() > 0)
1050 catch(std::runtime_error&
e){
1051 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
1071 std::map<EcalLogicID, MonTimingCrystalDat> timing;
1079 float entries(tItr->getBinEntries());
1080 if(entries < 1.)
continue;
1084 float mean(tItr->getBinContent());
1088 data.setTimingMean(
mean);
1089 data.setTimingRMS(
rms);
1091 int channelStatus(qItr->getBinContent());
1092 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
1093 data.setTaskStatus(channelBad);
1099 if(timing.size() > 0)
1102 catch(std::runtime_error&
e){
1103 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
1124 MESetMulti const& amplitude(static_cast<MESetMulti const&>(
source_.at(
"Amplitude")));
1125 unsigned nWL(ledWavelengths.size());
1126 for(
unsigned iWL(0); iWL != nWL; ++iWL){
1127 int wl(ledWavelengths[iWL]);
1128 if(wl != 1 && wl != 2)
throw cms::Exception(
"InvalidConfiguration") <<
"Led Wavelength";
1129 repl[
"wl"] = std::to_string(wl);
1150 std::map<EcalLogicID, MonLed1Dat> l1Amp;
1151 std::map<EcalLogicID, MonTimingLed1CrystalDat> l1Time;
1153 std::map<EcalLogicID, MonLed2Dat> l2Amp;
1154 std::map<EcalLogicID, MonTimingLed2CrystalDat> l2Time;
1166 for(std::map<int, unsigned>::iterator wlItr(
wlToME_.begin()); wlItr !=
wlToME_.end(); ++wlItr){
1167 int wl(wlItr->first);
1168 unsigned iM(wlItr->second);
1182 float aEntries(aItr->getBinEntries());
1183 if(aEntries < 1.)
continue;
1189 DetId id(aItr->getId());
1191 float ampMean(aItr->getBinContent());
1192 float ampRms(aItr->getBinError() *
std::sqrt(aEntries));
1202 int channelStatus(qItr->getBinContent());
1203 bool channelBad(channelStatus ==
kBad || channelStatus ==
kMBad);
1301 if(l1Amp.size() > 0)
1303 if(l1Time.size() > 0)
1307 if(l2Amp.size() > 0)
1309 if(l2Time.size() > 0)
1314 catch(std::runtime_error&
e){
1315 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
1332 std::map<EcalLogicID, MonOccupancyDat> occupancy;
1341 if(oItr->getME()->getTH1()->GetEntries() < 1000.)
continue;
1343 int entries(oItr->getBinContent());
1344 if(entries < 10)
continue;
1348 int eEntries(eItr->getBinEntries());
1349 float energy(eEntries > 10 ? eItr->getBinContent() : -1.);
1358 if(occupancy.size() > 0)
1361 catch(std::runtime_error&
e){
1362 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
1374 std::map<EcalLogicID, MonRunDat>
dataset;
1389 catch(std::runtime_error&
e){
1390 if(
std::string(e.what()).
find(
"unique constraint") != std::string::npos)
std::vector< unsigned > const memDCC
void setProblematicEvents(int prob)
void setADCMeanG1(float mean)
T getUntrackedParameter(std::string const &, T const &) const
void setPedMeanG1(float mean)
void setTaskList(int list)
void setADCRMSG16(float mean)
void setPedRMSG16(float mean)
void setPedRMSG1(float mean)
void setNumEvents(int num)
bool run(EcalCondDBInterface *, MonRunIOV &) override
PedestalWriter(edm::ParameterSet const &)
void setMonRunOutcomeDef(const MonRunOutcomeDef &outcomeDef)
DBWriterWorker(std::string const &, edm::ParameterSet const &)
void setProblematicEvents(int prob)
void setADCRMSG16(float mean)
void setADCRMSG1(float rms)
void setADCMeanG16(float mean)
void setAvgEnergy(float energy)
void setAPDOverPNRMS(float rms)
void setEventsOverLowThreshold(int events)
void setAPDOverPNMean(float mean)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void setPedRMSG16(float mean)
void setProcessedEvents(int proc)
std::map< int, unsigned > wlToME_
void setAPDMean(float mean)
void setProblemsID(int id)
void setADCMeanG16(float mean)
void setADCMeanG1(float mean)
EcalElectronicsMapping const * getElectronicsMap()
double getBinEntries() const
void setProblemsLV1(int LV1)
void setADCRMSG1(float mean)
void setTaskStatus(bool status)
std::map< int, unsigned > gainToME_
void setVPTOverPNMean(float mean)
void setADCMeanG1(float mean)
void setADCRMSG1(float mean)
bool run(EcalCondDBInterface *, MonRunIOV &) override
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void setADCMeanG6(float mean)
bool ccuExists(unsigned, unsigned)
void setPedRMSG1(float mean)
void setTaskStatus(bool status)
void setPedRMSG16(float mean)
void setTimingMean(float mean)
void setPedMeanG1(float mean)
void setProblemsSize(int size)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void setTaskStatus(bool status)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void setPedRMSG6(float rms)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void setSamples(std::vector< float > &samples, int gain)
void setShortDesc(std::string desc)
void setTaskStatus(bool status)
void setProblematicEvents(int prob)
void setProcessedEvents(int proc)
void setVPTMean(float mean)
void setADCMeanG12(float mean)
void setVPTOverPNRMS(float rms)
void setVPTOverPNMean(float mean)
LedWriter(edm::ParameterSet const &)
void setADCMeanG1(float mean)
LaserWriter(edm::ParameterSet const &)
void setADCMeanG16(float mean)
void setTaskStatus(bool status)
void setAPDMean(float mean)
void setTaskStatus(bool status)
void setTaskStatus(bool status)
void setPedMeanG6(float mean)
void setTaskStatus(bool status)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void setVPTRMS(float rms)
unsigned processedEvents_
double getBinError() const
void setPedMeanG1(float mean)
void setAPDMean(float mean)
void setTaskStatus(bool status)
void setProblematicEvents(int prob)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void setProblemsID(int id)
void setPedRMSG1(float mean)
void setProblemsID(int id)
void setPedRMSG1(float mean)
void setADCRMSG12(float rms)
void setTaskStatus(bool status)
void setPedRMSG1(float mean)
void setPedMeanG16(float mean)
EcalLogicID memChannelID(EcalPnDiodeDetId const &)
void setTaskOutcome(int outcome)
void setProblemsBunchX(int bunchX)
void setProblemsGainSwitch(int prob)
void setADCMeanG1(float mean)
void setADCRMSG1(float mean)
void setPedRMSG1(float mean)
void setADCRMSG1(float mean)
void setTaskStatus(bool status)
std::map< int, unsigned > pnGainToME_
void setAPDRMS(float rms)
void setPedRMSG16(float mean)
void setADCRMSG16(float mean)
void setAPDOverPNRMS(float rms)
void setAPDRMS(float rms)
std::map< int, unsigned > pnGainToME_
void setTaskStatus(bool status)
void setPedRMSG1(float rms)
void setAPDOverPNRMS(float rms)
void setVPTRMS(float rms)
bool qualityOK(int _quality)
void setTaskStatus(bool status)
EcalLogicID lmPNID(EcalPnDiodeDetId const &)
void setProblemsID(int id)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void setAPDOverPNMean(float mean)
void setTimingRMS(float rms)
void setADCMeanG16(float mean)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void setADCRMSG6(float rms)
void setADCMeanG16(float mean)
void setTaskStatus(bool status)
void setPedMeanG16(float mean)
void setPedMeanG16(float mean)
void setAPDOverPNRMS(float rms)
double getBinContent() const
void retrieveSource(DQMStore::IGetter &)
void setTaskStatus(bool status)
std::map< int, unsigned > gainToME_
void setPedMeanG1(float mean)
void setTaskStatus(bool status)
void setAPDOverPNMean(float mean)
void setAPDRMS(float rms)
void setProcessedEvents(int proc)
void setPedMeanG16(float mean)
void setEventsOverHighThreshold(int events)
void setTaskStatus(bool status)
char data[epos_bytes_allocation]
void setProcessedEvents(int proc)
void setADCRMSG1(float mean)
void setPedMeanG1(float mean)
void setProblemsGainZero(int prob)
void setPedRMSG16(float mean)
void setProblemsGainZero(int prob)
void setPedMeanG12(float mean)
void setADCMeanG1(float mean)
void setTaskStatus(bool status)
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
void setProblemsSize(int size)
void insertDataSet(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
EcalLogicID towerID(EcalElectronicsId const &)
TestPulseWriter(edm::ParameterSet const &)
void setVPTMean(float mean)
const_iterator & toNextChannel()
void setPedMeanG16(float mean)
void setTaskStatus(bool status)
volatile std::atomic< bool > shutdown_flag false
void setAPDMean(float mean)
std::map< int, unsigned > wlToME_
void setVPTOverPNRMS(float rms)
void setADCRMSG16(float mean)
std::set< std::string > runTypes_
void setADCRMSG16(float mean)
void setAPDOverPNMean(float mean)
EcalLogicID memTowerID(EcalElectronicsId const &)
std::map< std::string, std::string > PathReplacements
MESet * createMESet(edm::ParameterSet const &)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void setPedMeanG1(float mean)
void setPedMeanG1(float mean)
EcalLogicID crystalID(DetId const &)
void setPedRMSG16(float mean)
void setAPDRMS(float rms)
unsigned getIndex(PathReplacements const &) const
void setPedMeanG16(float mean)
void setPedRMSG12(float rms)