CMS 3D CMS Logo

SiPhase2OuterTrackerLorentzAngle.cc
Go to the documentation of this file.
3 
4 bool SiPhase2OuterTrackerLorentzAngle::putLorentzAngle(const uint32_t& detid, float value) {
5  std::unordered_map<unsigned int, float>::const_iterator id = m_LA.find(detid);
6  if (id != m_LA.end()) {
7  edm::LogError("SiPhase2OuterTrackerLorentzAngle") << "SiPhase2OuterTrackerLorentzAngle for DetID " << detid
8  << " is already stored. Skipping this put" << std::endl;
9  return false;
10  } else
11  m_LA[detid] = value;
12  return true;
13 }
14 
15 float SiPhase2OuterTrackerLorentzAngle::getLorentzAngle(const uint32_t& detid) const {
16  std::unordered_map<unsigned int, float>::const_iterator id = m_LA.find(detid);
17  if (id != m_LA.end())
18  return id->second;
19  else {
20  throw cms::Exception("SiPhase2OuterTrackerLorentzAngle")
21  << "SiPhase2OuterTrackerLorentzAngle for DetID " << detid << " is not stored" << std::endl;
22  }
23 }
24 
26  const TrackerGeometry::ModuleType& theType,
27  std::unordered_map<unsigned int, float>& out) const {
28  for (const auto& [det, LA] : m_LA) {
29  if (trackerGeometry->getDetectorType(det) == theType) {
30  out[det] = LA;
31  }
32  }
33 }
34 
35 void SiPhase2OuterTrackerLorentzAngle::printDebug(std::stringstream& ss, const TrackerTopology* /*trackerTopo*/) const {
36  const std::unordered_map<unsigned int, float>& detid_la = getLorentzAngles();
37  ss << "SiPhase2OuterTrackerLorentzAngleReader:" << std::endl;
38  ss << "detid \t Lorentz angle" << std::endl;
39  for (const auto& it : detid_la) {
40  ss << it.first << "\t" << it.second << std::endl;
41  }
42 }
const std::unordered_map< unsigned int, float > & getLorentzAngles() const
Log< level::Error, false > LogError
ModuleType getDetectorType(DetId) const
Definition: value.py:1
void getLorentzAnglesByModuleType(const TrackerGeometry *trackerGeometry, const TrackerGeometry::ModuleType &theType, std::unordered_map< unsigned int, float > &out) const
std::unordered_map< unsigned int, float > m_LA
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const