00001 #include "CondFormats/CSCObjects/interface/CSCNoiseMatrix.h" 00002 #include "DataFormats/MuonDetId/interface/CSCIndexer.h" 00003 #include "FWCore/Utilities/interface/Exception.h" 00004 00005 #include <iostream> 00006 00007 CSCNoiseMatrix::CSCNoiseMatrix(){} 00008 CSCNoiseMatrix::~CSCNoiseMatrix(){} 00009 00010 const CSCNoiseMatrix::Item & CSCNoiseMatrix::item(const CSCDetId & cscId, int strip) const 00011 { 00012 CSCIndexer indexer; 00013 NoiseMatrixMap::const_iterator mapItr = matrix.find( indexer.dbIndex(cscId, strip) ); 00014 if(mapItr == matrix.end()) 00015 { 00016 throw cms::Exception("CSCNoiseMatrix") 00017 << "Cannot find CSC conditions for chamber " << CSCDetId(cscId); 00018 } 00019 return mapItr->second.at(strip-1); 00020 } 00021 00022 00023 std::string CSCNoiseMatrix::Item::print() const 00024 { 00025 std::ostringstream os; 00026 os << elem33 << " " << elem34 << " " << elem35 << " " << elem44 << " " 00027 << elem45 << " " << elem46 << " " << elem55 << " " << elem56 << " " 00028 << elem57 << " " << elem66 << " " << elem67 << " " << elem77 << "\n"; 00029 return os.str(); 00030 } 00031 00032 std::string CSCNoiseMatrix::print() const 00033 { 00034 std::ostringstream os; 00035 for(NoiseMatrixMap::const_iterator mapItr = matrix.begin(); mapItr != matrix.end(); ++mapItr) 00036 { 00037 os << mapItr->first<< " "; 00038 for(std::vector<Item>::const_iterator itemItr = mapItr->second.begin(); 00039 itemItr != mapItr->second.end(); ++itemItr) 00040 { 00041 os << itemItr->print(); 00042 } 00043 } 00044 return os.str(); 00045 } 00046