CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/CondFormats/CSCObjects/src/CSCNoiseMatrix.cc

Go to the documentation of this file.
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 #include <sstream>
00007 
00008 CSCNoiseMatrix::CSCNoiseMatrix(){}
00009 CSCNoiseMatrix::~CSCNoiseMatrix(){}
00010 
00011 const CSCNoiseMatrix::Item & CSCNoiseMatrix::item(const CSCDetId & cscId, int strip) const
00012 {
00013   CSCIndexer indexer;
00014   NoiseMatrixMap::const_iterator mapItr = matrix.find( indexer.dbIndex(cscId, strip) );
00015   if(mapItr == matrix.end())
00016   {
00017     throw cms::Exception("CSCNoiseMatrix")
00018       << "Cannot find CSC conditions for chamber " << CSCDetId(cscId);
00019   }
00020   return mapItr->second.at(strip-1);
00021 }
00022 
00023 
00024 std::string CSCNoiseMatrix::Item::print() const
00025 {
00026   std::ostringstream os;
00027   os << elem33 << " " << elem34 << " " << elem35 << " " << elem44 << " "
00028      << elem45 << " " << elem46 << " " << elem55 << " " << elem56 << " "
00029      << elem57 << " " << elem66 << " " << elem67 << " " << elem77 << "\n";
00030   return os.str();
00031 }
00032 
00033 std::string CSCNoiseMatrix::print() const
00034 {
00035   std::ostringstream os;
00036   for(NoiseMatrixMap::const_iterator mapItr = matrix.begin(); mapItr != matrix.end(); ++mapItr)
00037   {
00038     os << mapItr->first<< " ";
00039     for(std::vector<Item>::const_iterator itemItr = mapItr->second.begin(); 
00040         itemItr != mapItr->second.end(); ++itemItr)
00041     {
00042       os << itemItr->print();
00043     }
00044   }
00045   return os.str();
00046 }
00047