CMS 3D CMS Logo

EcalHexDisplay.cc
Go to the documentation of this file.
1 
8 
10  : verbosity_(ps.getUntrackedParameter<int>("verbosity", 1)),
11  beg_fed_id_(ps.getUntrackedParameter<int>("beg_fed_id", 0)),
12  end_fed_id_(ps.getUntrackedParameter<int>("end_fed_id", 654)),
13  first_event_(ps.getUntrackedParameter<int>("first_event", 1)),
14  last_event_(ps.getUntrackedParameter<int>("last_event", 9999999)),
15  event_(0),
16  writeDcc_(ps.getUntrackedParameter<bool>("writeDCC", false)),
17  filename_(ps.getUntrackedParameter<std::string>("filename", "dump.bin")),
18  fedRawDataCollectionToken_(
19  consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("fedRawDataCollectionTag"))) {}
20 
22  event_++;
24  return;
25 
27 
28  std::ofstream dumpFile(filename_.c_str(), std::ios::app);
29 
30  for (int id = 0; id <= FEDNumbering::MAXFEDID; ++id) {
31  if (id < beg_fed_id_ || end_fed_id_ < id)
32  continue;
33 
34  const FEDRawData& data = rawdata->FEDData(id);
35 
36  if (data.size() > 4) {
37  edm::LogVerbatim("EcalTools") << "\n\n\n[EcalHexDumperModule] Event: " << std::dec << event_ << " fed_id: " << id
38  << " size_fed: " << data.size() << "\n";
39 
40  if ((data.size() % 16) != 0) {
41  edm::LogVerbatim("EcalTools") << "***********************************************";
42  edm::LogVerbatim("EcalTools") << "Fed size in bits not multiple of 64, strange.";
43  edm::LogVerbatim("EcalTools") << "***********************************************";
44  }
45 
46  int length = data.size();
47  const unsigned long* pData = (reinterpret_cast<unsigned long*>(const_cast<unsigned char*>(data.data())));
48  edm::LogVerbatim("EcalTools") << std::setfill('0');
49  for (int words = 0; words < length / 4; (words += 2)) {
50  edm::LogVerbatim("EcalTools") << std::setw(8) << std::hex << pData[words + 1] << " " << std::setw(8) << std::hex
51  << pData[words];
52  }
53 
54  edm::LogVerbatim("EcalTools") << "\n";
55 
56  if (beg_fed_id_ <= id && id <= end_fed_id_ && writeDcc_) {
57  dumpFile.write(reinterpret_cast<const char*>(pData), length);
58  }
59  }
60  }
61  dumpFile.close();
62  if (!writeDcc_)
63  remove(filename_.c_str());
64 }
Log< level::Info, true > LogVerbatim
const edm::EDGetTokenT< FEDRawDataCollection > fedRawDataCollectionToken_
EcalHexDisplay(const edm::ParameterSet &ps)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
std::string filename_