Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:55

0001 #include "CondFormats/CSCObjects/interface/CSCNoiseMatrix.h"
0002 #include "DataFormats/MuonDetId/interface/CSCIndexer.h"
0003 #include "FWCore/Utilities/interface/Exception.h"
0004 
0005 #include <iostream>
0006 #include <sstream>
0007 
0008 CSCNoiseMatrix::CSCNoiseMatrix() {}
0009 CSCNoiseMatrix::~CSCNoiseMatrix() {}
0010 
0011 const CSCNoiseMatrix::Item& CSCNoiseMatrix::item(const CSCDetId& cscId, int strip) const {
0012   CSCIndexer indexer;
0013   NoiseMatrixMap::const_iterator mapItr = matrix.find(indexer.dbIndex(cscId, strip));
0014   if (mapItr == matrix.end()) {
0015     throw cms::Exception("CSCNoiseMatrix") << "Cannot find CSC conditions for chamber " << CSCDetId(cscId);
0016   }
0017   return mapItr->second.at(strip - 1);
0018 }
0019 
0020 std::string CSCNoiseMatrix::Item::print() const {
0021   std::ostringstream os;
0022   os << elem33 << " " << elem34 << " " << elem35 << " " << elem44 << " " << elem45 << " " << elem46 << " " << elem55
0023      << " " << elem56 << " " << elem57 << " " << elem66 << " " << elem67 << " " << elem77 << "\n";
0024   return os.str();
0025 }
0026 
0027 std::string CSCNoiseMatrix::print() const {
0028   std::ostringstream os;
0029   for (NoiseMatrixMap::const_iterator mapItr = matrix.begin(); mapItr != matrix.end(); ++mapItr) {
0030     os << mapItr->first << " ";
0031     for (std::vector<Item>::const_iterator itemItr = mapItr->second.begin(); itemItr != mapItr->second.end();
0032          ++itemItr) {
0033       os << itemItr->print();
0034     }
0035   }
0036   return os.str();
0037 }