File indexing completed on 2024-04-06 12:02:34
0001 #include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003
0004 SiPixelDynamicInefficiency::SiPixelDynamicInefficiency() { theInstLumiScaleFactor_ = -9999; }
0005
0006 bool SiPixelDynamicInefficiency::putPixelGeomFactor(const uint32_t& detid, double& value) {
0007 std::map<unsigned int, double>::const_iterator id = m_PixelGeomFactors.find(detid);
0008 if (id != m_PixelGeomFactors.end()) {
0009 edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency PixelGeomFactor for DetID " << detid
0010 << " is already stored. Skipping this put" << std::endl;
0011 return false;
0012 } else
0013 m_PixelGeomFactors[detid] = value;
0014 return true;
0015 }
0016
0017 double SiPixelDynamicInefficiency::getPixelGeomFactor(const uint32_t& detid) const {
0018 std::map<unsigned int, double>::const_iterator id = m_PixelGeomFactors.find(detid);
0019 if (id != m_PixelGeomFactors.end())
0020 return id->second;
0021 else {
0022 edm::LogError("SiPixelDynamicInefficiency")
0023 << "SiPixelDynamicInefficiency PixelGeomFactor for DetID " << detid << " is not stored" << std::endl;
0024 }
0025 return 0;
0026 }
0027
0028 bool SiPixelDynamicInefficiency::putColGeomFactor(const uint32_t& detid, double& value) {
0029 std::map<unsigned int, double>::const_iterator id = m_ColGeomFactors.find(detid);
0030 if (id != m_ColGeomFactors.end()) {
0031 edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency ColGeomFactor for DetID " << detid
0032 << " is already stored. Skipping this put" << std::endl;
0033 return false;
0034 } else
0035 m_ColGeomFactors[detid] = value;
0036 return true;
0037 }
0038
0039 double SiPixelDynamicInefficiency::getColGeomFactor(const uint32_t& detid) const {
0040 std::map<unsigned int, double>::const_iterator id = m_ColGeomFactors.find(detid);
0041 if (id != m_ColGeomFactors.end())
0042 return id->second;
0043 else {
0044 edm::LogError("SiPixelDynamicInefficiency")
0045 << "SiPixelDynamicInefficiency ColGeomFactor for DetID " << detid << " is not stored" << std::endl;
0046 }
0047 return 0;
0048 }
0049
0050 bool SiPixelDynamicInefficiency::putChipGeomFactor(const uint32_t& detid, double& value) {
0051 std::map<unsigned int, double>::const_iterator id = m_ChipGeomFactors.find(detid);
0052 if (id != m_ChipGeomFactors.end()) {
0053 edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency ChipGeomFactor for DetID " << detid
0054 << " is already stored. Skipping this put" << std::endl;
0055 return false;
0056 } else
0057 m_ChipGeomFactors[detid] = value;
0058 return true;
0059 }
0060
0061 double SiPixelDynamicInefficiency::getChipGeomFactor(const uint32_t& detid) const {
0062 std::map<unsigned int, double>::const_iterator id = m_ChipGeomFactors.find(detid);
0063 if (id != m_ChipGeomFactors.end())
0064 return id->second;
0065 else {
0066 edm::LogError("SiPixelDynamicInefficiency")
0067 << "SiPixelDynamicInefficiency ChipGeomFactor for DetID " << detid << " is not stored" << std::endl;
0068 }
0069 return 0;
0070 }
0071
0072 bool SiPixelDynamicInefficiency::putPUFactor(const uint32_t& detid, std::vector<double>& v_value) {
0073 std::map<unsigned int, std::vector<double> >::const_iterator id = m_PUFactors.find(detid);
0074 if (id != m_PUFactors.end()) {
0075 edm::LogError("SiPixelDynamicInefficiency") << "SiPixelDynamicInefficiency PUFactor for DetID " << detid
0076 << " is already stored. Skipping this put" << std::endl;
0077 return false;
0078 } else
0079 m_PUFactors[detid] = v_value;
0080 return true;
0081 }
0082
0083 std::vector<double> SiPixelDynamicInefficiency::getPUFactor(const uint32_t& detid) const {
0084 std::map<unsigned int, std::vector<double> >::const_iterator id = m_PUFactors.find(detid);
0085 if (id != m_PUFactors.end())
0086 return id->second;
0087 else {
0088 edm::LogError("SiPixelDynamicInefficiency")
0089 << "SiPixelDynamicInefficiency PUFactor for DetID " << detid << " is not stored" << std::endl;
0090 }
0091 std::vector<double> empty;
0092 return empty;
0093 }
0094
0095 bool SiPixelDynamicInefficiency::putDetIdmask(uint32_t& mask) {
0096 for (unsigned int i = 0; i < v_DetIdmasks.size(); i++)
0097 if (mask == v_DetIdmasks.at(i))
0098 return false;
0099 v_DetIdmasks.push_back(mask);
0100 return true;
0101 }
0102 uint32_t SiPixelDynamicInefficiency::getDetIdmask(unsigned int& i) const {
0103 if (v_DetIdmasks.size() <= i) {
0104 edm::LogError("SiPixelDynamicInefficiency")
0105 << "SiPixelDynamicInefficiency DetIdmask " << i << " is not stored!" << std::endl;
0106 return 0;
0107 } else
0108 return v_DetIdmasks.at(i);
0109 }
0110
0111 bool SiPixelDynamicInefficiency::puttheInstLumiScaleFactor(double& theInstLumiScaleFactor) {
0112 if (theInstLumiScaleFactor_ != -9999) {
0113 edm::LogError("SiPixelDynamicInefficiency")
0114 << "SiPixelDynamicInefficiency theInstLumiScaleFactor is already stored! Skipping this put!" << std::endl;
0115 return false;
0116 } else {
0117 theInstLumiScaleFactor_ = theInstLumiScaleFactor;
0118 return true;
0119 }
0120 }
0121
0122 double SiPixelDynamicInefficiency::gettheInstLumiScaleFactor() const {
0123 if (theInstLumiScaleFactor_ == -9999) {
0124 edm::LogError("SiPixelDynamicInefficiency")
0125 << "SiPixelDynamicInefficiency theInstLumiScaleFactor is not stored!" << std::endl;
0126 return 0;
0127 } else
0128 return theInstLumiScaleFactor_;
0129 }