00001 #ifndef EventFilter_RPCRawToDigi_debugDigisPrintout_h 00002 #define EventFilter_RPCRawToDigi_debugDigisPrintout_h 00003 00004 #include <string> 00005 #include <sstream> 00006 #include <vector> 00007 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" 00008 00009 namespace rpcrawtodigi { 00010 class DebugDigisPrintout { 00011 00012 struct MyDigi { 00013 uint32_t det; int strip; 00014 bool operator==(const MyDigi&o) const { 00015 return (det==o.det && strip==o.strip); 00016 } 00017 bool operator< (const MyDigi&o) const { 00018 if (this->det < o.det) return true; 00019 if (this->det > o.det) return false; 00020 if (this->strip < o.strip) return true; 00021 return false; 00022 } 00023 }; 00024 00025 public: 00026 std::string operator()(const RPCDigiCollection * digis) { 00027 std::ostringstream str; 00028 str << "DebugDigisPrintout:"; 00029 if (!digis) return str.str(); 00030 typedef DigiContainerIterator<RPCDetId, RPCDigi> DigiRangeIterator; 00031 std::vector<MyDigi> myDigis; 00032 00033 int nDet = 0; 00034 int nDigisAll = 0; 00035 for (DigiRangeIterator it=digis->begin(); it != digis->end(); it++) { 00036 nDet++; 00037 RPCDetId rpcDetId = (*it).first; 00038 uint32_t rawDetId = rpcDetId.rawId(); 00039 RPCDigiCollection::Range range = digis->get(rpcDetId); 00040 for (std::vector<RPCDigi>::const_iterator id = range.first; id != range.second; id++) { 00041 nDigisAll++; 00042 const RPCDigi & digi = (*id); 00043 MyDigi myDigi = { rawDetId, digi.strip() }; 00044 if (myDigis.end() == std::find(myDigis.begin(), myDigis.end(), myDigi)) 00045 myDigis.push_back(myDigi); 00046 } 00047 } 00048 std::sort(myDigis.begin(),myDigis.end()); 00049 str << " dets: "<<nDet<<" allDigis: "<<nDigisAll<<" unigueDigis: "<<myDigis.size()<<std::endl; 00050 for (std::vector<MyDigi>::const_iterator it = myDigis.begin(); it != myDigis.end(); ++it) 00051 str << "debugDIGI: "<< it->det<<", "<<it->strip<<std::endl; 00052 return str.str(); 00053 } 00054 }; 00055 } 00056 #endif 00057