Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"

bool SiStripLorentzAngle::putLorentzAngle(const uint32_t& detid, float value) {
  std::map<unsigned int, float>::const_iterator id = m_LA.find(detid);
  if (id != m_LA.end()) {
    edm::LogError("SiStripLorentzAngle") << "SiStripLorentzAngle for DetID " << detid
                                         << " is already stored. Skipping this put" << std::endl;
    return false;
  } else
    m_LA[detid] = value;
  return true;
}
float SiStripLorentzAngle::getLorentzAngle(const uint32_t& detid) const {
  std::map<unsigned int, float>::const_iterator id = m_LA.find(detid);
  if (id != m_LA.end())
    return id->second;
  else {
    edm::LogError("SiStripLorentzAngle") << "SiStripLorentzAngle for DetID " << detid << " is not stored" << std::endl;
  }
  return 0;
}

void SiStripLorentzAngle::printDebug(std::stringstream& ss, const TrackerTopology* /*trackerTopo*/) const {
  std::map<unsigned int, float> detid_la = getLorentzAngles();
  std::map<unsigned int, float>::const_iterator it;
  ss << "SiStripLorentzAngleReader:" << std::endl;
  ss << "detid \t Lorentz angle" << std::endl;
  for (it = detid_la.begin(); it != detid_la.end(); ++it) {
    ss << it->first << "\t" << it->second << std::endl;
  }
}

void SiStripLorentzAngle::printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
  std::map<unsigned int, float> detid_la = getLorentzAngles();
  std::map<unsigned int, float>::const_iterator it;

  SiStripDetSummary summary{trackerTopo};

  for (it = detid_la.begin(); it != detid_la.end(); ++it) {
    DetId detid(it->first);
    float value = it->second;
    summary.add(detid, value);
  }
  ss << "Summary of lorentz angles:" << std::endl;
  summary.print(ss);
}