#include <RawToText.h>
Public Member Functions | |
RawToText (const edm::ParameterSet &) | |
~RawToText () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | endJob () |
Private Attributes | |
int | fedId_ |
std::ofstream | file_ |
std::string | filename_ |
edm::InputTag | inputLabel_ |
int | nevt_ |
Definition at line 25 of file RawToText.h.
RawToText::RawToText | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 16 of file RawToText.cc.
References filename_.
: inputLabel_(iConfig.getParameter<edm::InputTag>("inputLabel")), fedId_(iConfig.getUntrackedParameter<int>("fedId", 745)), filename_(iConfig.getUntrackedParameter<std::string>("filename", "slinkOutput.txt")), nevt_(0) { edm::LogInfo("TextToDigi") << "Creating ASCII dump " << filename_ << std::endl; }
RawToText::~RawToText | ( | ) |
Definition at line 25 of file RawToText.cc.
{}
void RawToText::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 28 of file RawToText.cc.
References FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, fedId_, file_, edm::Event::getByLabel(), i, inputLabel_, j, nevt_, and FEDRawData::size().
{ nevt_++; // get raw data collection edm::Handle<FEDRawDataCollection> feds; iEvent.getByLabel(inputLabel_, feds); const FEDRawData& gctRcd = feds->FEDData(fedId_); edm::LogInfo("GCT") << "Upacking FEDRawData of size " << std::dec << gctRcd.size() << std::endl; // do a simple check of the raw data if (gctRcd.size()<16) { edm::LogWarning("Invalid Data") << "Empty/invalid GCT raw data, size = " << gctRcd.size() << std::endl; return; } const unsigned char * data = gctRcd.data(); int eventSize = gctRcd.size() / 4; unsigned long d = 0; for(int i=0; i<eventSize; i++) { d = 0; //d = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) + (data[i*4+3]<<24); for(int j=0; j<4; j++) { d += ((data[i*4+j]&0xff)<<(8*j)); } file_ << std::setw(8) << std::setfill('0') << std::hex << d << std::endl; } file_ << std::flush << std::endl; }
void RawToText::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 67 of file RawToText.cc.
References file_, filename_, and dbtoconf::out.
{ // open VME file file_.open(filename_.c_str(), std::ios::out); if(!file_.good()) { edm::LogInfo("RawToText") << "Failed to open ASCII file " << filename_ << std::endl; } }
void RawToText::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 79 of file RawToText.cc.
References file_.
{ file_.close(); }
int RawToText::fedId_ [private] |
Definition at line 41 of file RawToText.h.
Referenced by analyze().
std::ofstream RawToText::file_ [private] |
Definition at line 45 of file RawToText.h.
Referenced by analyze(), beginJob(), and endJob().
std::string RawToText::filename_ [private] |
Definition at line 44 of file RawToText.h.
Referenced by beginJob(), and RawToText().
edm::InputTag RawToText::inputLabel_ [private] |
Definition at line 38 of file RawToText.h.
Referenced by analyze().
int RawToText::nevt_ [private] |
Definition at line 47 of file RawToText.h.
Referenced by analyze().