File indexing completed on 2023-03-17 11:00:13
0001 #ifndef EventFilter_RPCRawToDigi_debugDigisPrintout_h
0002 #define EventFilter_RPCRawToDigi_debugDigisPrintout_h
0003
0004 #include <algorithm>
0005 #include <string>
0006 #include <sstream>
0007 #include <vector>
0008 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
0009
0010 namespace rpcrawtodigi {
0011 class DebugDigisPrintout {
0012 struct MyDigi {
0013 uint32_t det;
0014 int strip;
0015 int bx;
0016 bool operator==(const MyDigi& o) const { return (det == o.det && strip == o.strip && bx == o.bx); }
0017 bool operator<(const MyDigi& o) const {
0018 if (this->det < o.det)
0019 return true;
0020 if (this->det > o.det)
0021 return false;
0022 if (this->strip < o.strip)
0023 return true;
0024 return false;
0025 }
0026 };
0027
0028 public:
0029 std::string operator()(const RPCDigiCollection* digis) {
0030 std::ostringstream str;
0031 str << "DebugDigisPrintout:";
0032 if (!digis)
0033 return str.str();
0034 typedef DigiContainerIterator<RPCDetId, RPCDigi> DigiRangeIterator;
0035 std::vector<MyDigi> myDigis;
0036
0037 int nDet = 0;
0038 int nDigisAll = 0;
0039 for (DigiRangeIterator it = digis->begin(); it != digis->end(); it++) {
0040 nDet++;
0041 RPCDetId rpcDetId = (*it).first;
0042 uint32_t rawDetId = rpcDetId.rawId();
0043 RPCDigiCollection::Range range = digis->get(rpcDetId);
0044 for (std::vector<RPCDigi>::const_iterator id = range.first; id != range.second; id++) {
0045 nDigisAll++;
0046 const RPCDigi& digi = (*id);
0047 MyDigi myDigi = {rawDetId, digi.strip(), digi.bx()};
0048 if (myDigis.end() == std::find(myDigis.begin(), myDigis.end(), myDigi))
0049 myDigis.push_back(myDigi);
0050 }
0051 }
0052 std::sort(myDigis.begin(), myDigis.end());
0053 str << " dets: " << nDet << " allDigis: " << nDigisAll << " unigueDigis: " << myDigis.size() << std::endl;
0054 for (std::vector<MyDigi>::const_iterator it = myDigis.begin(); it != myDigis.end(); ++it)
0055 str << "debugDIGI: " << it->det << ", " << it->strip << ", " << it->bx << std::endl;
0056 return str.str();
0057 }
0058 };
0059 }
0060 #endif