Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-17 23:36:00

0001 #include "CondFormats/SiStripObjects/interface/SiStripBackPlaneCorrection.h"
0002 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 bool SiStripBackPlaneCorrection::putBackPlaneCorrection(const uint32_t& detid, float value) {
0006   std::map<unsigned int, float>::const_iterator id = m_BPC.find(detid);
0007   if (id != m_BPC.end()) {
0008     edm::LogError("SiStripBackPlaneCorrection")
0009         << "SiStripBackPlaneCorrection for DetID " << detid << " is already stored. Skipping this put" << std::endl;
0010     return false;
0011   } else
0012     m_BPC[detid] = value;
0013   return true;
0014 }
0015 float SiStripBackPlaneCorrection::getBackPlaneCorrection(const uint32_t& detid) const {
0016   std::map<unsigned int, float>::const_iterator id = m_BPC.find(detid);
0017   if (id != m_BPC.end())
0018     return id->second;
0019   else {
0020     edm::LogError("SiStripBackPlaneCorrection")
0021         << "SiStripBackPlaneCorrection for DetID " << detid << " is not stored" << std::endl;
0022   }
0023   return 0;
0024 }
0025 
0026 void SiStripBackPlaneCorrection::printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
0027   std::map<unsigned int, float> detid_la = getBackPlaneCorrections();
0028   std::map<unsigned int, float>::const_iterator it;
0029   size_t count = 0;
0030   ss << "SiStripBackPlaneCorrectionReader:" << std::endl;
0031   ss << "detid \t Geometry \t Back Plane Corrections" << std::endl;
0032   for (it = detid_la.begin(); it != detid_la.end(); ++it) {
0033     ss << it->first << "\t" << static_cast<int>(trackerTopo->moduleGeometry(it->first)) << "\t" << it->second
0034        << std::endl;
0035     ++count;
0036   }
0037 }
0038 
0039 void SiStripBackPlaneCorrection::printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
0040   std::map<unsigned int, float> detid_la = getBackPlaneCorrections();
0041   std::map<unsigned int, float>::const_iterator it;
0042 
0043   SiStripDetSummary summary{trackerTopo};
0044 
0045   for (it = detid_la.begin(); it != detid_la.end(); ++it) {
0046     DetId detid(it->first);
0047     float value = it->second;
0048     summary.add(detid, value);
0049   }
0050   ss << "Summary of BackPlane corrections:" << std::endl;
0051   summary.print(ss);
0052 }