32 const string&
filename =
pset.getUntrackedParameter<
string>(
"fileName");
40 throw cms::Exception(
"InputFileMissing") <<
"[DTDDUFileReader]: the input file: " <<
filename <<
" is not present";
42 cout <<
"DTDDUFileReader: DaqSource file '" <<
filename <<
"' was succesfully opened" << endl;
45 uint32_t runNumber_tmp = 1;
53 cout <<
" Dear user, please be patient, " <<
skipEvents <<
" are being skipped .." << endl;
57 produces<FEDRawDataCollection>();
68 vector<uint64_t> eventData;
69 size_t estimatedEventDimension = 102400;
70 eventData.reserve(estimatedEventDimension);
73 bool haederTag =
false;
75 bool headerAlreadyFound =
false;
88 cout <<
"[DTDDUFileReader]: ERROR! no more words and failed to get the trailer" << endl;
99 cout <<
"[DTDDUFileReader]: ERROR! failed to get the trailer" << endl;
107 if (!headerAlreadyFound)
109 headerAlreadyFound =
true;
123 eventData.push_back(
word);
144 if (dduID < 770 || dduID > 775) {
145 cout <<
"[DTDDUFileReader]: ERROR. DDU ID out of range. DDU id=" <<
dduID << endl;
152 copy(reinterpret_cast<unsigned char*>(&eventData[0]),
153 reinterpret_cast<unsigned char*>(&eventData[0]) + eventDataSize,
164 std::unique_ptr<FEDRawDataCollection> bare_product(fedcoll);
171 uint32_t msBits_tmp = newWorld->
msBits;
173 newWorld->
lsBits = msBits_tmp;
186 uint32_t
data[2] = {0, 0};
188 data[0] |= td[3] & 0x3ffff;
189 data[0] |= (td[2] << 18) & 0xfffc0000;
190 data[1] |= (td[2] >> 14) & 0x0f;
191 data[1] |= (td[1] << 4) & 0x3ffff0;
192 data[1] |= (td[0] << 22) & 0xffc00000;
194 isData = (td[0] >> 10) & 0x01;
204 FEDHeader candidate(reinterpret_cast<const unsigned char*>(&
word));
205 if (candidate.
check()) {
217 FEDTrailer candidate(reinterpret_cast<const unsigned char*>(&
word));
218 if (candidate.
check()) {
virtual int fillRawData(edm::Event &e, FEDRawDataCollection *&data)
Generate and fill FED raw data for a full event.
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.
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
int close()
Close file if necessary.
void produce(edm::Event &, edm::EventSetup const &) override
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 ignore(long offset)
Ignore some bytes.
char data[epos_bytes_allocation]
bool isTrailer(uint64_t word, bool dataTag, unsigned int wordCount)
check for a 64 bits word to be a DDU trailer
uint64_t dmaUnpack(bool &isData, int &nread)
pre-unpack the data if read via DMA
bool check() const
Check that the trailer is OK.
static const int dduWordLength
~DTDDUFileReader() override
Destructor.