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