Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:41

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   ss << "SiStripLorentzAngleReader:" << std::endl;
0029   ss << "detid \t Lorentz angle" << std::endl;
0030   for (it = detid_la.begin(); it != detid_la.end(); ++it) {
0031     ss << it->first << "\t" << it->second << std::endl;
0032   }
0033 }
0034 
0035 void SiStripLorentzAngle::printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
0036   std::map<unsigned int, float> detid_la = getLorentzAngles();
0037   std::map<unsigned int, float>::const_iterator it;
0038 
0039   SiStripDetSummary summary{trackerTopo};
0040 
0041   for (it = detid_la.begin(); it != detid_la.end(); ++it) {
0042     DetId detid(it->first);
0043     float value = it->second;
0044     summary.add(detid, value);
0045   }
0046   ss << "Summary of lorentz angles:" << std::endl;
0047   summary.print(ss);
0048 }