35 unsigned char* tcds_pointer =
nullptr;
39 uint32_t L1EventID =
event_->event();
45 }
else if (tcds_pointer ==
nullptr) {
46 uint32_t L1EventID =
event_->event();
47 throw cms::Exception(
"DAQSource::read") <<
"No TCDS FED in event with FEDHeader EID -: " << L1EventID;
71 unsigned char*& tcds_pointer) {
74 gettimeofday(&stv,
nullptr);
79 uint32_t eventSize =
event_->eventSize();
80 unsigned char*
event = (
unsigned char*)
event_->payload();
81 tcds_pointer =
nullptr;
83 uint16_t selectedTCDSFed = 0;
84 while (eventSize > 0) {
94 throw cms::Exception(
"DAQSource::fillFEDRawDataCollection") <<
"Out of range FED ID : " <<
fedId;
96 if (!selectedTCDSFed) {
97 selectedTCDSFed =
fedId;
98 tcds_pointer =
event + eventSize;
104 <<
"Second TCDS FED ID " <<
fedId <<
" found. First ID: " << selectedTCDSFed;
109 memcpy(fedData.
data(),
event + eventSize, fedSize);
130 <<
" event id:" <<
event_->event() <<
" lumi:" <<
event_->lumi() <<
" run:" <<
event_->run()
131 <<
" of size:" <<
event_->size() <<
" bytes does not fit into a chunk of size:" <<
dataBlockMax_ <<
" bytes";
138 if (
event_->version() >= 5) {
147 std::stringstream
ss;
148 ss <<
"Found a wrong crc32c checksum: expected 0x" << std::hex <<
event_->crc32c() <<
" but calculated 0x" <<
crc_;
158 for (
auto&
baseDir : baseDirs) {
160 buPaths_.emplace_back(baseDirP / runDirP);
168 unsigned char* tcds_pointer =
nullptr;
171 auto const&
event =
events_[0];
173 uint32_t L1EventID =
event->event();
179 }
else if (tcds_pointer ==
nullptr) {
180 uint32_t L1EventID =
event->event();
181 throw cms::Exception(
"DAQSource::read") <<
"No TCDS FED in event with FEDHeader EID -: " << L1EventID;
205 unsigned char*& tcds_pointer) {
208 gettimeofday(&stv,
nullptr);
213 tcds_pointer =
nullptr;
215 uint16_t selectedTCDSFed = 0;
216 int selectedTCDSFileIndex = -1;
220 while (eventSize > 0) {
230 throw cms::Exception(
"DataModeFRDStriped:::fillFRDCollection") <<
"Out of range FED ID : " <<
fedId;
232 if (!selectedTCDSFed) {
233 selectedTCDSFed =
fedId;
234 selectedTCDSFileIndex =
index;
235 tcds_pointer =
event + eventSize;
241 <<
"Second TCDS FED ID " <<
fedId <<
" found in file " << selectedTCDSFileIndex
242 <<
". First ID: " << selectedTCDSFed <<
" in file " <<
index;
246 memcpy(fedData.
data(),
event + eventSize, fedSize);
281 if (
event->version() >= 5) {
282 crc =
crc32c(crc, (
const unsigned char*)
event->payload(),
event->eventSize());
283 if (crc !=
event->crc32c()) {
284 std::ostringstream
ss;
285 ss <<
"Found a wrong crc32c checksum at readout index " <<
i <<
": expected 0x" << std::hex <<
event->crc32c()
286 <<
" but calculated 0x" << crc <<
". ";
303 std::vector<std::string> additionalFiles;
307 additionalFiles.push_back(primaryName +
"_1");
308 return std::make_pair(
true, additionalFiles);
312 auto fullname =
fullpath.filename();
316 additionalFiles.push_back(newPath.generic_string());
318 return std::make_pair(
true, additionalFiles);
325 for (
unsigned int i = 0;
i <
events_.size();
i++) {
344 <<
"not all striped blocks were completed at the same time";
352 <<
" of size:" <<
events_[
i]->size() <<
" bytes does not fit into the buffer or has corrupted header";
std::string getChecksumError() const override
std::string getChecksumError() const override
std::pair< bool, std::vector< std::string > > defineAdditionalFiles(std::string const &primaryName, bool fileListMode) const override
bool checksumValid() override
bool checksumValid() override
edm::Timestamp fillFRDCollection(FEDRawDataCollection &rawData, bool &tcdsInRange, unsigned char *&tcds_pointer)
static const uint32_t length
edm::Timestamp fillFEDRawDataCollection(FEDRawDataCollection &rawData, bool &tcdsInRange, unsigned char *&tcds_pointer)
std::vector< std::unique_ptr< FRDEventMsgView > > events_
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > daqProvenanceHelpers_
bool nextEventView() override
void readEvent(edm::EventPrincipal &eventPrincipal) override
std::unique_ptr< FRDEventMsgView > event_
edm::EventAuxiliary makeEventAuxiliary(const tcds::Raw_v1 *, unsigned int runNumber, unsigned int lumiSection, bool isRealData, const edm::EventAuxiliary::ExperimentType &, const std::string &processGUID, bool verifyLumiSection, bool suppressWarning)
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
std::vector< unsigned char * > dataBlockMaxAddrs_
int currentLumiSection() const
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
void makeDirectoryEntries(std::vector< std::string > const &baseDirs, std::string const &runDir) override
void resize(size_t newsize)
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > & makeDaqProvenanceHelpers() override
std::vector< std::filesystem::path > buPaths_
bool useL1EventID() const
void makeEventWrapper(edm::EventPrincipal &eventPrincipal, edm::EventAuxiliary &aux)
uint16_t MINTCDSuTCAFEDID_
edm::ProcessHistoryID & processHistoryID()
unsigned long long TimeValue_t
bool nextEventView() override
void readEvent(edm::EventPrincipal &eventPrincipal) override
uint32_t crc32c(uint32_t crc, const unsigned char *buf, size_t len)
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > daqProvenanceHelpers_
unsigned char * dataBlockAddr_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
uint16_t MINTCDSuTCAFEDID_
uint16_t MAXTCDSuTCAFEDID_
int eventRunNumber() const
std::vector< unsigned char * > dataBlockAddrs_
uint16_t MAXTCDSuTCAFEDID_
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > & makeDaqProvenanceHelpers() override