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_;
157 std::vector<int>
const& numSources,
160 for (
auto&
baseDir : baseDirs) {
162 buPaths_.emplace_back(baseDirP / runDirP);
170 unsigned char* tcds_pointer =
nullptr;
173 auto const&
event =
events_[0];
175 uint32_t L1EventID =
event->event();
181 }
else if (tcds_pointer ==
nullptr) {
182 uint32_t L1EventID =
event->event();
183 throw cms::Exception(
"DAQSource::read") <<
"No TCDS FED in event with FEDHeader EID -: " << L1EventID;
207 unsigned char*& tcds_pointer) {
210 gettimeofday(&stv,
nullptr);
215 tcds_pointer =
nullptr;
217 uint16_t selectedTCDSFed = 0;
218 int selectedTCDSFileIndex = -1;
222 while (eventSize > 0) {
232 throw cms::Exception(
"DataModeFRDStriped:::fillFRDCollection") <<
"Out of range FED ID : " <<
fedId;
234 if (!selectedTCDSFed) {
235 selectedTCDSFed =
fedId;
236 selectedTCDSFileIndex =
index;
237 tcds_pointer =
event + eventSize;
243 <<
"Second TCDS FED ID " <<
fedId <<
" found in file " << selectedTCDSFileIndex
244 <<
". First ID: " << selectedTCDSFed <<
" in file " <<
index;
248 memcpy(fedData.
data(),
event + eventSize, fedSize);
283 if (
event->version() >= 5) {
284 crc =
crc32c(crc, (
const unsigned char*)
event->payload(),
event->eventSize());
285 if (crc !=
event->crc32c()) {
286 std::ostringstream
ss;
287 ss <<
"Found a wrong crc32c checksum at readout index " <<
i <<
": expected 0x" << std::hex <<
event->crc32c()
288 <<
" but calculated 0x" << crc <<
". ";
305 std::vector<std::string> additionalFiles;
309 additionalFiles.push_back(primaryName +
"_1");
310 return std::make_pair(
true, additionalFiles);
314 auto fullname =
fullpath.filename();
318 additionalFiles.push_back(newPath.generic_string());
320 return std::make_pair(
true, additionalFiles);
327 for (
unsigned int i = 0;
i <
events_.size();
i++) {
346 <<
"not all striped blocks were completed at the same time";
354 <<
" 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
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)
void makeDirectoryEntries(std::vector< std::string > const &baseDirs, std::vector< int > const &numSources, std::string const &runDir) override
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > daqProvenanceHelpers_
void resize(size_t newsize, size_t wordsize=8)
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