CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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 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   return 0;
00021 }
00022 
00023 void SiStripLorentzAngle::printDebug(std::stringstream& ss) const
00024 {
00025   std::map<unsigned int,float> detid_la = getLorentzAngles();
00026   std::map<unsigned int,float>::const_iterator it;
00027   size_t count=0;
00028   ss << "SiStripLorentzAngleReader:" << std::endl;
00029   ss << "detid \t Lorentz angle" << std::endl;
00030   for( it=detid_la.begin(); it!=detid_la.end(); ++it ) {
00031     ss << it->first << "\t" << it->second << std::endl;
00032     ++count;
00033   }
00034 }
00035 
00036 void SiStripLorentzAngle::printSummary(std::stringstream& ss) const
00037 {
00038   std::map<unsigned int,float> detid_la = getLorentzAngles();
00039   std::map<unsigned int,float>::const_iterator it;
00040 
00041   SiStripDetSummary summary;
00042 
00043   for( it=detid_la.begin(); it!=detid_la.end(); ++it ) {
00044     DetId detid(it->first);
00045     float value = it->second;
00046     summary.add(detid, value);
00047   }
00048   ss << "Summary of lorentz angles:" << std::endl;
00049   summary.print(ss);
00050 
00051 }