CMS 3D CMS Logo

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