50 MESet& meMLQualitySummary(
MEs_.
at(
"MLQualitySummary"));
51 MESet& meEventsperMLImage(
MEs_.
at(
"EventsperMLImage"));
58 double pu = sPU.getFloatValue();
83 TH2F* hEEmDigiMap((
sources_.
at(
"DigiAllByLumi")).getME(0)->getTH2F());
84 TH2F* hEbDigiMap((
sources_.
at(
"DigiAllByLumi")).getME(1)->getTH2F());
85 TH2F* hEEpDigiMap((
sources_.
at(
"DigiAllByLumi")).getME(2)->getTH2F());
91 std::vector<float> ebOccMap1dCumulPad;
92 std::vector<float> eemOccMap1dCumulPad;
93 std::vector<float> eepOccMap1dCumulPad;
96 std::valarray<float> ebOccMap1d(nEBTowers);
97 std::valarray<float> eemOccMap1d(nEETowers);
98 std::valarray<float> eepOccMap1d(nEETowers);
102 for (
int i = 0;
i < hEbDigiMap->GetNbinsY();
i++) {
103 for (
int j = 0;
j < hEbDigiMap->GetNbinsX();
j++) {
104 int bin = hEbDigiMap->GetBin(
j + 1,
i + 1);
106 ebOccMap1d[
k] = hEbDigiMap->GetBinContent(
bin);
111 for (
int i = 0;
i < hEEpDigiMap->GetNbinsY();
i++) {
112 for (
int j = 0;
j < hEEpDigiMap->GetNbinsX();
j++) {
113 int bin = hEEpDigiMap->GetBin(
j + 1,
i + 1);
115 eemOccMap1d[
k] = hEEmDigiMap->GetBinContent(
bin);
116 eepOccMap1d[
k] = hEEpDigiMap->GetBinContent(
bin);
139 for (
size_t i = 0;
i <
nLS;
i++) {
150 std::valarray<float> ebOccMap1dCumul(0., nEBTowers);
151 std::valarray<float> eemOccMap1dCumul(0., nEETowers);
152 std::valarray<float> eepOccMap1dCumul(0., nEETowers);
172 ebOccMap1dCumul = ebOccMap1dCumul * (500. / TNum);
173 eemOccMap1dCumul = eemOccMap1dCumul * (500. / TNum);
174 eepOccMap1dCumul = eepOccMap1dCumul * (500. / TNum);
181 ebOccMap2dCumul[
i][
j] = ebOccMap1dCumul[
k];
185 std::vector<float> pad_top;
186 std::vector<float> pad_bottom;
187 std::vector<float> pad_left;
188 std::vector<float> pad_right;
190 pad_top = ebOccMap2dCumul[0];
191 pad_bottom = ebOccMap2dCumul[ebOccMap2dCumul.size() - 1];
193 ebOccMap2dCumul.insert(ebOccMap2dCumul.begin(), pad_top);
194 ebOccMap2dCumul.push_back(pad_bottom);
203 eemOccMap2dCumul[
i][
j] = eemOccMap1dCumul[
k];
204 eepOccMap2dCumul[
i][
j] = eepOccMap1dCumul[
k];
214 pad_top = eemOccMap2dCumul[0];
215 pad_bottom = eemOccMap2dCumul[eemOccMap2dCumul.size() - 1];
217 eemOccMap2dCumul.insert(eemOccMap2dCumul.begin(), pad_top);
218 eemOccMap2dCumul.push_back(pad_bottom);
220 for (
auto& row : eemOccMap2dCumul) {
221 pad_left.push_back(row[0]);
222 pad_right.push_back(row[row.size() - 1]);
225 std::size_t Lindex = 0;
226 std::size_t Rindex = 0;
228 for (
auto& row : eemOccMap2dCumul) {
229 row.insert(row.begin(), pad_left[Lindex++]);
230 row.insert(row.end(), pad_right[Rindex++]);
237 pad_top = eepOccMap2dCumul[0];
238 pad_bottom = eepOccMap2dCumul[eepOccMap2dCumul.size() - 1];
240 eepOccMap2dCumul.insert(eepOccMap2dCumul.begin(), pad_top);
241 eepOccMap2dCumul.push_back(pad_bottom);
243 for (
auto& row : eepOccMap2dCumul) {
244 pad_left.push_back(row[0]);
245 pad_right.push_back(row[row.size() - 1]);
251 for (
auto& row : eepOccMap2dCumul) {
252 row.insert(row.begin(), pad_left[Lindex++]);
253 row.insert(row.end(), pad_right[Rindex++]);
257 for (
auto& row : ebOccMap2dCumul) {
258 ebOccMap1dCumulPad.insert(ebOccMap1dCumulPad.end(), row.begin(), row.end());
261 for (
auto& row : eemOccMap2dCumul) {
262 eemOccMap1dCumulPad.insert(eemOccMap1dCumulPad.end(), row.begin(), row.end());
265 for (
auto& row : eepOccMap2dCumul) {
266 eepOccMap1dCumulPad.insert(eepOccMap1dCumulPad.end(), row.begin(), row.end());
289 Ort::SessionOptions sessionOptions;
290 sessionOptions.SetIntraOpNumThreads(1);
291 Ort::Env
env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING, instanceName.c_str());
292 Ort::Session session(
env, modelFilepath.c_str(), sessionOptions);
294 Ort::AllocatorWithDefaultOptions allocator;
296 const char* inputName = session.GetInputName(0, allocator);
298 Ort::TypeInfo inputTypeInfo = session.GetInputTypeInfo(0);
299 auto inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo();
301 std::vector<int64_t> inputDims = inputTensorInfo.GetShape();
303 const char*
outputName = session.GetOutputName(0, allocator);
305 Ort::TypeInfo outputTypeInfo = session.GetOutputTypeInfo(0);
306 auto outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo();
308 std::vector<int64_t> outputDims = outputTensorInfo.GetShape();
311 std::vector<float> ebRecoOccMap1dPad(TensorSize);
313 std::vector<const char*> inputNames{inputName};
315 std::vector<Ort::Value> inputTensors;
316 std::vector<Ort::Value> outputTensors;
318 Ort::MemoryInfo memoryInfo =
319 Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
320 inputTensors.push_back(Ort::Value::CreateTensor<float>(
321 memoryInfo, ebOccMap1dCumulPad.data(), TensorSize, inputDims.data(), inputDims.size()));
323 outputTensors.push_back(Ort::Value::CreateTensor<float>(
324 memoryInfo, ebRecoOccMap1dPad.data(), TensorSize, outputDims.data(), outputDims.size()));
326 session.Run(Ort::RunOptions{
nullptr},
331 outputTensors.data(),
341 inputTensors.clear();
342 outputTensors.clear();
346 Ort::Session EEm_session(
env, modelFilepath.c_str(), sessionOptions);
348 inputName = EEm_session.GetInputName(0, allocator);
350 inputTypeInfo = EEm_session.GetInputTypeInfo(0);
351 auto EEm_inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo();
353 inputDims = EEm_inputTensorInfo.GetShape();
355 outputName = EEm_session.GetOutputName(0, allocator);
358 outputTypeInfo = EEm_session.GetOutputTypeInfo(0);
359 auto EEm_outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo();
361 outputDims = EEm_outputTensorInfo.GetShape();
364 std::vector<float> eemRecoOccMap1dPad(EE_TensorSize);
366 inputNames.push_back(inputName);
370 memoryInfo = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
371 inputTensors.push_back(Ort::Value::CreateTensor<float>(
372 memoryInfo, eemOccMap1dCumulPad.data(), EE_TensorSize, inputDims.data(), inputDims.size()));
374 outputTensors.push_back(Ort::Value::CreateTensor<float>(
375 memoryInfo, eemRecoOccMap1dPad.data(), EE_TensorSize, outputDims.data(), outputDims.size()));
377 EEm_session.Run(Ort::RunOptions{
nullptr},
382 outputTensors.data(),
390 inputTensors.clear();
391 outputTensors.clear();
395 Ort::Session EEp_session(
env, modelFilepath.c_str(), sessionOptions);
397 inputName = EEp_session.GetInputName(0, allocator);
399 inputTypeInfo = EEp_session.GetInputTypeInfo(0);
400 auto EEp_inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo();
402 inputDims = EEp_inputTensorInfo.GetShape();
404 outputName = EEp_session.GetOutputName(0, allocator);
406 outputTypeInfo = EEp_session.GetOutputTypeInfo(0);
408 auto EEp_outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo();
410 outputDims = EEp_outputTensorInfo.GetShape();
412 std::vector<float> eepRecoOccMap1dPad(EE_TensorSize);
414 inputNames.push_back(inputName);
418 memoryInfo = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
419 inputTensors.push_back(Ort::Value::CreateTensor<float>(
420 memoryInfo, eepOccMap1dCumulPad.data(), EE_TensorSize, inputDims.data(), inputDims.size()));
422 outputTensors.push_back(Ort::Value::CreateTensor<float>(
423 memoryInfo, eepRecoOccMap1dPad.data(), EE_TensorSize, outputDims.data(), outputDims.size()));
425 EEp_session.Run(Ort::RunOptions{
nullptr},
430 outputTensors.data(),
445 std::valarray<float> EBloss_;
450 std::valarray<float> EEmloss_;
455 std::valarray<float> EEploss_;
461 inFile.open((EBOccpath).c_str());
472 inFile.open((EEmOccpath).c_str());
483 inFile.open((EEpOccpath).c_str());
497 TH2F* hEBRecoMap2d(sAEReco.getME(1)->getTH2F());
502 int bin_ = hEBRecoMap2d->GetBin(
j + 1,
i);
503 EBrecoOcc1d[
j] = ebRecoOccMap1dPad[
k];
504 EBinputOcc1d[
j] = ebOccMap1dCumulPad[
k];
506 double content = ebRecoOccMap1dPad[
k];
507 hEBRecoMap2d->SetBinContent(bin_,
content);
510 EBloss_ =
std::pow((EBrecoOcc1d / EBavgOcc1d - EBinputOcc1d / EBavgOcc1d), 2);
511 EBlossMap2d[
i - 1] = (EBloss_);
514 TH2F* hEEmRecoMap2d(sAEReco.getME(0)->getTH2F());
515 TH2F* hEEpRecoMap2d(sAEReco.getME(2)->getTH2F());
520 int bin_ = hEEmRecoMap2d->GetBin(
j + 1,
i);
522 EEmrecoOcc1d[
j] = eemRecoOccMap1dPad[
k];
523 EEminputOcc1d[
j] = eemOccMap1dCumulPad[
k];
525 double EEmcontent = eemRecoOccMap1dPad[
k];
526 hEEmRecoMap2d->SetBinContent(bin_, EEmcontent);
528 EEprecoOcc1d[
j] = eepRecoOccMap1dPad[
k];
529 EEpinputOcc1d[
j] = eepOccMap1dCumulPad[
k];
531 double EEpcontent = eepRecoOccMap1dPad[
k];
532 hEEpRecoMap2d->SetBinContent(bin_, EEpcontent);
535 EEmloss_ =
std::pow((EEmrecoOcc1d / EEmavgOcc1d - EEminputOcc1d / EEmavgOcc1d), 2);
536 EEmlossMap2d[
i - 1] = (EEmloss_);
538 EEploss_ =
std::pow((EEprecoOcc1d / EEpavgOcc1d - EEpinputOcc1d / EEpavgOcc1d), 2);
539 EEplossMap2d[
i - 1] = (EEploss_);
574 TH2F* hEBLossMap2dMult(sAELoss.getME(1)->getTH2F());
576 for (
int i = 0;
i < hEBLossMap2dMult->GetNbinsY();
i++) {
577 for (
int j = 0;
j < hEBLossMap2dMult->GetNbinsX();
j++) {
578 int bin_ = hEBLossMap2dMult->GetBin(
j + 1,
i + 1);
580 hEBLossMap2dMult->SetBinContent(bin_,
content);
584 TH2F* hEEmLossMap2dMult(sAELoss.getME(0)->getTH2F());
585 TH2F* hEEpLossMap2dMult(sAELoss.getME(2)->getTH2F());
587 for (
int i = 0;
i < hEEmLossMap2dMult->GetNbinsY();
i++) {
588 for (
int j = 0;
j < hEEmLossMap2dMult->GetNbinsX();
j++) {
589 int bin_ = hEEmLossMap2dMult->GetBin(
j + 1,
i + 1);
591 double EEmcontent = EEmlossMap2dMult[
i][
j];
592 hEEmLossMap2dMult->SetBinContent(bin_, EEmcontent);
594 double EEpcontent = EEplossMap2dMult[
i][
j];
595 hEEpLossMap2dMult->SetBinContent(bin_, EEpcontent);
605 MESet& meTrendMLBadTower(
MEs_.
at(
"TrendMLBadTower"));
616 float entries(dItr->getBinContent());
623 if (eeid.
zside() > 0)
632 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
Power< A, B >::type pow(const A &a, const B &b)