CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
19 }
20 
22 
23  event_++;
24  if (event_ < first_event_ || last_event_ < event_) return;
25 
26 
28  e.getByType(rawdata);
29 
30  std::ofstream dumpFile (filename_.c_str(),std::ios::app );
31 
32  for (int id= 0; id<=FEDNumbering::MAXFEDID; ++id){
33 
34  if (id < beg_fed_id_ || end_fed_id_ < id) continue;
35 
36  const FEDRawData& data = rawdata->FEDData(id);
37 
38  if (data.size()>4){
39 
40  std::cout << "\n\n\n[EcalHexDumperModule] Event: "
41  << std::dec << event_
42  << " fed_id: " << id
43  << " size_fed: " << data.size() << "\n"<< std::endl;
44 
45  if ( ( data.size() %16 ) !=0)
46  {
47  std::cout << "***********************************************" << std::endl;
48  std::cout<< "Fed size in bits not multiple of 64, strange." << std::endl;
49  std::cout << "***********************************************" << std::endl;
50  }
51 
52 
53  int length = data.size();
54  const unsigned long * pData = ( reinterpret_cast<unsigned long*>(const_cast<unsigned char*> ( data.data())));
55  std::cout << std::setfill('0');
56  for (int words=0; words < length/4; (words+=2) )
57  {
58  std::cout << std::setw(8) << std::hex << pData[words+1] << " ";
59  std::cout << std::setw(8) << std::hex << pData[words] << std::endl;
60  }
61 
62  std::cout << "\n";
63 
64 
65  if (beg_fed_id_ <= id && id <= end_fed_id_ && writeDcc_)
66  {
67  dumpFile.write( reinterpret_cast <const char *> (pData), length);
68  }
69  }
70 
71  }
72  dumpFile.close();
73  if (! writeDcc_) remove(filename_.c_str());
74 }
75 
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
void analyze(const edm::Event &e, const edm::EventSetup &c)
EcalHexDisplay(const edm::ParameterSet &ps)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void event_()
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
tuple cout
Definition: gather_cfg.py:121
dictionary rawdata
Definition: lumiPlot.py:393
std::string filename_