CMS 3D CMS Logo

RawToText Class Reference

#include <L1Trigger/TextToDigi/plugins/RawToText.h>

Inheritance diagram for RawToText:

edm::EDAnalyzer

List of all members.

Public Member Functions

 RawToText (const edm::ParameterSet &)
 ~RawToText ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()

Private Attributes

int fedId_
std::ofstream file_
std::string filename_
edm::InputTag inputLabel_
int nevt_


Detailed Description

Definition at line 25 of file RawToText.h.


Constructor & Destructor Documentation

RawToText::RawToText ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 16 of file RawToText.cc.

References lat::endl(), and filename_.

00016                                                    :
00017   inputLabel_(iConfig.getParameter<edm::InputTag>("inputLabel")),
00018   fedId_(iConfig.getUntrackedParameter<int>("fedId", 745)),
00019   filename_(iConfig.getUntrackedParameter<std::string>("filename", "slinkOutput.txt")),
00020   nevt_(0) {
00021   edm::LogInfo("TextToDigi") << "Creating ASCII dump " << filename_ << std::endl;
00022 }

RawToText::~RawToText (  ) 

Definition at line 25 of file RawToText.cc.

00025 {}


Member Function Documentation

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 d, data, FEDRawData::data(), lat::endl(), fedId_, file_, flush(), edm::Event::getByLabel(), i, inputLabel_, j, nevt_, and FEDRawData::size().

00028                                                                            {
00029 
00030   nevt_++;
00031   
00032   // get raw data collection
00033   edm::Handle<FEDRawDataCollection> feds;
00034   iEvent.getByLabel(inputLabel_, feds);
00035   const FEDRawData& gctRcd = feds->FEDData(fedId_);
00036    
00037   edm::LogInfo("GCT") << "Upacking FEDRawData of size " 
00038                       << std::dec << gctRcd.size() 
00039                       << std::endl;
00040   
00041   // do a simple check of the raw data
00042   if (gctRcd.size()<16) {
00043     edm::LogWarning("Invalid Data") 
00044       << "Empty/invalid GCT raw data, size = " << gctRcd.size()
00045       << std::endl;
00046     return;
00047   }
00048   
00049   const unsigned char * data = gctRcd.data();
00050   
00051   int eventSize = gctRcd.size() / 4;
00052 
00053   unsigned long d = 0;
00054   for(int i=0; i<eventSize; i++) {
00055     d = 0;
00056     //d  = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) + (data[i*4+3]<<24);
00057     for(int j=0; j<4; j++) {
00058       d += ((data[i*4+j]&0xff)<<(8*j));
00059     }
00060     file_ << std::setw(8) << std::setfill('0') << std::hex  << d << std::endl;
00061   }
00062   file_ << std::flush << std::endl;
00063 
00064 }

void RawToText::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file RawToText.cc.

References lat::endl(), file_, filename_, and out.

00067                                              {
00068   
00069   // open VME file
00070   file_.open(filename_.c_str(), std::ios::out);
00071   
00072   if(!file_.good()) { 
00073     edm::LogInfo("RawToText") << "Failed to open ASCII file " << filename_ 
00074                               << std::endl; 
00075   }
00076 }

void RawToText::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 79 of file RawToText.cc.

References file_.

00079                        {
00080   file_.close();
00081 }


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:39 2009 for CMSSW by  doxygen 1.5.4