CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CondCore/CSCPlugins/plugins/CSCBadChambersPyWrapper.cc

Go to the documentation of this file.
00001 #include "CondFormats/CSCObjects/interface/CSCBadChambers.h"
00002 #include "DataFormats/MuonDetId/interface/CSCIndexer.h"
00003 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00004 #include "CondCore/Utilities/interface/PayLoadInspector.h"
00005 #include "CondCore/Utilities/interface/InspectorPythonWrapper.h"
00006 #include <sstream>
00007 #include <string>
00008 #include <vector>
00009 
00010 namespace cond {
00011   
00012         template<>
00013         std::string PayLoadInspector<CSCBadChambers>::summary() const {
00014                 std::stringstream ss;
00015                 CSCIndexer indexer;
00017                 int numberOfChambers = object().numberOfChambers();
00018 
00020                 std::vector<int> vContainerInts = object().container();
00021                 std::vector<CSCDetId> vCSCDetIds;
00022                 std::vector<int>::const_iterator iInt;
00023                 //get vector of CSCDetId:
00024                 for (iInt = vContainerInts.begin(); iInt != vContainerInts.end(); ++iInt){
00025                         vCSCDetIds.push_back(indexer.detIdFromChamberIndex(*iInt));
00026                 }
00028                 //bool isInBadChamber0 = object().isInBadChamber( const CSCDetId& id );
00029 
00030                 //print data:
00031                 ss << "---Total of bad Chambers: " << numberOfChambers << std::endl;
00032                 ss << "--Bad chambers:" << std::endl;
00033                 iInt = vContainerInts.begin();
00034                 int index = 0;
00035                 for (std::vector<CSCDetId>::const_iterator iCSCDetId = vCSCDetIds.begin(); iCSCDetId != vCSCDetIds.end(); ++iCSCDetId, ++iInt){
00036                         ss << index++ << ". "<< "Id[" << *iInt
00037                            << "]-> Chamber index: " << indexer.chamberIndex( *iCSCDetId )
00038                            << "; Layer index: " << indexer.layerIndex( *iCSCDetId ) 
00039                            << ";"<< std::endl;
00040                 }
00041                 
00042                 return ss.str();
00043         }
00044 
00045 }
00046 PYTHON_WRAPPER(CSCBadChambers,CSCBadChambers);