CMS 3D CMS Logo

DebugDigisPrintout.h
Go to the documentation of this file.
1 #ifndef EventFilter_RPCRawToDigi_debugDigisPrintout_h
2 #define EventFilter_RPCRawToDigi_debugDigisPrintout_h
3 
4 #include <algorithm>
5 #include <string>
6 #include <sstream>
7 #include <vector>
9 
10 namespace rpcrawtodigi {
12 
13  struct MyDigi {
14  uint32_t det; int strip; int bx;
15  bool operator==(const MyDigi&o) const {
16  return (det==o.det && strip==o.strip && bx==o.bx);
17  }
18  bool operator< (const MyDigi&o) const {
19  if (this->det < o.det) return true;
20  if (this->det > o.det) return false;
21  if (this->strip < o.strip) return true;
22  return false;
23  }
24  };
25 
26  public:
28  std::ostringstream str;
29  str << "DebugDigisPrintout:";
30  if (!digis) return str.str();
31  typedef DigiContainerIterator<RPCDetId, RPCDigi> DigiRangeIterator;
32  std::vector<MyDigi> myDigis;
33 
34  int nDet = 0;
35  int nDigisAll = 0;
36  for (DigiRangeIterator it=digis->begin(); it != digis->end(); it++) {
37  nDet++;
38  RPCDetId rpcDetId = (*it).first;
39  uint32_t rawDetId = rpcDetId.rawId();
40  RPCDigiCollection::Range range = digis->get(rpcDetId);
41  for (std::vector<RPCDigi>::const_iterator id = range.first; id != range.second; id++) {
42  nDigisAll++;
43  const RPCDigi & digi = (*id);
44  MyDigi myDigi = { rawDetId, digi.strip(), digi.bx() };
45  if (myDigis.end() == std::find(myDigis.begin(), myDigis.end(), myDigi))
46  myDigis.push_back(myDigi);
47  }
48  }
49  std::sort(myDigis.begin(),myDigis.end());
50  str << " dets: "<<nDet<<" allDigis: "<<nDigisAll<<" unigueDigis: "<<myDigis.size()<<std::endl;
51  for (std::vector<MyDigi>::const_iterator it = myDigis.begin(); it != myDigis.end(); ++it)
52  str << "debugDIGI: "<< it->det<<", "<<it->strip<<", "<<it->bx<<std::endl;
53  return str.str();
54  }
55  };
56 }
57 #endif
58 
int bx() const
Definition: RPCDigi.h:29
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
int strip() const
Definition: RPCDigi.h:28
bool operator==(const MyDigi &o) const
std::pair< const_iterator, const_iterator > Range
#define str(s)
bool operator<(const MyDigi &o) const
std::string operator()(const RPCDigiCollection *digis)