ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/baumgartel/CSC/CSCPlugins/plugins/CSCBadChambersPyWrapper.cc
Revision: 1.1
Committed: Wed Jun 15 09:56:25 2011 UTC (13 years, 10 months ago) by darinb
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
First template of CSC Plugins

File Contents

# User Rev Content
1 darinb 1.1 #include "CondFormats/CSCObjects/interface/CSCBadChambers.h"
2     #include "DataFormats/MuonDetId/interface/CSCIndexer.h"
3     #include "DataFormats/MuonDetId/interface/CSCDetId.h"
4     #include "CondCore/Utilities/interface/PayLoadInspector.h"
5     #include "CondCore/Utilities/interface/InspectorPythonWrapper.h"
6     #include <sstream>
7     #include <string>
8     #include <vector>
9    
10     namespace cond {
11    
12     template<>
13     std::string PayLoadInspector<CSCBadChambers>::summary() const {
14     std::stringstream ss;
15     CSCIndexer indexer;
16     /// How many bad chambers are there
17     int numberOfChambers = object().numberOfChambers();
18    
19     /// Return the container of bad chambers
20     std::vector<int> vContainerInts = object().container();
21     std::vector<CSCDetId> vCSCDetIds;
22     std::vector<int>::const_iterator iInt;
23     //get vector of CSCDetId:
24     for (iInt = vContainerInts.begin(); iInt != vContainerInts.end(); ++iInt){
25     vCSCDetIds.push_back(indexer.detIdFromChamberIndex(*iInt));
26     }
27     /// Is the given chamber flagged as bad?
28     //bool isInBadChamber0 = object().isInBadChamber( const CSCDetId& id );
29    
30     //print data:
31     ss << "---Total of bad Chambers: " << numberOfChambers << std::endl;
32     ss << "--Bad chambers:" << std::endl;
33     iInt = vContainerInts.begin();
34     int index = 0;
35     for (std::vector<CSCDetId>::const_iterator iCSCDetId = vCSCDetIds.begin(); iCSCDetId != vCSCDetIds.end(); ++iCSCDetId, ++iInt){
36     ss << index++ << ". "<< "Id[" << *iInt
37     << "]-> Chamber index: " << indexer.chamberIndex( *iCSCDetId )
38     << "; Layer index: " << indexer.layerIndex( *iCSCDetId )
39     << ";"<< std::endl;
40     }
41    
42     return ss.str();
43     }
44    
45     }
46     PYTHON_WRAPPER(CSCBadChambers,CSCBadChambers);