CMS 3D CMS Logo

SPReader Class Reference

#include <IORawData/CSCTFCommissioning/src/SPReader.h>

Inheritance diagram for SPReader:

FileReaderSP FileReaderSPNewFormat

List of all members.

Public Member Functions

void closeFile ()
virtual void Configure ()
virtual char * data ()
virtual int dataLength ()
virtual int disableBlock ()=0
virtual void Enable ()
virtual int enableBlock ()=0
virtual int endBlockRead ()=0
int openFile (string filename)
virtual void printStats ()
bool readNextEvent ()
 assumes readNextEvent has been called
virtual int readSP (unsigned short **buf, const bool debug=false)=0
 assumes fd_schar has been set
virtual int reset ()=0
 SPReader ()
virtual ~SPReader ()

Public Attributes

unsigned short errorFlag

Protected Member Functions

virtual int chunkSize ()=0
 How many bytes to read at a time.

Protected Attributes

int fd_schar
bool liveData_
int nbyte_schar
unsigned long nbytes_schar
int npack_schar
unsigned short * theBuffer
int theDataLength


Detailed Description

Definition at line 9 of file SPReader.h.


Constructor & Destructor Documentation

SPReader::SPReader (  )  [inline]

Definition at line 12 of file SPReader.h.

virtual SPReader::~SPReader (  )  [inline, virtual]

Definition at line 13 of file SPReader.h.

00013 {};


Member Function Documentation

virtual int SPReader::chunkSize (  )  [protected, pure virtual]

How many bytes to read at a time.

Implemented in FileReaderSP, and FileReaderSPNewFormat.

void SPReader::closeFile (  ) 

Definition at line 49 of file SPReader.cc.

References fd_schar.

00049                          {
00050   if(fd_schar != -1000)
00051     close(fd_schar);
00052 }

virtual void SPReader::Configure (  )  [inline, virtual]

Reimplemented in FileReaderSP, and FileReaderSPNewFormat.

Definition at line 14 of file SPReader.h.

00014 {};

virtual char* SPReader::data ( void   )  [inline, virtual]

Definition at line 21 of file SPReader.h.

References theBuffer.

Referenced by CSCTFFileReader::fillRawData().

00021 {return (char *) theBuffer;}

virtual int SPReader::dataLength (  )  [inline, virtual]

Definition at line 22 of file SPReader.h.

References theDataLength.

Referenced by CSCTFFileReader::fillRawData().

00022 {return theDataLength;}

virtual int SPReader::disableBlock (  )  [pure virtual]

Implemented in FileReaderSP, and FileReaderSPNewFormat.

virtual void SPReader::Enable (  )  [inline, virtual]

Definition at line 15 of file SPReader.h.

00015 {};

virtual int SPReader::enableBlock (  )  [pure virtual]

Implemented in FileReaderSP, and FileReaderSPNewFormat.

virtual int SPReader::endBlockRead (  )  [pure virtual]

Implemented in FileReaderSP, and FileReaderSPNewFormat.

int SPReader::openFile ( string  filename  ) 

Definition at line 14 of file SPReader.cc.

References TestMuL1L2Filter_cff::cerr, lat::endl(), and fd_schar.

Referenced by CSCTFFileReader::CSCTFFileReader().

00014                                       {
00015   
00016   fd_schar = open(filename.c_str(), O_RDONLY);
00017   // Abort in case of any failure
00018   if (fd_schar == -1) {
00019     cerr << "SPReader: FATAL in openFile - " << strerror(errno) << endl;
00020     cerr << "SPReader will abort!!!" << endl;
00021     abort();
00022   }
00023   return 0;
00024 }

void SPReader::printStats (  )  [virtual]

Definition at line 43 of file SPReader.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nbytes_schar, and npack_schar.

00044 {
00045   cout << " npackets " << dec << npack_schar
00046        << " nbytes " << nbytes_schar << endl;
00047 }

bool SPReader::readNextEvent (  ) 

assumes readNextEvent has been called

Definition at line 26 of file SPReader.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), NULL, readSP(), theBuffer, and theDataLength.

Referenced by CSCTFFileReader::fillRawData().

00026                              {
00027   bool debug = false;
00028   if(theBuffer)
00029     {
00030       delete theBuffer;
00031       theBuffer = NULL;
00032     }
00033   unsigned short ** buf2 = new unsigned short*;
00034   theDataLength = readSP(buf2, debug);
00035   if (debug) cout << " theDataLength " << theDataLength << endl;
00036   if(theDataLength<=4) return false;
00037   unsigned short * buf=(unsigned short *)*buf2;
00038   theBuffer = buf;
00039   delete buf2;
00040   return true;
00041 }

virtual int SPReader::readSP ( unsigned short **  buf,
const bool  debug = false 
) [pure virtual]

assumes fd_schar has been set

Implemented in FileReaderSP, and FileReaderSPNewFormat.

Referenced by readNextEvent().

virtual int SPReader::reset (  )  [pure virtual]

Implemented in FileReaderSP, and FileReaderSPNewFormat.


Member Data Documentation

unsigned short SPReader::errorFlag

Definition at line 32 of file SPReader.h.

int SPReader::fd_schar [protected]

Definition at line 39 of file SPReader.h.

Referenced by closeFile(), FileReaderSP::fillMiniBuf(), openFile(), FileReaderSPNewFormat::readSP(), and FileReaderSP::readSP().

bool SPReader::liveData_ [protected]

Definition at line 43 of file SPReader.h.

int SPReader::nbyte_schar [protected]

Definition at line 42 of file SPReader.h.

unsigned long SPReader::nbytes_schar [protected]

Definition at line 40 of file SPReader.h.

Referenced by printStats().

int SPReader::npack_schar [protected]

Definition at line 41 of file SPReader.h.

Referenced by printStats().

unsigned short* SPReader::theBuffer [protected]

Definition at line 46 of file SPReader.h.

Referenced by data(), and readNextEvent().

int SPReader::theDataLength [protected]

Definition at line 47 of file SPReader.h.

Referenced by dataLength(), and readNextEvent().


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