44 <<
"[DTDDUFileReader]: the input file: " << filename <<
" is not present";
46 cout <<
"DTDDUFileReader: DaqSource file '" << filename <<
"' was succesfully opened" << endl;
49 uint32_t runNumber_tmp;
57 cout<<
" Dear user, pleas be patient, "<<skipEvents<<
" are being skipped .."<<endl;
73 vector<uint64_t> eventData;
74 size_t estimatedEventDimension = 102400;
75 eventData.reserve(estimatedEventDimension);
78 bool haederTag =
false;
80 bool headerAlreadyFound =
false;
86 while ( !
isTrailer(word, dataTag, wordCount) ) {
93 cout<<
"[DTDDUFileReader]: ERROR! no more words and failed to get the trailer"<<endl;
103 cout<<
"[DTDDUFileReader]: ERROR! failed to get the trailer"<<endl;
110 if (!headerAlreadyFound)
112 headerAlreadyFound=
true;
127 eventData.push_back(word);
151 if ( dduID<770 || dduID > 775 ) {
152 cout<<
"[DTDDUFileReader]: ERROR. DDU ID out of range. DDU id="<<
dduID<<endl;
157 fedRawData.
resize(eventDataSize);
159 copy(reinterpret_cast<unsigned char*>(&eventData[0]),
160 reinterpret_cast<unsigned char*>(&eventData[0]) + eventDataSize, fedRawData.
data());
172 uint32_t msBits_tmp = newWorld->
msBits;
174 newWorld->
lsBits = msBits_tmp;
189 uint32_t
data[2] = {0, 0};
191 data[0] |= td[3] & 0x3ffff;
192 data[0] |= (td[2] << 18 ) & 0xfffc0000;
193 data[1] |= (td[2] >> 14 ) & 0x0f;
194 data[1] |= (td[1] << 4 ) & 0x3ffff0;
195 data[1] |= (td[0] << 22 ) & 0xffc00000;
197 isData = ( td[0] >> 10 ) & 0x01;
200 dduWord = (
uint64_t(data[1]) << 32) | data[0];
208 FEDHeader candidate(reinterpret_cast<const unsigned char*>(&word));
209 if ( candidate.
check() ) {
223 FEDTrailer candidate(reinterpret_cast<const unsigned char*>(&word));
224 if ( candidate.
check() ) {
227 if ( wordCount == candidate.
lenght())
T getUntrackedParameter(std::string const &, T const &) const
virtual bool checkEndOfFile()
DTDDUFileReader(const edm::ParameterSet &pset)
Constructor.
RawFile * open(const char *path)
Open file.
bool isHeader(uint64_t word, bool dataTag)
check for a 64 bits word to be a DDU header
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)
void swap(uint64_t &word)
swapping the lsBits with the msBits
edm::RunNumber_t runNumber
edm::EventNumber_t eventNumber
int eof()
Check end of file.
unsigned long long uint64_t
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
int ignore(long offset)
Ignore some bytes.
virtual int fillRawData(edm::EventID &eID, edm::Timestamp &tstamp, FEDRawDataCollection *&data)
Generate and fill FED raw data for a full event.
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
uint64_t dmaUnpack(bool &isData, int &nread)
pre-unpack the data if read via DMA
bool isTrailer(uint64_t word, bool dataTag, int wordCount)
check for a 64 bits word to be a DDU trailer
static const int dduWordLength
virtual ~DTDDUFileReader()
Destructor.