CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

EcalHexDisplay Class Reference

#include <EcalHexDisplay.h>

Inheritance diagram for EcalHexDisplay:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EcalHexDisplay (const edm::ParameterSet &ps)

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)

Protected Attributes

int beg_fed_id_
int end_fed_id_
int event_
std::string filename_
int first_event_
int last_event_
int verbosity_
bool writeDcc_

Detailed Description

Author:
G. Franzoni

Definition at line 26 of file EcalHexDisplay.h.


Constructor & Destructor Documentation

EcalHexDisplay::EcalHexDisplay ( const edm::ParameterSet ps)
Author:
G. Franzoni

Definition at line 9 of file EcalHexDisplay.cc.

                                                        :
    verbosity_ (ps.getUntrackedParameter<int>("verbosity",1)),
    beg_fed_id_ (ps.getUntrackedParameter<int>("beg_fed_id",0)),
    end_fed_id_ (ps.getUntrackedParameter<int>("end_fed_id",654)),
    first_event_ (ps.getUntrackedParameter<int>("first_event",1)),
    last_event_  (ps.getUntrackedParameter<int>("last_event",9999999)),
    event_ (0),
    writeDcc_ (ps.getUntrackedParameter<bool>("writeDCC",false)),
    filename_ (ps.getUntrackedParameter<std::string>("filename","dump.bin"))
{  
}

Member Function Documentation

void EcalHexDisplay::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 21 of file EcalHexDisplay.cc.

References beg_fed_id_, gather_cfg::cout, FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, end_fed_id_, event_, filename_, first_event_, edm::Event::getByType(), last_event_, FEDNumbering::MAXFEDID, lumiPlot::rawdata, FEDRawData::size(), and writeDcc_.

                                                                        {
  
  event_++;
  if (event_ < first_event_ || last_event_ < event_) return;
  

  edm::Handle<FEDRawDataCollection> rawdata;
  e.getByType(rawdata);  

  std::ofstream dumpFile (filename_.c_str(),std::ios::app );
  
  for (int id= 0; id<=FEDNumbering::MAXFEDID; ++id){ 
    
    if (id < beg_fed_id_ || end_fed_id_ < id) continue;

    const FEDRawData& data = rawdata->FEDData(id);
    
    if (data.size()>4){      
      
      std::cout << "\n\n\n[EcalHexDumperModule] Event: " 
                << std::dec << event_ 
                << " fed_id: " << id 
                << " size_fed: " << data.size() << "\n"<< std::endl;
      
      if ( ( data.size() %16 ) !=0)
        {
          std::cout << "***********************************************" << std::endl;
          std::cout<< "Fed size in bits not multiple of 64, strange." << std::endl;
          std::cout << "***********************************************" << std::endl;
        }
      
      
      int length = data.size();
      const unsigned long               * pData     = ( reinterpret_cast<unsigned long*>(const_cast<unsigned char*> ( data.data())));
      std::cout << std::setfill('0');
      for (int words=0; words < length/4; (words+=2)  )
        {
          std::cout << std::setw(8)   << std::hex << pData[words+1] << " ";
          std::cout << std::setw(8)   << std::hex << pData[words] << std::endl;
        }

      std::cout << "\n";


      if (beg_fed_id_ <= id && id <= end_fed_id_ && writeDcc_)
        {
          dumpFile.write( reinterpret_cast <const char *> (pData), length);
        }
    }
    
  }
  dumpFile.close();    
  if (! writeDcc_) remove(filename_.c_str()); 
}

Member Data Documentation

int EcalHexDisplay::beg_fed_id_ [protected]

Definition at line 33 of file EcalHexDisplay.h.

Referenced by analyze().

int EcalHexDisplay::end_fed_id_ [protected]

Definition at line 34 of file EcalHexDisplay.h.

Referenced by analyze().

int EcalHexDisplay::event_ [protected]

Definition at line 37 of file EcalHexDisplay.h.

Referenced by analyze().

std::string EcalHexDisplay::filename_ [protected]

Definition at line 39 of file EcalHexDisplay.h.

Referenced by analyze().

Definition at line 35 of file EcalHexDisplay.h.

Referenced by analyze().

int EcalHexDisplay::last_event_ [protected]

Definition at line 36 of file EcalHexDisplay.h.

Referenced by analyze().

int EcalHexDisplay::verbosity_ [protected]

Definition at line 32 of file EcalHexDisplay.h.

bool EcalHexDisplay::writeDcc_ [protected]

Definition at line 38 of file EcalHexDisplay.h.

Referenced by analyze().