Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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