51 MESet& meMLQualitySummary(
MEs_.
at(
"MLQualitySummary"));
52 MESet& meEventsperMLImage(
MEs_.
at(
"EventsperMLImage"));
59 double pu = sPU.getFloatValue();
84 TH2F* hEEmDigiMap((
sources_.
at(
"DigiAllByLumi")).getME(0)->getTH2F());
85 TH2F* hEbDigiMap((
sources_.
at(
"DigiAllByLumi")).getME(1)->getTH2F());
86 TH2F* hEEpDigiMap((
sources_.
at(
"DigiAllByLumi")).getME(2)->getTH2F());
92 std::vector<float> ebOccMap1dCumulPad;
93 std::vector<float> eemOccMap1dCumulPad;
94 std::vector<float> eepOccMap1dCumulPad;
97 std::valarray<float> ebOccMap1d(nEBTowers);
98 std::valarray<float> eemOccMap1d(nEETowers);
99 std::valarray<float> eepOccMap1d(nEETowers);
103 for (
int i = 0;
i < hEbDigiMap->GetNbinsY();
i++) {
104 for (
int j = 0;
j < hEbDigiMap->GetNbinsX();
j++) {
105 int bin = hEbDigiMap->GetBin(
j + 1,
i + 1);
107 ebOccMap1d[
k] = hEbDigiMap->GetBinContent(
bin);
112 for (
int i = 0;
i < hEEpDigiMap->GetNbinsY();
i++) {
113 for (
int j = 0;
j < hEEpDigiMap->GetNbinsX();
j++) {
114 int bin = hEEpDigiMap->GetBin(
j + 1,
i + 1);
116 eemOccMap1d[
k] = hEEmDigiMap->GetBinContent(
bin);
117 eepOccMap1d[
k] = hEEpDigiMap->GetBinContent(
bin);
140 for (
size_t i = 0;
i <
nLS;
i++) {
151 std::valarray<float> ebOccMap1dCumul(0., nEBTowers);
152 std::valarray<float> eemOccMap1dCumul(0., nEETowers);
153 std::valarray<float> eepOccMap1dCumul(0., nEETowers);
173 ebOccMap1dCumul = ebOccMap1dCumul * (500. / TNum);
174 eemOccMap1dCumul = eemOccMap1dCumul * (500. / TNum);
175 eepOccMap1dCumul = eepOccMap1dCumul * (500. / TNum);
182 ebOccMap2dCumul[
i][
j] = ebOccMap1dCumul[
k];
186 std::vector<float> pad_top;
187 std::vector<float> pad_bottom;
188 std::vector<float> pad_left;
189 std::vector<float> pad_right;
191 pad_top = ebOccMap2dCumul[0];
192 pad_bottom = ebOccMap2dCumul[ebOccMap2dCumul.size() - 1];
194 ebOccMap2dCumul.insert(ebOccMap2dCumul.begin(), pad_top);
195 ebOccMap2dCumul.push_back(pad_bottom);
204 eemOccMap2dCumul[
i][
j] = eemOccMap1dCumul[
k];
205 eepOccMap2dCumul[
i][
j] = eepOccMap1dCumul[
k];
215 pad_top = eemOccMap2dCumul[0];
216 pad_bottom = eemOccMap2dCumul[eemOccMap2dCumul.size() - 1];
218 eemOccMap2dCumul.insert(eemOccMap2dCumul.begin(), pad_top);
219 eemOccMap2dCumul.push_back(pad_bottom);
221 for (
auto& row : eemOccMap2dCumul) {
222 pad_left.push_back(row[0]);
223 pad_right.push_back(row[row.size() - 1]);
226 std::size_t Lindex = 0;
227 std::size_t Rindex = 0;
229 for (
auto& row : eemOccMap2dCumul) {
230 row.insert(row.begin(), pad_left[Lindex++]);
231 row.insert(row.end(), pad_right[Rindex++]);
238 pad_top = eepOccMap2dCumul[0];
239 pad_bottom = eepOccMap2dCumul[eepOccMap2dCumul.size() - 1];
241 eepOccMap2dCumul.insert(eepOccMap2dCumul.begin(), pad_top);
242 eepOccMap2dCumul.push_back(pad_bottom);
244 for (
auto& row : eepOccMap2dCumul) {
245 pad_left.push_back(row[0]);
246 pad_right.push_back(row[row.size() - 1]);
252 for (
auto& row : eepOccMap2dCumul) {
253 row.insert(row.begin(), pad_left[Lindex++]);
254 row.insert(row.end(), pad_right[Rindex++]);
258 for (
auto& row : ebOccMap2dCumul) {
259 ebOccMap1dCumulPad.insert(ebOccMap1dCumulPad.end(), row.begin(), row.end());
262 for (
auto& row : eemOccMap2dCumul) {
263 eemOccMap1dCumulPad.insert(eemOccMap1dCumulPad.end(), row.begin(), row.end());
266 for (
auto& row : eepOccMap2dCumul) {
267 eepOccMap1dCumulPad.insert(eepOccMap1dCumulPad.end(), row.begin(), row.end());
290 Ort::SessionOptions sessionOptions;
291 sessionOptions.SetIntraOpNumThreads(1);
292 Ort::Env
env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING, instanceName.c_str());
293 Ort::Session session(
env, modelFilepath.c_str(), sessionOptions);
295 Ort::AllocatorWithDefaultOptions allocator;
298 std::string inputName{session.GetInputNameAllocated(0, allocator).get()};
300 Ort::TypeInfo inputTypeInfo = session.GetInputTypeInfo(0);
301 auto inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo();
303 std::vector<int64_t> inputDims = inputTensorInfo.GetShape();
307 Ort::TypeInfo outputTypeInfo = session.GetOutputTypeInfo(0);
308 auto outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo();
310 std::vector<int64_t> outputDims = outputTensorInfo.GetShape();
313 std::vector<float> ebRecoOccMap1dPad(TensorSize);
315 std::vector<const char*> inputNames{inputName.c_str()};
317 std::vector<Ort::Value> inputTensors;
318 std::vector<Ort::Value> outputTensors;
320 Ort::MemoryInfo memoryInfo =
321 Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
322 inputTensors.push_back(Ort::Value::CreateTensor<float>(
323 memoryInfo, ebOccMap1dCumulPad.data(), TensorSize, inputDims.data(), inputDims.size()));
325 outputTensors.push_back(Ort::Value::CreateTensor<float>(
326 memoryInfo, ebRecoOccMap1dPad.data(), TensorSize, outputDims.data(), outputDims.size()));
328 session.Run(Ort::RunOptions{
nullptr},
333 outputTensors.data(),
343 inputTensors.clear();
344 outputTensors.clear();
348 Ort::Session EEm_session(
env, modelFilepath.c_str(), sessionOptions);
350 inputName = EEm_session.GetInputNameAllocated(0, allocator).get();
352 inputTypeInfo = EEm_session.GetInputTypeInfo(0);
353 auto EEm_inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo();
355 inputDims = EEm_inputTensorInfo.GetShape();
357 outputName = EEm_session.GetOutputNameAllocated(0, allocator).get();
360 outputTypeInfo = EEm_session.GetOutputTypeInfo(0);
361 auto EEm_outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo();
363 outputDims = EEm_outputTensorInfo.GetShape();
366 std::vector<float> eemRecoOccMap1dPad(EE_TensorSize);
368 inputNames.push_back(inputName.c_str());
372 memoryInfo = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
373 inputTensors.push_back(Ort::Value::CreateTensor<float>(
374 memoryInfo, eemOccMap1dCumulPad.data(), EE_TensorSize, inputDims.data(), inputDims.size()));
376 outputTensors.push_back(Ort::Value::CreateTensor<float>(
377 memoryInfo, eemRecoOccMap1dPad.data(), EE_TensorSize, outputDims.data(), outputDims.size()));
379 EEm_session.Run(Ort::RunOptions{
nullptr},
384 outputTensors.data(),
392 inputTensors.clear();
393 outputTensors.clear();
397 Ort::Session EEp_session(
env, modelFilepath.c_str(), sessionOptions);
399 inputName = EEp_session.GetInputNameAllocated(0, allocator).get();
401 inputTypeInfo = EEp_session.GetInputTypeInfo(0);
402 auto EEp_inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo();
404 inputDims = EEp_inputTensorInfo.GetShape();
406 outputName = EEp_session.GetOutputNameAllocated(0, allocator).get();
408 outputTypeInfo = EEp_session.GetOutputTypeInfo(0);
410 auto EEp_outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo();
412 outputDims = EEp_outputTensorInfo.GetShape();
414 std::vector<float> eepRecoOccMap1dPad(EE_TensorSize);
416 inputNames.push_back(inputName.c_str());
420 memoryInfo = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
421 inputTensors.push_back(Ort::Value::CreateTensor<float>(
422 memoryInfo, eepOccMap1dCumulPad.data(), EE_TensorSize, inputDims.data(), inputDims.size()));
424 outputTensors.push_back(Ort::Value::CreateTensor<float>(
425 memoryInfo, eepRecoOccMap1dPad.data(), EE_TensorSize, outputDims.data(), outputDims.size()));
427 EEp_session.Run(Ort::RunOptions{
nullptr},
432 outputTensors.data(),
447 std::valarray<float> EBloss_;
452 std::valarray<float> EEmloss_;
457 std::valarray<float> EEploss_;
463 inFile.open((EBOccpath).c_str());
474 inFile.open((EEmOccpath).c_str());
485 inFile.open((EEpOccpath).c_str());
499 TH2F* hEBRecoMap2d(sAEReco.getME(1)->getTH2F());
504 int bin_ = hEBRecoMap2d->GetBin(
j + 1,
i);
505 EBrecoOcc1d[
j] = ebRecoOccMap1dPad[
k];
506 EBinputOcc1d[
j] = ebOccMap1dCumulPad[
k];
508 double content = ebRecoOccMap1dPad[
k];
509 hEBRecoMap2d->SetBinContent(bin_,
content);
512 EBloss_ =
std::pow((EBrecoOcc1d / EBavgOcc1d - EBinputOcc1d / EBavgOcc1d), 2);
513 EBlossMap2d[
i - 1] = (EBloss_);
516 TH2F* hEEmRecoMap2d(sAEReco.getME(0)->getTH2F());
517 TH2F* hEEpRecoMap2d(sAEReco.getME(2)->getTH2F());
522 int bin_ = hEEmRecoMap2d->GetBin(
j + 1,
i);
524 EEmrecoOcc1d[
j] = eemRecoOccMap1dPad[
k];
525 EEminputOcc1d[
j] = eemOccMap1dCumulPad[
k];
527 double EEmcontent = eemRecoOccMap1dPad[
k];
528 hEEmRecoMap2d->SetBinContent(bin_, EEmcontent);
530 EEprecoOcc1d[
j] = eepRecoOccMap1dPad[
k];
531 EEpinputOcc1d[
j] = eepOccMap1dCumulPad[
k];
533 double EEpcontent = eepRecoOccMap1dPad[
k];
534 hEEpRecoMap2d->SetBinContent(bin_, EEpcontent);
537 EEmloss_ =
std::pow((EEmrecoOcc1d / EEmavgOcc1d - EEminputOcc1d / EEmavgOcc1d), 2);
538 EEmlossMap2d[
i - 1] = (EEmloss_);
540 EEploss_ =
std::pow((EEprecoOcc1d / EEpavgOcc1d - EEpinputOcc1d / EEpavgOcc1d), 2);
541 EEplossMap2d[
i - 1] = (EEploss_);
576 TH2F* hEBLossMap2dMult(sAELoss.getME(1)->getTH2F());
578 for (
int i = 0;
i < hEBLossMap2dMult->GetNbinsY();
i++) {
579 for (
int j = 0;
j < hEBLossMap2dMult->GetNbinsX();
j++) {
580 int bin_ = hEBLossMap2dMult->GetBin(
j + 1,
i + 1);
582 hEBLossMap2dMult->SetBinContent(bin_,
content);
586 TH2F* hEEmLossMap2dMult(sAELoss.getME(0)->getTH2F());
587 TH2F* hEEpLossMap2dMult(sAELoss.getME(2)->getTH2F());
589 for (
int i = 0;
i < hEEmLossMap2dMult->GetNbinsY();
i++) {
590 for (
int j = 0;
j < hEEmLossMap2dMult->GetNbinsX();
j++) {
591 int bin_ = hEEmLossMap2dMult->GetBin(
j + 1,
i + 1);
593 double EEmcontent = EEmlossMap2dMult[
i][
j];
594 hEEmLossMap2dMult->SetBinContent(bin_, EEmcontent);
596 double EEpcontent = EEplossMap2dMult[
i][
j];
597 hEEpLossMap2dMult->SetBinContent(bin_, EEpcontent);
607 MESet& meTrendMLBadTower(
MEs_.
at(
"TrendMLBadTower"));
618 float entries(dItr->getBinContent());
625 if (eeid.
zside() > 0)
634 if (entries > MLThreshold) {
std::deque< std::valarray< std::valarray< float > > > EBlossMap2dQ
static const int nEEPhiTowers
void setParams(edm::ParameterSet const &) override
#define DEFINE_ECALDQM_WORKER(TYPE)
static const int nEBEtaTowers
edm::LuminosityBlockNumber_t iLumi
static const int PHYSICS_BAD_CHANNEL_WARNING
std::string fullPath() const
MESet & at(const std::string &key)
std::deque< std::valarray< std::valarray< float > > > EEplossMap2dQ
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int PHYSICS_BAD_CHANNEL_ERROR
void producePlots(ProcessType) override
static const int nEBEtaTowersPad
double getFloatValue() const
std::set< std::string > qualitySummaries_
std::vector< double > EEpavgOcc
std::deque< std::valarray< float > > eemOccMap1dQ
StatusManager const * statusManager_
float EEp_PUcorr_intercept_
std::deque< std::valarray< float > > eepOccMap1dQ
std::deque< std::valarray< std::valarray< float > > > EEmlossMap2dQ
static const int nEETowersPad
float EEm_PUcorr_intercept_
EcalElectronicsMapping const * GetElectronicsMap()
EcalDQMSetupObjects const getEcalDQMSetupObjects()
std::vector< double > EEmavgOcc
static const int nEBPhiTowers
std::deque< int > NEventQ
float EB_PUcorr_intercept_
const_iterator & toNextChannel(EcalElectronicsMapping const *)
std::vector< double > EBavgOcc
EcalTrigTowerConstituentsMap const * GetTrigTowerMap()
static const int nEEEtaTowers
void erase(const std::string &key)
std::deque< std::valarray< float > > ebOccMap1dQ