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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
#include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

SiPixelDynamicInefficiency::SiPixelDynamicInefficiency() { theInstLumiScaleFactor_ = -9999; }

bool SiPixelDynamicInefficiency::putPixelGeomFactor(const uint32_t& detid, double& value) {
  std::map<unsigned int, double>::const_iterator id = m_PixelGeomFactors.find(detid);
  if (id != m_PixelGeomFactors.end()) {
    edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency PixelGeomFactor for DetID " << detid
                                                << " is already stored. Skipping this put" << std::endl;
    return false;
  } else
    m_PixelGeomFactors[detid] = value;
  return true;
}

double SiPixelDynamicInefficiency::getPixelGeomFactor(const uint32_t& detid) const {
  std::map<unsigned int, double>::const_iterator id = m_PixelGeomFactors.find(detid);
  if (id != m_PixelGeomFactors.end())
    return id->second;
  else {
    edm::LogError("SiPixelDynamicInefficiency")
        << "SiPixelDynamicInefficiency PixelGeomFactor for DetID " << detid << " is not stored" << std::endl;
  }
  return 0;
}

bool SiPixelDynamicInefficiency::putColGeomFactor(const uint32_t& detid, double& value) {
  std::map<unsigned int, double>::const_iterator id = m_ColGeomFactors.find(detid);
  if (id != m_ColGeomFactors.end()) {
    edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency ColGeomFactor for DetID " << detid
                                                << " is already stored. Skipping this put" << std::endl;
    return false;
  } else
    m_ColGeomFactors[detid] = value;
  return true;
}

double SiPixelDynamicInefficiency::getColGeomFactor(const uint32_t& detid) const {
  std::map<unsigned int, double>::const_iterator id = m_ColGeomFactors.find(detid);
  if (id != m_ColGeomFactors.end())
    return id->second;
  else {
    edm::LogError("SiPixelDynamicInefficiency")
        << "SiPixelDynamicInefficiency ColGeomFactor for DetID " << detid << " is not stored" << std::endl;
  }
  return 0;
}

bool SiPixelDynamicInefficiency::putChipGeomFactor(const uint32_t& detid, double& value) {
  std::map<unsigned int, double>::const_iterator id = m_ChipGeomFactors.find(detid);
  if (id != m_ChipGeomFactors.end()) {
    edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency ChipGeomFactor for DetID " << detid
                                                << " is already stored. Skipping this put" << std::endl;
    return false;
  } else
    m_ChipGeomFactors[detid] = value;
  return true;
}

double SiPixelDynamicInefficiency::getChipGeomFactor(const uint32_t& detid) const {
  std::map<unsigned int, double>::const_iterator id = m_ChipGeomFactors.find(detid);
  if (id != m_ChipGeomFactors.end())
    return id->second;
  else {
    edm::LogError("SiPixelDynamicInefficiency")
        << "SiPixelDynamicInefficiency ChipGeomFactor for DetID " << detid << " is not stored" << std::endl;
  }
  return 0;
}

bool SiPixelDynamicInefficiency::putPUFactor(const uint32_t& detid, std::vector<double>& v_value) {
  std::map<unsigned int, std::vector<double> >::const_iterator id = m_PUFactors.find(detid);
  if (id != m_PUFactors.end()) {
    edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency PUFactor for DetID " << detid
                                                << " is already stored. Skipping this put" << std::endl;
    return false;
  } else
    m_PUFactors[detid] = v_value;
  return true;
}

std::vector<double> SiPixelDynamicInefficiency::getPUFactor(const uint32_t& detid) const {
  std::map<unsigned int, std::vector<double> >::const_iterator id = m_PUFactors.find(detid);
  if (id != m_PUFactors.end())
    return id->second;
  else {
    edm::LogError("SiPixelDynamicInefficiency")
        << "SiPixelDynamicInefficiency PUFactor for DetID " << detid << " is not stored" << std::endl;
  }
  std::vector<double> empty;
  return empty;
}

bool SiPixelDynamicInefficiency::putDetIdmask(uint32_t& mask) {
  for (unsigned int i = 0; i < v_DetIdmasks.size(); i++)
    if (mask == v_DetIdmasks.at(i))
      return false;
  v_DetIdmasks.push_back(mask);
  return true;
}
uint32_t SiPixelDynamicInefficiency::getDetIdmask(unsigned int& i) const {
  if (v_DetIdmasks.size() <= i) {
    edm::LogError("SiPixelDynamicInefficiency")
        << "SiPixelDynamicInefficiency DetIdmask " << i << " is not stored!" << std::endl;
    return 0;
  } else
    return v_DetIdmasks.at(i);
}

bool SiPixelDynamicInefficiency::puttheInstLumiScaleFactor(double& theInstLumiScaleFactor) {
  if (theInstLumiScaleFactor_ != -9999) {
    edm::LogError("SiPixelDynamicInefficiency")
        << "SiPixelDynamicInefficiency theInstLumiScaleFactor is already stored! Skipping this put!" << std::endl;
    return false;
  } else {
    theInstLumiScaleFactor_ = theInstLumiScaleFactor;
    return true;
  }
}

double SiPixelDynamicInefficiency::gettheInstLumiScaleFactor() const {
  if (theInstLumiScaleFactor_ == -9999) {
    edm::LogError("SiPixelDynamicInefficiency")
        << "SiPixelDynamicInefficiency theInstLumiScaleFactor is not stored!" << std::endl;
    return 0;
  } else
    return theInstLumiScaleFactor_;
}