CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/CondFormats/SiStripObjects/src/SiStripLorentzAngle.cc

Go to the documentation of this file.
00001 #include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" 
00004 
00005 bool SiStripLorentzAngle::putLorentzAngle(const uint32_t& detid, float& value){
00006   std::map<unsigned int,float>::const_iterator id=m_LA.find(detid);
00007   if(id!=m_LA.end()){
00008     edm::LogError("SiStripLorentzAngle") << "SiStripLorentzAngle for DetID " << detid << " is already stored. Skippig this put" << std::endl;
00009     return false;
00010   }
00011   else m_LA[detid]=value;
00012   return true;
00013 }
00014 const float& SiStripLorentzAngle::getLorentzAngle(const uint32_t& detid) const  {
00015   std::map<unsigned int,float>::const_iterator id=m_LA.find(detid);
00016   if(id!=m_LA.end()) return id->second;
00017   else {
00018     edm::LogError("SiStripLorentzAngle") << "SiStripLorentzAngle for DetID " << detid << " is not stored" << std::endl; 
00019   }
00020   static float temp = 0.; // added by R.B. 
00021   return temp;
00022 }
00023 
00024 void SiStripLorentzAngle::printDebug(std::stringstream& ss) const
00025 {
00026   std::map<unsigned int,float> detid_la = getLorentzAngles();
00027   std::map<unsigned int,float>::const_iterator it;
00028   size_t count=0;
00029   ss << "SiStripLorentzAngleReader:" << std::endl;
00030   ss << "detid \t Lorentz angle" << std::endl;
00031   for( it=detid_la.begin(); it!=detid_la.end(); ++it ) {
00032     ss << it->first << "\t" << it->second << std::endl;
00033     ++count;
00034   }
00035 }
00036 
00037 void SiStripLorentzAngle::printSummary(std::stringstream& ss) const
00038 {
00039   std::map<unsigned int,float> detid_la = getLorentzAngles();
00040   std::map<unsigned int,float>::const_iterator it;
00041 
00042   SiStripDetSummary summary;
00043 
00044   for( it=detid_la.begin(); it!=detid_la.end(); ++it ) {
00045     DetId detid(it->first);
00046     float value = it->second;
00047     summary.add(detid, value);
00048   }
00049   ss << "Summary of lorentz angles:" << std::endl;
00050   summary.print(ss);
00051 
00052 }