Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
#include "OnlineDB/EcalCondDB/interface/RunIOV.h"

#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"

#include "CondTools/Ecal/interface/EcalErrorDictionary.h"

#include "CondTools/Ecal/interface/EcalErrorMask.h"

#include <iostream>

void EcalErrorMask::readDB(EcalCondDBInterface* eConn, RunIOV* runIOV) noexcept(false) {
  if (eConn) {
    RunIOV validIOV;
    RunTag runTag = runIOV->getRunTag();

    std::string location = runTag.getLocationDef().getLocation();

    std::cout << std::endl;
    std::cout << " RunCrystalErrorsDat: ";
    try {
      eConn->fetchValidDataSet(&mapCrystalErrors_, &validIOV, location, runIOV->getRunNumber());
      std::cout << "found" << std::endl;
    } catch (std::runtime_error& e) {
      std::cout << "not found" << std::endl;
      throw(std::runtime_error(e.what()));
    }

    // use the IOV for CrystalErrors as reference
    runNb_ = validIOV.getRunNumber();

    std::cout << " RunTTErrorsDat:      ";
    try {
      eConn->fetchValidDataSet(&mapTTErrors_, &validIOV, location, runIOV->getRunNumber());
      std::cout << "found" << std::endl;
    } catch (std::runtime_error& e) {
      std::cout << "not found" << std::endl;
    }
    std::cout << " RunPNErrorsDat:      ";
    try {
      eConn->fetchValidDataSet(&mapPNErrors_, &validIOV, location, runIOV->getRunNumber());
      std::cout << "found" << std::endl;
    } catch (std::runtime_error& e) {
      std::cout << "not found" << std::endl;
    }
    std::cout << " RunMemChErrorsDat:   ";
    try {
      eConn->fetchValidDataSet(&mapMemChErrors_, &validIOV, location, runIOV->getRunNumber());
      std::cout << "found" << std::endl;
    } catch (std::runtime_error& e) {
      std::cout << "not found" << std::endl;
    }
    std::cout << " RunMemTTErrorsDat:   ";
    try {
      eConn->fetchValidDataSet(&mapMemTTErrors_, &validIOV, location, runIOV->getRunNumber());
      std::cout << "found" << std::endl;
    } catch (std::runtime_error& e) {
      std::cout << "not found" << std::endl;
    }

    std::cout << std::endl;
  }
}

void EcalErrorMask::fetchDataSet(std::map<EcalLogicID, RunCrystalErrorsDat>* fillMap) {
  fillMap->clear();
  *fillMap = mapCrystalErrors_;
  return;
}

void EcalErrorMask::fetchDataSet(std::map<EcalLogicID, RunTTErrorsDat>* fillMap) {
  fillMap->clear();
  *fillMap = mapTTErrors_;
  return;
}

void EcalErrorMask::fetchDataSet(std::map<EcalLogicID, RunPNErrorsDat>* fillMap) {
  fillMap->clear();
  *fillMap = mapPNErrors_;
  return;
}

void EcalErrorMask::fetchDataSet(std::map<EcalLogicID, RunMemChErrorsDat>* fillMap) {
  fillMap->clear();
  *fillMap = mapMemChErrors_;
  return;
}

void EcalErrorMask::fetchDataSet(std::map<EcalLogicID, RunMemTTErrorsDat>* fillMap) {
  fillMap->clear();
  *fillMap = mapMemTTErrors_;
  return;
}