34 runNum(1), eventNum(0) {
43 <<
"DTROS8FileReader: the input file: " << filename <<
" is not present";
46 produces<FEDRawDataCollection>();
71 if ( nread<=0 )
throw 1;
75 int* eventData =
new int[numberOfWords];
77 if ( nread<=0 )
throw 1;
81 if ( numberOfWords <= 0 || eventData[numberOfWords-1] != numberOfWords ) {
82 cout <<
"[DTROS8FileReader]: word counter mismatch exception: " 83 << numberOfWords <<
" " << eventData[numberOfWords-1] << endl;
88 int* head = eventData + 1;
102 eID =
EventID( head[0], 1
U, head[1]*head[2]);
105 int* rosData = eventData + head[4];
110 int adjustment = (eventDataSize/4)%2 == 1 ? 4 : 0;
117 fedRawData.
resize(eventDataSize+adjustment);
120 copy(reinterpret_cast<unsigned char*>(rosData),
121 reinterpret_cast<unsigned char*>(rosData) + eventDataSize, fedRawData.
data());
132 cout <<
"[DTROS8FileReader]: END OF FILE REACHED. " 133 <<
"No information read for the requested event" << endl;
134 delete data; data=
nullptr;
138 cout <<
"[DTROS8FileReader]: PROBLEM WITH EVENT INFORMATION ON THE FILE. " 139 <<
"EVENT DATA READING FAILED code= " << i << endl;
140 delete data; data=
nullptr;
152 std::unique_ptr<FEDRawDataCollection> bare_product(fedcoll);
T getUntrackedParameter(std::string const &, T const &) const
~DTROS8FileReader() override
Destructor.
virtual bool checkEndOfFile()
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::Event &, edm::EventSetup const &) override
virtual int fillRawData(edm::Event &e, FEDRawDataCollection *&data)
Generate and fill FED raw data for a full event.
RawFile * open(const char *path)
Open file.
int read(void *data, size_t nbytes)
Read from file.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
int close()
Close file if necessary.
void resize(size_t newsize)
int eof()
Check end of file.
static const int ros8WordLenght
DTROS8FileReader(const edm::ParameterSet &pset)
Constructor.
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.